@powerlines/plugin-env 0.16.136 → 0.16.138

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,9 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_types_plugin = require('../types/plugin.cjs');
4
- const require_helpers_docs_helper = require('../helpers/docs-helper.cjs');
5
4
  let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
6
- let _stryke_path_join = require("@stryke/path/join");
5
+ let powerlines_plugin_utils = require("powerlines/plugin-utils");
7
6
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
7
  let _alloy_js_core = require("@alloy-js/core");
9
8
  let _alloy_js_markdown = require("@alloy-js/markdown");
@@ -12,6 +11,7 @@ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin
12
11
  let _powerlines_plugin_alloy_markdown_components_heading = require("@powerlines/plugin-alloy/markdown/components/heading");
13
12
  let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@powerlines/plugin-alloy/markdown/components/markdown-file");
14
13
  let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
14
+ let _stryke_path_join = require("@stryke/path/join");
15
15
 
16
16
  //#region src/components/docs.tsx
17
17
  const __ΩPartial = [
@@ -39,7 +39,7 @@ function EnvDocsFile(props) {
39
39
  const { levelOffset = 0, reflection, ...rest } = props;
40
40
  const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
41
41
  return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_file.MarkdownFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({ get path() {
42
- return (0, _stryke_path_join.joinPaths)(require_helpers_docs_helper.getDocsOutputPath(context), "env.md");
42
+ return (0, _stryke_path_join.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(context.config.root), "env.md");
43
43
  } }, rest, { get children() {
44
44
  return [
45
45
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_heading.Heading, {
@@ -1,7 +1,6 @@
1
1
  import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { getDocsOutputPath } from "../helpers/docs-helper.mjs";
3
2
  import { stringifyType } from "@powerlines/deepkit/vendor/type";
4
- import { joinPaths } from "@stryke/path/join";
3
+ import { getDocsOutputPath } from "powerlines/plugin-utils";
5
4
  import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
6
5
  import { Show, code } from "@alloy-js/core";
7
6
  import { Link } from "@alloy-js/markdown";
@@ -10,6 +9,7 @@ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
10
9
  import { Heading } from "@powerlines/plugin-alloy/markdown/components/heading";
11
10
  import { MarkdownFile } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
12
11
  import { MarkdownTable } from "@powerlines/plugin-alloy/markdown/components/markdown-table";
12
+ import { joinPaths } from "@stryke/path/join";
13
13
 
14
14
  //#region src/components/docs.tsx
15
15
  const __ΩPartial = [
@@ -37,7 +37,7 @@ function EnvDocsFile(props) {
37
37
  const { levelOffset = 0, reflection, ...rest } = props;
38
38
  const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
39
39
  return createComponent(MarkdownFile, mergeProps({ get path() {
40
- return joinPaths(getDocsOutputPath(context), "env.md");
40
+ return joinPaths(getDocsOutputPath(context.config.root), "env.md");
41
41
  } }, rest, { get children() {
42
42
  return [
43
43
  createComponent(Heading, {
@@ -1 +1 @@
1
- {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\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 { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"../helpers/docs-helper\";\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 reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n !property.isHidden() &&\n !property.isIgnored() &&\n !property.isReadonly() &&\n !property.isInternal()\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;AAC/B,IAAG,SAAU;AACb,QAAQ;;;;;;;;;;;;;;AAkCT,SAAM,YAAA,OAAA;CACJ,MAAG,EACF,cAAA,GACC,YACA,GAAA,SACF;;AAEA,QAAA,gBAAY,cAAoB,WAAA,EAClC,IAAA,OAAA;;IAGG,EAAA,MAAA,EACD,IAAA,WAAA;AACI,SAAC;GAAA,gBAAqB,SAAO;IAC3B,OAAE,IAAA;;IAEH,CAAC;GAAA,IAAA;GAA2C,gBAAA,MAAA;;AAE1C,YAAA,CAAA,CAAA,QAAA,YAAA;;IAEH,IAAM,WAAU;AACZ,YAAK,gBAAA,MAAA;MACR,IAAQ,OAAQ;AACX,cAAS,iCAAgC,QAAQ,YAAI;;MAExD,IAAA,QAAA;AACK,cAAG,QAAY,YAAU;;MAE9B,CAAA;;IAEF,CAAA;GAAA,IAAK;GAAsF,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,SAAA;IAC3F,OAAQ,IAAC;IACT,UAAQ;IACR,CAAA;GAAA,gBAAS,SAAA,EAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,eAAA,EACT,IAAK,OAAI;AACT,WAAS,YAAA,eAAA,CAAA,OAAA,cAAA,aAAA,CAAA,SAAA,UAAA,IAAA,CAAA,SAAA,WAAA,IAAA,CAAA,SAAA,YAAA,IAAA,CAAA,SAAA,YAAA,EAAA;KAAA;KAAA;KAAA;KAAA,CAAA,CAAA,CAAA,KAAA,cAAA,GAAA,MAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,EAAA;KAAA;KAAA;KAAA;KAAA;KAAA,CAAA,CAAA,CAAA,IAAA,cAAA,uBAAA;AACT,YAAA;MACM,MAAA,mBAAA,iBAAA,CAAA,MAAA;MACH,cAAA,mBAAA,gBAAA,IAAA,IAAA,MAAA;MACI,MAAA,cAAc,mBAAA,SAAA,CAAA,CAAA,MAAA,CAAA,WAAA,mBAAA,QAAA;MACf,cAAM,mBAAA,YAAA,GAAA,OAAA,mBAAA,iBAAA,CAAA,EAAA,SAAA,KAAA,GAAA,mBAAA,iBAAA,GAAA,KAAA,mBAAA,iBAAA,CAAA,MAAA;MACL,UAAU,mBAAA,iBAAA,GAAA,KAAA;MACX;OACA;KAAC;KAAsB;KAAG;KAAA,CAAA,CAAA,IAAA,EAAA;MAEhC,CAAC;GAAC;IAEN,CAAC,CAAC;;AAEL,YAAY,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\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 { 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 reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n !property.isHidden() &&\n !property.isIgnored() &&\n !property.isReadonly() &&\n !property.isInternal()\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;AAC/B,IAAG,SAAU;AACb,QAAQ;;;;;;;;;;;;;;AAkCT,SAAM,YAAA,OAAA;CACJ,MAAG,EACF,cAAA,GACC,YACA,GAAA,SACF;;AAEA,QAAA,gBAAY,cAAoB,WAAA,EAClC,IAAA,OAAA;;IAGG,EAAA,MAAA,EACD,IAAA,WAAA;AACI,SAAC;GAAA,gBAAqB,SAAO;IAC3B,OAAE,IAAA;;IAEH,CAAC;GAAA,IAAA;GAA2C,gBAAA,MAAA;;AAE1C,YAAA,CAAA,CAAA,QAAA,YAAA;;IAEH,IAAM,WAAU;AACZ,YAAK,gBAAA,MAAA;MACR,IAAQ,OAAQ;AACX,cAAS,iCAAgC,QAAQ,YAAI;;MAExD,IAAA,QAAA;AACK,cAAG,QAAY,YAAU;;MAE9B,CAAA;;IAEF,CAAA;GAAA,IAAK;GAAsF,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,SAAA;IAC3F,OAAQ,IAAC;IACT,UAAQ;IACR,CAAA;GAAA,gBAAS,SAAA,EAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,eAAA,EACT,IAAK,OAAI;AACT,WAAS,YAAA,eAAA,CAAA,OAAA,cAAA,aAAA,CAAA,SAAA,UAAA,IAAA,CAAA,SAAA,WAAA,IAAA,CAAA,SAAA,YAAA,IAAA,CAAA,SAAA,YAAA,EAAA;KAAA;KAAA;KAAA;KAAA,CAAA,CAAA,CAAA,KAAA,cAAA,GAAA,MAAA,EAAA,iBAAA,CAAA,cAAA,EAAA,iBAAA,CAAA,EAAA;KAAA;KAAA;KAAA;KAAA;KAAA,CAAA,CAAA,CAAA,IAAA,cAAA,uBAAA;AACT,YAAA;MACM,MAAA,mBAAA,iBAAA,CAAA,MAAA;MACH,cAAA,mBAAA,gBAAA,IAAA,IAAA,MAAA;MACI,MAAA,cAAc,mBAAA,SAAA,CAAA,CAAA,MAAA,CAAA,WAAA,mBAAA,QAAA;MACf,cAAM,mBAAA,YAAA,GAAA,OAAA,mBAAA,iBAAA,CAAA,EAAA,SAAA,KAAA,GAAA,mBAAA,iBAAA,GAAA,KAAA,mBAAA,iBAAA,CAAA,MAAA;MACL,UAAU,mBAAA,iBAAA,GAAA,KAAA;MACX;OACA;KAAC;KAAsB;KAAG;KAAA,CAAA,CAAA,IAAA,EAAA;MAEhC,CAAC;GAAC;IAEN,CAAC,CAAC;;AAEL,YAAY,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -2,6 +2,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  let _stryke_path_join_paths = require("@stryke/path/join-paths");
4
4
  let automd = require("automd");
5
+ let powerlines_plugin_utils = require("powerlines/plugin-utils");
5
6
 
6
7
  //#region src/helpers/automd-generator.ts
7
8
  function __assignType(fn, args) {
@@ -17,7 +18,7 @@ function __assignType(fn, args) {
17
18
  const env = __assignType((context) => (0, automd.defineGenerator)({
18
19
  name: "env",
19
20
  generate: __assignType(async function generate() {
20
- const envDocFile = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "docs", "generated", "env.md");
21
+ const envDocFile = (0, _stryke_path_join_paths.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(context.config.root), "env.md");
21
22
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
22
23
  return { contents: await context.fs.read(envDocFile) || "" };
23
24
  }, ["generate", "P\"/!"])
@@ -1 +1 @@
1
- {"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA4BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA4BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
1
+ {"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;;;AA6BA;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAA,KAAiB,QAAA,CAAA,SAAA"}
@@ -1,5 +1,6 @@
1
1
  import { joinPaths } from "@stryke/path/join-paths";
2
2
  import { defineGenerator } from "automd";
3
+ import { getDocsOutputPath } from "powerlines/plugin-utils";
3
4
 
4
5
  //#region src/helpers/automd-generator.ts
5
6
  function __assignType(fn, args) {
@@ -15,7 +16,7 @@ function __assignType(fn, args) {
15
16
  const env = __assignType((context) => defineGenerator({
16
17
  name: "env",
17
18
  generate: __assignType(async function generate() {
18
- const envDocFile = joinPaths(context.config.root, "docs", "generated", "env.md");
19
+ const envDocFile = joinPaths(getDocsOutputPath(context.config.root), "env.md");
19
20
  if (!context.fs.existsSync(envDocFile)) return { contents: "" };
20
21
  return { contents: await context.fs.read(envDocFile) || "" };
21
22
  }, ["generate", "P\"/!"])
@@ -1 +1 @@
1
- {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AA2BT,MAAE,MAAgB,cAAA,YAAA,gBAAA;CAChB,MAAM;CACN,UAAQ,aAAW,eAAA,WAAA;EACjB,MAAE,aAAiB,UAAE,QAAS,OAAA,MAAA,QAAA,aAAA,SAAA;AAC9B,MAAI,CAAA,QAAQ,GAAA,WAAW,WAAA,CACrB,QAAO,EACL,UAAU,IACX;AAGH,SAAO,EACL,UAAS,qCAAA,IACV;IACA,CAAC,YAAG,QAAA,CAAA;CACR,CAAC,EAAE;CAAC;CAAC;CAAA;CAAA,CAAA"}
1
+ {"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.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 { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE9B,QAAO;;;;;;;;AA4BT,MAAE,MAAgB,cAAA,YAAA,gBAAA;CAChB,MAAM;CACN,UAAQ,aAAW,eAAA,WAAA;EACjB,MAAE,aAAiB,UAAE,kBAAS,QAAA,OAAA,KAAA,EAAA,SAAA;AAC9B,MAAI,CAAA,QAAA,GAAA,WAAkB,WAAe,CACnC,QAAO,EACN,UAAA;AAIH,SAAM,EACJ,UAAG,MAFM,QAAA,GAAA,KAAA,WAAA,IAEN,IACJ;;CAEJ,CAAC,EAAE;CAAC;CAAO;CAAQ;CAAS,CAAA"}
package/dist/index.cjs CHANGED
@@ -4,7 +4,6 @@ const require_types_plugin = require('./types/plugin.cjs');
4
4
  const require_helpers_reflect = require('./helpers/reflect.cjs');
5
5
  const require_helpers_persistence = require('./helpers/persistence.cjs');
6
6
  const require_helpers_load = require('./helpers/load.cjs');
7
- const require_helpers_docs_helper = require('./helpers/docs-helper.cjs');
8
7
  const require_helpers_automd_generator = require('./helpers/automd-generator.cjs');
9
8
  const require_components_docs = require('./components/docs.cjs');
10
9
  const require_components_env_builtin = require('./components/env-builtin.cjs');
@@ -13,8 +12,9 @@ let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type")
13
12
  let defu = require("defu");
14
13
  defu = require_runtime.__toESM(defu);
15
14
  let powerlines_constants = require("powerlines/constants");
16
- let _stryke_path_join = require("@stryke/path/join");
15
+ let powerlines_plugin_utils = require("powerlines/plugin-utils");
17
16
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
17
+ let _stryke_path_join = require("@stryke/path/join");
18
18
  let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
19
19
  let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
20
20
  let _powerlines_plugin_automd = require("@powerlines/plugin-automd");
@@ -196,7 +196,7 @@ const plugin = __assignType((options = {}) => {
196
196
  }, ["handler", "P\"/!"])
197
197
  },
198
198
  docs: __assignType(async function docs() {
199
- this.debug(`Documenting environment variables configuration values in "${(0, _stryke_path_join.joinPaths)(require_helpers_docs_helper.getDocsOutputPath(this), "env.md")}"`);
199
+ this.debug(`Documenting environment variables configuration values in "${(0, _stryke_path_join.joinPaths)((0, powerlines_plugin_utils.getDocsOutputPath)(this.config.root), "env.md")}"`);
200
200
  const result = await require_helpers_persistence.readEnvTypeReflection(this, "env");
201
201
  return (0, _powerlines_plugin_alloy_render.render)(this, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.EnvDocsFile, {
202
202
  levelOffset: 0,
package/dist/index.mjs CHANGED
@@ -2,7 +2,6 @@ import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "./types/plugin.mjs";
2
2
  import { reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
3
3
  import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, writeEnvReflection, writeEnvTypeReflection } from "./helpers/persistence.mjs";
4
4
  import { loadEnv } from "./helpers/load.mjs";
5
- import { getDocsOutputPath } from "./helpers/docs-helper.mjs";
6
5
  import { env } from "./helpers/automd-generator.mjs";
7
6
  import { EnvDocsFile } from "./components/docs.mjs";
8
7
  import { EnvBuiltin } from "./components/env-builtin.mjs";
@@ -10,8 +9,9 @@ import { envBabelPlugin } from "./babel/plugin.mjs";
10
9
  import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
11
10
  import defu from "defu";
12
11
  import { VIRTUAL_MODULE_PREFIX } from "powerlines/constants";
13
- import { joinPaths } from "@stryke/path/join";
12
+ import { getDocsOutputPath } from "powerlines/plugin-utils";
14
13
  import { createComponent } from "@alloy-js/core/jsx-runtime";
14
+ import { joinPaths } from "@stryke/path/join";
15
15
  import { getUnique } from "@stryke/helpers/get-unique";
16
16
  import { render } from "@powerlines/plugin-alloy/render";
17
17
  import automd from "@powerlines/plugin-automd";
@@ -190,7 +190,7 @@ const plugin = __assignType((options = {}) => {
190
190
  }, ["handler", "P\"/!"])
191
191
  },
192
192
  docs: __assignType(async function docs() {
193
- this.debug(`Documenting environment variables configuration values in "${joinPaths(getDocsOutputPath(this), "env.md")}"`);
193
+ this.debug(`Documenting environment variables configuration values in "${joinPaths(getDocsOutputPath(this.config.root), "env.md")}"`);
194
194
  const result = await readEnvTypeReflection(this, "env");
195
195
  return render(this, createComponent(EnvDocsFile, {
196
196
  levelOffset: 0,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { VIRTUAL_MODULE_PREFIX } from \"powerlines/constants\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { getDocsOutputPath } from \"./helpers/docs-helper\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit(options.deepkit),\n babel(options.babel),\n {\n name: \"env:core\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(config.env.secrets);\n\n const file = await this.fs.resolve(config.env.secrets.file);\n if (file) {\n config.env.secrets.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n );\n }\n }\n\n if (config.env.types || config.env.secrets) {\n config.tsc.filter = {\n id: [\n new RegExp(\n `^(${VIRTUAL_MODULE_PREFIX})?${joinPaths(\n this.builtinsPath,\n \"env.ts\"\n )\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\//g, \"\\\\/\")\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\$/g, \"\\\\$\")}$`\n )\n ]\n };\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.debug(\n `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n );\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAAyB,UAAA,EAAA,KAAA;AACzB,QAAA;EAAA,QAAA,QAAA,QAA+B;EAAA,MAAA,QAAA,MAAA;EAAA;GAC/B,MAAA;GACA,MAAA,SAAA;AACA,SAAA,MAAA,yEAAqB;IACrB,MAAA,SAAkB;KAClB,KAAA,KAAA,SAAA;MACQ,OAAO,EAAC;MACT,UAAW;MACX,QAAA;;MAEF,CAAA;cAEC,SAAQ,CAAA,eAAY,EAC1B;KACM,SAAE;MACR,YAAA;MACF,OAAA;;KAEE,KAAA,EAAA;KACG;AACH,QAAA,YAAA,OAAA,IAAA,MAAA,IAAA,OAAA,IAAA,SAAA,YAAA,OAAA,IAAA,MAAA,KAAA,EAAA;AACK,YAAM,IAAM,QAAI,oBAAiB,OAAA,IAAkB,MAAC;KACzD,MAAS,OAAA,MAAgB,KAAI,GAAA,QAAA,OAAA,IAAA,MAAA,KAAA;AAC1B,SAAA,KACI,QAAA,IAAA,MAAA,OAAA;WAEC;AACN,UAAA,KAAA,4FAAA;KACE,MAAO,2BAAS,MAAA,4BAAA,KAAA;KAChB,MAAM,OAAS,MAAA,KAAA,GAAA,QAAA,yBAAA,KAAA;AACb,SAAI,KACF,QAAC,IAAU,QAAQ,oBAAkB,GAAI,K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IAAsC;IAAG,CAAA,EAC7D;GACF;EAAE,OAAK,QAAA,OAAA;EAAA;GACP;OAAO;CAAK;QAAA,EAAA;CAAA;CAAA;CAAA,CAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport { VIRTUAL_MODULE_PREFIX } from \"powerlines/constants\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit(options.deepkit),\n babel(options.babel),\n {\n name: \"env:core\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(config.env.secrets);\n\n const file = await this.fs.resolve(config.env.secrets!.file);\n if (file) {\n config.env.secrets!.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n );\n }\n }\n\n if (config.env.types || config.env.secrets) {\n config.tsc.filter = {\n id: [\n new RegExp(\n `^(${VIRTUAL_MODULE_PREFIX})?${joinPaths(\n this.builtinsPath,\n \"env.ts\"\n )\n .replace(/\\\\/g, \"\\\\\\\\\")\n .replace(/\\//g, \"\\\\/\")\n .replace(/\\./g, \"\\\\.\")\n .replace(/\\$/g, \"\\\\$\")}$`\n )\n ]\n };\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.debug(\n `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n );\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAAyB,UAAA,EAAA,KAAA;AACzB,QAAA;EAAA,QAAA,QAAA,QAA+B;EAAA,MAAA,QAAA,MAAA;EAAA;GAC/B,MAAA;GACA,MAAA,SAAA;AACA,SAAA,MAAA,yEAAqB;IACrB,MAAA,SAAkB;KAClB,KAAA,KAAA,SAAA;MACQ,OAAO,EAAC;MACT,UAAW;MACX,QAAA;;MAEF,CAAA;cAEC,SAAQ,CAAA,eAAY,EAC1B;KACM,SAAE;MACR,YAAA;MACF,OAAA;;KAEE,KAAA,EAAA;KACG;AACH,QAAA,YAAA,OAAA,IAAA,MAAA,IAAA,OAAA,IAAA,SAAA,YAAA,OAAA,IAAA,MAAA,KAAA,EAAA;AACK,YAAM,IAAM,QAAI,oBAAiB,OAAA,IAAkB,MAAC;KACzD,MAAS,OAAA,MAAgB,KAAI,GAAA,QAAA,OAAA,IAAA,MAAA,KAAA;AAC1B,SAAA,KACI,QAAA,IAAA,MAAA,OAAA;WAEC;AACN,UAAA,KAAA,4FAAA;KACE,MAAO,2BAAS,MAAA,4BAAA,KAAA;KAChB,MAAM,OAAS,MAAA,KAAA,GAAA,QAAA,yBAAA,KAAA;AACb,SAAI,KACF,QAAC,IAAU,QAAQ,oBAAkB,GAAI,KAAA,GAAA,yBAA8B,OAAA;;AAG3E,QAAE,YAAc,OAAC,IAAA,QAA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OAAA;EAAA;GACP;OAAO;CAAK;QAAA,EAAA;CAAA;CAAA;CAAA,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.16.136",
3
+ "version": "0.16.138",
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"],
@@ -166,20 +166,6 @@
166
166
  "default": "./dist/helpers/create-reflection-resource.mjs"
167
167
  }
168
168
  },
169
- "./helpers/docs-helper": {
170
- "require": {
171
- "types": "./dist/helpers/docs-helper.d.cts",
172
- "default": "./dist/helpers/docs-helper.cjs"
173
- },
174
- "import": {
175
- "types": "./dist/helpers/docs-helper.d.mts",
176
- "default": "./dist/helpers/docs-helper.mjs"
177
- },
178
- "default": {
179
- "types": "./dist/helpers/docs-helper.d.mts",
180
- "default": "./dist/helpers/docs-helper.mjs"
181
- }
182
- },
183
169
  "./helpers/load": {
184
170
  "require": {
185
171
  "types": "./dist/helpers/load.d.cts",
@@ -306,12 +292,12 @@
306
292
  "@alloy-js/typescript": "0.23.0-dev.4",
307
293
  "@babel/core": "8.0.0-rc.3",
308
294
  "@babel/types": "8.0.0-rc.3",
309
- "@powerlines/plugin-alloy": "^0.26.29",
310
- "@powerlines/plugin-automd": "^0.1.411",
311
- "@powerlines/plugin-babel": "^0.12.405",
312
- "@powerlines/plugin-plugin": "^0.12.362",
313
- "@powerlines/deepkit": "^0.8.13",
314
- "@powerlines/plugin-deepkit": "^0.11.292",
295
+ "@powerlines/plugin-alloy": "^0.26.31",
296
+ "@powerlines/plugin-automd": "^0.1.413",
297
+ "@powerlines/plugin-babel": "^0.12.407",
298
+ "@powerlines/plugin-plugin": "^0.12.364",
299
+ "@powerlines/deepkit": "^0.8.15",
300
+ "@powerlines/plugin-deepkit": "^0.11.294",
315
301
  "@storm-software/config-tools": "^1.189.77",
316
302
  "@stryke/capnp": "^0.12.92",
317
303
  "@stryke/convert": "^0.6.58",
@@ -325,10 +311,10 @@
325
311
  "@stryke/types": "^0.11.3",
326
312
  "automd": "^0.4.3",
327
313
  "defu": "^6.1.7",
328
- "powerlines": "^0.43.10",
314
+ "powerlines": "^0.43.12",
329
315
  "c12": "^3.3.4"
330
316
  },
331
317
  "devDependencies": { "@types/node": "^25.6.0", "vite": "^8.0.10" },
332
318
  "publishConfig": { "access": "public" },
333
- "gitHead": "713163d802aa1d7c282a417119df058b4f151781"
319
+ "gitHead": "38520490a931e823de74962179f663502a83c4ea"
334
320
  }
@@ -1,25 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_plugin = require('../types/plugin.cjs');
4
- let _stryke_path_join = require("@stryke/path/join");
5
-
6
- //#region src/helpers/docs-helper.ts
7
- /**
8
- * Gets the output path for the generated environment documentation.
9
- *
10
- * @param context - The environment plugin context.
11
- * @returns The output path for the generated environment documentation.
12
- */
13
- function getDocsOutputPath(context) {
14
- return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "reference");
15
- }
16
- getDocsOutputPath.__type = [
17
- () => require_types_plugin.__ΩEnvPluginContext,
18
- "context",
19
- "getDocsOutputPath",
20
- "Gets the output path for the generated environment documentation.",
21
- "Pn!2\"&/#?$"
22
- ];
23
-
24
- //#endregion
25
- exports.getDocsOutputPath = getDocsOutputPath;
@@ -1,13 +0,0 @@
1
- import { EnvPluginContext } from "../types/plugin.cjs";
2
-
3
- //#region src/helpers/docs-helper.d.ts
4
- /**
5
- * Gets the output path for the generated environment documentation.
6
- *
7
- * @param context - The environment plugin context.
8
- * @returns The output path for the generated environment documentation.
9
- */
10
- declare function getDocsOutputPath(context: EnvPluginContext): string;
11
- //#endregion
12
- export { getDocsOutputPath };
13
- //# sourceMappingURL=docs-helper.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs-helper.d.cts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,iBAAA,CAAkB,OAAA,EAAS,gBAAA"}
@@ -1,13 +0,0 @@
1
- import { EnvPluginContext } from "../types/plugin.mjs";
2
-
3
- //#region src/helpers/docs-helper.d.ts
4
- /**
5
- * Gets the output path for the generated environment documentation.
6
- *
7
- * @param context - The environment plugin context.
8
- * @returns The output path for the generated environment documentation.
9
- */
10
- declare function getDocsOutputPath(context: EnvPluginContext): string;
11
- //#endregion
12
- export { getDocsOutputPath };
13
- //# sourceMappingURL=docs-helper.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs-helper.d.mts","names":[],"sources":["../../src/helpers/docs-helper.ts"],"mappings":";;;;;AA2BA;;;;iBAAgB,iBAAA,CAAkB,OAAA,EAAS,gBAAA"}
@@ -1,24 +0,0 @@
1
- import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { joinPaths } from "@stryke/path/join";
3
-
4
- //#region src/helpers/docs-helper.ts
5
- /**
6
- * Gets the output path for the generated environment documentation.
7
- *
8
- * @param context - The environment plugin context.
9
- * @returns The output path for the generated environment documentation.
10
- */
11
- function getDocsOutputPath(context) {
12
- return joinPaths(context.config.root, "docs", "reference");
13
- }
14
- getDocsOutputPath.__type = [
15
- () => __ΩEnvPluginContext,
16
- "context",
17
- "getDocsOutputPath",
18
- "Gets the output path for the generated environment documentation.",
19
- "Pn!2\"&/#?$"
20
- ];
21
-
22
- //#endregion
23
- export { getDocsOutputPath };
24
- //# sourceMappingURL=docs-helper.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.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 { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"reference\");\n}\n"],"mappings":";;;;;;;;;;AA0BA,SAAE,kBAAA,SAAA;AACF,QAAO,UAAS,QAAA,OAAkB,MAAA,QAAS,YAAiB;;AAE5D,kBAAA,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}