@powerlines/plugin-env 0.16.62 → 0.16.64

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/babel/plugin.cjs +11 -83
  2. package/dist/babel/plugin.mjs +11 -83
  3. package/dist/babel/plugin.mjs.map +1 -1
  4. package/dist/components/docs.cjs +27 -37
  5. package/dist/components/docs.mjs +27 -37
  6. package/dist/components/docs.mjs.map +1 -1
  7. package/dist/components/env-builtin.cjs +315 -405
  8. package/dist/components/env-builtin.mjs +315 -405
  9. package/dist/components/env-builtin.mjs.map +1 -1
  10. package/dist/helpers/automd-generator.cjs +4 -14
  11. package/dist/helpers/automd-generator.d.mts +1 -1
  12. package/dist/helpers/automd-generator.mjs +4 -14
  13. package/dist/helpers/automd-generator.mjs.map +1 -1
  14. package/dist/helpers/create-reflection-resource.cjs +0 -8
  15. package/dist/helpers/create-reflection-resource.mjs +0 -9
  16. package/dist/helpers/create-reflection-resource.mjs.map +1 -1
  17. package/dist/helpers/docs-helper.cjs +0 -8
  18. package/dist/helpers/docs-helper.mjs +0 -8
  19. package/dist/helpers/docs-helper.mjs.map +1 -1
  20. package/dist/helpers/index.cjs +0 -1
  21. package/dist/helpers/index.mjs +2 -2
  22. package/dist/helpers/load.cjs +7 -58
  23. package/dist/helpers/load.mjs +7 -58
  24. package/dist/helpers/load.mjs.map +1 -1
  25. package/dist/helpers/persistence.cjs +1 -108
  26. package/dist/helpers/persistence.mjs +1 -108
  27. package/dist/helpers/persistence.mjs.map +1 -1
  28. package/dist/helpers/reflect.cjs +16 -156
  29. package/dist/helpers/reflect.mjs +17 -156
  30. package/dist/helpers/reflect.mjs.map +1 -1
  31. package/dist/helpers/source-file-env.cjs +4 -34
  32. package/dist/helpers/source-file-env.mjs +4 -34
  33. package/dist/helpers/source-file-env.mjs.map +1 -1
  34. package/dist/helpers/template-helpers.cjs +5 -33
  35. package/dist/helpers/template-helpers.mjs +5 -33
  36. package/dist/helpers/template-helpers.mjs.map +1 -1
  37. package/dist/index.cjs +3 -6
  38. package/dist/index.mjs +4 -7
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +0 -2
  41. package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +1 -1
  42. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +0 -4
  43. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -1
  44. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +1 -1
  45. package/dist/types/index.cjs +0 -11
  46. package/dist/types/index.mjs +1 -4
  47. package/dist/types/plugin.cjs +0 -137
  48. package/dist/types/plugin.d.mts +4 -4
  49. package/dist/types/plugin.mjs +1 -132
  50. package/dist/types/runtime.cjs +0 -244
  51. package/dist/types/runtime.mjs +1 -242
  52. package/package.json +10 -10
  53. package/dist/types/plugin.mjs.map +0 -1
  54. package/dist/types/runtime.mjs.map +0 -1
@@ -1,63 +1,31 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_runtime = require('../types/runtime.cjs');
4
- const require_types_plugin = require('../types/plugin.cjs');
5
3
  const require_helpers_persistence = require('./persistence.cjs');
6
- let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
7
4
  let _stryke_string_format_title_case = require("@stryke/string-format/title-case");
5
+ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
8
6
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
9
7
  let _powerlines_deepkit_reflect_type = require("@powerlines/deepkit/reflect-type");
10
8
  let _stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
11
9
 
12
10
  //#region src/helpers/reflect.ts
13
- function __assignType(fn, args) {
14
- fn.__type = args;
15
- return fn;
16
- }
17
11
  function mergeEnvReflections(context, reflections) {
18
- return createEnvReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
19
- "reflection",
20
- "",
21
- "P\"2!\"/\""
22
- ]))) });
12
+ return createEnvReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map((reflection) => reflection.type)) });
23
13
  }
24
- mergeEnvReflections.__type = [
25
- () => require_types_plugin.__ΩEnvPluginContext,
26
- "context",
27
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
28
- "reflections",
29
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
30
- "mergeEnvReflections",
31
- "Pn!2\"P\"7#F2$P\"7%/&"
32
- ];
33
14
  function mergeSecretsReflections(context, reflections) {
34
- return createSecretsReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map(__assignType((reflection) => reflection.type, [
35
- "reflection",
36
- "",
37
- "P\"2!\"/\""
38
- ]))) });
15
+ return createSecretsReflection(context, { type: (0, _powerlines_deepkit_vendor_type.merge)(reflections.map((reflection) => reflection.type)) });
39
16
  }
40
- mergeSecretsReflections.__type = [
41
- () => require_types_plugin.__ΩEnvPluginContext,
42
- "context",
43
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
44
- "reflections",
45
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
46
- "mergeSecretsReflections",
47
- "Pn!2\"P\"7#F2$P\"7%/&"
48
- ];
49
- const __ΩCreateEnvReflectionOptions = [
50
- () => _powerlines_deepkit_vendor_type.__ΩTypeObjectLiteral,
51
- () => _powerlines_deepkit_vendor_type.__ΩTypeClass,
52
- "type",
53
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
54
- "superReflection",
55
- "CreateEnvReflectionOptions",
56
- "PPn!n\"J4#8P\"7$4%8Mw&y"
57
- ];
58
17
  var BaseEnv = class {
18
+ APP_NAME;
19
+ APP_VERSION;
20
+ BUILD_ID;
21
+ BUILD_TIMESTAMP;
22
+ BUILD_CHECKSUM;
23
+ RELEASE_ID;
24
+ RELEASE_TAG;
25
+ ORGANIZATION;
59
26
  PLATFORM = "neutral";
60
27
  MODE = "production";
28
+ ENVIRONMENT;
61
29
  DEBUG = false;
62
30
  TEST = false;
63
31
  MINIMAL = false;
@@ -66,82 +34,13 @@ var BaseEnv = class {
66
34
  FORCE_HYPERLINK = false;
67
35
  STACKTRACE = false;
68
36
  INCLUDE_ERROR_DATA = false;
37
+ ERROR_URL;
38
+ DEFAULT_TIMEZONE;
39
+ DEFAULT_LOCALE;
69
40
  CI = false;
70
- static __type = [
71
- "APP_NAME",
72
- "APP_VERSION",
73
- "BUILD_ID",
74
- "BUILD_TIMESTAMP",
75
- "BUILD_CHECKSUM",
76
- "RELEASE_ID",
77
- "RELEASE_TAG",
78
- "ORGANIZATION",
79
- "node",
80
- "browser",
81
- "neutral",
82
- "PLATFORM",
83
- function() {
84
- return "neutral";
85
- },
86
- "development",
87
- "test",
88
- "production",
89
- "MODE",
90
- function() {
91
- return "production";
92
- },
93
- "ENVIRONMENT",
94
- "DEBUG",
95
- function() {
96
- return false;
97
- },
98
- "TEST",
99
- function() {
100
- return false;
101
- },
102
- "MINIMAL",
103
- function() {
104
- return false;
105
- },
106
- "NO_COLOR",
107
- function() {
108
- return false;
109
- },
110
- "FORCE_COLOR",
111
- function() {
112
- return false;
113
- },
114
- "FORCE_HYPERLINK",
115
- function() {
116
- return false;
117
- },
118
- "STACKTRACE",
119
- function() {
120
- return false;
121
- },
122
- "INCLUDE_ERROR_DATA",
123
- function() {
124
- return false;
125
- },
126
- "ERROR_URL",
127
- "DEFAULT_TIMEZONE",
128
- "DEFAULT_LOCALE",
129
- "CI",
130
- function() {
131
- return false;
132
- },
133
- () => require_types_runtime.__ΩEnvInterface,
134
- "BaseEnv",
135
- "&3!&3\"&3#&3$&3%&3&&3'&3(P.).*.+J3,>-P.../.0J31>2&33)34>5)36>7)38>9)3:>;P')J3<>=P')J3>>?)3@>A)3B>C&3D&3E&3F)3G>H5nIx\"wJ"
136
- ];
137
41
  };
138
42
  var BaseSecrets = class {
139
- static __type = [
140
- "ENCRYPTION_KEY",
141
- () => require_types_runtime.__ΩSecretsInterface,
142
- "BaseSecrets",
143
- "&3!5n\"x\"w#"
144
- ];
43
+ ENCRYPTION_KEY;
145
44
  };
146
45
  function createEnvReflection(context, options = {}) {
147
46
  const parent = options.superReflection ?? new _powerlines_deepkit_vendor_type.ReflectionClass({
@@ -166,16 +65,6 @@ function createEnvReflection(context, options = {}) {
166
65
  result.name = "Env";
167
66
  return result;
168
67
  }
169
- createEnvReflection.__type = [
170
- () => require_types_plugin.__ΩEnvPluginContext,
171
- "context",
172
- () => __ΩCreateEnvReflectionOptions,
173
- "options",
174
- () => ({}),
175
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
176
- "createEnvReflection",
177
- "Pn!2\"n#2$>%P\"7&/'"
178
- ];
179
68
  function createSecretsReflection(context, options = {}) {
180
69
  const parent = options.superReflection ?? new _powerlines_deepkit_vendor_type.ReflectionClass({
181
70
  kind: _powerlines_deepkit_vendor_type.ReflectionKind.class,
@@ -199,16 +88,6 @@ function createSecretsReflection(context, options = {}) {
199
88
  result.name = "Secrets";
200
89
  return result;
201
90
  }
202
- createSecretsReflection.__type = [
203
- () => require_types_plugin.__ΩEnvPluginContext,
204
- "context",
205
- () => __ΩCreateEnvReflectionOptions,
206
- "options",
207
- () => ({}),
208
- () => _powerlines_deepkit_vendor_type.ReflectionClass,
209
- "createSecretsReflection",
210
- "Pn!2\"n#2$>%P\"7&/'"
211
- ];
212
91
  /**
213
92
  * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
214
93
  *
@@ -232,15 +111,6 @@ async function reflectEnv(context, file, name) {
232
111
  (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getEnvDefaultTypeDefinition(context)))
233
112
  ].filter(Boolean));
234
113
  }
235
- reflectEnv.__type = [
236
- () => require_types_plugin.__ΩEnvPluginContext,
237
- "context",
238
- "file",
239
- "name",
240
- "reflectEnv",
241
- "Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.",
242
- "Pn!2\"&2#8&2$8\"/%?&"
243
- ];
244
114
  /**
245
115
  * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
246
116
  *
@@ -264,20 +134,10 @@ async function reflectSecrets(context, file, name) {
264
134
  (0, _powerlines_deepkit_vendor_type.resolveClassType)(await (0, _powerlines_deepkit_reflect_type.reflectType)(context, await require_helpers_persistence.getSecretsDefaultTypeDefinition(context)))
265
135
  ].filter(Boolean));
266
136
  }
267
- reflectSecrets.__type = [
268
- () => require_types_plugin.__ΩEnvPluginContext,
269
- "context",
270
- "file",
271
- "name",
272
- "reflectSecrets",
273
- "Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.",
274
- "Pn!2\"&2#8&2$8\"/%?&"
275
- ];
276
137
 
277
138
  //#endregion
278
139
  exports.BaseEnv = BaseEnv;
279
140
  exports.BaseSecrets = BaseSecrets;
280
- exports.__ΩCreateEnvReflectionOptions = __ΩCreateEnvReflectionOptions;
281
141
  exports.createEnvReflection = createEnvReflection;
282
142
  exports.createSecretsReflection = createSecretsReflection;
283
143
  exports.mergeEnvReflections = mergeEnvReflections;
@@ -1,61 +1,29 @@
1
- import { __ΩEnvInterface, __ΩSecretsInterface } from "../types/runtime.mjs";
2
- import { __ΩEnvPluginContext } from "../types/plugin.mjs";
3
1
  import { getEnvDefaultTypeDefinition, getSecretsDefaultTypeDefinition, readEnvTypeReflection, readSecretsReflection } from "./persistence.mjs";
4
- import { ReflectionClass, ReflectionKind, __ΩTypeClass, __ΩTypeObjectLiteral, merge, resolveClassType } from "@powerlines/deepkit/vendor/type";
5
2
  import { titleCase } from "@stryke/string-format/title-case";
3
+ import { ReflectionClass, ReflectionKind, merge, resolveClassType } from "@powerlines/deepkit/vendor/type";
6
4
  import { joinPaths } from "@stryke/path/join-paths";
7
5
  import { reflectType } from "@powerlines/deepkit/reflect-type";
8
6
  import { isParentPath } from "@stryke/path/is-parent-path";
9
7
 
10
8
  //#region src/helpers/reflect.ts
11
- function __assignType(fn, args) {
12
- fn.__type = args;
13
- return fn;
14
- }
15
9
  function mergeEnvReflections(context, reflections) {
16
- return createEnvReflection(context, { type: merge(reflections.map(__assignType((reflection) => reflection.type, [
17
- "reflection",
18
- "",
19
- "P\"2!\"/\""
20
- ]))) });
10
+ return createEnvReflection(context, { type: merge(reflections.map((reflection) => reflection.type)) });
21
11
  }
22
- mergeEnvReflections.__type = [
23
- () => __ΩEnvPluginContext,
24
- "context",
25
- () => ReflectionClass,
26
- "reflections",
27
- () => ReflectionClass,
28
- "mergeEnvReflections",
29
- "Pn!2\"P\"7#F2$P\"7%/&"
30
- ];
31
12
  function mergeSecretsReflections(context, reflections) {
32
- return createSecretsReflection(context, { type: merge(reflections.map(__assignType((reflection) => reflection.type, [
33
- "reflection",
34
- "",
35
- "P\"2!\"/\""
36
- ]))) });
13
+ return createSecretsReflection(context, { type: merge(reflections.map((reflection) => reflection.type)) });
37
14
  }
38
- mergeSecretsReflections.__type = [
39
- () => __ΩEnvPluginContext,
40
- "context",
41
- () => ReflectionClass,
42
- "reflections",
43
- () => ReflectionClass,
44
- "mergeSecretsReflections",
45
- "Pn!2\"P\"7#F2$P\"7%/&"
46
- ];
47
- const __ΩCreateEnvReflectionOptions = [
48
- () => __ΩTypeObjectLiteral,
49
- () => __ΩTypeClass,
50
- "type",
51
- () => ReflectionClass,
52
- "superReflection",
53
- "CreateEnvReflectionOptions",
54
- "PPn!n\"J4#8P\"7$4%8Mw&y"
55
- ];
56
15
  var BaseEnv = class {
16
+ APP_NAME;
17
+ APP_VERSION;
18
+ BUILD_ID;
19
+ BUILD_TIMESTAMP;
20
+ BUILD_CHECKSUM;
21
+ RELEASE_ID;
22
+ RELEASE_TAG;
23
+ ORGANIZATION;
57
24
  PLATFORM = "neutral";
58
25
  MODE = "production";
26
+ ENVIRONMENT;
59
27
  DEBUG = false;
60
28
  TEST = false;
61
29
  MINIMAL = false;
@@ -64,82 +32,13 @@ var BaseEnv = class {
64
32
  FORCE_HYPERLINK = false;
65
33
  STACKTRACE = false;
66
34
  INCLUDE_ERROR_DATA = false;
35
+ ERROR_URL;
36
+ DEFAULT_TIMEZONE;
37
+ DEFAULT_LOCALE;
67
38
  CI = false;
68
- static __type = [
69
- "APP_NAME",
70
- "APP_VERSION",
71
- "BUILD_ID",
72
- "BUILD_TIMESTAMP",
73
- "BUILD_CHECKSUM",
74
- "RELEASE_ID",
75
- "RELEASE_TAG",
76
- "ORGANIZATION",
77
- "node",
78
- "browser",
79
- "neutral",
80
- "PLATFORM",
81
- function() {
82
- return "neutral";
83
- },
84
- "development",
85
- "test",
86
- "production",
87
- "MODE",
88
- function() {
89
- return "production";
90
- },
91
- "ENVIRONMENT",
92
- "DEBUG",
93
- function() {
94
- return false;
95
- },
96
- "TEST",
97
- function() {
98
- return false;
99
- },
100
- "MINIMAL",
101
- function() {
102
- return false;
103
- },
104
- "NO_COLOR",
105
- function() {
106
- return false;
107
- },
108
- "FORCE_COLOR",
109
- function() {
110
- return false;
111
- },
112
- "FORCE_HYPERLINK",
113
- function() {
114
- return false;
115
- },
116
- "STACKTRACE",
117
- function() {
118
- return false;
119
- },
120
- "INCLUDE_ERROR_DATA",
121
- function() {
122
- return false;
123
- },
124
- "ERROR_URL",
125
- "DEFAULT_TIMEZONE",
126
- "DEFAULT_LOCALE",
127
- "CI",
128
- function() {
129
- return false;
130
- },
131
- () => __ΩEnvInterface,
132
- "BaseEnv",
133
- "&3!&3\"&3#&3$&3%&3&&3'&3(P.).*.+J3,>-P.../.0J31>2&33)34>5)36>7)38>9)3:>;P')J3<>=P')J3>>?)3@>A)3B>C&3D&3E&3F)3G>H5nIx\"wJ"
134
- ];
135
39
  };
136
40
  var BaseSecrets = class {
137
- static __type = [
138
- "ENCRYPTION_KEY",
139
- () => __ΩSecretsInterface,
140
- "BaseSecrets",
141
- "&3!5n\"x\"w#"
142
- ];
41
+ ENCRYPTION_KEY;
143
42
  };
144
43
  function createEnvReflection(context, options = {}) {
145
44
  const parent = options.superReflection ?? new ReflectionClass({
@@ -164,16 +63,6 @@ function createEnvReflection(context, options = {}) {
164
63
  result.name = "Env";
165
64
  return result;
166
65
  }
167
- createEnvReflection.__type = [
168
- () => __ΩEnvPluginContext,
169
- "context",
170
- () => __ΩCreateEnvReflectionOptions,
171
- "options",
172
- () => ({}),
173
- () => ReflectionClass,
174
- "createEnvReflection",
175
- "Pn!2\"n#2$>%P\"7&/'"
176
- ];
177
66
  function createSecretsReflection(context, options = {}) {
178
67
  const parent = options.superReflection ?? new ReflectionClass({
179
68
  kind: ReflectionKind.class,
@@ -197,16 +86,6 @@ function createSecretsReflection(context, options = {}) {
197
86
  result.name = "Secrets";
198
87
  return result;
199
88
  }
200
- createSecretsReflection.__type = [
201
- () => __ΩEnvPluginContext,
202
- "context",
203
- () => __ΩCreateEnvReflectionOptions,
204
- "options",
205
- () => ({}),
206
- () => ReflectionClass,
207
- "createSecretsReflection",
208
- "Pn!2\"n#2$>%P\"7&/'"
209
- ];
210
89
  /**
211
90
  * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
212
91
  *
@@ -230,15 +109,6 @@ async function reflectEnv(context, file, name) {
230
109
  resolveClassType(await reflectType(context, await getEnvDefaultTypeDefinition(context)))
231
110
  ].filter(Boolean));
232
111
  }
233
- reflectEnv.__type = [
234
- () => __ΩEnvPluginContext,
235
- "context",
236
- "file",
237
- "name",
238
- "reflectEnv",
239
- "Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.",
240
- "Pn!2\"&2#8&2$8\"/%?&"
241
- ];
242
112
  /**
243
113
  * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
244
114
  *
@@ -262,16 +132,7 @@ async function reflectSecrets(context, file, name) {
262
132
  resolveClassType(await reflectType(context, await getSecretsDefaultTypeDefinition(context)))
263
133
  ].filter(Boolean));
264
134
  }
265
- reflectSecrets.__type = [
266
- () => __ΩEnvPluginContext,
267
- "context",
268
- "file",
269
- "name",
270
- "reflectSecrets",
271
- "Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.",
272
- "Pn!2\"&2#8&2$8\"/%?&"
273
- ];
274
135
 
275
136
  //#endregion
276
- export { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
137
+ export { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
277
138
  //# sourceMappingURL=reflect.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/helpers/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { reflectType } from \"@powerlines/deepkit/reflect-type\";\nimport {\n merge,\n ReflectionClass,\n ReflectionKind,\n resolveClassType,\n TypeClass,\n TypeObjectLiteral\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext } from \"../types/plugin\";\nimport { EnvInterface, SecretsInterface } from \"../types/runtime\";\nimport {\n getEnvDefaultTypeDefinition,\n getSecretsDefaultTypeDefinition,\n readEnvTypeReflection,\n readSecretsReflection\n} from \"./persistence\";\n\nexport function mergeEnvReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createEnvReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport function mergeSecretsReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createSecretsReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport interface CreateEnvReflectionOptions {\n type?: TypeObjectLiteral | TypeClass;\n superReflection?: ReflectionClass<any>;\n}\n\nexport class BaseEnv implements EnvInterface {\n APP_NAME!: string;\n\n APP_VERSION!: string;\n\n BUILD_ID!: string;\n\n BUILD_TIMESTAMP!: string;\n\n BUILD_CHECKSUM!: string;\n\n RELEASE_ID!: string;\n\n RELEASE_TAG!: string;\n\n ORGANIZATION!: string;\n\n PLATFORM: \"node\" | \"browser\" | \"neutral\" = \"neutral\";\n\n MODE: \"development\" | \"test\" | \"production\" = \"production\";\n\n ENVIRONMENT!: string;\n\n DEBUG: boolean = false;\n\n TEST: boolean = false;\n\n MINIMAL: boolean = false;\n\n NO_COLOR: boolean = false;\n\n FORCE_COLOR: number | boolean = false;\n\n FORCE_HYPERLINK: number | boolean = false;\n\n STACKTRACE: boolean = false;\n\n INCLUDE_ERROR_DATA: boolean = false;\n\n ERROR_URL!: string;\n\n DEFAULT_TIMEZONE!: string;\n\n DEFAULT_LOCALE!: string;\n\n CI: boolean = false;\n}\n\nexport class BaseSecrets implements SecretsInterface {\n ENCRYPTION_KEY!: string;\n}\n\nexport function createEnvReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base environment configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseEnv,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"EnvInterface\",\n description: `The environment configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Env\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `A schema describing the list of available environment variables that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Env\";\n\n return result;\n}\n\nexport function createSecretsReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base secrets configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseSecrets,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"SecretsInterface\",\n description: `The secrets configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Secrets\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `A schema describing the list of available environment secrets that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Secrets\";\n\n return result;\n}\n\n/**\n * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the environment configuration type definition from\n * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n */\nexport async function reflectEnv(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeEnvReflections(\n context,\n [\n await readEnvTypeReflection(context, \"env\"),\n config,\n resolveClassType(\n await reflectType(context, await getEnvDefaultTypeDefinition(context))\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n\n/**\n * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the secrets configuration type definition from\n * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n */\nexport async function reflectSecrets(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeSecretsReflections(\n context,\n [\n await readSecretsReflection(context),\n config,\n resolveClassType(\n await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n )\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n"],"mappings":"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"}
1
+ {"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/helpers/reflect.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { reflectType } from \"@powerlines/deepkit/reflect-type\";\nimport {\n merge,\n ReflectionClass,\n ReflectionKind,\n resolveClassType,\n TypeClass,\n TypeObjectLiteral\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext } from \"../types/plugin\";\nimport { EnvInterface, SecretsInterface } from \"../types/runtime\";\nimport {\n getEnvDefaultTypeDefinition,\n getSecretsDefaultTypeDefinition,\n readEnvTypeReflection,\n readSecretsReflection\n} from \"./persistence\";\n\nexport function mergeEnvReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createEnvReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport function mergeSecretsReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createSecretsReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport interface CreateEnvReflectionOptions {\n type?: TypeObjectLiteral | TypeClass;\n superReflection?: ReflectionClass<any>;\n}\n\nexport class BaseEnv implements EnvInterface {\n APP_NAME!: string;\n\n APP_VERSION!: string;\n\n BUILD_ID!: string;\n\n BUILD_TIMESTAMP!: string;\n\n BUILD_CHECKSUM!: string;\n\n RELEASE_ID!: string;\n\n RELEASE_TAG!: string;\n\n ORGANIZATION!: string;\n\n PLATFORM: \"node\" | \"browser\" | \"neutral\" = \"neutral\";\n\n MODE: \"development\" | \"test\" | \"production\" = \"production\";\n\n ENVIRONMENT!: string;\n\n DEBUG: boolean = false;\n\n TEST: boolean = false;\n\n MINIMAL: boolean = false;\n\n NO_COLOR: boolean = false;\n\n FORCE_COLOR: number | boolean = false;\n\n FORCE_HYPERLINK: number | boolean = false;\n\n STACKTRACE: boolean = false;\n\n INCLUDE_ERROR_DATA: boolean = false;\n\n ERROR_URL!: string;\n\n DEFAULT_TIMEZONE!: string;\n\n DEFAULT_LOCALE!: string;\n\n CI: boolean = false;\n}\n\nexport class BaseSecrets implements SecretsInterface {\n ENCRYPTION_KEY!: string;\n}\n\nexport function createEnvReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base environment configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseEnv,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"EnvInterface\",\n description: `The environment configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Env\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `A schema describing the list of available environment variables that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Env\";\n\n return result;\n}\n\nexport function createSecretsReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base secrets configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseSecrets,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"SecretsInterface\",\n description: `The secrets configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Secrets\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `A schema describing the list of available environment secrets that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Secrets\";\n\n return result;\n}\n\n/**\n * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the environment configuration type definition from\n * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n */\nexport async function reflectEnv(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeEnvReflections(\n context,\n [\n await readEnvTypeReflection(context, \"env\"),\n config,\n resolveClassType(\n await reflectType(context, await getEnvDefaultTypeDefinition(context))\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n\n/**\n * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the secrets configuration type definition from\n * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n */\nexport async function reflectSecrets(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeSecretsReflections(\n context,\n [\n await readSecretsReflection(context),\n config,\n resolveClassType(\n await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n )\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n"],"mappings":"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"}
@@ -5,54 +5,24 @@ let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case
5
5
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
6
6
 
7
7
  //#region src/helpers/source-file-env.ts
8
- function __assignType(fn, args) {
9
- fn.__type = args;
10
- return fn;
11
- }
12
- const __ΩTReturned = [
13
- "TEnv",
14
- "TReturned",
15
- "l2&R!RPe#!&qk#%QRb!Pde\"!p'w\"y"
16
- ];
17
8
  function removeEnvPrefix(env) {
18
9
  if ((0, _stryke_type_checks_is_string.isString)(env)) {
19
- let name = _stryke_env_types.ENV_PREFIXES.reduce(__assignType((ret, prefix) => {
10
+ let name = _stryke_env_types.ENV_PREFIXES.reduce((ret, prefix) => {
20
11
  if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
21
12
  return ret;
22
- }, [
23
- "ret",
24
- "prefix",
25
- "",
26
- "P\"2!\"2\"\"/#"
27
- ]), env.toUpperCase());
13
+ }, env.toUpperCase());
28
14
  while (name.startsWith("_")) name = name.slice(1);
29
15
  return name;
30
16
  }
31
- return Object.keys(env).reduce(__assignType((ret, key) => {
17
+ return Object.keys(env).reduce((ret, key) => {
32
18
  const name = removeEnvPrefix(key);
33
19
  if (name) ret[name] = env[key];
34
20
  return ret;
35
- }, [
36
- "ret",
37
- "key",
38
- "",
39
- "P\"2!\"2\"\"/#"
40
- ]), {});
21
+ }, {});
41
22
  }
42
- removeEnvPrefix.__type = [
43
- "env",
44
- () => __ΩTReturned,
45
- "removeEnvPrefix",
46
- "P\"2!\"o\"\"/#"
47
- ];
48
23
  function formatEnvField(key) {
49
24
  return (0, _stryke_string_format_camel_case.camelCase)(removeEnvPrefix(key));
50
25
  }
51
- formatEnvField.__type = [
52
- "key",
53
- "formatEnvField",
54
- "P&2!&/\""
55
- ];
56
26
 
57
27
  //#endregion
58
28
  exports.formatEnvField = formatEnvField;
@@ -3,54 +3,24 @@ import { camelCase } from "@stryke/string-format/camel-case";
3
3
  import { isString } from "@stryke/type-checks/is-string";
4
4
 
5
5
  //#region src/helpers/source-file-env.ts
6
- function __assignType(fn, args) {
7
- fn.__type = args;
8
- return fn;
9
- }
10
- const __ΩTReturned = [
11
- "TEnv",
12
- "TReturned",
13
- "l2&R!RPe#!&qk#%QRb!Pde\"!p'w\"y"
14
- ];
15
6
  function removeEnvPrefix(env) {
16
7
  if (isString(env)) {
17
- let name = ENV_PREFIXES.reduce(__assignType((ret, prefix) => {
8
+ let name = ENV_PREFIXES.reduce((ret, prefix) => {
18
9
  if (ret.startsWith(prefix)) ret = ret.slice(prefix.length);
19
10
  return ret;
20
- }, [
21
- "ret",
22
- "prefix",
23
- "",
24
- "P\"2!\"2\"\"/#"
25
- ]), env.toUpperCase());
11
+ }, env.toUpperCase());
26
12
  while (name.startsWith("_")) name = name.slice(1);
27
13
  return name;
28
14
  }
29
- return Object.keys(env).reduce(__assignType((ret, key) => {
15
+ return Object.keys(env).reduce((ret, key) => {
30
16
  const name = removeEnvPrefix(key);
31
17
  if (name) ret[name] = env[key];
32
18
  return ret;
33
- }, [
34
- "ret",
35
- "key",
36
- "",
37
- "P\"2!\"2\"\"/#"
38
- ]), {});
19
+ }, {});
39
20
  }
40
- removeEnvPrefix.__type = [
41
- "env",
42
- () => __ΩTReturned,
43
- "removeEnvPrefix",
44
- "P\"2!\"o\"\"/#"
45
- ];
46
21
  function formatEnvField(key) {
47
22
  return camelCase(removeEnvPrefix(key));
48
23
  }
49
- formatEnvField.__type = [
50
- "key",
51
- "formatEnvField",
52
- "P&2!&/\""
53
- ];
54
24
 
55
25
  //#endregion
56
26
  export { formatEnvField, removeEnvPrefix };
@@ -1 +1 @@
1
- {"version":3,"file":"source-file-env.mjs","names":[],"sources":["../../src/helpers/source-file-env.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAKX,MAAK,eAAe;CAAE;CAAQ;CAAC;CAAoC;;AAElE,KAAO,SAAS,IAAI,EAAE;EACtB,IAAW,OAAO,aAAa,OAAG,cAAiB,KAAA,WAAS;AAC5D,OAAe,IAAI,WAAO,OAAQ,CACnB,OAAM,IAAI,MAAM,OAAG,OAAA;AAE7B,UAAQ;;;;;;;AAEN,SAAO,KAAK,WAAW,IAAI;AAG3B,SAAC;;AAET,QAAS,OAAS,KAAE,IAAO,CAAA,OAAO,cAAe,KAAA,QAAO;;AAEnD,MAAA;AAGE,SAAA;IACJ;EAAA;EAAU;EAAM;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEnB,gBAAc,SAAS;CAAA;OAAa;CAAa;CAAW;CAAA;AAC5D,SAAc,eAAiB,KAAG;AAC9B,QAAO,UAAO,gBAAmB,IAAC,CAAA"}
1
+ {"version":3,"file":"source-file-env.mjs","names":[],"sources":["../../src/helpers/source-file-env.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":";;;;;AAyBA,SAAgB,gBACd,KACiB;AACjB,KAAI,SAAS,IAAI,EAAE;EACjB,IAAI,OAAe,aAAa,QAAQ,KAAK,WAAW;AACtD,OAAI,IAAI,WAAW,OAAO,CACxB,OAAM,IAAI,MAAM,OAAO,OAAO;AAGhC,UAAO;KACN,IAAI,aAAa,CAAC;AAErB,SAAO,KAAK,WAAW,IAAI,CACzB,QAAO,KAAK,MAAM,EAAE;AAGtB,SAAO;;AAGT,QAAO,OAAO,KAAK,IAAI,CAAC,QAAQ,KAAK,QAAQ;EAC3C,MAAM,OAAO,gBAAgB,IAAI;AACjC,MAAI,KACF,CAAC,IAA0B,QAAQ,IAAI;AAGzC,SAAO;IACN,EAAE,CAAoB;;AAG3B,SAAgB,eAAe,KAAqB;AAClD,QAAO,UAAU,gBAAgB,IAAI,CAAC"}