@powerlines/plugin-env 0.16.256 → 0.16.257

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,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_types_plugin = require('../types/plugin.cjs');
3
- let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
3
+ let _powerlines_schema = require("@powerlines/schema");
4
4
  let _stryke_path_join = require("@stryke/path/join");
5
5
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
6
6
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
@@ -10,7 +10,6 @@ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin
10
10
  let _powerlines_plugin_alloy_markdown_components_heading = require("@powerlines/plugin-alloy/markdown/components/heading");
11
11
  let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@powerlines/plugin-alloy/markdown/components/markdown-file");
12
12
  let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
13
- let _powerlines_schema_codegen = require("@powerlines/schema/codegen");
14
13
 
15
14
  //#region src/components/docs.tsx
16
15
  const __ΩPartial = [
@@ -54,7 +53,7 @@ function EnvDocsFile(props) {
54
53
  _alloy_js_core.code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`,
55
54
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
56
55
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
57
- return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config).filter(__assignType((property) => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config).some(__assignType((p) => p.name === property.name && context.env.config.active.includes(property.name), [
56
+ return (0, _powerlines_schema.getPropertiesList)(context.env.config).filter(__assignType((property) => (0, _powerlines_schema.getPropertiesList)(context.env.config).some(__assignType((p) => p.name === property.name && context.env.config.active.includes(property.name), [
58
57
  "p",
59
58
  "",
60
59
  "P\"2!\"/\""
@@ -71,8 +70,8 @@ function EnvDocsFile(props) {
71
70
  return {
72
71
  name: property.name?.trim(),
73
72
  description: (property.description ?? "").trim(),
74
- type: (_powerlines_schema_codegen.stringifyType.Ω = [["\""]], (0, _powerlines_schema_codegen.stringifyType)(property)).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
75
- defaultValue: property.default ? (0, _powerlines_schema_codegen.stringifyType)(property.default) : "",
73
+ type: (_powerlines_schema.stringifyType.Ω = [["\""]], (0, _powerlines_schema.stringifyType)(property)).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
74
+ defaultValue: property.default ? (0, _powerlines_schema.stringifyType)(property.default) : "",
76
75
  required: property.nullable ? "" : "✔"
77
76
  };
78
77
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
1
+ {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAgCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
1
+ {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAgCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1,5 +1,5 @@
1
1
  import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { getPropertiesList } from "@powerlines/schema/helpers";
2
+ import { getPropertiesList, stringifyType } from "@powerlines/schema";
3
3
  import { joinPaths } from "@stryke/path/join";
4
4
  import { getDocsOutputPath } from "powerlines/plugin-utils";
5
5
  import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
@@ -9,7 +9,6 @@ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
9
9
  import { Heading } from "@powerlines/plugin-alloy/markdown/components/heading";
10
10
  import { MarkdownFile } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
11
11
  import { MarkdownTable } from "@powerlines/plugin-alloy/markdown/components/markdown-table";
12
- import { stringifyType } from "@powerlines/schema/codegen";
13
12
 
14
13
  //#region src/components/docs.tsx
15
14
  const __ΩPartial = [
@@ -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 } from \"@alloy-js/core\";\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 { JsonSchema } from \"@powerlines/schema\";\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</Heading>\n {code`The ${\n context.config.name\n } package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \\`config.json\\` file in the application configuration directory.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Configuration</Heading>\n <Spacing />\n {code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.config)\n .filter(\n property =>\n getPropertiesList(context.env.config).some(\n p =>\n p.name === property.name &&\n context.env.config.active.includes(property.name)\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType<any>(property as JsonSchema<any>)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.nullable ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA4BA,MAAI,sBAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;AAKJ,SAAG,YAAA,OAAA;CACD,MAAI,EACF,cAAA,GACF,GAAA,SACF;;CAEE,OAAA,gBAAA,cAAA,WAAA,EACC,IAAA,OAAU;EACX,OAAA,UAAA,kBAAA,QAAA,OAAA,IAAA,GAAA,QAAA;CACF,EACE,GAAA,MAAQ;EAER,OAAM;GAAA,gBAAwB,SAAA;;IAExB,UAAC;GACJ,CAAA;GAAA,WAAA,IAAA,OAAA,QAAA,OAAA,KAAA,+QAAA;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,SAAA;IACC,OAAM,IAAA;IACJ,UAAO;GACT,CAAC;GAAA,gBAAmB,SAAW,CAAC,CAAC;GAAA,IAAA;GAAoB,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,eAAA,EACpD,IAAK,OAAK;IACT,OAAQ,kBAAO,QAAA,IAAA,MAAA,EAAA,OAAA,cAAA,aAAA,kBAAA,QAAA,IAAA,MAAA,EAAA,KAAA,cAAA,MAAA,EAAA,SAAA,SAAA,QAAA,QAAA,IAAA,OAAA,OAAA,SAAA,SAAA,IAAA,GAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA,UAAA,UAAA,CAAA,UAAA,UAAA,CAAA,UAAA,YAAA,CAAA,UAAA,UAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,KAAA,cAAA,GAAA,MAAA,CAAA,GAAA,QAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,KAAA,EAAA,KAAA,cAAA,EAAA,IAAA,GAAA;KAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,IAAA,cAAA,aAAA;KACf,OAAQ;MACF,MAAE,SAAA,MAAA,KAAA;MACF,cAAY,SAAW,eAAe,IAAE,KAAO;MAC/C,OAAE,cAAA,IAAA,CAAA,CAAA,IAAA,CAAA,GAAA,cAAA,QAAA,GAAA,KAAA,EAAA,WAAA,mBAAA,OAAA;MACJ,cAAe,SAAG,UAAc,cAAiB,SAAM,OAAU,IAAC;MAChE,UAAE,SAAA,WAAA,KAAA;KACT;IACC,GAAK;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA;GACL,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAS;OAAO;CAAkB;CAAA;CAAA;CAAA;AAAA"}
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 } from \"@alloy-js/core\";\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 { getPropertiesList, stringifyType } from \"@powerlines/schema\";\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</Heading>\n {code`The ${\n context.config.name\n } package uses various configuration parameters to control the behavior of the application. These parameters can be provided as environment variables when the application is run, or they can be defined in a \\`config.json\\` file in the application configuration directory.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Configuration</Heading>\n <Spacing />\n {code`The below list of configuration parameters are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text locally.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.config)\n .filter(\n property =>\n getPropertiesList(context.env.config).some(\n p =>\n p.name === property.name &&\n context.env.config.active.includes(property.name)\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType<any>(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.nullable ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA2BA,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,WAAY,IAAA,OAAA,QAAkB,OAAQ,KAAM,+QAAiB;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,SAAA;IAC/D,OAAO,IAAA;IACR,UAAQ;GACT,CAAC;GAAA,gBAAU,SAAA,CAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,eAAA,EACT,IAAA,OAAQ;IACR,OAAQ,kBAAa,QAAc,IAAA,MAAU,EAAC,OAAG,cAAY,aAAgB,kBAAmB,QAAA,IAAW,MAAO,EAAA,KAAQ,cAAI,MAAY,EAAA,SAAU,SAAS,QAAW,QAAQ,IAAI,OAAK,OAAO,SAAW,SAAI,IAAO,GAAK;KAAC;KAAK;KAAI;IAAI,CAAA,CAAA,KAAY,CAAA,UAAA,UAAc,CAAA,UAAW,UAAA,CAAA,UAAA,YAAA,CAAA,UAAA,UAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,KAAA,cAAA,GAAA,MAAA,CAAA,GAAA,QAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,IAAA,CAAA,GAAA,OAAA,KAAA,EAAA,KAAA,cAAA,EAAA,IAAA,GAAA;KAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,IAAA,cAAA,aAAA;KAC/Q,OAAS;MACF,MAAM,SAAM,MAAA,KAAa;MACzB,cAAE,SAAA,eAAA,IAAA,KAAA;MACJ,OAAS,cAAS,IAAA,CAAA,CAAA,IAAc,CAAA,GAAA,cAAiB,QAAM,GAAA,KAAW,EAAA,WAAa,mBAAkB,OAAO;MACtG,cAAE,SAAA,UAAA,cAAA,SAAA,OAAA,IAAA;MACT,UAAA,SAAA,WAAA,KAAA;KACK;IACF,GAAA;KAAA;KAAA;KAAkB;IAAW,CAAC,CAAA,KAAM,CAAA;GACtC,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAQ;OAAQ;CAAkB;CAAS;CAAa;CAAA;AAAA"}
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_helpers_load = require('../helpers/load.cjs');
3
- let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
3
+ let _powerlines_schema = require("@powerlines/schema");
4
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
5
  let _alloy_js_core = require("@alloy-js/core");
6
6
  let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
@@ -73,7 +73,7 @@ function EnvTypeDefinition() {
73
73
  get children() {
74
74
  return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
75
75
  get each() {
76
- return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
76
+ return (0, _powerlines_schema.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
77
77
  "property",
78
78
  "",
79
79
  "P\"2!\"/\""
@@ -322,7 +322,7 @@ function EnvBuiltin(props) {
322
322
  const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
323
323
  const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
324
324
  const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
325
- const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
325
+ const schemaGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.writeOnly, [
326
326
  "property",
327
327
  "",
328
328
  "P\"2!\"/\""
@@ -332,7 +332,7 @@ function EnvBuiltin(props) {
332
332
  "",
333
333
  "P\"2!\"2\"\"/#"
334
334
  ])) ?? []);
335
- const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
335
+ const schemaSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema.getPropertiesList)(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
336
336
  "property",
337
337
  "",
338
338
  "P\"2!\"/\""
@@ -409,7 +409,7 @@ function EnvBuiltin(props) {
409
409
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
410
410
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
411
411
  get each() {
412
- return reflectionGetProperties.value;
412
+ return schemaGetProperties.value;
413
413
  },
414
414
  get children() {
415
415
  return __assignType((property, index) => (0, _alloy_js_core_jsx_runtime.createComponent)(ConfigPropertyGet, {
@@ -435,7 +435,7 @@ function EnvBuiltin(props) {
435
435
  (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
436
436
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
437
437
  get each() {
438
- return reflectionSetProperties.value;
438
+ return schemaSetProperties.value;
439
439
  },
440
440
  ender: _alloy_js_core.code` else `,
441
441
  get children() {
@@ -1,5 +1,5 @@
1
1
  import { loadEnvFromContext } from "../helpers/load.mjs";
2
- import { getPropertiesList } from "@powerlines/schema/helpers";
2
+ import { getPropertiesList } from "@powerlines/schema";
3
3
  import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
4
4
  import { For, Show, code, computed, splitProps } from "@alloy-js/core";
5
5
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
@@ -321,7 +321,7 @@ function EnvBuiltin(props) {
321
321
  const [{ defaultConfig, children }, rest] = splitProps(props, ["defaultConfig", "children"]);
322
322
  const context = (usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], usePowerlines());
323
323
  const defaultValue = computed(() => context && loadEnvFromContext(context, process.env));
324
- const reflectionGetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored, [
324
+ const schemaGetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.writeOnly, [
325
325
  "property",
326
326
  "",
327
327
  "P\"2!\"/\""
@@ -331,7 +331,7 @@ function EnvBuiltin(props) {
331
331
  "",
332
332
  "P\"2!\"2\"\"/#"
333
333
  ])) ?? []);
334
- const reflectionSetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
334
+ const schemaSetProperties = computed(() => getPropertiesList(context.env.config.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
335
335
  "property",
336
336
  "",
337
337
  "P\"2!\"/\""
@@ -408,7 +408,7 @@ function EnvBuiltin(props) {
408
408
  createIntrinsic("hbr", {}),
409
409
  createComponent(For, {
410
410
  get each() {
411
- return reflectionGetProperties.value;
411
+ return schemaGetProperties.value;
412
412
  },
413
413
  get children() {
414
414
  return __assignType((property, index) => createComponent(ConfigPropertyGet, {
@@ -434,7 +434,7 @@ function EnvBuiltin(props) {
434
434
  createIntrinsic("hbr", {}),
435
435
  createComponent(For, {
436
436
  get each() {
437
- return reflectionSetProperties.value;
437
+ return schemaSetProperties.value;
438
438
  },
439
439
  ender: code` else `,
440
440
  get children() {
@@ -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 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 { JsonSchemaProperty } 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.config.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.config.schema).filter(\n property => !property?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property?.name}`}\n type={`UnprefixedEnv[\"${property?.name}\"]`}\n readOnly={property?.readOnly}\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: JsonSchemaProperty;\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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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.config.schema)\n .filter(property => !property?.isIgnored)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n getPropertiesList(context.env.config.schema)\n .filter(property => !property?.isIgnored && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.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.config.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.config.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: JsonSchemaProperty, 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: JsonSchemaProperty, 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;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAAA,IAAA,CAAA,CAAA,oBAAA,MAAA,CAAA,GAAA,cAAA;CAChB,OAAA;EAAA,gBAAoB,wBAAA;GACpB,MAAA;GACA,IAAA,SAAA;IACA,OAAA,QAAA,IAAA,OAAA;GACA;GACF,UAAO;EACL,CAAA;EAAA,gBAAK,SAAA,CAAA,CAAA;EAAA,gBAAA,OAAA;GACL,SAAU;GACV,IAAA,WAAY;IACZ,OAAA,gBAAA,cAAA,EACM,UAAC,sPACH,CAAC;GACP;EACA,CAAA;EAAM,gBAAe,sBAA0B;GAC/C,MAAS;GACT,UAAc;;GAEZ,IAAA,WAAA;IACC,OAAU,gBAAgB,KAAA;KAC3B,IAAA,OAAA;MACK,OAAS,UAAA,QAAmB,OAAC,IAAA,MAAA,EAAA,IAAA,cAAA,WAAA,OAAA,QAAA,MAAA,EAAA,GAAA;OAAA;OAAA;OAAA;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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 { JsonSchemaProperty } from \"@powerlines/schema\";\nimport { getPropertiesList } from \"@powerlines/schema\";\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.config.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.config.schema).filter(\n property => !property?.isIgnored\n ) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocSchemaProperty schema={property} />\n <InterfaceMember\n name={`${prefix}_${property?.name}`}\n type={`UnprefixedEnv[\"${property?.name}\"]`}\n readOnly={property?.readOnly}\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: JsonSchemaProperty;\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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 when={property?.alias && property?.alias.length > 0}>\n {code` || `}\n <For each={property?.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 schemaGetProperties = computed(\n () =>\n getPropertiesList(context.env.config.schema)\n .filter(property => !property?.isIgnored && !property?.writeOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.name)\n ) ?? []\n );\n const schemaSetProperties = computed(\n () =>\n getPropertiesList(context.env.config.schema)\n .filter(property => !property?.isIgnored && !property?.readOnly)\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a?.name.localeCompare(b?.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.config.schema)}>\n <EnvTypeDefinition defaultValue={defaultValue} />\n <Spacing />\n </Show>\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n schema={context.env.config.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={schemaGetProperties.value}>\n {(property: JsonSchemaProperty, 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={schemaSetProperties.value} ender={code` else `}>\n {(property: JsonSchemaProperty, 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;;;;;;;AAEtC,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;AA+BA,SAAa,oBAAA;CACX,MAAA,WAAgB,cAAA,IAAA,CAAA,CAAA,oBAAA,MAAA,CAAA,GAAA,cAAA;CAChB,OAAA;EAAA,gBAAoB,wBAAA;GACpB,MAAA;GACA,IAAA,SAAA;IACA,OAAA,QAAA,IAAA,OAAA;GACA;GACF,UAAO;EACL,CAAA;EAAA,gBAAK,SAAA,CAAA,CAAA;EAAA,gBAAA,OAAA;GACL,SAAU;GACV,IAAA,WAAY;IACZ,OAAA,gBAAA,cAAA,EACM,UAAC,sPACH,CAAC;GACP;EACA,CAAA;EAAM,gBAAe,sBAA0B;GAC/C,MAAS;GACT,UAAc;;GAEZ,IAAA,WAAA;IACC,OAAU,gBAAgB,KAAA;KAC3B,IAAA,OAAA;MACK,OAAS,UAAA,QAAmB,OAAC,IAAA,MAAA,EAAA,IAAA,cAAA,WAAA,OAAA,QAAA,MAAA,EAAA,GAAA;OAAA;OAAA;OAAA;MAAA,CAAA,CAAA;KAC5B;;KAEA,IAAC,WAAA;MACJ,OAAA,cAAA,WAAA,gBAAA,KAAA;OACE,IAAA,OAAA;QACO,OAAA,kBAAa,QAAA,IAAA,OAAA,MAAA,EAAA,OAAA,cAAA,aAAA,CAAA,UAAA,WAAA;SAAA;SAAA;SAAA;QAAA,CAAA,CAAA,KAAA,CAAA;OACnB;OACA,gBAAA;OACD,IAAA,WAAA;QACO,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;;;;;;;;;;;;;;;;;;;;;GAqDP,CAAC;GAAG,gBAAW,SAAA,CAAA,CAAA;GAAA,gBAAA,OAAA;IACb,SAAM;IACN,IAAE,WAAa;KACb,OAAI,gBAAgB,cAAA,EACpB,UAAI,IAAA;;;;YAKJ,CAAA;IACF;GACF,CAAC;GAAG,gBAAa,gBAAA;IACf,UAAM;IACN,SAAM;IACN,MAAM;IACN,aAAM,IAAW;GACnB,CAAC;GAAG,gBAAI,SAAkB,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACxB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAM,IAAW;GACnB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACjB,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAU,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACZ,UAAM;IACN,SAAM;IACN,MAAM;IACN,KAAK;IACL,aAAI,IAAA;GACN,CAAC;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,gBAAA;IACA,UAAS;;IAET,MAAM;IACL,KAAC;IACD,aAAa,IAAC;GAChB,CAAC;GAAG,gBAAe,SAAA,CAAA,CAAA;GAAA,gBAAA,MAAA;IACjB,IAAI,OAAO;KACT,OAAI,QAAW,QAAC;IAClB;IACE;GACJ,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,WAAQ,SAAU;OAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
@@ -2,7 +2,7 @@ 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
4
  const require_helpers_source_file_env = require('./source-file-env.cjs');
5
- let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
5
+ let _powerlines_schema = require("@powerlines/schema");
6
6
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
7
7
  let defu = require("defu");
8
8
  defu = require_runtime.__toESM(defu, 1);
@@ -100,7 +100,7 @@ function loadEnvFromContext(context, parsed, workspaceConfig) {
100
100
  STACKTRACE: context.config.mode !== "production",
101
101
  RUNTIME: context.config.environment.runtime,
102
102
  ENVIRONMENT: !context.config.environment.name || context.config.environment.name === powerlines_constants.DEFAULT_ENVIRONMENT ? context.config.mode : context.config.environment.name
103
- }, (0, _stryke_type_checks_is_set_object.isSetObject)(context.env.config) ? Object.entries((0, _powerlines_schema_helpers.getProperties)(context.env.config)).reduce(__assignType((ret, [name, prop]) => {
103
+ }, (0, _stryke_type_checks_is_set_object.isSetObject)(context.env.config) ? Object.entries((0, _powerlines_schema.getProperties)(context.env.config)).reduce(__assignType((ret, [name, prop]) => {
104
104
  ret[name] = parsed[name] ?? prop?.default;
105
105
  return ret;
106
106
  }, [
@@ -1,6 +1,6 @@
1
1
  import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
2
2
  import { removeEnvPrefix } from "./source-file-env.mjs";
3
- import { getProperties } from "@powerlines/schema/helpers";
3
+ import { getProperties } from "@powerlines/schema";
4
4
  import { isSetObject } from "@stryke/type-checks/is-set-object";
5
5
  import defu from "defu";
6
6
  import { tryGetWorkspaceConfig } from "@storm-software/config-tools/get-config";
@@ -1 +1 @@
1
- {"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.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 { getProperties } from \"@powerlines/schema/helpers\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context.env.config)\n ? Object.entries(getProperties(context.env.config)).reduce(\n (ret, [name, prop]) => {\n ret[name] = parsed[name] ?? prop?.default;\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB,KAAK,IAAE;CACrC,IAAM,QAAG,mBAAkB,QAAA,iBAA4B,SAAY,GAAC;EACpE,MAAS,qBAAsB,MAAI,QAAO,IAAK,QAAI,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,GAAA,GAAA;GAAA;GAAA;GAAA;EAAA,CAAA,CAAA,CAAA;sDAE7C,MAAA,KAAS,mBAAkB,GAAA;CAE/B;CACA,OAAK,gBAAA,GAAA;AACP;AACA,aAAY,SAAM;OAAW;CAAW;CAAA;CAAA;CAAA;CAAA;AAAA;AACxC,eAAc,iBAAkB,SAAS,SAAA,WAAiB,MAAS,UAAG,aAAA,iBAAA;CACpE,MAAE,CAAK,WAAC,aAAqB,MAAM,QAAQ,IAAG,EAAA,aAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,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AM,OAAS,SAAS,MAAA;EAChC,OAAA;;;;;;;AAEA;AACA,mBAAa,SAAe;OAAA;CAAyB;CAAS;CAAO;CAAA;CAAA;CAAA;AAAA;AACrE,eAAC,QAAA,SAAA,SAAA;CACC,MAAE,kBAAoB,MAAQ,sBAAsB;CACpD,MAAE,CAAK,SAAS,WAAW,UAAQ,MAAA,QAAa,IAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,MAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;CAAA,CAAA;CAChD,OAAE,KAAU,mBAAmB,SAAI,QAAO,KAAA,eAAa,GAAA,SAAA,WAAA,MAAA;AACzD;AACA,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;CAAA;CAAA;AAAA"}
1
+ {"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.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 { getProperties } from \"@powerlines/schema\";\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context.env.config)\n ? Object.entries(getProperties(context.env.config)).reduce(\n (ret, [name, prop]) => {\n ret[name] = parsed[name] ?? prop?.default;\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB,KAAK,IAAE;CACrC,IAAM,QAAG,mBAAkB,QAAA,iBAA4B,SAAY,GAAC;EACpE,MAAS,qBAAsB,MAAI,QAAO,IAAK,QAAI,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,GAAA,GAAA;GAAA;GAAA;GAAA;EAAA,CAAA,CAAA,CAAA;sDAE7C,MAAA,KAAS,mBAAkB,GAAA;CAE/B;CACA,OAAK,gBAAA,GAAA;AACP;AACA,aAAY,SAAM;OAAW;CAAW;CAAA;CAAA;CAAA;CAAA;AAAA;AACxC,eAAc,iBAAkB,SAAS,SAAA,WAAiB,MAAS,UAAG,aAAA,iBAAA;CACpE,MAAE,CAAK,WAAC,aAAqB,MAAM,QAAQ,IAAG,EAAA,aAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,aAAA,SAAA,MAAA,SAAA,IAAA,WAAA;EAC5C,KAAE;EACF,MAAI,QA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e;OAAA;CAAyB;CAAS;CAAO;CAAA;CAAA;CAAA;AAAA;AACrE,eAAC,QAAA,SAAA,SAAA;CACC,MAAE,kBAAoB,MAAQ,sBAAsB;CACpD,MAAE,CAAK,SAAS,WAAW,UAAQ,MAAA,QAAa,IAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,MAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,GAAA,CAAA,GAAA,iBAAA,SAAA,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,eAAA;CAAA,CAAA;CAChD,OAAE,KAAU,mBAAmB,SAAI,QAAO,KAAA,eAAa,GAAA,SAAA,WAAA,MAAA;AACzD;AACA,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;CAAA;CAAA;AAAA"}
@@ -4,8 +4,6 @@ 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
6
  let _powerlines_schema = require("@powerlines/schema");
7
- let _powerlines_schema_extract = require("@powerlines/schema/extract");
8
- let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
9
7
  let _stryke_helpers_omit = require("@stryke/helpers/omit");
10
8
  let _stryke_path_join = require("@stryke/path/join");
11
9
  let _stryke_type_checks_is_set_array = require("@stryke/type-checks/is-set-array");
@@ -141,12 +139,12 @@ readActive.__type = [
141
139
  async function extractEnv(context) {
142
140
  const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);
143
141
  const defaultSecretsTypeDefinition = await getDefaultSecretsTypeDefinition(context);
144
- const config = await (_powerlines_schema_extract.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_extract.extract)(context, context.config.env.config));
142
+ const config = await (_powerlines_schema.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.extract)(context, context.config.env.config));
145
143
  config.active = await readActive(context, "config");
146
- if ((0, _stryke_type_checks_is_string.isString)(context.config.env.config) && context.config.env.config !== `${defaultVarsTypeDefinition.file}#${defaultVarsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.config) && (context.config.env.config.file !== defaultVarsTypeDefinition.file || context.config.env.config.name !== defaultVarsTypeDefinition.name)) config.schema = (_powerlines_schema_helpers.mergeSchemas.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_helpers.mergeSchemas)(config, await (_powerlines_schema_extract.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_extract.extract)(context, defaultVarsTypeDefinition))));
147
- const secrets = await (_powerlines_schema_extract.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_extract.extract)(context, context.config.env.secrets));
144
+ if ((0, _stryke_type_checks_is_string.isString)(context.config.env.config) && context.config.env.config !== `${defaultVarsTypeDefinition.file}#${defaultVarsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.config) && (context.config.env.config.file !== defaultVarsTypeDefinition.file || context.config.env.config.name !== defaultVarsTypeDefinition.name)) config.schema = (_powerlines_schema.mergeSchemas.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.mergeSchemas)(config, await (_powerlines_schema.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.extract)(context, defaultVarsTypeDefinition))));
145
+ const secrets = await (_powerlines_schema.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.extract)(context, context.config.env.secrets));
148
146
  secrets.active = await readActive(context, "secrets");
149
- if ((0, _stryke_type_checks_is_string.isString)(context.config.env.secrets) && context.config.env.secrets !== `${defaultSecretsTypeDefinition.file}#${defaultSecretsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.secrets) && (context.config.env.secrets.file !== defaultSecretsTypeDefinition.file || context.config.env.secrets.name !== defaultSecretsTypeDefinition.name)) secrets.schema = (_powerlines_schema_helpers.mergeSchemas.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_helpers.mergeSchemas)(secrets, await (_powerlines_schema_extract.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema_extract.extract)(context, defaultSecretsTypeDefinition))));
147
+ if ((0, _stryke_type_checks_is_string.isString)(context.config.env.secrets) && context.config.env.secrets !== `${defaultSecretsTypeDefinition.file}#${defaultSecretsTypeDefinition.name}` || (0, _stryke_type_checks_is_set_object.isSetObject)(context.config.env.secrets) && (context.config.env.secrets.file !== defaultSecretsTypeDefinition.file || context.config.env.secrets.name !== defaultSecretsTypeDefinition.name)) secrets.schema = (_powerlines_schema.mergeSchemas.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.mergeSchemas)(secrets, await (_powerlines_schema.extract.Ω = [[() => __ΩRecord, "&\"o!#"]], (0, _powerlines_schema.extract)(context, defaultSecretsTypeDefinition))));
150
148
  context.env = (0, defu.default)({
151
149
  config,
152
150
  secrets,
@@ -156,10 +154,10 @@ async function extractEnv(context) {
156
154
  parsed: {},
157
155
  injected: []
158
156
  });
159
- const properties = (0, _powerlines_schema_helpers.getProperties)(context.env.config);
157
+ const properties = (0, _powerlines_schema.getProperties)(context.env.config);
160
158
  context.info({
161
159
  meta: { category: "env" },
162
- message: `Environment Variables configuration: ${context.config.env.config ? "" : "Defaulted "}${context.env.config.variant === "reflection" ? "Deepkit type definition" : context.env.config.variant === "json-schema" ? "JSON Schema" : context.env.config.variant === "standard-schema" ? "Standard Schema" : context.env.config.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.config ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.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"}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? (0, _powerlines_schema_helpers.getPropertiesList)(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"}`
160
+ message: `Environment Variables configuration: ${context.config.env.config ? "" : "Defaulted "}${context.env.config.variant === "reflection" ? "Deepkit type definition" : context.env.config.variant === "json-schema" ? "JSON Schema" : context.env.config.variant === "standard-schema" ? "Standard Schema" : context.env.config.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.config ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.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"}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? (0, _powerlines_schema.getPropertiesList)(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"}`
163
161
  });
164
162
  const aliases = Object.fromEntries(Object.entries(properties).flatMap(__assignType(([key, prop]) => (0, _stryke_type_checks_is_set_array.isSetArray)(prop.alias) ? prop.alias?.map(__assignType((alias) => [alias, {
165
163
  ...prop,
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA0CA;;;;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;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAkKmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
1
+ {"version":3,"file":"schema.d.cts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA4CA;;;;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;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAkKmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"schema.d.mts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA0CA;;;;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;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAkKmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
1
+ {"version":3,"file":"schema.d.mts","names":[],"sources":["../../src/helpers/schema.ts"],"mappings":";;;;;;;AA4CA;;;;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;;;;;;;iBAad,iBAAA,kBAAmC,gBAAA,CAAA,CACjD,OAAA,EAAS,QAAQ;AAAA,iBAKH,gBAAA,kBAAkC,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAQ,EACjB,OAAA;;;;;;AAnC0C;AAY5C;;;iBAsEsB,UAAA,kBAA4B,gBAAA,CAAA,CAChD,OAAA,EAAS,QAAA,GACR,OAAA;;;;;;;iBAkKmB,QAAA,kBAA0B,gBAAA,CAAA,CAC9C,OAAA,EAAS,QAAA,GACR,OAAA"}
@@ -1,9 +1,7 @@
1
1
  import { __ΩEnvSchema } from "../types/plugin.mjs";
2
2
  import { loadEnv } from "./load.mjs";
3
3
  import { isString } from "@stryke/type-checks/is-string";
4
- import { isSchema, writeSchema } from "@powerlines/schema";
5
- import { extract } from "@powerlines/schema/extract";
6
- import { getProperties as getProperties$1, getPropertiesList, mergeSchemas } from "@powerlines/schema/helpers";
4
+ import { extract, getProperties, getPropertiesList, isSchema, mergeSchemas, writeSchema } from "@powerlines/schema";
7
5
  import { omit } from "@stryke/helpers/omit";
8
6
  import { joinPaths } from "@stryke/path/join";
9
7
  import { isSetArray } from "@stryke/type-checks/is-set-array";
@@ -153,7 +151,7 @@ async function extractEnv(context) {
153
151
  parsed: {},
154
152
  injected: []
155
153
  });
156
- const properties = getProperties$1(context.env.config);
154
+ const properties = getProperties(context.env.config);
157
155
  context.info({
158
156
  meta: { category: "env" },
159
157
  message: `Environment Variables configuration: ${context.config.env.config ? "" : "Defaulted "}${context.env.config.variant === "reflection" ? "Deepkit type definition" : context.env.config.variant === "json-schema" ? "JSON Schema" : context.env.config.variant === "standard-schema" ? "Standard Schema" : context.env.config.variant === "zod3" ? "Zod v3 schema" : "Typescript exported type"}${context.config.env.config ? " from plugin options" : ""} provided ${Object.keys(properties).length} parameters\nEnvironment Secret configuration: ${context.config.env.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"}${context.config.env.secrets ? " from plugin options" : ""} provided ${context.env.secrets?.schema ? getPropertiesList(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"}`
@@ -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 { isSchema, Schema, writeSchema } from \"@powerlines/schema\";\nimport { extract } from \"@powerlines/schema/extract\";\nimport {\n getProperties,\n getPropertiesList,\n mergeSchemas\n} from \"@powerlines/schema/helpers\";\nimport { omit } from \"@stryke/helpers/omit\";\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, 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 * A helper function to get the cache directory path for storing schemas. This function takes a context object as input and returns the path to the cache directory where schemas are stored. The cache directory is constructed by joining the `cachePath` property from the context with a subdirectory named \"schemas\". This function is useful for centralizing the logic for determining where schema files should be cached, ensuring that all schema-related file operations use a consistent location for storing and retrieving cached schemas.\n *\n * @param context - The context object providing access to the cache path.\n * @returns The path to the cache directory for storing schemas, constructed by joining the context's `cachePath` with the \"schemas\" subdirectory.\n */\nexport function getCacheDirectory<TContext extends EnvPluginContext>(\n context: TContext\n): string {\n return joinPaths(context.cachePath, \"env\");\n}\n\nexport function getCacheFilePath<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): string {\n return joinPaths(getCacheDirectory(context), `${variant}.json`);\n}\n\nasync function writeActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\",\n schema: EnvSchema\n) {\n if (!isSchema<EnvSchema>(schema)) {\n throw new Error(\n `The provided input is not a valid env schema. A valid schema must have a \"variant\" property indicating the type of the input and a \"schema\" property containing the parsed JSON Schema object.`\n );\n }\n\n await context.fs.write(\n getCacheFilePath(context, variant),\n JSON.stringify(schema.schema)\n );\n}\n\nasync function readActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): Promise<string[]> {\n if (!context.fs.existsSync(getCacheFilePath(context, variant))) {\n return [];\n }\n\n const data = await context.fs.read(getCacheFilePath(context, variant));\n if (!data) {\n return [];\n }\n\n return JSON.parse(data);\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 * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void> {\n const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const config = (await extract<Record<string, any>>(\n context,\n context.config.env.config\n )) as EnvSchema;\n config.active = await readActive(context, \"config\");\n\n if (\n (isString(context.config.env.config) &&\n context.config.env.config !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.config as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n config.schema = mergeSchemas<Record<string, any>>(\n config,\n await extract<Record<string, any>>(context, defaultVarsTypeDefinition)\n );\n }\n\n const secrets = (await extract<Record<string, any>>(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n secrets.active = await readActive(context, \"secrets\");\n\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<Record<string, any>>(\n secrets,\n await extract<Record<string, any>>(context, defaultSecretsTypeDefinition)\n );\n }\n\n context.env = defu(\n {\n config,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n active: [],\n parsed: {},\n injected: []\n }\n );\n\n const properties = getProperties(context.env.config);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config ? \"\" : \"Defaulted \"\n }${\n context.env.config.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.config.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.config.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.config.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${context.config.env.config ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n context.config.env.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 }${context.config.env.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? getPropertiesList(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.alias)\n ? prop.alias?.map(alias => [\n alias,\n {\n ...prop,\n name: alias,\n alias: [...(prop.alias?.filter(a => a !== alias) ?? []), key]\n }\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]?.runtime) {\n const propertySchema =\n context.env.config.schema.properties?.[unprefixedKey];\n if (propertySchema) {\n propertySchema.default = value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey]?.runtime) {\n const alias = aliases[unprefixedKey]?.alias?.[0] ?? unprefixedKey;\n const aliasSchema = context.env.config.schema.properties?.[alias];\n if (aliasSchema) {\n aliasSchema.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Writes the environment variables and secrets schema stored in the plugin context to the cache directory for later retrieval during the build process. This function should be called during the plugin's `build` hook after the schema has been extracted and stored in the plugin context to ensure that the active environment variables and secrets are persisted across builds and can be accessed during the build process for validation and injection purposes.\n *\n * @param context - The plugin context containing the environment variables and secrets schema to be written to the cache directory.\n * @returns A promise that resolves when the schema has been successfully written to the cache directory.\n */\nexport async function writeEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void[]> {\n return Promise.all([\n writeSchema(context, omit(context.env.config, [\"active\"]) as Schema),\n writeSchema(context, omit(context.env.secrets, [\"active\"]) as Schema),\n writeActive(context, \"config\", context.env.config),\n writeActive(context, \"secrets\", context.env.secrets)\n ]);\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;AAAwB;;CAI9D,GAAI,SAAS;CACb,OAAG;AACJ;;;;;;;AAkCA,eAAgB,uBAA6B,SAAQ;CACnD,MAAA,WAAA,MAAA,QAAA,GAAA,QAAA,kCAAA;CACF,IAA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A,EAAA,WAAgC,MAAQ;GAG9C,OAAO;EACP,GAAA;GAAA;GAAQ;GAAW;GAAA;EAAA,CAAA,GAAA,GAAA;EACnB,IAAI,WAAS,gBACf;OAAO,CAAA,WAAS,gBAAiB,SAAU;;IAExC,IAAA,gBACA,eAAiB,UAAW;GAE3B;SACI,IAAA,QAAA,gBACJ;OAAI,CAAC,QAAE,gBAAA,SAAA;IACR,MAAA,QAAY,QAAQ,gBAAoB,QAAA,MAAA;IACrC,MAAA,cAAmB,QAAS,IAAC,OAAA,OAAgB,aAAO;IACpD,IAAA,aACC,YAAQ,UAAW;GAExB;;CAEF;AACF;AACA,WAAK,SAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;AAOL,eAAmB,SAAM,SAAW;;;;;;;AAEpC;AACA,SAAK,SAAS;CAAA;CAAe;CAAa;CAAC;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 {\n extract,\n getProperties,\n getPropertiesList,\n isSchema,\n mergeSchemas,\n Schema,\n writeSchema\n} from \"@powerlines/schema\";\nimport { omit } from \"@stryke/helpers/omit\";\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, 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 * A helper function to get the cache directory path for storing schemas. This function takes a context object as input and returns the path to the cache directory where schemas are stored. The cache directory is constructed by joining the `cachePath` property from the context with a subdirectory named \"schemas\". This function is useful for centralizing the logic for determining where schema files should be cached, ensuring that all schema-related file operations use a consistent location for storing and retrieving cached schemas.\n *\n * @param context - The context object providing access to the cache path.\n * @returns The path to the cache directory for storing schemas, constructed by joining the context's `cachePath` with the \"schemas\" subdirectory.\n */\nexport function getCacheDirectory<TContext extends EnvPluginContext>(\n context: TContext\n): string {\n return joinPaths(context.cachePath, \"env\");\n}\n\nexport function getCacheFilePath<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): string {\n return joinPaths(getCacheDirectory(context), `${variant}.json`);\n}\n\nasync function writeActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\",\n schema: EnvSchema\n) {\n if (!isSchema<EnvSchema>(schema)) {\n throw new Error(\n `The provided input is not a valid env schema. A valid schema must have a \"variant\" property indicating the type of the input and a \"schema\" property containing the parsed JSON Schema object.`\n );\n }\n\n await context.fs.write(\n getCacheFilePath(context, variant),\n JSON.stringify(schema.schema)\n );\n}\n\nasync function readActive<TContext extends EnvPluginContext>(\n context: TContext,\n variant: \"config\" | \"secrets\"\n): Promise<string[]> {\n if (!context.fs.existsSync(getCacheFilePath(context, variant))) {\n return [];\n }\n\n const data = await context.fs.read(getCacheFilePath(context, variant));\n if (!data) {\n return [];\n }\n\n return JSON.parse(data);\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 * @returns A promise that resolves when the schema has been extracted and stored in the plugin context.\n */\nexport async function extractEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void> {\n const defaultVarsTypeDefinition = await getDefaultVarsTypeDefinition(context);\n const defaultSecretsTypeDefinition =\n await getDefaultSecretsTypeDefinition(context);\n\n const config = (await extract<Record<string, any>>(\n context,\n context.config.env.config\n )) as EnvSchema;\n config.active = await readActive(context, \"config\");\n\n if (\n (isString(context.config.env.config) &&\n context.config.env.config !==\n `${defaultVarsTypeDefinition.file}#${\n defaultVarsTypeDefinition.name\n }`) ||\n (isSetObject(context.config.env.config) &&\n ((context.config.env.config as TypeDefinition).file !==\n defaultVarsTypeDefinition.file ||\n (context.config.env.config as TypeDefinition).name !==\n defaultVarsTypeDefinition.name))\n ) {\n config.schema = mergeSchemas<Record<string, any>>(\n config,\n await extract<Record<string, any>>(context, defaultVarsTypeDefinition)\n );\n }\n\n const secrets = (await extract<Record<string, any>>(\n context,\n context.config.env.secrets\n )) as EnvSchema;\n secrets.active = await readActive(context, \"secrets\");\n\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<Record<string, any>>(\n secrets,\n await extract<Record<string, any>>(context, defaultSecretsTypeDefinition)\n );\n }\n\n context.env = defu(\n {\n config,\n secrets,\n parsed: await loadEnv(context, context.config.env)\n },\n context.env ?? {},\n {\n active: [],\n parsed: {},\n injected: []\n }\n );\n\n const properties = getProperties(context.env.config);\n context.info({\n meta: {\n category: \"env\"\n },\n message: `Environment Variables configuration: ${\n context.config.env.config ? \"\" : \"Defaulted \"\n }${\n context.env.config.variant === \"reflection\"\n ? \"Deepkit type definition\"\n : context.env.config.variant === \"json-schema\"\n ? \"JSON Schema\"\n : context.env.config.variant === \"standard-schema\"\n ? \"Standard Schema\"\n : context.env.config.variant === \"zod3\"\n ? \"Zod v3 schema\"\n : \"Typescript exported type\"\n }${context.config.env.config ? \" from plugin options\" : \"\"} provided ${\n Object.keys(properties).length\n } parameters\\nEnvironment Secret configuration: ${\n context.config.env.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 }${context.config.env.secrets ? \" from plugin options\" : \"\"} provided ${\n context.env.secrets?.schema\n ? getPropertiesList(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.alias)\n ? prop.alias?.map(alias => [\n alias,\n {\n ...prop,\n name: alias,\n alias: [...(prop.alias?.filter(a => a !== alias) ?? []), key]\n }\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]?.runtime) {\n const propertySchema =\n context.env.config.schema.properties?.[unprefixedKey];\n if (propertySchema) {\n propertySchema.default = value;\n }\n }\n } else if (aliases[unprefixedKey]) {\n if (!aliases[unprefixedKey]?.runtime) {\n const alias = aliases[unprefixedKey]?.alias?.[0] ?? unprefixedKey;\n const aliasSchema = context.env.config.schema.properties?.[alias];\n if (aliasSchema) {\n aliasSchema.default = value;\n }\n }\n }\n }\n}\n\n/**\n * Writes the environment variables and secrets schema stored in the plugin context to the cache directory for later retrieval during the build process. This function should be called during the plugin's `build` hook after the schema has been extracted and stored in the plugin context to ensure that the active environment variables and secrets are persisted across builds and can be accessed during the build process for validation and injection purposes.\n *\n * @param context - The plugin context containing the environment variables and secrets schema to be written to the cache directory.\n * @returns A promise that resolves when the schema has been successfully written to the cache directory.\n */\nexport async function writeEnv<TContext extends EnvPluginContext>(\n context: TContext\n): Promise<void[]> {\n return Promise.all([\n writeSchema(context, omit(context.env.config, [\"active\"]) as Schema),\n writeSchema(context, omit(context.env.secrets, [\"active\"]) as Schema),\n writeActive(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AA;CAAA;CAAA;AAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.16.256",
3
+ "version": "0.16.257",
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"],
@@ -107,12 +107,12 @@
107
107
  "@alloy-js/typescript": "^0.23.0",
108
108
  "@babel/core": "8.0.0-rc.5",
109
109
  "@babel/types": "8.0.0-rc.5",
110
- "@powerlines/core": "^0.48.4",
111
- "@powerlines/plugin-alloy": "^0.26.146",
112
- "@powerlines/plugin-automd": "^0.1.521",
113
- "@powerlines/plugin-babel": "^0.13.56",
114
- "@powerlines/plugin-plugin": "^0.12.472",
115
- "@powerlines/schema": "^0.11.41",
110
+ "@powerlines/core": "0.48.5",
111
+ "@powerlines/plugin-alloy": "0.26.147",
112
+ "@powerlines/plugin-automd": "0.1.522",
113
+ "@powerlines/plugin-babel": "0.13.57",
114
+ "@powerlines/plugin-plugin": "0.12.473",
115
+ "@powerlines/schema": "0.11.42",
116
116
  "@storm-software/config-tools": "^1.190.27",
117
117
  "@stryke/capnp": "^0.12.102",
118
118
  "@stryke/convert": "^0.7.7",
@@ -127,9 +127,9 @@
127
127
  "automd": "^0.4.3",
128
128
  "c12": "^3.3.4",
129
129
  "defu": "^6.1.7",
130
- "powerlines": "^0.47.60"
130
+ "powerlines": "0.47.61"
131
131
  },
132
132
  "devDependencies": { "@types/node": "^25.9.1", "vite": "^8.0.14" },
133
133
  "publishConfig": { "access": "public" },
134
- "gitHead": "3b2fa8b99824b2931e215e3794ea4365b928034d"
134
+ "gitHead": "6ca3515304ea3e458094bd7650a9bfbe0681a124"
135
135
  }