@powerlines/plugin-env 0.16.236 → 0.16.238

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.
@@ -1,10 +1,10 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_types_plugin = require('../types/plugin.cjs');
4
+ let _powerlines_schema = require("@powerlines/schema");
4
5
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
6
  let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
6
7
  let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
7
- let _powerlines_schema = require("@powerlines/schema");
8
8
  let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
9
9
 
10
10
  //#region src/babel/plugin.ts
@@ -1,8 +1,8 @@
1
1
  import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
+ import { getProperties, stringifyValue } from "@powerlines/schema";
2
3
  import { isSetObject } from "@stryke/type-checks/is-set-object";
3
4
  import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
4
5
  import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
5
- import { getProperties, stringifyValue } from "@powerlines/schema";
6
6
  import { isUndefined } from "@stryke/type-checks/is-undefined";
7
7
 
8
8
  //#region src/babel/plugin.ts
@@ -72,7 +72,7 @@ function EnvDocsFile(props) {
72
72
  _alloy_js_core.code`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.`,
73
73
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
74
74
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
75
- return Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars)).filter(__assignType((property) => !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
75
+ return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars).filter(__assignType((property) => context.env.vars.active?.includes(property.name) && !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
76
76
  "property",
77
77
  "",
78
78
  "P\"2!\"/\""
@@ -1,5 +1,5 @@
1
1
  import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { getProperties } from "@powerlines/schema/helpers";
2
+ import { getPropertiesList } from "@powerlines/schema/helpers";
3
3
  import { joinPaths } from "@stryke/path/join";
4
4
  import { getDocsOutputPath } from "powerlines/plugin-utils";
5
5
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
@@ -70,7 +70,7 @@ function EnvDocsFile(props) {
70
70
  code`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.`,
71
71
  createComponent(Spacing, {}),
72
72
  createComponent(MarkdownTable, { get data() {
73
- return Object.values(getProperties(context.env.vars)).filter(__assignType((property) => !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
73
+ return getPropertiesList(context.env.vars).filter(__assignType((property) => context.env.vars.active?.includes(property.name) && !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
74
74
  "property",
75
75
  "",
76
76
  "P\"2!\"/\""
@@ -1 +1 @@
1
- {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"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 { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { stringifyType } from \"@powerlines/schema/codegen\";\nimport { getProperties } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`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.`}\n <Spacing />\n <MarkdownTable\n data={\n Object.values(getProperties(context.env.vars))\n .filter(\n property =>\n !property?.metadata?.isHidden &&\n !property?.metadata?.isIgnored &&\n !property?.metadata?.isReadonly &&\n !property?.metadata?.isInternal\n )\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n )\n .map(property => {\n return {\n name: property.metadata?.name?.trim(),\n description: (property.metadata?.description ?? \"\").trim(),\n type: stringifyType(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.metadata?.defaultValue\n ? stringifyType(property.metadata.defaultValue)\n : \"\",\n required: property.optional ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,MAAK,sBAAkB;OAAU;CAAa;CAAU;CAAA;CAAa;CAAA;AAAA;;;;AAKrE,SAAM,YAAa,OAAA;CACjB,MAAE,EACF,cAAc,GAChB,GAAA;CAEE,MAAA,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,IAAA,CAAA,GAAA,cAAA;CACA,OAAC,gBAAc,cAAY,WAAuB,EAClD,IAAA,OAAA;EACI,OAAC,UAAS,kBAAmB,QAAA,OAAkB,IAAA,GAAA,QAAA;CACnD,aAEA,IAAM,WAAU;;;IAEV,OAAC,IAAA;IACJ,UAAA;GACC,CAAA;GAAI,IAAE;GAA0D,gBAAC,MAAA;IAC/D,IAAE,OAAK;KACR,OAAQ,CAAA,CAAA,QAAW,YAAa;IAChC;IACA,IAAK,WAAQ;KACX,OAAA,gBAAA,MAAA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 {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"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 { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { stringifyType } from \"@powerlines/schema/codegen\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`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.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.vars)\n .filter(\n property =>\n context.env.vars.active?.includes(property.name) &&\n !property?.metadata?.isHidden &&\n !property?.metadata?.isIgnored &&\n !property?.metadata?.isReadonly &&\n !property?.metadata?.isInternal\n )\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n )\n .map(property => {\n return {\n name: property.metadata?.name?.trim(),\n description: (property.metadata?.description ?? \"\").trim(),\n type: stringifyType(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.metadata?.defaultValue\n ? stringifyType(property.metadata.defaultValue)\n : \"\",\n required: property.optional ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,MAAK,sBAAkB;OAAU;CAAa;CAAU;CAAA;CAAa;CAAA;AAAA;;;;AAKrE,SAAM,YAAa,OAAA;CACjB,MAAE,EACF,cAAc,GAChB,GAAA;CAEE,MAAA,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,IAAA,CAAA,GAAA,cAAA;CACA,OAAC,gBAAc,cAAY,WAAuB,EAClD,IAAA,OAAA;EACI,OAAC,UAAS,kBAAmB,QA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cAAa,SAAU,UAAU,eAAE,cAAA,SAAA,SAAA,YAAA,IAAA;MACnC,UAAG,SAAU,WAAU,KAAA;KACzB;IACF,GAAG;KAAA;KAAa;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA;GAClB,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAS;OAAE;CAAA;CAAA;CAAA;CAAA;AAAA"}
@@ -1,6 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_plugin = require('../types/plugin.cjs');
4
3
  const require_helpers_load = require('../helpers/load.cjs');
5
4
  let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
6
5
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
@@ -9,11 +8,8 @@ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plug
9
8
  let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
10
9
  let _alloy_js_typescript = require("@alloy-js/typescript");
11
10
  let _powerlines_plugin_alloy_helpers_refkey = require("@powerlines/plugin-alloy/helpers/refkey");
12
- let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
13
- let _powerlines_plugin_alloy_typescript_components_interface_declaration = require("@powerlines/plugin-alloy/typescript/components/interface-declaration");
14
- let _powerlines_plugin_alloy_typescript_components_object_declaration = require("@powerlines/plugin-alloy/typescript/components/object-declaration");
11
+ let _powerlines_plugin_alloy_typescript_components = require("@powerlines/plugin-alloy/typescript/components");
15
12
  let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
16
- let _powerlines_plugin_alloy_typescript_components_tsdoc_schema = require("@powerlines/plugin-alloy/typescript/components/tsdoc-schema");
17
13
  let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
18
14
 
19
15
  //#region src/components/env-builtin.tsx
@@ -45,9 +41,9 @@ function __assignType(fn, args) {
45
41
  * Generates the environment configuration typescript definition for the Powerlines project.
46
42
  */
47
43
  function EnvTypeDefinition() {
48
- const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
44
+ const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
49
45
  return [
50
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_interface_declaration.InterfaceDeclaration, {
46
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.InterfaceDeclaration, {
51
47
  name: "UnprefixedEnv",
52
48
  get schema() {
53
49
  return context.env.vars.schema;
@@ -78,7 +74,7 @@ function EnvTypeDefinition() {
78
74
  get children() {
79
75
  return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
80
76
  get each() {
81
- return Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
77
+ return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
82
78
  "property",
83
79
  "",
84
80
  "P\"2!\"/\""
@@ -86,7 +82,7 @@ function EnvTypeDefinition() {
86
82
  },
87
83
  doubleHardline: true,
88
84
  get children() {
89
- return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc_schema.TSDocSchemaProperty, { schema: property }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
85
+ return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.TSDocSchemaProperty, { schema: property }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.InterfaceMember, {
90
86
  get name() {
91
87
  return `${prefix}_${property.metadata?.name}`;
92
88
  },
@@ -120,11 +116,11 @@ EnvTypeDefinition.__type = [
120
116
  "P\"/!?\""
121
117
  ];
122
118
  const __ΩConfigPropertyConditionalProps = [
123
- () => require_types_plugin.__ΩEnvPluginContext,
119
+ "EnvPluginContext",
124
120
  "context",
125
121
  "name",
126
122
  "ConfigPropertyConditionalProps",
127
- "P!n!4\"&4#Mw$y"
123
+ "P!\"w!4\"&4#Mw$y"
128
124
  ];
129
125
  function ConfigPropertyConditional(props) {
130
126
  const [{ context, name }] = (0, _alloy_js_core.splitProps)(props, ["context", "name"]);
@@ -147,12 +143,12 @@ ConfigPropertyConditional.__type = [
147
143
  ];
148
144
  const __ΩConfigPropertyProps = [
149
145
  "index",
150
- () => require_types_plugin.__ΩEnvPluginContext,
146
+ "EnvPluginContext",
151
147
  "context",
152
148
  "name",
153
149
  "property",
154
150
  "ConfigPropertyProps",
155
- "P!'4!n\"4#&4$!4%Mw&y"
151
+ "P!'4!\"w\"4#&4$!4%Mw&y"
156
152
  ];
157
153
  function ConfigPropertyGet(props) {
158
154
  const [{ context, name, property, index }] = (0, _alloy_js_core.splitProps)(props, [
@@ -325,9 +321,9 @@ const envRefkey = (0, _powerlines_plugin_alloy_helpers_refkey.refkey)("env");
325
321
  */
326
322
  function EnvBuiltin(props) {
327
323
  const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
328
- const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
324
+ const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
329
325
  const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
330
- const reflectionGetProperties = (0, _alloy_js_core.computed)(() => Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
326
+ const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
331
327
  "property",
332
328
  "",
333
329
  "P\"2!\"/\""
@@ -337,7 +333,7 @@ function EnvBuiltin(props) {
337
333
  "",
338
334
  "P\"2!\"2\"\"/#"
339
335
  ])) ?? []);
340
- const reflectionSetProperties = (0, _alloy_js_core.computed)(() => Object.values((0, _powerlines_schema_helpers.getProperties)(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
336
+ const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
341
337
  "property",
342
338
  "",
343
339
  "P\"2!\"/\""
@@ -347,7 +343,7 @@ function EnvBuiltin(props) {
347
343
  "",
348
344
  "P\"2!\"2\"\"/#"
349
345
  ])) ?? []);
350
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
346
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
351
347
  id: "env",
352
348
  description: "The environment configuration module provides an interface to define environment configuration parameters."
353
349
  }, rest, { get children() {
@@ -360,7 +356,7 @@ function EnvBuiltin(props) {
360
356
  return [(0, _alloy_js_core_jsx_runtime.createComponent)(EnvTypeDefinition, { defaultValue }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
361
357
  }
362
358
  }),
363
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_object_declaration.ObjectDeclaration, {
359
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.ObjectDeclaration, {
364
360
  name: "initialEnv",
365
361
  type: "Partial<Env>",
366
362
  get schema() {
@@ -1,5 +1,5 @@
1
1
  import { Children } from "@alloy-js/core";
2
- import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
2
+ import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components";
3
3
 
4
4
  //#region src/components/env-builtin.d.ts
5
5
  /**
@@ -1,5 +1,5 @@
1
1
  import { Children } from "@alloy-js/core";
2
- import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
2
+ import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components";
3
3
 
4
4
  //#region src/components/env-builtin.d.ts
5
5
  /**
@@ -1,17 +1,13 @@
1
- import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
1
  import { loadEnvFromContext } from "../helpers/load.mjs";
3
- import { getProperties } from "@powerlines/schema/helpers";
2
+ import { getPropertiesList } from "@powerlines/schema/helpers";
4
3
  import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
5
4
  import { For, Show, code, computed, splitProps } from "@alloy-js/core";
6
5
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
7
6
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
8
- import { ElseIfClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
7
+ import { ElseIfClause, FunctionDeclaration, IfStatement, InterfaceDeclaration, VarDeclaration } from "@alloy-js/typescript";
9
8
  import { refkey } from "@powerlines/plugin-alloy/helpers/refkey";
10
- import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
11
- import { InterfaceDeclaration as InterfaceDeclaration$1 } from "@powerlines/plugin-alloy/typescript/components/interface-declaration";
12
- import { ObjectDeclaration } from "@powerlines/plugin-alloy/typescript/components/object-declaration";
9
+ import { BuiltinFile, InterfaceDeclaration as InterfaceDeclaration$1, InterfaceMember, ObjectDeclaration, TSDocSchemaProperty } from "@powerlines/plugin-alloy/typescript/components";
13
10
  import { TSDoc, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
14
- import { TSDocSchemaProperty } from "@powerlines/plugin-alloy/typescript/components/tsdoc-schema";
15
11
  import { getUnique } from "@stryke/helpers/get-unique";
16
12
 
17
13
  //#region src/components/env-builtin.tsx
@@ -43,7 +39,7 @@ function __assignType(fn, args) {
43
39
  * Generates the environment configuration typescript definition for the Powerlines project.
44
40
  */
45
41
  function EnvTypeDefinition() {
46
- const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
42
+ const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
47
43
  return [
48
44
  createComponent(InterfaceDeclaration$1, {
49
45
  name: "UnprefixedEnv",
@@ -76,7 +72,7 @@ function EnvTypeDefinition() {
76
72
  get children() {
77
73
  return __assignType((prefix) => createComponent(For, {
78
74
  get each() {
79
- return Object.values(getProperties(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
75
+ return getPropertiesList(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
80
76
  "property",
81
77
  "",
82
78
  "P\"2!\"/\""
@@ -118,11 +114,11 @@ EnvTypeDefinition.__type = [
118
114
  "P\"/!?\""
119
115
  ];
120
116
  const __ΩConfigPropertyConditionalProps = [
121
- () => __ΩEnvPluginContext,
117
+ "EnvPluginContext",
122
118
  "context",
123
119
  "name",
124
120
  "ConfigPropertyConditionalProps",
125
- "P!n!4\"&4#Mw$y"
121
+ "P!\"w!4\"&4#Mw$y"
126
122
  ];
127
123
  function ConfigPropertyConditional(props) {
128
124
  const [{ context, name }] = splitProps(props, ["context", "name"]);
@@ -145,12 +141,12 @@ ConfigPropertyConditional.__type = [
145
141
  ];
146
142
  const __ΩConfigPropertyProps = [
147
143
  "index",
148
- () => __ΩEnvPluginContext,
144
+ "EnvPluginContext",
149
145
  "context",
150
146
  "name",
151
147
  "property",
152
148
  "ConfigPropertyProps",
153
- "P!'4!n\"4#&4$!4%Mw&y"
149
+ "P!'4!\"w\"4#&4$!4%Mw&y"
154
150
  ];
155
151
  function ConfigPropertyGet(props) {
156
152
  const [{ context, name, property, index }] = splitProps(props, [
@@ -323,9 +319,9 @@ const envRefkey = refkey("env");
323
319
  */
324
320
  function EnvBuiltin(props) {
325
321
  const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
326
- const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
322
+ const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
327
323
  const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
328
- const reflectionGetProperties = computed(() => Object.values(getProperties(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored, [
324
+ const reflectionGetProperties = computed(() => getPropertiesList(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
329
325
  "property",
330
326
  "",
331
327
  "P\"2!\"/\""
@@ -335,7 +331,7 @@ function EnvBuiltin(props) {
335
331
  "",
336
332
  "P\"2!\"2\"\"/#"
337
333
  ])) ?? []);
338
- const reflectionSetProperties = computed(() => Object.values(getProperties(context.env.vars.schema)).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
334
+ const reflectionSetProperties = computed(() => getPropertiesList(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
339
335
  "property",
340
336
  "",
341
337
  "P\"2!\"/\""
@@ -1 +1 @@
1
- {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"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 {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TSDocSchemaProperty } from \"@powerlines/plugin-alloy/typescript/components/tsdoc-schema\";\nimport { JTDSchemaType } from \"@powerlines/schema\";\nimport { getProperties } from \"@powerlines/schema/helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.vars.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n Object.values(getProperties(context.env.vars.schema)).filter(\n property => !property.metadata?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property.metadata?.name}`}\n type={`UnprefixedEnv[\"${property.metadata?.name}\"]`}\n isReadonly={property.metadata?.isReadonly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JTDSchemaType;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const reflectionGetProperties = computed(\n () =>\n Object.values(getProperties(context.env.vars.schema))\n .filter(property => !property.metadata?.isIgnored)\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n Object.values(getProperties(context.env.vars.schema))\n .filter(\n property =>\n !property.metadata?.isIgnored && !property.metadata?.isReadonly\n )\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.vars.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.vars.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={reflectionGetProperties.value}>\n {(property: JTDSchemaType & { name: string }, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties.value} ender={code` else `}>\n {(property: JTDSchemaType & { name: string }, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAItC,SAAS,aAAY,IAAI,MAAO;CAC/B,GAAI,SAAS;;AAEd;;;;AAkCA,SAAS,oBAA2B;CACpC,MAAO,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,IAAA,CAAA,GAAA,cAAA;CACL,OAAK;EAAA,gBAAA,wBAAA;GACL,MAAA;GACA,IAAA,SAAY;IACZ,OAAA,QAAA,IAAA,KAAA;GACA;GACF,UAAS;EACT,CAAA;EAAM,gBAAkB,SAAQ,CAAA,CAAA;EAAA,gBAAkB,OAAA;GAClD,SAAS;GACT,IAAQ,WAAW;IACb,OAAG,gBAAqB,cAAS,EAC/B,UAAC;GAEP;EACA,CAAC;EAAA,gBAAc,sBAA0B;GACzC,MAAA;GACF,UAAO;GACL,WAAa;;IAEb,OAAO,gBAAA,KAAA;KACJ,IAAA,OAAA;MACE,OAAA,UAAA,QAAA,OAAA,IAAA,MAAA,EAAA,IAAA,cAAA,WAAA,OAAA,QAAA,MAAA,EAAA,GAAA;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,UAAM;IACN,SAAM;IACN,MAAM;IACN,aAAM,IAAW;GACnB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACjB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAY,IAAA;GACd,CAAC;GAAG,gBAAkB,SAAE,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACtB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAa,IAAE;GACjB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACjB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAiB,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACnB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAI,SAAkB,CAAA,CAAA;GAAA,gBAAA,MAAA;IACxB,IAAE,OAAI;KACJ,OAAI,QAAM,QAAA;IACZ;IACM;GACR,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,WAAO,SAAS;OAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
1
+ {"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"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 {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport type { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps,\n InterfaceDeclaration,\n InterfaceMember,\n ObjectDeclaration,\n TSDocSchemaProperty\n} from \"@powerlines/plugin-alloy/typescript/components\";\nimport {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport type { JTDSchemaType } from \"@powerlines/schema\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport type { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition() {\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n schema={context.env.vars.schema}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n getPropertiesList(context.env.vars.schema).filter(\n property => !property.metadata?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property.metadata?.name}`}\n type={`UnprefixedEnv[\"${property.metadata?.name}\"]`}\n isReadonly={property.metadata?.isReadonly}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n name: string;\n property: JTDSchemaType;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${name}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, name, property, index }] = splitProps(props, [\n \"context\",\n \"name\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional name={name} context={context} />\n <Show\n when={\n property.metadata?.alias &&\n property.metadata?.alias.length > 0\n }>\n {code` || `}\n <For each={property.metadata?.alias ?? []} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${name}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const reflectionGetProperties = computed(\n () =>\n getPropertiesList(context.env.vars.schema)\n .filter(property => !property.metadata?.isIgnored)\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n getPropertiesList(context.env.vars.schema)\n .filter(\n property =>\n !property.metadata?.isIgnored && !property.metadata?.isReadonly\n )\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}>\n <Show when={Boolean(context.env.vars.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.vars.schema}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n <For each={reflectionGetProperties.value}>\n {(property: JTDSchemaType & { name: string }, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties.value} ender={code` else `}>\n {(property: JTDSchemaType & { name: string }, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n name={property.name}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAEA,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const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_types_plugin = require('../types/plugin.cjs');
4
4
  const require_helpers_load = require('./load.cjs');
5
5
  let _stryke_type_checks_is_string = require("@stryke/type-checks/is-string");
6
+ let _powerlines_schema = require("@powerlines/schema");
6
7
  let _powerlines_schema_extract = require("@powerlines/schema/extract");
7
8
  let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
8
9
  let _stryke_path_join = require("@stryke/path/join");
@@ -92,6 +93,7 @@ async function extractEnvSchema(context, options = {}) {
92
93
  parsed: {},
93
94
  injected: []
94
95
  });
96
+ await readActiveEnv(context);
95
97
  const properties = (0, _powerlines_schema_helpers.getProperties)(context.env.vars);
96
98
  context.info({
97
99
  meta: { category: "env" },
@@ -162,17 +164,15 @@ extractEnvSchema.__type = [
162
164
  * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.
163
165
  */
164
166
  async function readActiveEnv(context) {
165
- context.env.vars.schema.metadata ??= {};
166
- context.env.vars.schema.metadata.active ??= [];
167
- if (context.fs.existsSync((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "vars.json"))) {
168
- const content = await context.fs.read((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "vars.json"));
169
- if (content) context.env.vars.schema.metadata.active = JSON.parse(content)?.elements ?? [];
167
+ context.env.vars.active ??= [];
168
+ if (context.fs.existsSync((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "vars.json"))) {
169
+ const content = await context.fs.read((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "vars.json"));
170
+ if (content) context.env.vars.active = JSON.parse(content)?.elements ?? [];
170
171
  }
171
- context.env.secrets.schema.metadata ??= {};
172
- context.env.secrets.schema.metadata.active ??= [];
173
- if (context.fs.existsSync((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "secrets.json"))) {
174
- const content = await context.fs.read((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "secrets.json"));
175
- if (content) context.env.secrets.schema.metadata.active = JSON.parse(content)?.elements ?? [];
172
+ context.env.secrets.active ??= [];
173
+ if (context.fs.existsSync((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "secrets.json"))) {
174
+ const content = await context.fs.read((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "secrets.json"));
175
+ if (content) context.env.secrets.active = JSON.parse(content)?.elements ?? [];
176
176
  }
177
177
  }
178
178
  readActiveEnv.__type = [
@@ -188,7 +188,7 @@ readActiveEnv.__type = [
188
188
  * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.
189
189
  */
190
190
  async function writeActiveEnv(context) {
191
- return Promise.all([(0, _stryke_type_checks_is_set_array.isSetArray)(context.env.vars.schema.metadata?.active) ? context.fs.write((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "vars.json"), JSON.stringify({ elements: context.env.vars.schema.metadata.active })) : void 0, (0, _stryke_type_checks_is_set_array.isSetArray)(context.env.secrets.schema.metadata?.active) ? context.fs.write((0, _stryke_path_join.joinPaths)(context.cachePath, "env", "secrets.json"), JSON.stringify({ elements: context.env.secrets.schema.metadata.active })) : void 0].filter(Boolean));
191
+ return Promise.all([(0, _stryke_type_checks_is_set_array.isSetArray)(context.env.vars.active) ? context.fs.write((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "vars.json"), JSON.stringify({ elements: context.env.vars.active })) : void 0, (0, _stryke_type_checks_is_set_array.isSetArray)(context.env.secrets.active) ? context.fs.write((0, _stryke_path_join.joinPaths)((0, _powerlines_schema.getCacheDirectory)(context), "env", "secrets.json"), JSON.stringify({ elements: context.env.secrets.active })) : void 0].filter(Boolean));
192
192
  }
193
193
  writeActiveEnv.__type = [
194
194
  "context",
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AAyCA;;;;iBAAsB,sBAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA;;;;;;;iBAiBA,4BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;AAnBD;AAiB7B;;iBAcsB,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;;;;iBAiBR,gBAAA,kBAAkC,gBAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,gBAAA,GACR,OAAA;;;AAlCyC;AAY5C;;;iBAqMsB,aAAA,kBAA+B,gBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GAAQ,OAAA;;;;;;;iBAmCG,cAAA,kBAAgC,gBAAA,CAAA,CACpD,OAAA,EAAS,QAAA,GAAQ,OAAA"}
1
+ {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AAqCA;;;;iBAAsB,sBAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA;;;;;;;iBAiBA,4BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;AAnBD;AAiB7B;;iBAcsB,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;;;;iBAiBR,gBAAA,kBAAkC,gBAAA,CAAA,CACtD,OAAA,EAAS,QAAA,EACT,OAAA,GAAS,gBAAA,GACR,OAAA;;;AAlCyC;AAY5C;;;iBA8LsB,aAAA,kBAA+B,gBAAA,CAAA,CACnD,OAAA,EAAS,QAAA,GAAQ,OAAA;;;;;;;iBAqCG,cAAA,kBAAgC,gBAAA,CAAA,CACpD,OAAA,EAAS,QAAA,GAAQ,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../../src/helpers/sch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 @@
1
1
  import { __ΩEnvPluginOptions } from "../types/plugin.mjs";
2
2
  import { loadEnv } from "./load.mjs";
3
3
  import { isString } from "@stryke/type-checks/is-string";
4
+ import { getCacheDirectory } from "@powerlines/schema";
4
5
  import { extract } from "@powerlines/schema/extract";
5
- import { getProperties, mergeSchemas } from "@powerlines/schema/helpers";
6
+ import { getProperties as getProperties$1, mergeSchemas } from "@powerlines/schema/helpers";
6
7
  import { joinPaths } from "@stryke/path/join";
7
8
  import { isSetArray } from "@stryke/type-checks/is-set-array";
8
9
  import { isSetObject } from "@stryke/type-checks/is-set-object";
@@ -89,10 +90,11 @@ async function extractEnvSchema(context, options = {}) {
89
90
  parsed: {},
90
91
  injected: []
91
92
  });
92
- const properties = getProperties(context.env.vars);
93
+ await readActiveEnv(context);
94
+ const properties = getProperties$1(context.env.vars);
93
95
  context.info({
94
96
  meta: { category: "env" },
95
- message: `Environment Variables configuration: ${options.vars ? "" : "Defaulted "}${context.env.vars.variant === "reflection" ? "Deepkit type definition" : context.env.vars.variant === "json-schema" ? "JSON Schema" : context.env.vars.variant === "standard-schema" ? "Standard Schema" : context.env.vars.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${options.vars ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${options.secrets ? "" : "Defaulted "}${context.env.secrets.variant === "reflection" ? "Deepkit type definition" : context.env.secrets.variant === "json-schema" ? "JSON Schema" : context.env.secrets.variant === "standard-schema" ? "Standard Schema" : context.env.secrets.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${options.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? Object.keys(getProperties(context.env.secrets)).length : "0"} parameters\nEnvironment variable Prefixes: ${context.config.env.prefix.join(", ")}\nShould inject values: ${context.config.env.inject ? "Yes" : "No"}\nShould validate configuration: ${context.config.env.validate ? "Yes" : "No"}`
97
+ message: `Environment Variables configuration: ${options.vars ? "" : "Defaulted "}${context.env.vars.variant === "reflection" ? "Deepkit type definition" : context.env.vars.variant === "json-schema" ? "JSON Schema" : context.env.vars.variant === "standard-schema" ? "Standard Schema" : context.env.vars.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${options.vars ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${options.secrets ? "" : "Defaulted "}${context.env.secrets.variant === "reflection" ? "Deepkit type definition" : context.env.secrets.variant === "json-schema" ? "JSON Schema" : context.env.secrets.variant === "standard-schema" ? "Standard Schema" : context.env.secrets.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${options.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? Object.keys(getProperties$1(context.env.secrets)).length : "0"} parameters\nEnvironment variable Prefixes: ${context.config.env.prefix.join(", ")}\nShould inject values: ${context.config.env.inject ? "Yes" : "No"}\nShould validate configuration: ${context.config.env.validate ? "Yes" : "No"}`
96
98
  });
97
99
  const aliases = Object.fromEntries(Object.entries(properties).flatMap(__assignType(([key, prop]) => isSetArray(prop.metadata?.alias) ? prop.metadata?.alias?.map(__assignType((alias) => [alias, {
98
100
  ...prop,
@@ -159,17 +161,15 @@ extractEnvSchema.__type = [
159
161
  * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.
160
162
  */
161
163
  async function readActiveEnv(context) {
162
- context.env.vars.schema.metadata ??= {};
163
- context.env.vars.schema.metadata.active ??= [];
164
- if (context.fs.existsSync(joinPaths(context.cachePath, "env", "vars.json"))) {
165
- const content = await context.fs.read(joinPaths(context.cachePath, "env", "vars.json"));
166
- if (content) context.env.vars.schema.metadata.active = JSON.parse(content)?.elements ?? [];
164
+ context.env.vars.active ??= [];
165
+ if (context.fs.existsSync(joinPaths(getCacheDirectory(context), "env", "vars.json"))) {
166
+ const content = await context.fs.read(joinPaths(getCacheDirectory(context), "env", "vars.json"));
167
+ if (content) context.env.vars.active = JSON.parse(content)?.elements ?? [];
167
168
  }
168
- context.env.secrets.schema.metadata ??= {};
169
- context.env.secrets.schema.metadata.active ??= [];
170
- if (context.fs.existsSync(joinPaths(context.cachePath, "env", "secrets.json"))) {
171
- const content = await context.fs.read(joinPaths(context.cachePath, "env", "secrets.json"));
172
- if (content) context.env.secrets.schema.metadata.active = JSON.parse(content)?.elements ?? [];
169
+ context.env.secrets.active ??= [];
170
+ if (context.fs.existsSync(joinPaths(getCacheDirectory(context), "env", "secrets.json"))) {
171
+ const content = await context.fs.read(joinPaths(getCacheDirectory(context), "env", "secrets.json"));
172
+ if (content) context.env.secrets.active = JSON.parse(content)?.elements ?? [];
173
173
  }
174
174
  }
175
175
  readActiveEnv.__type = [
@@ -185,7 +185,7 @@ readActiveEnv.__type = [
185
185
  * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.
186
186
  */
187
187
  async function writeActiveEnv(context) {
188
- return Promise.all([isSetArray(context.env.vars.schema.metadata?.active) ? context.fs.write(joinPaths(context.cachePath, "env", "vars.json"), JSON.stringify({ elements: context.env.vars.schema.metadata.active })) : void 0, isSetArray(context.env.secrets.schema.metadata?.active) ? context.fs.write(joinPaths(context.cachePath, "env", "secrets.json"), JSON.stringify({ elements: context.env.secrets.schema.metadata.active })) : void 0].filter(Boolean));
188
+ return Promise.all([isSetArray(context.env.vars.active) ? context.fs.write(joinPaths(getCacheDirectory(context), "env", "vars.json"), JSON.stringify({ elements: context.env.vars.active })) : void 0, isSetArray(context.env.secrets.active) ? context.fs.write(joinPaths(getCacheDirectory(context), "env", "secrets.json"), JSON.stringify({ elements: context.env.secrets.active })) : void 0].filter(Boolean));
189
189
  }
190
190
  writeActiveEnv.__type = [
191
191
  "context",
@@ -1 +1 @@
1
- {"version":3,"file":"schema.mjs","names":[],"sources":["../../src/helpers/schema.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 { ObjectSchema } from \"@powerlines/schema\";\nimport { extract } from \"@powerlines/schema/extract\";\nimport { getProperties, mergeSchemas } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { UnresolvedContext } from \"powerlines\";\nimport {\n EnvPluginContext,\n EnvPluginOptions,\n EnvSchemaMetadata\n} from \"../types/plugin\";\nimport { loadEnv } from \"./load\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getDefaultVarsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getDefaultSecretsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Extracts the environment variables and secrets schema from the provided type definitions in the plugin options, merges them with the default environment variables and secrets schema, and stores the resulting schema in the plugin context for later use during the build process.\n *\n * @remarks\n * This function should be called during the plugin's `config` hook to ensure that the environment variables and secrets schema is available in the plugin context before the build process begins. The resulting schema will be used to validate the loaded environment variables and secrets, as well as to provide type information for the injected environment variables and secrets during the build process.\n *\n * @param context - The plugin context\n * @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.\n * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnvSchema<TContext extends EnvPluginContext>(\n context: TContext,\n options: EnvPluginOptions = {}\n): Promise<void> {\n const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const vars = (await extract(\n context,\n context.config.env.vars\n )) as ObjectSchema<EnvSchemaMetadata>;\n if (\n (isString(context.config.env.vars) &&\n context.config.env.vars !==\n `${defaultVarsTypeDefinition.file}#${defaultVarsTypeDefinition.name}`) ||\n (isSetObject(context.config.env.vars) &&\n ((context.config.env.vars as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.vars as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n vars.schema = mergeSchemas(\n vars,\n (await extract(\n context,\n defaultVarsTypeDefinition\n )) as ObjectSchema<EnvSchemaMetadata>\n );\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as ObjectSchema<EnvSchemaMetadata>;\n if (\n (isString(context.config.env.secrets) &&\n context.config.env.secrets !==\n `${defaultSecretsTypeDefinition.file}#${defaultSecretsTypeDefinition.name}`) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as TypeDefinition).file !==\n defaultSecretsTypeDefinition.file ||\n (context.config.env.secrets as TypeDefinition).name !==\n defaultSecretsTypeDefinition.name))\n ) {\n secrets.schema = mergeSchemas(\n secrets,\n (await extract(\n context,\n defaultSecretsTypeDefinition\n )) as ObjectSchema<EnvSchemaMetadata>\n );\n }\n\n context.env = defu(\n {\n vars,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n parsed: {},\n injected: []\n }\n );\n\n const properties = getProperties(context.env.vars);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n options.vars ? \"\" : \"Defaulted \"\n }${\n context.env.vars.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.vars.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.vars.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.vars.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${options.vars ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n options.secrets ? \"\" : \"Defaulted \"\n }${\n context.env.secrets.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.secrets.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.secrets.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.secrets.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${options.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? Object.keys(getProperties(context.env.secrets)).length\n : \"0\"\n } parameters\\nEnvironment variable Prefixes: ${context.config.env.prefix.join(\n \", \"\n )}\\nShould inject values: ${\n context.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n context.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n const aliases = Object.fromEntries(\n Object.entries(properties).flatMap(\n ([key, prop]) =>\n (isSetArray(prop.metadata?.alias)\n ? prop.metadata?.alias?.map(alias => [\n alias,\n { ...prop, metadata: { ...prop.metadata, alias: [key] } }\n ])\n : []) as [string, typeof prop][]\n )\n );\n\n for (const [key, value] of Object.entries(\n await loadEnv(context, context.config.env)\n )) {\n const unprefixedKey = context.config.env.prefix.reduce((ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n }, key);\n if (properties[unprefixedKey]) {\n if (!properties[unprefixedKey].metadata?.isRuntime) {\n if (\n properties[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[unprefixedKey]\n ) {\n context.env.vars.schema.optionalProperties[unprefixedKey].metadata ??=\n {} as EnvSchemaMetadata;\n context.env.vars.schema.optionalProperties[\n unprefixedKey\n ].metadata.default = value;\n } else if (context.env.vars.schema.properties?.[unprefixedKey]) {\n context.env.vars.schema.properties[unprefixedKey].metadata ??=\n {} as EnvSchemaMetadata;\n context.env.vars.schema.properties[unprefixedKey].metadata.default =\n value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey].metadata?.isRuntime) {\n const alias =\n aliases[unprefixedKey].metadata?.alias?.[0] ?? unprefixedKey;\n if (\n aliases[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[alias]\n ) {\n context.env.vars.schema.optionalProperties[alias].metadata ??=\n {} as EnvSchemaMetadata;\n context.env.vars.schema.optionalProperties[alias].metadata.default =\n value;\n } else if (context.env.vars.schema.properties?.[alias]) {\n context.env.vars.schema.properties[alias].metadata ??=\n {} as EnvSchemaMetadata;\n context.env.vars.schema.properties[alias].metadata.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.\n */\nexport async function readActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n context.env.vars.schema.metadata ??= {} as EnvSchemaMetadata;\n context.env.vars.schema.metadata.active ??= [];\n if (context.fs.existsSync(joinPaths(context.cachePath, \"env\", \"vars.json\"))) {\n const content = await context.fs.read(\n joinPaths(context.cachePath, \"env\", \"vars.json\")\n );\n if (content) {\n context.env.vars.schema.metadata.active =\n JSON.parse(content)?.elements ?? [];\n }\n }\n\n context.env.secrets.schema.metadata ??= {} as EnvSchemaMetadata;\n context.env.secrets.schema.metadata.active ??= [];\n if (\n context.fs.existsSync(joinPaths(context.cachePath, \"env\", \"secrets.json\"))\n ) {\n const content = await context.fs.read(\n joinPaths(context.cachePath, \"env\", \"secrets.json\")\n );\n if (content) {\n context.env.secrets.schema.metadata.active =\n JSON.parse(content)?.elements ?? [];\n }\n }\n}\n\n/**\n * Writes the active environment variables and secrets from the plugin context to the plugin context's cache for use during the build process. This function should be called whenever the active environment variables and secrets are updated in the plugin context to ensure that the latest values are available during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.\n */\nexport async function writeActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n return Promise.all(\n [\n isSetArray(context.env.vars.schema.metadata?.active)\n ? context.fs.write(\n joinPaths(context.cachePath, \"env\", \"vars.json\"),\n JSON.stringify({\n elements: context.env.vars.schema.metadata!.active\n })\n )\n : undefined,\n isSetArray(context.env.secrets.schema.metadata?.active)\n ? context.fs.write(\n joinPaths(context.cachePath, \"env\", \"secrets.json\"),\n JSON.stringify({\n elements: context.env.secrets.schema.metadata!.active\n })\n )\n : undefined\n ].filter(Boolean) as Promise<void>[]\n );\n}\n"],"mappings":";;;;;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;;;;;;;AAeA,eAAsB,uBAAuB,SAAC;CAC9C,MAAQ,WAAW,MAAM,QAAG,GAAO,QAAS,kCAAC;CAC7C,IAAM,CAAC,UACP,MAAS,IAAA,MAAW,yJAA2C;CAE/D,OAAO;AACP;AACA,uBAAS,SAAoB;CAAI;CAAE;CAAW;CAAA;AAAA;;;;;;;;CAQ5C,OAAA;EACC,MAAA,MAA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A,SAAA,WAAkC,CAAA;CAC1C,IAAE,QAAA,GAAA,WAAA,UAAA,QAAA,WAAA,OAAA,WAAA,CAAA,GAAA;EACA,MAAA,UAAgB,MAAC,QAAY,GAAA,KAAA,UAAA,QAAA,WAAA,OAAA,WAAA,CAAA;EAC7B,IAAE,SACA,QAAO,IAAA,KAAO,OAAA,SAAA,SAAA,KAAA,MAAA,OAAA,GAAA,YAAA,CAAA;CAElB;CACA,QAAO,IAAG,QAAA,OAAa,aAAiB,CAAA;CACxC,QAAG,IAAA,QAAA,OAAA,SAAA,WAAA,CAAA;CACH,IAAA,QAAA,GAAA,WAAA,UAAA,QAAA,WAAA,OAAA,cAAA,CAAA,GAAA;;EAEA,IAAA,SACE,QAAA,IAAA,QAAA,OAAA,SAAA,SAAA,KAAA,MAAA,OAAA,GAAA,YAAA,CAAA;CAEF;AACF;AACA,cAAK,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;;CAQH,OAAM,QAAA,IAAa,CAAA,WAAA,QAAc,IAAQ,KAAI,OAAK,UAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,QAAA,WAAA,OAAA,WAAA,GAAA,KAAA,UAAA,EAClD,UAAY,QAAC,IAAA,KAAA,OAAA,SAAA,OACb,CAAC,CAAC,IAAI,QAAE,WAAA,QAAA,IAAA,QAAA,OAAA,UAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,QAAA,WAAA,OAAA,cAAA,GAAA,KAAA,UAAA,EACN,UAAU,QAAM,IAAA,QAAA,OAAA,SAAA,OAClB,CAAC,CAAC,IAAC,MAAA,EAAA,OAAA,OAAA,CAAA;AACL;AACA,eAAc,SAAU;CAAC;CAAW;CAAC;CAAA;AAAA"}
1
+ {"version":3,"file":"schema.mjs","names":[],"sources":["../../src/helpers/schema.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 { getCacheDirectory } from \"@powerlines/schema\";\nimport { extract } from \"@powerlines/schema/extract\";\nimport { getProperties, mergeSchemas } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetArray } from \"@stryke/type-checks/is-set-array\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvPluginOptions, EnvSchema } from \"../types/plugin\";\nimport { loadEnv } from \"./load\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getDefaultVarsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getDefaultSecretsTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Extracts the environment variables and secrets schema from the provided type definitions in the plugin options, merges them with the default environment variables and secrets schema, and stores the resulting schema in the plugin context for later use during the build process.\n *\n * @remarks\n * This function should be called during the plugin's `config` hook to ensure that the environment variables and secrets schema is available in the plugin context before the build process begins. The resulting schema will be used to validate the loaded environment variables and secrets, as well as to provide type information for the injected environment variables and secrets during the build process.\n *\n * @param context - The plugin context\n * @param options - The plugin options containing the environment variables and secrets type definitions to extract the schema from. If not provided, the default type definitions will be used.\n * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnvSchema<TContext extends EnvPluginContext>(\n context: TContext,\n options: EnvPluginOptions = {}\n): Promise<void> {\n const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const vars = (await extract(context, context.config.env.vars)) as EnvSchema;\n if (\n (isString(context.config.env.vars) &&\n context.config.env.vars !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.vars) &&\n ((context.config.env.vars as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.vars as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n vars.schema = mergeSchemas(\n vars,\n (await extract(context, defaultVarsTypeDefinition)) as EnvSchema\n );\n }\n\n const secrets = (await extract(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n if (\n (isString(context.config.env.secrets) &&\n context.config.env.secrets !==\n `${defaultSecretsTypeDefinition.file}#${\n defaultSecretsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.secrets) &&\n ((context.config.env.secrets as TypeDefinition).file !==\n defaultSecretsTypeDefinition.file ||\n (context.config.env.secrets as TypeDefinition).name !==\n defaultSecretsTypeDefinition.name))\n ) {\n secrets.schema = mergeSchemas(\n secrets,\n (await extract(context, defaultSecretsTypeDefinition)) as EnvSchema\n );\n }\n\n context.env = defu(\n {\n vars,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n parsed: {},\n injected: []\n }\n );\n await readActiveEnv(context);\n\n const properties = getProperties(context.env.vars);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n options.vars ? \"\" : \"Defaulted \"\n }${\n context.env.vars.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.vars.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.vars.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.vars.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${options.vars ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n options.secrets ? \"\" : \"Defaulted \"\n }${\n context.env.secrets.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.secrets.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.secrets.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.secrets.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${options.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? Object.keys(getProperties(context.env.secrets)).length\n : \"0\"\n } parameters\\nEnvironment variable Prefixes: ${context.config.env.prefix.join(\n \", \"\n )}\\nShould inject values: ${\n context.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n context.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n const aliases = Object.fromEntries(\n Object.entries(properties).flatMap(\n ([key, prop]) =>\n (isSetArray(prop.metadata?.alias)\n ? prop.metadata?.alias?.map(alias => [\n alias,\n { ...prop, metadata: { ...prop.metadata, alias: [key] } }\n ])\n : []) as [string, typeof prop][]\n )\n );\n\n for (const [key, value] of Object.entries(\n await loadEnv(context, context.config.env)\n )) {\n const unprefixedKey = context.config.env.prefix.reduce((ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n }, key);\n if (properties[unprefixedKey]) {\n if (!properties[unprefixedKey].metadata?.isRuntime) {\n if (\n properties[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[unprefixedKey]\n ) {\n context.env.vars.schema.optionalProperties[unprefixedKey].metadata ??=\n {};\n context.env.vars.schema.optionalProperties[\n unprefixedKey\n ].metadata.default = value;\n } else if (context.env.vars.schema.properties?.[unprefixedKey]) {\n context.env.vars.schema.properties[unprefixedKey].metadata ??= {};\n context.env.vars.schema.properties[unprefixedKey].metadata.default =\n value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey].metadata?.isRuntime) {\n const alias =\n aliases[unprefixedKey].metadata?.alias?.[0] ?? unprefixedKey;\n if (\n aliases[unprefixedKey].optional &&\n context.env.vars.schema.optionalProperties?.[alias]\n ) {\n context.env.vars.schema.optionalProperties[alias].metadata ??= {};\n context.env.vars.schema.optionalProperties[alias].metadata.default =\n value;\n } else if (context.env.vars.schema.properties?.[alias]) {\n context.env.vars.schema.properties[alias].metadata ??= {};\n context.env.vars.schema.properties[alias].metadata.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Reads the active environment variables and secrets from the plugin context's cache and stores them in the plugin context for use during the build process. This function should be called during the plugin's `buildStart` hook to ensure that the active environment variables and secrets are available before the build process begins.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been read and stored in the plugin context.\n */\nexport async function readActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n context.env.vars.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\")\n );\n if (content) {\n context.env.vars.active = JSON.parse(content)?.elements ?? [];\n }\n }\n\n context.env.secrets.active ??= [];\n if (\n context.fs.existsSync(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n )\n ) {\n const content = await context.fs.read(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\")\n );\n if (content) {\n context.env.secrets.active = JSON.parse(content)?.elements ?? [];\n }\n }\n}\n\n/**\n * Writes the active environment variables and secrets from the plugin context to the plugin context's cache for use during the build process. This function should be called whenever the active environment variables and secrets are updated in the plugin context to ensure that the latest values are available during the build process.\n *\n * @param context - The plugin context\n * @returns A promise that resolves when the active environment variables and secrets have been written to the plugin context's cache.\n */\nexport async function writeActiveEnv<TContext extends EnvPluginContext>(\n context: TContext\n) {\n return Promise.all(\n [\n isSetArray(context.env.vars.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"vars.json\"),\n JSON.stringify({\n elements: context.env.vars.active\n })\n )\n : undefined,\n isSetArray(context.env.secrets.active)\n ? context.fs.write(\n joinPaths(getCacheDirectory(context), \"env\", \"secrets.json\"),\n JSON.stringify({\n elements: context.env.secrets.active\n })\n )\n : undefined\n ].filter(Boolean) as Promise<void>[]\n );\n}\n"],"mappings":";;;;;;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;;;;;;;AAiCA,eAAmB,uBAAA,SAAA;CACjB,MAAA,WAAiB,MAAG,QAAQ,GAAM,QAAE,kCAAA;CACpC,IAAA,CAAK,UACH,MAAG,IAAA,MAAU,yJAAA;CAEf,OAAK;AACP;AACA,uBAAE,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOF,eAAC,6BAAA,SAAA;CACC,OAAO;EACL,MAAA,MAAY,uBAAuB,OAAK;EAC1C,MAAA;CACF;AACA;AACA,6BAA6B,SAAC;CAAA;CAAgB;CAAA;CAAA;AAAA;;;;;;;CAO5C,OAAO;EACR,MAAA,MAAA,uBAAA,OAAA;EACG,MAAM;CACR;AACF;AACA,gCAAsB,SAAA;CAAA;C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AAI,QAAI,GAAO,WAAU,UAAW,kBAAa,OAAA,GAAA,OAAA,cAAA,CAAA,GAAA;EAC/C,MAAM,UAAQ,MAAM,QAAA,GAAA,KAAA,UAAA,kBAAA,OAAA,GAAA,OAAA,cAAA,CAAA;EACpB,IAAI,SACF,QAAQ,IAAC,QAAS,SAAM,KAAA,MAAA,OAAA,GAAA,YAAA,CAAA;CAE5B;AACF;AACA,cAAc,SAAS;CAAC;CAAW;CAAgB;CAAU;AAAA;;;;;;;AAO7D,eAAsB,eAAe,SAAM;CACzC,OAAO,QAAQ,IAAC,CAAA,WAAM,QAAA,IAAA,KAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,kBAAA,OAAA,GAAA,OAAA,WAAA,GAAA,KAAA,UAAA,EACpB,UAAQ,QAAQ,IAAI,KAAO,OAC7B,CAAC,CAAC,IAAI,QAAO,WAAe,QAAA,IAAA,QAAA,MAAA,IAAA,QAAA,GAAA,MAAA,UAAA,kBAAA,OAAA,GAAA,OAAA,cAAA,GAAA,KAAA,UAAA,EAC1B,UAAU,QAAQ,IAAI,QAAQ,OAChC,CAAC,CAAC,IAAI,MAAS,EAAA,OAAO,OAAM,CAAA;AAC9B;AACA,eAAe,SAAS;CAAC;CAAO;CAAsB;CAAU;AAAA"}
package/dist/index.cjs CHANGED
@@ -18,6 +18,7 @@ let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
18
18
  _powerlines_plugin_automd = require_runtime.__toESM(_powerlines_plugin_automd);
19
19
  let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
20
20
  _powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
21
+ let _powerlines_schema_persistence = require("@powerlines/schema/persistence");
21
22
  let _stryke_convert_to_array = require("@stryke/convert/to-array");
22
23
  let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
23
24
 
@@ -81,19 +82,17 @@ const plugin = __assignType((options = {}) => {
81
82
  prepare: __assignType(async function prepare() {
82
83
  const _self$ = this;
83
84
  this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
84
- await require_helpers_schema.readActiveEnv(this);
85
85
  return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_env_builtin.EnvBuiltin, { get defaultConfig() {
86
86
  return _self$.config.env.defaultConfig;
87
87
  } }));
88
88
  }, ["prepare", "P\"/!"]),
89
89
  docs: __assignType(async function docs() {
90
90
  this.debug(`Documenting environment variables configuration values in "${(0, _stryke_path_join.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(this.config.root), "env.md")}"`);
91
- await require_helpers_schema.readActiveEnv(this);
92
91
  return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.EnvDocsFile, { levelOffset: 0 }));
93
92
  }, ["docs", "P\"/!"]),
94
93
  buildEnd: __assignType(async function buildEnd() {
95
94
  this.debug("Writing active environment variables to disk.");
96
- await require_helpers_schema.writeActiveEnv(this);
95
+ await (0, _powerlines_schema_persistence.writeSchema)(this, this.env.vars);
97
96
  }, ["buildEnd", "P\"/!"])
98
97
  },
99
98
  {
@@ -129,7 +128,7 @@ exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
129
128
  exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
130
129
  exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
131
130
  exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
132
- exports.__ΩEnvSchemaMetadata = require_types_plugin.__ΩEnvSchemaMetadata;
131
+ exports.__ΩEnvSchema = require_types_plugin.__ΩEnvSchema;
133
132
  exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
134
133
  exports.__ΩSecretsInterface = require_types_env.__ΩSecretsInterface;
135
134
  exports.default = plugin;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./types/plugin.cjs";
1
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType } from "./types/plugin.cjs";
2
2
  import { EnvInterface, SecretsInterface } from "./types/env.cjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
@@ -13,5 +13,5 @@ declare module "powerlines" {
13
13
  */
14
14
  declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
15
15
  //#endregion
16
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface, plugin as default, plugin };
16
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType, SecretsInterface, plugin as default, plugin };
17
17
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA6CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAkIJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA8HJ,MAAA,CAAO,QAAA"}
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./types/plugin.mjs";
1
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType } from "./types/plugin.mjs";
2
2
  import { EnvInterface, SecretsInterface } from "./types/env.mjs";
3
3
  import { Plugin } from "powerlines";
4
4
 
@@ -13,5 +13,5 @@ declare module "powerlines" {
13
13
  */
14
14
  declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
15
15
  //#endregion
16
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface, plugin as default, plugin };
16
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType, SecretsInterface, plugin as default, plugin };
17
17
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA6CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KAkIJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YA4CY,MAAA;IACR,GAAA,GAAM,gBAAgB;EAAA;AAAA;;;;cAOb,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA8HJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
- import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType } from "./types/plugin.mjs";
1
+ import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchema, __ΩEnvType } from "./types/plugin.mjs";
2
2
  import { __ΩEnvInterface, __ΩSecretsInterface } from "./types/env.mjs";
3
- import { extractEnvSchema, getDefaultSecretsTypeDefinition, getDefaultVarsTypeDefinition, readActiveEnv, writeActiveEnv } from "./helpers/schema.mjs";
3
+ import { extractEnvSchema, getDefaultSecretsTypeDefinition, getDefaultVarsTypeDefinition } from "./helpers/schema.mjs";
4
4
  import { env } from "./helpers/automd-generator.mjs";
5
5
  import { EnvDocsFile } from "./components/docs.mjs";
6
6
  import { EnvBuiltin } from "./components/env-builtin.mjs";
@@ -13,6 +13,7 @@ import { getUnique } from "@stryke/helpers/get-unique";
13
13
  import { render } from "@powerlines/plugin-alloy/render";
14
14
  import automd from "@powerlines/plugin-automd";
15
15
  import babel from "@powerlines/plugin-babel";
16
+ import { writeSchema } from "@powerlines/schema/persistence";
16
17
  import { toArray } from "@stryke/convert/to-array";
17
18
  import { constantCase } from "@stryke/string-format/constant-case";
18
19
 
@@ -76,19 +77,17 @@ const plugin = __assignType((options = {}) => {
76
77
  prepare: __assignType(async function prepare() {
77
78
  const _self$ = this;
78
79
  this.debug(`Preparing the Environment runtime artifacts for the Powerlines project.`);
79
- await readActiveEnv(this);
80
80
  return render(this, createComponent(EnvBuiltin, { get defaultConfig() {
81
81
  return _self$.config.env.defaultConfig;
82
82
  } }));
83
83
  }, ["prepare", "P\"/!"]),
84
84
  docs: __assignType(async function docs() {
85
85
  this.debug(`Documenting environment variables configuration values in "${joinPaths(getDocsOutputPath(this.config.root), "env.md")}"`);
86
- await readActiveEnv(this);
87
86
  return render(this, createComponent(EnvDocsFile, { levelOffset: 0 }));
88
87
  }, ["docs", "P\"/!"]),
89
88
  buildEnd: __assignType(async function buildEnd() {
90
89
  this.debug("Writing active environment variables to disk.");
91
- await writeActiveEnv(this);
90
+ await writeSchema(this, this.env.vars);
92
91
  }, ["buildEnd", "P\"/!"])
93
92
  },
94
93
  {
@@ -119,5 +118,5 @@ const plugin = __assignType((options = {}) => {
119
118
  ]);
120
119
 
121
120
  //#endregion
122
- export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
121
+ export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchema, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
123
122
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnvSchema,\n getDefaultSecretsTypeDefinition,\n getDefaultVarsTypeDefinition,\n readActiveEnv,\n writeActiveEnv\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n if (!config.env.vars) {\n this.warn(\n \"The `env.vars` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.vars = await getDefaultVarsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n if (!config.env.secrets) {\n config.env.secrets = await getDefaultSecretsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n await extractEnvSchema(this, options);\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n await readActiveEnv(this);\n\n return render(\n this,\n <EnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n await readActiveEnv(this);\n\n return render(this, <EnvDocsFile levelOffset={0} />);\n },\n async buildEnd() {\n this.debug(\"Writing active environment variables to disk.\");\n\n await writeActiveEnv(this);\n }\n },\n {\n name: \"env:automd-generator\",\n configResolved() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;CAEE,GAAG,SAAS;;AAEd;;;;AAoCA,MAAa,SAAC,cAAkB,UAAA,CAAA,MAAmB;;;;GAEnD,MAAS;;IAET,KAAQ,MAAQ,wEAAY;IAC1B,MAAU,SAAO;KACX,KAAE,KAAA,SAAgB;MACxB,UAAA;MACF,QAAA;;KAEE,CAAA;KACG,OAAU;MACb,GAAA,QAAA;MACK,eAAgB,CAAA,QAAS;MACtB,SAAC,CAAA,cAAoB;KAC1B;IACH;IACE,IAAM,CAAA,OAAQ,IAAA,MAAM;KACpB,KAAA,KAAA,0FAAA;KACE,OAAO,IAAI,OAAA,MAAA,6BAAA,IAAA;IACX;IACA,IAAE,CAAA,OAAU,IAAA,SACV,OAAG,IAAA,UAAkB,MAAA,gCAAsC,IAAC;;KAG5D,MAAM,kBAAS,aAAA,MAAA;KACf,IAAE,CAAG,IAAE,SAAK,eAAS,GACnB,IAAE,KAAA,eAAe;KAEnB,OAAI;IACN,GAAG;KAAC;KAAE;KAAA;KAAA;IAAA,CAAA,GAAA,CAAA,eAAA,KAAA,OAAA,WAAA,QAAA,KAAA,OAAA,WAAA,SAAA,gBAAA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ACN,WAAA,KAAA,QAAA,KAAA;GAEH,GAAE;IAAA;IAAa;IAAA;IAAA;GAAA,CAAA,EACjB;EACF;EAAG,OAAO,QAAA,MAAc;CAAC;AAC3B,GAAG;CAAC;CAAc;QAAA,CAAA;CAAA;CAAA;AAAA,CAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"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 { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { writeSchema } from \"@powerlines/schema/persistence\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport defu from \"defu\";\nimport type { Plugin, UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport {\n extractEnvSchema,\n getDefaultSecretsTypeDefinition,\n getDefaultVarsTypeDefinition\n} from \"./helpers/schema\";\nimport type { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n }\n };\n\n if (!config.env.vars) {\n this.warn(\n \"The `env.vars` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.vars = await getDefaultVarsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n if (!config.env.secrets) {\n config.env.secrets = await getDefaultSecretsTypeDefinition(\n this as UnresolvedContext\n );\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n await extractEnvSchema(this, options);\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n return render(\n this,\n <EnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n return render(this, <EnvDocsFile levelOffset={0} />);\n },\n async buildEnd() {\n this.debug(\"Writing active environment variables to disk.\");\n\n await writeSchema(this, this.env.vars);\n }\n },\n {\n name: \"env:automd-generator\",\n configResolved() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;CAEE,GAAG,SAAS;;AAEd;;;;AAqCA,MAAa,SAAS,cAAC,UAAA,CAAA,MAAA;;;;GAEvB,MAAQ;GACN,MAAA,SAAiB;IACf,KAAM,MAAA,wEAAgB;IACxB,MAAA,SAAA;KACF,KAAA,KAAA,SAAA;;MAEE,QAAA;MACG,QAAW,CAAA;KACd,CAAA;KACK,OAAM;MACH,GAAC,QAAA;MACN,eAAA,CAAA,QAAA;MACI,SAAA,CAAA,cAAA;KACL;IACA;IACE,IAAI,CAAC,OAAM,IAAA,MAAA;KACX,KAAM,KAAM,0FAAG;KACb,OAAK,IAAK,OAAA,MAAA,6BAAA,IAAA;IACZ;IACA,IAAG,CAAA,OAAA,IAAA;IAGH,OAAO,IAAE,SAAK,QAAS,OAAA,IAAA,UAAA,CAAA,CAAA,EAAA,OAAA,cAAA,KAAA,WAAA;KACrB,MAAI,kBAAe,aAAA,MAAA;KACnB,IAAI,CAAA,IAAA,SAAa,eAAA,GACf,IAAE,KAAO,eAAE;KAEb,OAAO;IACT,GAAG;KAAC;KAAK;KAAQ;KAAK;IAAA,CAAA,GAAA,CAAA,eAAA,KAAA,OAAA,WAAA,QAAA,KAAA,OAAA,WAAA,SAAA,gBAAA,GAAA,aAAA,KAAA,OAAA,WAAA,IAAA,EAAA,EAAA,EAAA,OAAA,OAAA,CAAA;IACtB,OAAM,IAAA,SAAc,UAAU,QAAM,OA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Ac;QAAA,CAAA;CAAA;CAAA;AAAA,CAAA"}
@@ -7,6 +7,6 @@ exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
7
7
  exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
8
8
  exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
9
9
  exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
10
- exports.__ΩEnvSchemaMetadata = require_types_plugin.__ΩEnvSchemaMetadata;
10
+ exports.__ΩEnvSchema = require_types_plugin.__ΩEnvSchema;
11
11
  exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
12
12
  exports.__ΩSecretsInterface = require_types_env.__ΩSecretsInterface;
@@ -1,3 +1,3 @@
1
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./plugin.cjs";
1
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType } from "./plugin.cjs";
2
2
  import { EnvInterface, SecretsInterface } from "./env.cjs";
3
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface };
3
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType, SecretsInterface };
@@ -1,3 +1,3 @@
1
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType } from "./plugin.mjs";
1
+ import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType } from "./plugin.mjs";
2
2
  import { EnvInterface, SecretsInterface } from "./env.mjs";
3
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType, SecretsInterface };
3
+ export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType, SecretsInterface };
@@ -1,4 +1,4 @@
1
- import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType } from "./plugin.mjs";
1
+ import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchema, __ΩEnvType } from "./plugin.mjs";
2
2
  import { __ΩEnvInterface, __ΩSecretsInterface } from "./env.mjs";
3
3
 
4
- export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType, __ΩSecretsInterface };
4
+ export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchema, __ΩEnvType, __ΩSecretsInterface };
@@ -20,6 +20,11 @@ const __ΩPick = [
20
20
  "Pick",
21
21
  "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
22
22
  ];
23
+ const __ΩPartial = [
24
+ "T",
25
+ "Partial",
26
+ "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
27
+ ];
23
28
  const __ΩExclude = [
24
29
  "T",
25
30
  "U",
@@ -76,17 +81,22 @@ const __ΩEnvPluginResolvedConfig = [
76
81
  "EnvPluginResolvedConfig",
77
82
  "P!PP!.#o\"#o!\"!P)4$?%)4&?'&F4(?)MK4*MKw+y"
78
83
  ];
79
- const __ΩEnvSchemaMetadata = [
84
+ const __ΩEnvSchema = [
85
+ () => __ΩPartial,
86
+ "TMetadata",
80
87
  "active",
81
88
  "The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).",
82
- "EnvSchemaMetadata",
83
- "P!&F4!?\"Mw#y"
89
+ "The schema for the environment variables or secrets used by the project and expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true). This schema extends the base {@link ObjectSchema} with additional metadata specific to environment variables, including an `active` property that lists the environment variables or secrets that are currently active and should be injected during the build process.",
90
+ "EnvSchema",
91
+ "!o!\"c\"P!&F4#?$M?%w&y"
84
92
  ];
85
93
  const __ΩEnvPluginContext = [
86
94
  () => __ΩEnvPluginResolvedConfig,
87
95
  "TResolvedConfig",
96
+ () => __ΩEnvSchema,
88
97
  "vars",
89
98
  "The type definition for the expected env variable parameters",
99
+ () => __ΩEnvSchema,
90
100
  "secrets",
91
101
  "The type definition for the expected env secret parameters",
92
102
  "parsed",
@@ -95,7 +105,7 @@ const __ΩEnvPluginContext = [
95
105
  "The injected environment variables and secrets reflection",
96
106
  "env",
97
107
  "EnvPluginContext",
98
- "n!c\"P!P!4#?$!4%?&!4'?(&F4)?*M4+Mw,y"
108
+ "n!c\"P!Pn#4$?%n&4'?(!4)?*&F4+?,M4-Mw.y"
99
109
  ];
100
110
 
101
111
  //#endregion
@@ -103,5 +113,5 @@ exports.__ΩEnvPluginContext = __ΩEnvPluginContext;
103
113
  exports.__ΩEnvPluginOptions = __ΩEnvPluginOptions;
104
114
  exports.__ΩEnvPluginResolvedConfig = __ΩEnvPluginResolvedConfig;
105
115
  exports.__ΩEnvPluginUserConfig = __ΩEnvPluginUserConfig;
106
- exports.__ΩEnvSchemaMetadata = __ΩEnvSchemaMetadata;
116
+ exports.__ΩEnvSchema = __ΩEnvSchema;
107
117
  exports.__ΩEnvType = __ΩEnvType;
@@ -86,7 +86,10 @@ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {
86
86
  prefix: string[];
87
87
  };
88
88
  };
89
- interface EnvSchemaMetadata extends SchemaMetadata {
89
+ /**
90
+ * The schema for the environment variables or secrets used by the project and expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true). This schema extends the base {@link ObjectSchema} with additional metadata specific to environment variables, including an `active` property that lists the environment variables or secrets that are currently active and should be injected during the build process.
91
+ */
92
+ interface EnvSchema<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>> extends ObjectSchema<TMetadata> {
90
93
  /**
91
94
  * The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).
92
95
  */
@@ -100,14 +103,14 @@ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = Env
100
103
  * @remarks
101
104
  * This value is parsed from the {@link EnvPluginOptions.vars} option.
102
105
  */
103
- vars: ObjectSchema<EnvSchemaMetadata>;
106
+ vars: EnvSchema;
104
107
  /**
105
108
  * The type definition for the expected env secret parameters
106
109
  *
107
110
  * @remarks
108
111
  * This value is parsed from the {@link EnvPluginOptions.secrets} option.
109
112
  */
110
- secrets: ObjectSchema<EnvSchemaMetadata>;
113
+ secrets: EnvSchema;
111
114
  /**
112
115
  * The parsed .env configuration object
113
116
  *
@@ -125,5 +128,5 @@ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = Env
125
128
  };
126
129
  }
127
130
  //#endregion
128
- export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType };
131
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType };
129
132
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;KAmCY,OAAA;AAAA,KAEA,gBAAA,GAAmB,IAAA,CAAK,mBAAA;EAFxB;;;EAMV,IAAA,GAAO,WAAA;EANU;AAEnB;;EASE,OAAA,GAAU,WAAA;EATwB;;;;;;EAiBlC,MAAA;EAsC4B;;;;;EA/B5B,MAAA;EAfA;;;;;EAsBA,QAAA;EAQgB;;;;;;EAAhB,aAAA,GAAgB,QAAA;EA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QAAA,CAAS,IAAA,CAAK,mBAAA,wBACjB,YAAA,CAAa,gBAAA;IAFqB;;;;;;IAShC,MAAA;IAAA;;;;AAgBM;AAOZ;IAfM,QAAA;IAeoB;;;;;;IAPpB,MAAA;EAAA;AAAA;;;;UAOW,SAAA,mBACG,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,WAC5C,YAAA,CAAa,SAAA;EAD+B;;;EAKpD,MAAA;AAAA;AAAA,UAGe,gBAAA,yBACS,uBAAA,GAA0B,uBAAA,UAC1C,kBAAA,CAAmB,eAAA;EAC3B,GAAA;IAH+B;;;;;;IAU7B,IAAA,EAAM,SAAA;IAgBE;;;;;;IARR,OAAA,EAAS,SAAA;IAhBH;;;;;;IAwBN,MAAA,EAAQ,iBAAA;IAAR;;;;AAQQ;;IAAR,QAAA;EAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  import { DotenvParseOutput } from "@stryke/env/types";
2
- import { Children } from "@alloy-js/core";
3
2
  import { ObjectSchema, SchemaInput, SchemaMetadata } from "@powerlines/schema";
3
+ import { Children } from "@alloy-js/core";
4
4
  import { AutoMDPluginOptions } from "@powerlines/plugin-automd/types/plugin";
5
5
  import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
6
6
  import { RequiredKeys } from "@stryke/types";
@@ -86,7 +86,10 @@ type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {
86
86
  prefix: string[];
87
87
  };
88
88
  };
89
- interface EnvSchemaMetadata extends SchemaMetadata {
89
+ /**
90
+ * The schema for the environment variables or secrets used by the project and expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true). This schema extends the base {@link ObjectSchema} with additional metadata specific to environment variables, including an `active` property that lists the environment variables or secrets that are currently active and should be injected during the build process.
91
+ */
92
+ interface EnvSchema<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>> extends ObjectSchema<TMetadata> {
90
93
  /**
91
94
  * The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).
92
95
  */
@@ -100,14 +103,14 @@ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = Env
100
103
  * @remarks
101
104
  * This value is parsed from the {@link EnvPluginOptions.vars} option.
102
105
  */
103
- vars: ObjectSchema<EnvSchemaMetadata>;
106
+ vars: EnvSchema;
104
107
  /**
105
108
  * The type definition for the expected env secret parameters
106
109
  *
107
110
  * @remarks
108
111
  * This value is parsed from the {@link EnvPluginOptions.secrets} option.
109
112
  */
110
- secrets: ObjectSchema<EnvSchemaMetadata>;
113
+ secrets: EnvSchema;
111
114
  /**
112
115
  * The parsed .env configuration object
113
116
  *
@@ -125,5 +128,5 @@ interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = Env
125
128
  };
126
129
  }
127
130
  //#endregion
128
- export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchemaMetadata, EnvType };
131
+ export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvSchema, EnvType };
129
132
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;;;KAmCY,OAAA;AAAA,KAEA,gBAAA,GAAmB,IAAA,CAAK,mBAAA;EAFxB;;;EAMV,IAAA,GAAO,WAAA;EANU;AAEnB;;EASE,OAAA,GAAU,WAAA;EATwB;;;;;;EAiBlC,MAAA;EAsC4B;;;;;EA/B5B,MAAA;EAfA;;;;;EAsBA,QAAA;EAQgB;;;;;;EAAhB,aAAA,GAAgB,QAAA;EAmBN;;;;;;EAXV,KAAA,GAAQ,kBAAA;EAYa;AAAA;AAGvB;;;;EAPE,MAAA,GAAS,mBAAA;AAAA;AAAA,KAGC,mBAAA,GAAsB,qBAAA;EAChC,GAAA,EAAK,gBAAgB;AAAA;AAAA,KAGX,uBA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mBACG,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,WAC5C,YAAA,CAAa,SAAA;EAD+B;;;EAKpD,MAAA;AAAA;AAAA,UAGe,gBAAA,yBACS,uBAAA,GAA0B,uBAAA,UAC1C,kBAAA,CAAmB,eAAA;EAC3B,GAAA;IAH+B;;;;;;IAU7B,IAAA,EAAM,SAAA;IAgBE;;;;;;IARR,OAAA,EAAS,SAAA;IAhBH;;;;;;IAwBN,MAAA,EAAQ,iBAAA;IAAR;;;;AAQQ;;IAAR,QAAA;EAAA;AAAA"}
@@ -18,6 +18,11 @@ const __ΩPick = [
18
18
  "Pick",
19
19
  "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
20
20
  ];
21
+ const __ΩPartial = [
22
+ "T",
23
+ "Partial",
24
+ "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
25
+ ];
21
26
  const __ΩExclude = [
22
27
  "T",
23
28
  "U",
@@ -74,17 +79,22 @@ const __ΩEnvPluginResolvedConfig = [
74
79
  "EnvPluginResolvedConfig",
75
80
  "P!PP!.#o\"#o!\"!P)4$?%)4&?'&F4(?)MK4*MKw+y"
76
81
  ];
77
- const __ΩEnvSchemaMetadata = [
82
+ const __ΩEnvSchema = [
83
+ () => __ΩPartial,
84
+ "TMetadata",
78
85
  "active",
79
86
  "The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).",
80
- "EnvSchemaMetadata",
81
- "P!&F4!?\"Mw#y"
87
+ "The schema for the environment variables or secrets used by the project and expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true). This schema extends the base {@link ObjectSchema} with additional metadata specific to environment variables, including an `active` property that lists the environment variables or secrets that are currently active and should be injected during the build process.",
88
+ "EnvSchema",
89
+ "!o!\"c\"P!&F4#?$M?%w&y"
82
90
  ];
83
91
  const __ΩEnvPluginContext = [
84
92
  () => __ΩEnvPluginResolvedConfig,
85
93
  "TResolvedConfig",
94
+ () => __ΩEnvSchema,
86
95
  "vars",
87
96
  "The type definition for the expected env variable parameters",
97
+ () => __ΩEnvSchema,
88
98
  "secrets",
89
99
  "The type definition for the expected env secret parameters",
90
100
  "parsed",
@@ -93,9 +103,9 @@ const __ΩEnvPluginContext = [
93
103
  "The injected environment variables and secrets reflection",
94
104
  "env",
95
105
  "EnvPluginContext",
96
- "n!c\"P!P!4#?$!4%?&!4'?(&F4)?*M4+Mw,y"
106
+ "n!c\"P!Pn#4$?%n&4'?(!4)?*&F4+?,M4-Mw.y"
97
107
  ];
98
108
 
99
109
  //#endregion
100
- export { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchemaMetadata, __ΩEnvType };
110
+ export { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvSchema, __ΩEnvType };
101
111
  //# sourceMappingURL=plugin.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/types/plugin.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 { Children } from \"@alloy-js/core\";\nimport { AutoMDPluginOptions } from \"@powerlines/plugin-automd/types/plugin\";\nimport {\n BabelPluginContext,\n BabelPluginOptions,\n BabelPluginResolvedConfig,\n BabelPluginUserConfig\n} from \"@powerlines/plugin-babel/types\";\nimport type {\n ObjectSchema,\n SchemaInput,\n SchemaMetadata\n} from \"@powerlines/schema\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { RequiredKeys } from \"@stryke/types\";\nimport { DotenvConfiguration } from \"@stryke/types/configuration\";\n\nexport type EnvType = \"env\" | \"secrets\";\n\nexport type EnvPluginOptions = Omit<DotenvConfiguration, \"types\"> & {\n /**\n * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigConfiguration\"`.\n */\n vars?: SchemaInput;\n\n /**\n * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigSecrets\"`.\n */\n secrets?: SchemaInput;\n\n /**\n * An additional prefix (or list of additional prefixes) to apply to the environment variables\n *\n * @remarks\n * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.\n */\n prefix?: string | string[];\n\n /**\n * Should the plugin inject the env variables in the source code with their values?\n *\n * @defaultValue false\n */\n inject?: boolean;\n\n /**\n * Should the plugin validate the loaded environment variables against the provided type definitions?\n *\n * @defaultValue false\n */\n validate?: boolean;\n\n /**\n * The default configuration to use when loading environment variables.\n *\n * @remarks\n * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.\n */\n defaultConfig?: Children;\n\n /**\n * Babel configuration options to use when injecting environment variables into the source code.\n *\n * @remarks\n * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.\n */\n babel?: BabelPluginOptions;\n\n /**\n * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.\n *\n * @remarks\n * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.\n */\n automd?: AutoMDPluginOptions;\n};\n\nexport type EnvPluginUserConfig = BabelPluginUserConfig & {\n env: EnvPluginOptions;\n};\n\nexport type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {\n env: Required<Pick<DotenvConfiguration, \"additionalFiles\">> &\n RequiredKeys<EnvPluginOptions, \"vars\" | \"secrets\" | \"defaultConfig\"> & {\n /**\n * Should the plugin inject the env variables in the source code with their values?\n *\n * @remarks\n * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.\n */\n inject: boolean;\n\n /**\n * Should the plugin validate the loaded environment variables against the provided type definitions?\n *\n * @remarks\n * This value is the result of reflecting the {@link EnvPluginOptions.validate} option.\n */\n validate: boolean;\n\n /**\n * The prefix used for environment variables\n *\n * @remarks\n * This value is used to filter environment variables that are loaded from the .env file and the process environment.\n */\n prefix: string[];\n };\n};\n\nexport interface EnvSchemaMetadata extends SchemaMetadata {\n /**\n * The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).\n */\n active: string[];\n}\n\nexport interface EnvPluginContext<\n TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig\n> extends BabelPluginContext<TResolvedConfig> {\n env: {\n /**\n * The type definition for the expected env variable parameters\n *\n * @remarks\n * This value is parsed from the {@link EnvPluginOptions.vars} option.\n */\n vars: ObjectSchema<EnvSchemaMetadata>;\n\n /**\n * The type definition for the expected env secret parameters\n *\n * @remarks\n * This value is parsed from the {@link EnvPluginOptions.secrets} option.\n */\n secrets: ObjectSchema<EnvSchemaMetadata>;\n\n /**\n * The parsed .env configuration object\n *\n * @remarks\n * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}\n */\n parsed: DotenvParseOutput;\n\n /**\n * The injected environment variables and secrets reflection\n *\n * @remarks\n * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.\n */\n injected: string[];\n };\n}\n"],"mappings":";AAAA,MAAM,UAAU;CAAC;CAAK;OAAW;OAAe;CAAY;CAAQ;AAAC;;;;;;AAErE,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAEtC,MAAM,aAAS;CAAA;CAAY;CAAW;CAAW;AAAU;AAE3D,MAAM,sBAAmB;OAAQ;CAAS;CAAK;CAAa;CAAO;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAInE,MAAC,6BAAkC;OAAO;OAAmB;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;AAE7D,MAAC,uBAA0B;CAAA;CAAQ;CAAkB;CAAA;AAAA;AAErD,MAAM,sBAAqB;OAAQ;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/types/plugin.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 { Children } from \"@alloy-js/core\";\nimport { AutoMDPluginOptions } from \"@powerlines/plugin-automd/types/plugin\";\nimport {\n BabelPluginContext,\n BabelPluginOptions,\n BabelPluginResolvedConfig,\n BabelPluginUserConfig\n} from \"@powerlines/plugin-babel/types\";\nimport type {\n ObjectSchema,\n SchemaInput,\n SchemaMetadata\n} from \"@powerlines/schema\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { RequiredKeys } from \"@stryke/types\";\nimport { DotenvConfiguration } from \"@stryke/types/configuration\";\n\nexport type EnvType = \"env\" | \"secrets\";\n\nexport type EnvPluginOptions = Omit<DotenvConfiguration, \"types\"> & {\n /**\n * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigConfiguration\"`.\n */\n vars?: SchemaInput;\n\n /**\n * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigSecrets\"`.\n */\n secrets?: SchemaInput;\n\n /**\n * An additional prefix (or list of additional prefixes) to apply to the environment variables\n *\n * @remarks\n * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.\n */\n prefix?: string | string[];\n\n /**\n * Should the plugin inject the env variables in the source code with their values?\n *\n * @defaultValue false\n */\n inject?: boolean;\n\n /**\n * Should the plugin validate the loaded environment variables against the provided type definitions?\n *\n * @defaultValue false\n */\n validate?: boolean;\n\n /**\n * The default configuration to use when loading environment variables.\n *\n * @remarks\n * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.\n */\n defaultConfig?: Children;\n\n /**\n * Babel configuration options to use when injecting environment variables into the source code.\n *\n * @remarks\n * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.\n */\n babel?: BabelPluginOptions;\n\n /**\n * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.\n *\n * @remarks\n * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.\n */\n automd?: AutoMDPluginOptions;\n};\n\nexport type EnvPluginUserConfig = BabelPluginUserConfig & {\n env: EnvPluginOptions;\n};\n\nexport type EnvPluginResolvedConfig = BabelPluginResolvedConfig & {\n env: Required<Pick<DotenvConfiguration, \"additionalFiles\">> &\n RequiredKeys<EnvPluginOptions, \"vars\" | \"secrets\" | \"defaultConfig\"> & {\n /**\n * Should the plugin inject the env variables in the source code with their values?\n *\n * @remarks\n * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.\n */\n inject: boolean;\n\n /**\n * Should the plugin validate the loaded environment variables against the provided type definitions?\n *\n * @remarks\n * This value is the result of reflecting the {@link EnvPluginOptions.validate} option.\n */\n validate: boolean;\n\n /**\n * The prefix used for environment variables\n *\n * @remarks\n * This value is used to filter environment variables that are loaded from the .env file and the process environment.\n */\n prefix: string[];\n };\n};\n\n/**\n * The schema for the environment variables or secrets used by the project and expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true). This schema extends the base {@link ObjectSchema} with additional metadata specific to environment variables, including an `active` property that lists the environment variables or secrets that are currently active and should be injected during the build process.\n */\nexport interface EnvSchema<\n TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>\n> extends ObjectSchema<TMetadata> {\n /**\n * The active environment variables or secrets that are used by the project and are expected to be injected into the source code (if {@link EnvPluginOptions.inject} is true).\n */\n active: string[];\n}\n\nexport interface EnvPluginContext<\n TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig\n> extends BabelPluginContext<TResolvedConfig> {\n env: {\n /**\n * The type definition for the expected env variable parameters\n *\n * @remarks\n * This value is parsed from the {@link EnvPluginOptions.vars} option.\n */\n vars: EnvSchema;\n\n /**\n * The type definition for the expected env secret parameters\n *\n * @remarks\n * This value is parsed from the {@link EnvPluginOptions.secrets} option.\n */\n secrets: EnvSchema;\n\n /**\n * The parsed .env configuration object\n *\n * @remarks\n * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}\n */\n parsed: DotenvParseOutput;\n\n /**\n * The injected environment variables and secrets reflection\n *\n * @remarks\n * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.\n */\n injected: string[];\n };\n}\n"],"mappings":";AAAA,MAAM,UAAU;CAAC;CAAK;OAAW;OAAe;CAAY;CAAQ;AAAC;;;;;;AAErE,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;AAEtC,MAAM,aAAS;CAAA;CAAS;CAAG;CAAY;AAAoB;AAC3D,MAAI,aAAc;CAAA;CAAM;CAAc;CAAW;AAAK;AAEtD,MAAK,sBAAuB;OAAG;CAAa;CAAK;CAAS;CAAmB;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;AAE7E,MAAC,yBAA0B;OAAQ;CAAc;CAAA;CAAA;AAAA;AAEjD,MAAC,6BAAkC;OAAK;OAAkB;CAAS;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.16.236",
3
+ "version": "0.16.238",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "keywords": ["dotenv", "powerlines", "storm-software", "powerlines-plugin"],
@@ -108,11 +108,11 @@
108
108
  "@babel/core": "8.0.0-rc.5",
109
109
  "@babel/types": "8.0.0-rc.5",
110
110
  "@powerlines/core": "^0.15.22",
111
- "@powerlines/plugin-alloy": "^0.26.128",
111
+ "@powerlines/plugin-alloy": "^0.26.130",
112
112
  "@powerlines/plugin-automd": "^0.1.506",
113
113
  "@powerlines/plugin-babel": "^0.13.41",
114
114
  "@powerlines/plugin-plugin": "^0.12.457",
115
- "@powerlines/schema": "^0.11.23",
115
+ "@powerlines/schema": "^0.11.25",
116
116
  "@storm-software/config-tools": "^1.190.20",
117
117
  "@stryke/capnp": "^0.12.102",
118
118
  "@stryke/convert": "^0.7.7",
@@ -131,5 +131,5 @@
131
131
  },
132
132
  "devDependencies": { "@types/node": "^25.9.0", "vite": "^8.0.13" },
133
133
  "publishConfig": { "access": "public" },
134
- "gitHead": "f95fab7200cc5687144ea1b1ee4ba77b44000935"
134
+ "gitHead": "ff6d22768ebad99001bfa73846017aaa9c1b3dab"
135
135
  }