@powerlines/plugin-env 0.1.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/LICENSE +201 -0
- package/README.md +295 -0
- package/dist/babel/index.cjs +1 -0
- package/dist/babel/index.d.cts +28 -0
- package/dist/babel/index.d.ts +28 -0
- package/dist/babel/index.js +1 -0
- package/dist/babel/plugin.cjs +19 -0
- package/dist/babel/plugin.d.cts +31 -0
- package/dist/babel/plugin.d.ts +31 -0
- package/dist/babel/plugin.js +19 -0
- package/dist/chunk-FBBMZ4NC.cjs +7 -0
- package/dist/chunk-UCUR73HG.js +7 -0
- package/dist/components/env.cjs +40 -0
- package/dist/components/env.d.cts +106 -0
- package/dist/components/env.d.ts +106 -0
- package/dist/components/env.js +40 -0
- package/dist/components/index.cjs +1 -0
- package/dist/components/index.d.cts +9 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/components/index.js +1 -0
- package/dist/helpers/index.cjs +1 -0
- package/dist/helpers/index.d.cts +32 -0
- package/dist/helpers/index.d.ts +32 -0
- package/dist/helpers/index.js +1 -0
- package/dist/helpers/load.cjs +7 -0
- package/dist/helpers/load.d.cts +57 -0
- package/dist/helpers/load.d.ts +57 -0
- package/dist/helpers/load.js +7 -0
- package/dist/helpers/persistence.cjs +7 -0
- package/dist/helpers/persistence.d.cts +98 -0
- package/dist/helpers/persistence.d.ts +98 -0
- package/dist/helpers/persistence.js +7 -0
- package/dist/helpers/reflect.cjs +7 -0
- package/dist/helpers/reflect.d.cts +70 -0
- package/dist/helpers/reflect.d.ts +70 -0
- package/dist/helpers/reflect.js +7 -0
- package/dist/helpers/source-file-env.cjs +7 -0
- package/dist/helpers/source-file-env.d.cts +7 -0
- package/dist/helpers/source-file-env.d.ts +7 -0
- package/dist/helpers/source-file-env.js +7 -0
- package/dist/helpers/template-helpers.cjs +7 -0
- package/dist/helpers/template-helpers.d.cts +38 -0
- package/dist/helpers/template-helpers.d.ts +38 -0
- package/dist/helpers/template-helpers.js +7 -0
- package/dist/index.cjs +22 -0
- package/dist/index.d.cts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +22 -0
- package/dist/runtime-DqvtGYT3.d.ts +3289 -0
- package/dist/runtime-I3P49niA.d.cts +3289 -0
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.d.cts +27 -0
- package/dist/types/index.d.ts +27 -0
- package/dist/types/index.js +1 -0
- package/dist/types/plugin.cjs +1 -0
- package/dist/types/plugin.d.cts +169 -0
- package/dist/types/plugin.d.ts +169 -0
- package/dist/types/plugin.js +0 -0
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts +24 -0
- package/dist/types/runtime.d.ts +24 -0
- package/dist/types/runtime.js +0 -0
- package/dist/vfs-COoZkq8D.d.cts +358 -0
- package/dist/vfs-COoZkq8D.d.ts +358 -0
- package/package.json +213 -0
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),p=require('@stryke/capnp'),buffer=require('@stryke/fs/buffer'),joinPaths=require('@stryke/path/join-paths'),isEmptyObject=require('@stryke/type-checks/is-empty-object'),node_buffer=require('node:buffer'),node_fs=require('node:fs'),type=require('powerlines/deepkit/type'),capnp=require('powerlines/lib/capnp'),resolveReflections=require('powerlines/lib/deepkit/resolve-reflections'),reflection=require('powerlines/schemas/reflection'),reflect=require('./reflect');function _interopNamespace(e){if(e&&e.__esModule)return e;var n=Object.create(null);if(e){Object.keys(e).forEach(function(k){if(k!=='default'){var d=Object.getOwnPropertyDescriptor(e,k);Object.defineProperty(n,k,d.get?d:{enumerable:true,get:function(){return e[k]}});}})}n.default=e;return Object.freeze(n)}var p__namespace=/*#__PURE__*/_interopNamespace(p);/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function U(e){return {file:process.env.POWERLINES_LOCAL?joinPaths.joinPaths(e.workspaceConfig.workspaceRoot,"dist/packages/types/dist/esm/src/shared/env.js"):"powerlines/runtime-types/shared/env",name:"__\u03A9EnvInterface"}}chunkFBBMZ4NC_cjs.a(U,"getEnvDefaultTypeDefinition");function V(e){return {file:process.env.POWERLINES_LOCAL?joinPaths.joinPaths(e.workspaceConfig.workspaceRoot,"dist/packages/types/dist/esm/src/shared/env.js"):"powerlines/runtime-types/shared/env",name:"__\u03A9SecretsInterface"}}chunkFBBMZ4NC_cjs.a(V,"getSecretsDefaultTypeDefinition");function b(e,n="env"){return joinPaths.joinPaths(resolveReflections.getReflectionsPath(e),"env",`${n}-types.bin`)}chunkFBBMZ4NC_cjs.a(b,"getEnvTypeReflectionsPath");async function S(e,n="env"){const t=b(e,n);if(!node_fs.existsSync(t)){if(!e.env.types.env||isEmptyObject.isEmptyObject(e.env.types.env)){const f=reflect.createEnvReflection(e),T=new p__namespace.Message;f.messageRoot=T.initRoot(reflection.SerializedTypes),f.dataBuffer=T.toArrayBuffer(),e.env.types.env=f,await A(e,e.env.types.env,n);}return e.env.types.env}const o=await buffer.readFileBuffer(t),i=new p__namespace.Message(o,false).getRoot(reflection.SerializedTypes),r=type.resolveClassType(type.deserializeType(capnp.convertFromCapnp(i.types)));return e.env.types[n]=r,e.env.types[n].messageRoot=i,e.env.types[n].dataBuffer=o,r}chunkFBBMZ4NC_cjs.a(S,"readEnvTypeReflection");async function A(e,n,t="env"){const o=n.serializeType(),s=new p__namespace.Message,i=s.initRoot(reflection.SerializedTypes);capnp.convertToCapnp(o,i._initTypes(o.length)),await e.fs.writeFile(b(e,t),node_buffer.Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}chunkFBBMZ4NC_cjs.a(A,"writeEnvTypeReflection");function l(e,n){return joinPaths.joinPaths(resolveReflections.getReflectionsPath(e),"env",`${n}.bin`)}chunkFBBMZ4NC_cjs.a(l,"getEnvReflectionsPath");async function X(e){const n=l(e,"env");if(!node_fs.existsSync(n)){if(e.env.types.env||(e.env.types.env=await S(e,"env")),!e.env.used.env||isEmptyObject.isEmptyObject(e.env.used.env)){const r=reflect.createEnvReflection(e,{type:{kind:type.ReflectionKind.objectLiteral,typeName:"StormEnv",description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:"application"}.`,types:[]},superReflection:e.env.types.env});r.name="StormEnv";const f=new p__namespace.Message;r.messageRoot=f.initRoot(reflection.SerializedTypes),r.dataBuffer=f.toArrayBuffer(),e.env.used.env=r,await B(e,e.env.used.env,"env");}return e.env.used.env}const t=await buffer.readFileBuffer(n),s=new p__namespace.Message(t,false).getRoot(reflection.SerializedTypes),i=type.resolveClassType(type.deserializeType(capnp.convertFromCapnp(s.types)));return e.env.used.env=i,e.env.used.env.messageRoot=s,e.env.used.env.dataBuffer=t,i}chunkFBBMZ4NC_cjs.a(X,"readEnvReflection");async function Y(e){const n=l(e,"secrets");if(!node_fs.existsSync(n)){if(e.env.types.secrets||(e.env.types.secrets=await S(e,"secrets")),!e.env.used.secrets||isEmptyObject.isEmptyObject(e.env.used.secrets)){const r=reflect.createEnvReflection(e,{type:{kind:type.ReflectionKind.objectLiteral,typeName:"StormSecrets",description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:"application"}.`,types:[]},superReflection:e.env.types.secrets});r.name="StormSecrets";const f=new p__namespace.Message;r.messageRoot=f.initRoot(reflection.SerializedTypes),r.dataBuffer=f.toArrayBuffer(),e.env.used.secrets=r,await B(e,e.env.used.secrets,"secrets");}return e.env.used.secrets}const t=await buffer.readFileBuffer(n),s=new p__namespace.Message(t,false).getRoot(reflection.SerializedTypes),i=type.resolveClassType(type.deserializeType(capnp.convertFromCapnp(s.types)));return e.env.used.secrets=i,e.env.used.secrets.messageRoot=s,e.env.used.secrets.dataBuffer=t,i}chunkFBBMZ4NC_cjs.a(Y,"readSecretsReflection");async function B(e,n,t="env"){const o=n.serializeType(),s=new p__namespace.Message,i=s.initRoot(reflection.SerializedTypes);capnp.convertToCapnp(o,i._initTypes(o.length)),await e.fs.writeFile(l(e,t),node_buffer.Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}chunkFBBMZ4NC_cjs.a(B,"writeEnvReflection");function Z(e,n,t="env"){const o=n.serializeType(),s=new p__namespace.Message,i=s.initRoot(reflection.SerializedTypes);capnp.convertToCapnp(o,i._initTypes(o.length)),e.fs.writeFileSync(l(e,t),node_buffer.Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}chunkFBBMZ4NC_cjs.a(Z,"writeEnvReflectionSync");exports.getEnvDefaultTypeDefinition=U;exports.getEnvReflectionsPath=l;exports.getEnvTypeReflectionsPath=b;exports.getSecretsDefaultTypeDefinition=V;exports.readEnvReflection=X;exports.readEnvTypeReflection=S;exports.readSecretsReflection=Y;exports.writeEnvReflection=B;exports.writeEnvReflectionSync=Z;exports.writeEnvTypeReflection=A;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TypeDefinition } from '@stryke/types/configuration';
|
|
2
|
+
import { ReflectionClass } from '@deepkit/type';
|
|
3
|
+
import { C as Context } from '../runtime-I3P49niA.cjs';
|
|
4
|
+
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.cjs';
|
|
5
|
+
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/package-json';
|
|
7
|
+
import 'jiti';
|
|
8
|
+
import 'unplugin';
|
|
9
|
+
import '@stryke/capnp';
|
|
10
|
+
import '@storm-software/config-tools/types';
|
|
11
|
+
import '@stryke/types/base';
|
|
12
|
+
import '@stryke/types/file';
|
|
13
|
+
import 'vite';
|
|
14
|
+
import '@babel/core';
|
|
15
|
+
import '@storm-software/build-tools/types';
|
|
16
|
+
import '@storm-software/config/types';
|
|
17
|
+
import '@babel/helper-plugin-utils';
|
|
18
|
+
import 'semver';
|
|
19
|
+
import '@stryke/types/array';
|
|
20
|
+
import '@stryke/types/tsconfig';
|
|
21
|
+
import 'typescript';
|
|
22
|
+
import '../vfs-COoZkq8D.cjs';
|
|
23
|
+
import 'memfs';
|
|
24
|
+
import 'node:fs';
|
|
25
|
+
import 'unionfs';
|
|
26
|
+
import '@alloy-js/core/jsx-runtime';
|
|
27
|
+
import '@stryke/env/types';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets the default type definition for the environment variables.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The plugin context.
|
|
33
|
+
* @returns The default type definition for the environment variables.
|
|
34
|
+
*/
|
|
35
|
+
declare function getEnvDefaultTypeDefinition(context: Context<EnvPluginResolvedConfig>): TypeDefinition;
|
|
36
|
+
/** Gets the default type definition for the environment secrets.
|
|
37
|
+
*
|
|
38
|
+
* @param context - The plugin context.
|
|
39
|
+
* @returns The default type definition for the environment secrets.
|
|
40
|
+
*/
|
|
41
|
+
declare function getSecretsDefaultTypeDefinition(context: Context<EnvPluginResolvedConfig>): TypeDefinition;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the path to the environment type reflections.
|
|
44
|
+
*
|
|
45
|
+
* @param context - The plugin context.
|
|
46
|
+
* @param name - The name of the type reflections.
|
|
47
|
+
* @returns The path to the environment type reflections.
|
|
48
|
+
*/
|
|
49
|
+
declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the environment type reflection from the file system.
|
|
52
|
+
*
|
|
53
|
+
* @param context - The plugin context.
|
|
54
|
+
* @param name - The name of the type reflections.
|
|
55
|
+
* @returns The environment type reflection.
|
|
56
|
+
*/
|
|
57
|
+
declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
58
|
+
/**
|
|
59
|
+
* Writes the environment type reflection to the file system.
|
|
60
|
+
*
|
|
61
|
+
* @param context - The plugin context.
|
|
62
|
+
* @param reflection - The environment type reflection to write.
|
|
63
|
+
* @param name - The name of the type reflections.
|
|
64
|
+
*/
|
|
65
|
+
declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
66
|
+
declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
|
|
67
|
+
/**
|
|
68
|
+
* Reads the environment reflection data from the file system.
|
|
69
|
+
*
|
|
70
|
+
* @param context - The plugin context.
|
|
71
|
+
* @returns The environment reflection data.
|
|
72
|
+
*/
|
|
73
|
+
declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
74
|
+
/**
|
|
75
|
+
* Reads the secret environment reflection data from the file system.
|
|
76
|
+
*
|
|
77
|
+
* @param context - The plugin context.
|
|
78
|
+
* @returns The environment reflection data.
|
|
79
|
+
*/
|
|
80
|
+
declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
81
|
+
/**
|
|
82
|
+
* Writes the environment reflection data to the file system.
|
|
83
|
+
*
|
|
84
|
+
* @param context - The plugin context.
|
|
85
|
+
* @param reflection - The reflection data to write.
|
|
86
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
87
|
+
*/
|
|
88
|
+
declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Writes the environment reflection data to the file system.
|
|
91
|
+
*
|
|
92
|
+
* @param context - The plugin context.
|
|
93
|
+
* @param reflection - The reflection data to write.
|
|
94
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
95
|
+
*/
|
|
96
|
+
declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
|
|
97
|
+
|
|
98
|
+
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TypeDefinition } from '@stryke/types/configuration';
|
|
2
|
+
import { ReflectionClass } from '@deepkit/type';
|
|
3
|
+
import { C as Context } from '../runtime-DqvtGYT3.js';
|
|
4
|
+
import { EnvPluginResolvedConfig, EnvType, EnvPluginContext } from '../types/plugin.js';
|
|
5
|
+
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/package-json';
|
|
7
|
+
import 'jiti';
|
|
8
|
+
import 'unplugin';
|
|
9
|
+
import '@stryke/capnp';
|
|
10
|
+
import '@storm-software/config-tools/types';
|
|
11
|
+
import '@stryke/types/base';
|
|
12
|
+
import '@stryke/types/file';
|
|
13
|
+
import 'vite';
|
|
14
|
+
import '@babel/core';
|
|
15
|
+
import '@storm-software/build-tools/types';
|
|
16
|
+
import '@storm-software/config/types';
|
|
17
|
+
import '@babel/helper-plugin-utils';
|
|
18
|
+
import 'semver';
|
|
19
|
+
import '@stryke/types/array';
|
|
20
|
+
import '@stryke/types/tsconfig';
|
|
21
|
+
import 'typescript';
|
|
22
|
+
import '../vfs-COoZkq8D.js';
|
|
23
|
+
import 'memfs';
|
|
24
|
+
import 'node:fs';
|
|
25
|
+
import 'unionfs';
|
|
26
|
+
import '@alloy-js/core/jsx-runtime';
|
|
27
|
+
import '@stryke/env/types';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Gets the default type definition for the environment variables.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The plugin context.
|
|
33
|
+
* @returns The default type definition for the environment variables.
|
|
34
|
+
*/
|
|
35
|
+
declare function getEnvDefaultTypeDefinition(context: Context<EnvPluginResolvedConfig>): TypeDefinition;
|
|
36
|
+
/** Gets the default type definition for the environment secrets.
|
|
37
|
+
*
|
|
38
|
+
* @param context - The plugin context.
|
|
39
|
+
* @returns The default type definition for the environment secrets.
|
|
40
|
+
*/
|
|
41
|
+
declare function getSecretsDefaultTypeDefinition(context: Context<EnvPluginResolvedConfig>): TypeDefinition;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the path to the environment type reflections.
|
|
44
|
+
*
|
|
45
|
+
* @param context - The plugin context.
|
|
46
|
+
* @param name - The name of the type reflections.
|
|
47
|
+
* @returns The path to the environment type reflections.
|
|
48
|
+
*/
|
|
49
|
+
declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
|
|
50
|
+
/**
|
|
51
|
+
* Reads the environment type reflection from the file system.
|
|
52
|
+
*
|
|
53
|
+
* @param context - The plugin context.
|
|
54
|
+
* @param name - The name of the type reflections.
|
|
55
|
+
* @returns The environment type reflection.
|
|
56
|
+
*/
|
|
57
|
+
declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
58
|
+
/**
|
|
59
|
+
* Writes the environment type reflection to the file system.
|
|
60
|
+
*
|
|
61
|
+
* @param context - The plugin context.
|
|
62
|
+
* @param reflection - The environment type reflection to write.
|
|
63
|
+
* @param name - The name of the type reflections.
|
|
64
|
+
*/
|
|
65
|
+
declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
66
|
+
declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
|
|
67
|
+
/**
|
|
68
|
+
* Reads the environment reflection data from the file system.
|
|
69
|
+
*
|
|
70
|
+
* @param context - The plugin context.
|
|
71
|
+
* @returns The environment reflection data.
|
|
72
|
+
*/
|
|
73
|
+
declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
74
|
+
/**
|
|
75
|
+
* Reads the secret environment reflection data from the file system.
|
|
76
|
+
*
|
|
77
|
+
* @param context - The plugin context.
|
|
78
|
+
* @returns The environment reflection data.
|
|
79
|
+
*/
|
|
80
|
+
declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
81
|
+
/**
|
|
82
|
+
* Writes the environment reflection data to the file system.
|
|
83
|
+
*
|
|
84
|
+
* @param context - The plugin context.
|
|
85
|
+
* @param reflection - The reflection data to write.
|
|
86
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
87
|
+
*/
|
|
88
|
+
declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
89
|
+
/**
|
|
90
|
+
* Writes the environment reflection data to the file system.
|
|
91
|
+
*
|
|
92
|
+
* @param context - The plugin context.
|
|
93
|
+
* @param reflection - The reflection data to write.
|
|
94
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
95
|
+
*/
|
|
96
|
+
declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
|
|
97
|
+
|
|
98
|
+
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import*as p from'@stryke/capnp';import {readFileBuffer}from'@stryke/fs/buffer';import {joinPaths}from'@stryke/path/join-paths';import {isEmptyObject}from'@stryke/type-checks/is-empty-object';import {Buffer}from'node:buffer';import {existsSync}from'node:fs';import {resolveClassType,deserializeType,ReflectionKind}from'powerlines/deepkit/type';import {convertFromCapnp,convertToCapnp}from'powerlines/lib/capnp';import {getReflectionsPath}from'powerlines/lib/deepkit/resolve-reflections';import {SerializedTypes}from'powerlines/schemas/reflection';import {createEnvReflection}from'./reflect';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function V(e){return {file:process.env.POWERLINES_LOCAL?joinPaths(e.workspaceConfig.workspaceRoot,"dist/packages/types/dist/esm/src/shared/env.js"):"powerlines/runtime-types/shared/env",name:"__\u03A9EnvInterface"}}a(V,"getEnvDefaultTypeDefinition");function X(e){return {file:process.env.POWERLINES_LOCAL?joinPaths(e.workspaceConfig.workspaceRoot,"dist/packages/types/dist/esm/src/shared/env.js"):"powerlines/runtime-types/shared/env",name:"__\u03A9SecretsInterface"}}a(X,"getSecretsDefaultTypeDefinition");function b(e,n="env"){return joinPaths(getReflectionsPath(e),"env",`${n}-types.bin`)}a(b,"getEnvTypeReflectionsPath");async function S(e,n="env"){const t=b(e,n);if(!existsSync(t)){if(!e.env.types.env||isEmptyObject(e.env.types.env)){const f=createEnvReflection(e),T=new p.Message;f.messageRoot=T.initRoot(SerializedTypes),f.dataBuffer=T.toArrayBuffer(),e.env.types.env=f,await A(e,e.env.types.env,n);}return e.env.types.env}const o=await readFileBuffer(t),i=new p.Message(o,false).getRoot(SerializedTypes),r=resolveClassType(deserializeType(convertFromCapnp(i.types)));return e.env.types[n]=r,e.env.types[n].messageRoot=i,e.env.types[n].dataBuffer=o,r}a(S,"readEnvTypeReflection");async function A(e,n,t="env"){const o=n.serializeType(),s=new p.Message,i=s.initRoot(SerializedTypes);convertToCapnp(o,i._initTypes(o.length)),await e.fs.writeFile(b(e,t),Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}a(A,"writeEnvTypeReflection");function l(e,n){return joinPaths(getReflectionsPath(e),"env",`${n}.bin`)}a(l,"getEnvReflectionsPath");async function Y(e){const n=l(e,"env");if(!existsSync(n)){if(e.env.types.env||(e.env.types.env=await S(e,"env")),!e.env.used.env||isEmptyObject(e.env.used.env)){const r=createEnvReflection(e,{type:{kind:ReflectionKind.objectLiteral,typeName:"StormEnv",description:`An object containing the environment configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:"application"}.`,types:[]},superReflection:e.env.types.env});r.name="StormEnv";const f=new p.Message;r.messageRoot=f.initRoot(SerializedTypes),r.dataBuffer=f.toArrayBuffer(),e.env.used.env=r,await B(e,e.env.used.env,"env");}return e.env.used.env}const t=await readFileBuffer(n),s=new p.Message(t,false).getRoot(SerializedTypes),i=resolveClassType(deserializeType(convertFromCapnp(s.types)));return e.env.used.env=i,e.env.used.env.messageRoot=s,e.env.used.env.dataBuffer=t,i}a(Y,"readEnvReflection");async function Z(e){const n=l(e,"secrets");if(!existsSync(n)){if(e.env.types.secrets||(e.env.types.secrets=await S(e,"secrets")),!e.env.used.secrets||isEmptyObject(e.env.used.secrets)){const r=createEnvReflection(e,{type:{kind:ReflectionKind.objectLiteral,typeName:"StormSecrets",description:`An object containing the secret configuration parameters that are used (at least once) by the ${e.config.name?`${e.config.name} application`:"application"}.`,types:[]},superReflection:e.env.types.secrets});r.name="StormSecrets";const f=new p.Message;r.messageRoot=f.initRoot(SerializedTypes),r.dataBuffer=f.toArrayBuffer(),e.env.used.secrets=r,await B(e,e.env.used.secrets,"secrets");}return e.env.used.secrets}const t=await readFileBuffer(n),s=new p.Message(t,false).getRoot(SerializedTypes),i=resolveClassType(deserializeType(convertFromCapnp(s.types)));return e.env.used.secrets=i,e.env.used.secrets.messageRoot=s,e.env.used.secrets.dataBuffer=t,i}a(Z,"readSecretsReflection");async function B(e,n,t="env"){const o=n.serializeType(),s=new p.Message,i=s.initRoot(SerializedTypes);convertToCapnp(o,i._initTypes(o.length)),await e.fs.writeFile(l(e,t),Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}a(B,"writeEnvReflection");function x(e,n,t="env"){const o=n.serializeType(),s=new p.Message,i=s.initRoot(SerializedTypes);convertToCapnp(o,i._initTypes(o.length)),e.fs.writeFileSync(l(e,t),Buffer.from(s.toArrayBuffer()),{encoding:"binary",mode:"fs"});}a(x,"writeEnvReflectionSync");export{V as getEnvDefaultTypeDefinition,l as getEnvReflectionsPath,b as getEnvTypeReflectionsPath,X as getSecretsDefaultTypeDefinition,Y as readEnvReflection,S as readEnvTypeReflection,Z as readSecretsReflection,B as writeEnvReflection,x as writeEnvReflectionSync,A as writeEnvTypeReflection};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),isParentPath=require('@stryke/path/is-parent-path'),joinPaths=require('@stryke/path/join-paths'),titleCase=require('@stryke/string-format/title-case'),type=require('powerlines/deepkit/type'),reflectType=require('powerlines/lib/deepkit/reflect-type'),persistence=require('./persistence');/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function T(e,n){return L(e,{type:type.merge(n.map(t=>t.type))})}chunkFBBMZ4NC_cjs.a(T,"mergeEnvReflections");function v(e,n){return O(e,{type:type.merge(n.map(t=>t.type))})}chunkFBBMZ4NC_cjs.a(v,"mergeSecretsReflections");class b{static{chunkFBBMZ4NC_cjs.a(this,"StormBaseEnv");}POWERLINES_LOCAL=false;APP_NAME;APP_VERSION;BUILD_ID;BUILD_TIMESTAMP;BUILD_CHECKSUM;RELEASE_ID;RELEASE_TAG;ORGANIZATION;PLATFORM="neutral";MODE="development";ENVIRONMENT;DEBUG=false;TEST=false;MINIMAL=false;NO_COLOR=false;FORCE_COLOR=false;FORCE_HYPERLINK=false;STACKTRACE=false;INCLUDE_ERROR_DATA=false;ERROR_URL;DEFAULT_TIMEZONE;DEFAULT_LOCALE;CI=false}class S{static{chunkFBBMZ4NC_cjs.a(this,"StormBaseSecrets");}ENCRYPTION_KEY}function L(e,n={}){const o=n.superReflection??new type.ReflectionClass({kind:type.ReflectionKind.class,description:`The base environment configuration definition for the ${titleCase.titleCase(e.config.name)} project.`,classType:b,types:[],implements:[{kind:type.ReflectionKind.objectLiteral,typeName:"EnvInterface",description:`The environment configuration interface definition for the ${titleCase.titleCase(e.config.name)} project.`,types:[]}]});o.name="StormEnv";const t=new type.ReflectionClass(n.type??{kind:type.ReflectionKind.objectLiteral,typeName:"StormEnv",description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${titleCase.titleCase(e.config.name)} application`:"application"}.`,types:[]},o);return t.name="StormEnv",t}chunkFBBMZ4NC_cjs.a(L,"createEnvReflection");function O(e,n={}){const o=n.superReflection??new type.ReflectionClass({kind:type.ReflectionKind.class,description:`The base secrets configuration definition for the ${titleCase.titleCase(e.config.name)} project.`,classType:S,types:[],implements:[{kind:type.ReflectionKind.objectLiteral,typeName:"SecretsInterface",description:`The secrets configuration interface definition for the ${titleCase.titleCase(e.config.name)} project.`,types:[]}]});o.name="StormSecrets";const t=new type.ReflectionClass(n.type??{kind:type.ReflectionKind.objectLiteral,typeName:"StormSecrets",description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${titleCase.titleCase(e.config.name)} application`:"application"}.`,types:[]},o);return t.name="StormSecrets",t}chunkFBBMZ4NC_cjs.a(O,"createSecretsReflection");async function F(e,n,o){let t;if(n){const m=await reflectType.reflectType(e,{file:isParentPath.isParentPath(n,e.workspaceConfig.workspaceRoot)?n:joinPaths.joinPaths(e.workspaceConfig.workspaceRoot,n),name:o},{skipNodeModulesBundle:true});t=type.resolveClassType(m);}const f=await reflectType.reflectType(e,persistence.getEnvDefaultTypeDefinition(e)),p=await persistence.readEnvTypeReflection(e,"env");return T(e,[p,t,type.resolveClassType(f)].filter(Boolean))}chunkFBBMZ4NC_cjs.a(F,"reflectEnv");async function K(e,n,o){let t;if(n){const m=await reflectType.reflectType(e,{file:isParentPath.isParentPath(n,e.workspaceConfig.workspaceRoot)?n:joinPaths.joinPaths(e.workspaceConfig.workspaceRoot,n),name:o},{skipNodeModulesBundle:true});t=type.resolveClassType(m);}const f=await reflectType.reflectType(e,persistence.getSecretsDefaultTypeDefinition(e)),p=await persistence.readSecretsReflection(e);return v(e,[p,t,type.resolveClassType(f)].filter(Boolean))}chunkFBBMZ4NC_cjs.a(K,"reflectSecrets");exports.StormBaseEnv=b;exports.StormBaseSecrets=S;exports.createEnvReflection=L;exports.createSecretsReflection=O;exports.mergeEnvReflections=T;exports.mergeSecretsReflections=v;exports.reflectEnv=F;exports.reflectSecrets=K;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
|
|
2
|
+
import { EnvPluginContext } from '../types/plugin.cjs';
|
|
3
|
+
import { E as EnvInterface, S as SecretsInterface } from '../runtime-I3P49niA.cjs';
|
|
4
|
+
import '@alloy-js/core/jsx-runtime';
|
|
5
|
+
import '@stryke/env/types';
|
|
6
|
+
import '@stryke/types/configuration';
|
|
7
|
+
import '@stryke/env/get-env-paths';
|
|
8
|
+
import '@stryke/types/package-json';
|
|
9
|
+
import 'jiti';
|
|
10
|
+
import 'unplugin';
|
|
11
|
+
import '@stryke/capnp';
|
|
12
|
+
import '@storm-software/config-tools/types';
|
|
13
|
+
import '@stryke/types/base';
|
|
14
|
+
import '@stryke/types/file';
|
|
15
|
+
import 'vite';
|
|
16
|
+
import '@babel/core';
|
|
17
|
+
import '@storm-software/build-tools/types';
|
|
18
|
+
import '@storm-software/config/types';
|
|
19
|
+
import '@babel/helper-plugin-utils';
|
|
20
|
+
import 'semver';
|
|
21
|
+
import '@stryke/types/array';
|
|
22
|
+
import '@stryke/types/tsconfig';
|
|
23
|
+
import 'typescript';
|
|
24
|
+
import '../vfs-COoZkq8D.cjs';
|
|
25
|
+
import 'memfs';
|
|
26
|
+
import 'node:fs';
|
|
27
|
+
import 'unionfs';
|
|
28
|
+
|
|
29
|
+
declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
30
|
+
declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
31
|
+
interface CreateEnvReflectionOptions {
|
|
32
|
+
type?: TypeObjectLiteral | TypeClass;
|
|
33
|
+
superReflection?: ReflectionClass<any>;
|
|
34
|
+
}
|
|
35
|
+
declare class StormBaseEnv implements EnvInterface {
|
|
36
|
+
POWERLINES_LOCAL: boolean;
|
|
37
|
+
APP_NAME: string;
|
|
38
|
+
APP_VERSION: string;
|
|
39
|
+
BUILD_ID: string;
|
|
40
|
+
BUILD_TIMESTAMP: string;
|
|
41
|
+
BUILD_CHECKSUM: string;
|
|
42
|
+
RELEASE_ID: string;
|
|
43
|
+
RELEASE_TAG: string;
|
|
44
|
+
ORGANIZATION: string;
|
|
45
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
46
|
+
MODE: "development" | "test" | "production";
|
|
47
|
+
ENVIRONMENT: string;
|
|
48
|
+
DEBUG: boolean;
|
|
49
|
+
TEST: boolean;
|
|
50
|
+
MINIMAL: boolean;
|
|
51
|
+
NO_COLOR: boolean;
|
|
52
|
+
FORCE_COLOR: number | boolean;
|
|
53
|
+
FORCE_HYPERLINK: number | boolean;
|
|
54
|
+
STACKTRACE: boolean;
|
|
55
|
+
INCLUDE_ERROR_DATA: boolean;
|
|
56
|
+
ERROR_URL: string;
|
|
57
|
+
DEFAULT_TIMEZONE: string;
|
|
58
|
+
DEFAULT_LOCALE: string;
|
|
59
|
+
CI: boolean;
|
|
60
|
+
}
|
|
61
|
+
declare class StormBaseSecrets implements SecretsInterface {
|
|
62
|
+
ENCRYPTION_KEY: string;
|
|
63
|
+
}
|
|
64
|
+
declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
65
|
+
declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
66
|
+
declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
67
|
+
declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
68
|
+
declare type __ΩCreateEnvReflectionOptions = any[];
|
|
69
|
+
|
|
70
|
+
export { type CreateEnvReflectionOptions, StormBaseEnv, StormBaseSecrets, type __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ReflectionClass, TypeObjectLiteral, TypeClass } from '@deepkit/type';
|
|
2
|
+
import { EnvPluginContext } from '../types/plugin.js';
|
|
3
|
+
import { E as EnvInterface, S as SecretsInterface } from '../runtime-DqvtGYT3.js';
|
|
4
|
+
import '@alloy-js/core/jsx-runtime';
|
|
5
|
+
import '@stryke/env/types';
|
|
6
|
+
import '@stryke/types/configuration';
|
|
7
|
+
import '@stryke/env/get-env-paths';
|
|
8
|
+
import '@stryke/types/package-json';
|
|
9
|
+
import 'jiti';
|
|
10
|
+
import 'unplugin';
|
|
11
|
+
import '@stryke/capnp';
|
|
12
|
+
import '@storm-software/config-tools/types';
|
|
13
|
+
import '@stryke/types/base';
|
|
14
|
+
import '@stryke/types/file';
|
|
15
|
+
import 'vite';
|
|
16
|
+
import '@babel/core';
|
|
17
|
+
import '@storm-software/build-tools/types';
|
|
18
|
+
import '@storm-software/config/types';
|
|
19
|
+
import '@babel/helper-plugin-utils';
|
|
20
|
+
import 'semver';
|
|
21
|
+
import '@stryke/types/array';
|
|
22
|
+
import '@stryke/types/tsconfig';
|
|
23
|
+
import 'typescript';
|
|
24
|
+
import '../vfs-COoZkq8D.js';
|
|
25
|
+
import 'memfs';
|
|
26
|
+
import 'node:fs';
|
|
27
|
+
import 'unionfs';
|
|
28
|
+
|
|
29
|
+
declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
30
|
+
declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
31
|
+
interface CreateEnvReflectionOptions {
|
|
32
|
+
type?: TypeObjectLiteral | TypeClass;
|
|
33
|
+
superReflection?: ReflectionClass<any>;
|
|
34
|
+
}
|
|
35
|
+
declare class StormBaseEnv implements EnvInterface {
|
|
36
|
+
POWERLINES_LOCAL: boolean;
|
|
37
|
+
APP_NAME: string;
|
|
38
|
+
APP_VERSION: string;
|
|
39
|
+
BUILD_ID: string;
|
|
40
|
+
BUILD_TIMESTAMP: string;
|
|
41
|
+
BUILD_CHECKSUM: string;
|
|
42
|
+
RELEASE_ID: string;
|
|
43
|
+
RELEASE_TAG: string;
|
|
44
|
+
ORGANIZATION: string;
|
|
45
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
46
|
+
MODE: "development" | "test" | "production";
|
|
47
|
+
ENVIRONMENT: string;
|
|
48
|
+
DEBUG: boolean;
|
|
49
|
+
TEST: boolean;
|
|
50
|
+
MINIMAL: boolean;
|
|
51
|
+
NO_COLOR: boolean;
|
|
52
|
+
FORCE_COLOR: number | boolean;
|
|
53
|
+
FORCE_HYPERLINK: number | boolean;
|
|
54
|
+
STACKTRACE: boolean;
|
|
55
|
+
INCLUDE_ERROR_DATA: boolean;
|
|
56
|
+
ERROR_URL: string;
|
|
57
|
+
DEFAULT_TIMEZONE: string;
|
|
58
|
+
DEFAULT_LOCALE: string;
|
|
59
|
+
CI: boolean;
|
|
60
|
+
}
|
|
61
|
+
declare class StormBaseSecrets implements SecretsInterface {
|
|
62
|
+
ENCRYPTION_KEY: string;
|
|
63
|
+
}
|
|
64
|
+
declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
65
|
+
declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
66
|
+
declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
67
|
+
declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
68
|
+
declare type __ΩCreateEnvReflectionOptions = any[];
|
|
69
|
+
|
|
70
|
+
export { type CreateEnvReflectionOptions, StormBaseEnv, StormBaseSecrets, type __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {isParentPath}from'@stryke/path/is-parent-path';import {joinPaths}from'@stryke/path/join-paths';import {titleCase}from'@stryke/string-format/title-case';import {merge,ReflectionClass,ReflectionKind,resolveClassType}from'powerlines/deepkit/type';import {reflectType}from'powerlines/lib/deepkit/reflect-type';import {getEnvDefaultTypeDefinition,readEnvTypeReflection,getSecretsDefaultTypeDefinition,readSecretsReflection}from'./persistence';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function T(e,n){return L(e,{type:merge(n.map(t=>t.type))})}a(T,"mergeEnvReflections");function v(e,n){return O(e,{type:merge(n.map(t=>t.type))})}a(v,"mergeSecretsReflections");class b{static{a(this,"StormBaseEnv");}POWERLINES_LOCAL=false;APP_NAME;APP_VERSION;BUILD_ID;BUILD_TIMESTAMP;BUILD_CHECKSUM;RELEASE_ID;RELEASE_TAG;ORGANIZATION;PLATFORM="neutral";MODE="development";ENVIRONMENT;DEBUG=false;TEST=false;MINIMAL=false;NO_COLOR=false;FORCE_COLOR=false;FORCE_HYPERLINK=false;STACKTRACE=false;INCLUDE_ERROR_DATA=false;ERROR_URL;DEFAULT_TIMEZONE;DEFAULT_LOCALE;CI=false}class S{static{a(this,"StormBaseSecrets");}ENCRYPTION_KEY}function L(e,n={}){const o=n.superReflection??new ReflectionClass({kind:ReflectionKind.class,description:`The base environment configuration definition for the ${titleCase(e.config.name)} project.`,classType:b,types:[],implements:[{kind:ReflectionKind.objectLiteral,typeName:"EnvInterface",description:`The environment configuration interface definition for the ${titleCase(e.config.name)} project.`,types:[]}]});o.name="StormEnv";const t=new ReflectionClass(n.type??{kind:ReflectionKind.objectLiteral,typeName:"StormEnv",description:`A schema describing the list of available environment variables that can be used by the ${e.config.name?`${titleCase(e.config.name)} application`:"application"}.`,types:[]},o);return t.name="StormEnv",t}a(L,"createEnvReflection");function O(e,n={}){const o=n.superReflection??new ReflectionClass({kind:ReflectionKind.class,description:`The base secrets configuration definition for the ${titleCase(e.config.name)} project.`,classType:S,types:[],implements:[{kind:ReflectionKind.objectLiteral,typeName:"SecretsInterface",description:`The secrets configuration interface definition for the ${titleCase(e.config.name)} project.`,types:[]}]});o.name="StormSecrets";const t=new ReflectionClass(n.type??{kind:ReflectionKind.objectLiteral,typeName:"StormSecrets",description:`A schema describing the list of available environment secrets that can be used by the ${e.config.name?`${titleCase(e.config.name)} application`:"application"}.`,types:[]},o);return t.name="StormSecrets",t}a(O,"createSecretsReflection");async function K(e,n,o){let t;if(n){const m=await reflectType(e,{file:isParentPath(n,e.workspaceConfig.workspaceRoot)?n:joinPaths(e.workspaceConfig.workspaceRoot,n),name:o},{skipNodeModulesBundle:true});t=resolveClassType(m);}const f=await reflectType(e,getEnvDefaultTypeDefinition(e)),p=await readEnvTypeReflection(e,"env");return T(e,[p,t,resolveClassType(f)].filter(Boolean))}a(K,"reflectEnv");async function G(e,n,o){let t;if(n){const m=await reflectType(e,{file:isParentPath(n,e.workspaceConfig.workspaceRoot)?n:joinPaths(e.workspaceConfig.workspaceRoot,n),name:o},{skipNodeModulesBundle:true});t=resolveClassType(m);}const f=await reflectType(e,getSecretsDefaultTypeDefinition(e)),p=await readSecretsReflection(e);return v(e,[p,t,resolveClassType(f)].filter(Boolean))}a(G,"reflectSecrets");export{b as StormBaseEnv,S as StormBaseSecrets,L as createEnvReflection,O as createSecretsReflection,T as mergeEnvReflections,v as mergeSecretsReflections,K as reflectEnv,G as reflectSecrets};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),types=require('@stryke/env/types'),camelCase=require('@stryke/string-format/camel-case'),isString=require('@stryke/type-checks/is-string');/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function i(r){if(isString.isString(r)){let t=types.ENV_PREFIXES.reduce((e,n)=>(e.startsWith(n)&&(e=e.slice(n.length)),e),r.toUpperCase());for(;t.startsWith("_");)t=t.slice(1);return t}return Object.keys(r).reduce((t,e)=>{const n=i(e);return n&&(t[n]=r[e]),t},{})}chunkFBBMZ4NC_cjs.a(i,"removeEnvPrefix");function T(r){return camelCase.camelCase(i(r))}chunkFBBMZ4NC_cjs.a(T,"formatEnvField");exports.formatEnvField=T;exports.removeEnvPrefix=i;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DotenvParseOutput } from '@stryke/env/types';
|
|
2
|
+
|
|
3
|
+
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
4
|
+
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
5
|
+
declare function formatEnvField(key: string): string;
|
|
6
|
+
|
|
7
|
+
export { formatEnvField, removeEnvPrefix };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DotenvParseOutput } from '@stryke/env/types';
|
|
2
|
+
|
|
3
|
+
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
4
|
+
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
5
|
+
declare function formatEnvField(key: string): string;
|
|
6
|
+
|
|
7
|
+
export { formatEnvField, removeEnvPrefix };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {ENV_PREFIXES}from'@stryke/env/types';import {camelCase}from'@stryke/string-format/camel-case';import {isString}from'@stryke/type-checks/is-string';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
function i(r){if(isString(r)){let t=ENV_PREFIXES.reduce((e,n)=>(e.startsWith(n)&&(e=e.slice(n.length)),e),r.toUpperCase());for(;t.startsWith("_");)t=t.slice(1);return t}return Object.keys(r).reduce((t,e)=>{const n=i(e);return n&&(t[n]=r[e]),t},{})}a(i,"removeEnvPrefix");function f(r){return camelCase(i(r))}a(f,"formatEnvField");export{f as formatEnvField,i as removeEnvPrefix};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use strict';var chunkFBBMZ4NC_cjs=require('../chunk-FBBMZ4NC.cjs'),titleCase=require('@stryke/string-format/title-case'),persistence=require('./persistence');/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
async function P(a,l){const i=await persistence.readEnvTypeReflection(a,l);return i.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{i.addProperty({name:t,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(s=>s!==t).concat(e.name),title:e.getTitle()||titleCase.titleCase(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}});});}),i}chunkFBBMZ4NC_cjs.a(P,"createTemplateReflection");exports.createTemplateReflection=P;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReflectionClass } from '@deepkit/type';
|
|
2
|
+
import { EnvPluginContext, EnvType } from '../types/plugin.cjs';
|
|
3
|
+
import '@alloy-js/core/jsx-runtime';
|
|
4
|
+
import '../runtime-I3P49niA.cjs';
|
|
5
|
+
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/package-json';
|
|
7
|
+
import 'jiti';
|
|
8
|
+
import 'unplugin';
|
|
9
|
+
import '@stryke/capnp';
|
|
10
|
+
import '@storm-software/config-tools/types';
|
|
11
|
+
import '@stryke/types/base';
|
|
12
|
+
import '@stryke/types/configuration';
|
|
13
|
+
import '@stryke/types/file';
|
|
14
|
+
import 'vite';
|
|
15
|
+
import '@babel/core';
|
|
16
|
+
import '@storm-software/build-tools/types';
|
|
17
|
+
import '@storm-software/config/types';
|
|
18
|
+
import '@babel/helper-plugin-utils';
|
|
19
|
+
import 'semver';
|
|
20
|
+
import '@stryke/types/array';
|
|
21
|
+
import '@stryke/types/tsconfig';
|
|
22
|
+
import 'typescript';
|
|
23
|
+
import '../vfs-COoZkq8D.cjs';
|
|
24
|
+
import 'memfs';
|
|
25
|
+
import 'node:fs';
|
|
26
|
+
import 'unionfs';
|
|
27
|
+
import '@stryke/env/types';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates the reflection data used when generating runtime template files.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The context for the configuration plugin.
|
|
33
|
+
* @param name - The name of the configuration template.
|
|
34
|
+
* @returns The reflection for the specified configuration template.
|
|
35
|
+
*/
|
|
36
|
+
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
37
|
+
|
|
38
|
+
export { createTemplateReflection };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ReflectionClass } from '@deepkit/type';
|
|
2
|
+
import { EnvPluginContext, EnvType } from '../types/plugin.js';
|
|
3
|
+
import '@alloy-js/core/jsx-runtime';
|
|
4
|
+
import '../runtime-DqvtGYT3.js';
|
|
5
|
+
import '@stryke/env/get-env-paths';
|
|
6
|
+
import '@stryke/types/package-json';
|
|
7
|
+
import 'jiti';
|
|
8
|
+
import 'unplugin';
|
|
9
|
+
import '@stryke/capnp';
|
|
10
|
+
import '@storm-software/config-tools/types';
|
|
11
|
+
import '@stryke/types/base';
|
|
12
|
+
import '@stryke/types/configuration';
|
|
13
|
+
import '@stryke/types/file';
|
|
14
|
+
import 'vite';
|
|
15
|
+
import '@babel/core';
|
|
16
|
+
import '@storm-software/build-tools/types';
|
|
17
|
+
import '@storm-software/config/types';
|
|
18
|
+
import '@babel/helper-plugin-utils';
|
|
19
|
+
import 'semver';
|
|
20
|
+
import '@stryke/types/array';
|
|
21
|
+
import '@stryke/types/tsconfig';
|
|
22
|
+
import 'typescript';
|
|
23
|
+
import '../vfs-COoZkq8D.js';
|
|
24
|
+
import 'memfs';
|
|
25
|
+
import 'node:fs';
|
|
26
|
+
import 'unionfs';
|
|
27
|
+
import '@stryke/env/types';
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Creates the reflection data used when generating runtime template files.
|
|
31
|
+
*
|
|
32
|
+
* @param context - The context for the configuration plugin.
|
|
33
|
+
* @param name - The name of the configuration template.
|
|
34
|
+
* @returns The reflection for the specified configuration template.
|
|
35
|
+
*/
|
|
36
|
+
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
37
|
+
|
|
38
|
+
export { createTemplateReflection };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import {a}from'../chunk-UCUR73HG.js';import {titleCase}from'@stryke/string-format/title-case';import {readEnvTypeReflection}from'./persistence';/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
async function R(a,l){const i=await readEnvTypeReflection(a,l);return i.getProperties().forEach(e=>{e.getAlias().filter(Boolean).forEach(t=>{i.addProperty({name:t,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(s=>s!==t).concat(e.name),title:e.getTitle()||titleCase(e.name),readonly:e.isReadonly(),permission:e.getPermission(),domain:e.getDomain()}});});}),i}a(R,"createTemplateReflection");export{R as createTemplateReflection};
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';Object.defineProperty(exports,'__esModule',{value:true});require('./chunk-FBBMZ4NC.cjs');var createPlugin=require('@powerlines/alloy/create-plugin'),$=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'),u=require('defu'),type=require('powerlines/deepkit/type'),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 $__default=/*#__PURE__*/_interopDefault($);var u__default=/*#__PURE__*/_interopDefault(u);/*****************************************
|
|
2
|
+
*
|
|
3
|
+
* ⚡ Built by Storm Software
|
|
4
|
+
*
|
|
5
|
+
*****************************************/
|
|
6
|
+
|
|
7
|
+
const O=createPlugin.createAlloyPlugin(T=>({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(T,{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]),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
|
+
|
|
9
|
+
# Environment variables configuration
|
|
10
|
+
|
|
11
|
+
Below is a list of environment variables used by the [${this.packageJson.name}](https://www.npmjs.com/package/${this.packageJson.name}) package. These values can be updated in the \`.env\` file in the root of the project.
|
|
12
|
+
|
|
13
|
+
## Environment Configuration
|
|
14
|
+
|
|
15
|
+
The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.
|
|
16
|
+
|
|
17
|
+
| Name | Description | Type | Default Value | Required |
|
|
18
|
+
| ---- | ----------- | ---- | ------------- | :------: |
|
|
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
|
+
`,"")??"").trim()} | ${type.stringifyType(t.getType()).trim().replaceAll(" | ",", or ")} | ${t.hasDefault()?String(t.getDefaultValue())?.includes('"')?t.getDefaultValue():`\`${t.getDefaultValue()}\``:""} | ${t.isValueRequired()?"":"\u2714"} |`).join(`
|
|
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=O;exports.default=le;exports.plugin=O;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]}})});
|