@powerlines/plugin-env 0.16.121 → 0.16.123

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.
@@ -20,17 +20,7 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
20
20
  "P\"2!\"/\""
21
21
  ]));
22
22
  if (node.name) {
23
- const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
24
- "prop",
25
- "",
26
- "P\"2!\"/\""
27
- ]))), [
28
- "pre",
29
- "",
30
- "P\"2!\"/\""
31
- ]));
32
- let name = node.name;
33
- if (prefix) name = node.name.replace(`${prefix}_`, "");
23
+ const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
34
24
  log(_storm_software_config_tools_types.LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
35
25
  if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
36
26
  "prop",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CA4M1B,uBAAA,GA5M0B,MAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CAgM1B,uBAAA,GAhM0B,MAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CA4M1B,uBAAA,GA5M0B,MAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CAgM1B,uBAAA,GAhM0B,MAAA"}
@@ -18,17 +18,7 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
18
18
  "P\"2!\"/\""
19
19
  ]));
20
20
  if (node.name) {
21
- const prefix = context.config.env.prefix.find(__assignType((pre) => node.name && node.name.startsWith(pre) && (context.env.types.env?.hasProperty(node.name.replace(`${pre}_`, "")) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(node.name.replace(`${pre}_`, "")), [
22
- "prop",
23
- "",
24
- "P\"2!\"/\""
25
- ]))), [
26
- "pre",
27
- "",
28
- "P\"2!\"/\""
29
- ]));
30
- let name = node.name;
31
- if (prefix) name = node.name.replace(`${prefix}_`, "");
21
+ const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
32
22
  log(LogLevelLabel.TRACE, `Environment variable ${name} found in ${pass.filename || "unknown file"}.`);
33
23
  if (context.env.types.env?.hasProperty(name) || envTypesAliasProperties.some(__assignType((prop) => prop.getAlias().includes(name), [
34
24
  "prop",
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAU;;AA8BX,MAAO,kBAAA,kBAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;CACH,SAAM,WAAc,MAAA,MAAA,eAAA,OAAA,iBAAA,OAAA;EACpB,MAAS,0BAAU,QAAA,IAAA,MAAA,KACT,eAAU,CACZ,OAAA,cAAe,SAAA,KAAA,UAAA,CAAA,SAAA,GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AACr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aAAY,EAAA,MAAe,OAAM,CAAA,IAC7B,KACH,IAAY,SAAS,EACvB,IAAA,SAAA,EACH,aAAA,EAAA,MAAA,WAAA,CAAA;GAGF,MAAA,aAAA,KAAA,IAAA,WAAA,EAAA;AACS,OAAA,CAAA,WAAe,KACd;AAED,cAAW,YAAa,MAAI,OAAO,MAAA;AACzC,QAAA,wBAAA,OAAA,WAAA,OAAA;;IAEW,QAAA,GAAW,QAAC,OAAc,aAAU,aAAgB;IAC9D,MAAgB;IACN,UAAU;IAClB,CAAA;aAEM,KACJ,IAAA,SAAA,EACE,IAAM,WAAA,EACJ,aAAK,EAAA,MAAgB,OAAM,CAAA,IAC7B,KAAE,IAAK,SAAW,EAAA,IAAM,SAAG,EAAA,gBAAA,IAC7B,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEE,MAAM,aAAI,KAAA,IAAA,WAAA,EAAA;AACV,OAAI,CAAC,WAAS,KACV;AAEJ,cAAW,YAAM,MAAA,OAAA,MAAA;AACjB,QAAG,wBAAA,OAAA,WAAA,OAAA;AACN,aAAA,MAAA;IACL,QAAA,GAAA,QAAA,OAAA,aAAA,aAAA;IACK,MAAA;IACA,UAAA;IACC,CAAA;aAED,KAAA,IAAA,SAAA,EAAA,aAAA,EAAA,MAAA,OAAA,CAAA,IACA,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEN,MAAA,aAAA,KAAA,IAAA,WAAA,EAAA;AACQ,OAAK,CAAA,WAAY,KACd;AAER,cAAA,YAAA,MAAA,OAAA,KAAA;;IAEA;QAAK;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EACV,EACJ;GACF;CAAC;CAAI;CAAA;CAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"plugin.mjs","names":[],"sources":["../../src/babel/plugin.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { NodePath } from \"@babel/core\";\nimport * as t from \"@babel/types\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { BabelPluginPass } from \"@powerlines/plugin-babel/types/config\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false,\n isUsingBuiltin = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n log(\n LogLevelLabel.DEBUG,\n `Adding \"${name}\" environment variables found in \"${\n pass.filename || \"unknown file\"\n }\" to used environment configuration reflection object.`\n );\n\n context.env.used.env.addProperty(envProperty.property);\n }\n\n if (context.config.env.inject && isInjectable) {\n let value = context.env.parsed?.[name];\n if (value === undefined) {\n const prefix = context.config.env.prefix.find(pre => {\n return context.env.parsed[`${pre.replace(/_$/g, \"\")}_${name}`];\n });\n if (prefix) {\n value =\n context.env.parsed[`${prefix.replace(/_$/g, \"\")}_${name}`];\n }\n }\n\n value ??= envProperty.getDefaultValue();\n\n if (envProperty.isValueRequired() && value === undefined) {\n throw new Error(\n `Environment variable \\`${name}\\` is not defined in the .env configuration files`\n );\n }\n\n return stringifyDefaultValue(envProperty, value);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `The \"${name}\" environment variable is not defined in the \\`env\\` type definition, but is used in the source code file ${\n pass.filename ? pass.filename : \"unknown\"\n }.\n\n The following environment configuration names are defined in the \\`env\\` type definition: \\n${context.env.types.env\n ?.getPropertyNames()\n .sort((a, b) => String(a).localeCompare(String(b)))\n .map(\n typeDef =>\n ` - ${String(typeDef)} ${\n envTypesAliasProperties.some(\n prop =>\n prop.getNameAsString() === String(typeDef) &&\n prop.getAlias().length > 0\n )\n ? `(Alias: ${envTypesAliasProperties\n ?.find(\n prop => prop.getNameAsString() === String(typeDef)\n )\n ?.getAlias()\n .join(\", \")})`\n : \"\"\n }`\n )\n .join(\n \"\\n\"\n )} \\n\\nUsing the following env prefix: \\n${context.config.env.prefix\n .map(prefix => ` - ${prefix}`)\n .join(\n \"\\n\"\n )} \\n\\nPlease check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code. \\n\\n`\n );\n } else if (pass.filename && isUsingBuiltin) {\n context.warn(\n `The \"${\n name\n }\" environment variable is used in the source code file ${\n pass.filename\n }, but is not defined in the \\`env\\` type definition. If this is intentional, you can ignore this warning. Otherwise, please check your \\`env\\` configuration option. If you are using a custom dotenv type definition, please make sure that the configuration names match the ones in the code.`\n );\n }\n }\n\n return undefined;\n }\n\n return {\n visitor: {\n MemberExpression(\n path: NodePath<t.MemberExpression>,\n pass: BabelPluginPass\n ) {\n if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAU;;AA8BX,MAAO,kBAAA,kBAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;CACH,SAAM,WAAc,MAAA,MAAA,eAAA,OAAA,iBAAA,OAAA;EACpB,MAAS,0BAAU,QAAA,IAAA,MAAA,KACT,eAAU,CAC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ACtB,MAAA;IACM,UAAE;IACL,CAAC;aAEJ,KACG,IAAG,SAAS,EACX,IAAI,WAAI,EACR,aAAY,EAAA,MAAK,OAAA,CAAA,IACnB,KAAI,IAAA,SAAA,EAAA,IAAA,SAAA,EAAA,gBAAA,IACJ,KAAK,IAAC,WAAS,EAAA,cAAA,EAAA;GAEf,MAAG,aAAA,KAAA,IAAA,WAAA,EAAA;AACN,OAAA,CAAA,WAAA,KACL;AAEK,cAAA,YAAA,MAAA,OAAA,MAAA;AACC,QAAO,wBAAwB,OAAM,WAAQ,OAAW;AACzD,aAAa,MAAG;IAChB,QAAA,GAAA,QAAA,OAAA,aAAA,aAAA;IACA,MAAA;IACC,UAAc;IACrB,CAAA;aAEW,KAAA,IAAA,SAAA,EAAA,aAAA,EAAA,MAAA,OAAA,CAAA,IACH,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEJ,MAAW,aAAa,KAAK,IAAG,WAAW,EAAA;AACvC,OAAA,CAAA,WAAA,KACG;AAEd,cAAA,YAAA,MAAA,OAAA,KAAA;;;;;;;;KAGF,EACF"}
@@ -1,5 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_types_plugin = require('../types/plugin.cjs');
3
4
  const require_helpers_docs_helper = require('../helpers/docs-helper.cjs');
4
5
  let _powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
5
6
  let _stryke_path_join = require("@stryke/path/join");
@@ -12,12 +13,30 @@ let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@power
12
13
  let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
13
14
 
14
15
  //#region src/components/docs.tsx
16
+ const __ΩPartial = [
17
+ "T",
18
+ "Partial",
19
+ "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
20
+ ];
21
+ function __assignType(fn, args) {
22
+ fn.__type = args;
23
+ return fn;
24
+ }
25
+ const __ΩEnvDocsFileProps = [
26
+ () => __ΩPartial,
27
+ "levelOffset",
28
+ 0,
29
+ "The heading level offset to apply to the generated documentation.",
30
+ "reflection",
31
+ "EnvDocsFileProps",
32
+ "P!o!\"'4\"8>#?$!4%Mw&y"
33
+ ];
15
34
  /**
16
35
  * Generates the environment configuration markdown documentation for the Powerlines project.
17
36
  */
18
37
  function EnvDocsFile(props) {
19
38
  const { levelOffset = 0, reflection, ...rest } = props;
20
- const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
39
+ const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
21
40
  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() {
22
41
  return (0, _stryke_path_join.joinPaths)(require_helpers_docs_helper.getDocsOutputPath(context), "env.md");
23
42
  } }, rest, { get children() {
@@ -52,7 +71,16 @@ function EnvDocsFile(props) {
52
71
  _alloy_js_core.code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text to the public.`,
53
72
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
54
73
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
55
- return reflection?.getProperties().filter((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__" && !property.isHidden()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
74
+ return reflection?.getProperties().filter(__assignType((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__" && !property.isHidden(), [
75
+ "property",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
79
+ "a",
80
+ "b",
81
+ "",
82
+ "P\"2!\"2\"\"/#"
83
+ ])).map(__assignType((reflectionProperty) => {
56
84
  return {
57
85
  name: reflectionProperty.getNameAsString().trim(),
58
86
  description: (reflectionProperty.getDescription() ?? "").trim(),
@@ -60,11 +88,23 @@ function EnvDocsFile(props) {
60
88
  defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
61
89
  required: reflectionProperty.isValueRequired() ? "" : "✔"
62
90
  };
63
- }) ?? [];
91
+ }, [
92
+ "reflectionProperty",
93
+ "",
94
+ "P\"2!\"/\""
95
+ ])) ?? [];
64
96
  } })
65
97
  ];
66
98
  } }));
67
99
  }
100
+ EnvDocsFile.__type = [
101
+ () => __ΩEnvDocsFileProps,
102
+ "props",
103
+ "EnvDocsFile",
104
+ "Generates the environment configuration markdown documentation for the Powerlines project.",
105
+ "Pn!2\"\"/#?$"
106
+ ];
68
107
 
69
108
  //#endregion
70
- exports.EnvDocsFile = EnvDocsFile;
109
+ exports.EnvDocsFile = EnvDocsFile;
110
+ exports.__ΩEnvDocsFileProps = __ΩEnvDocsFileProps;
@@ -1,3 +1,4 @@
1
+ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
1
2
  import { getDocsOutputPath } from "../helpers/docs-helper.mjs";
2
3
  import { stringifyType } from "@powerlines/deepkit/vendor/type";
3
4
  import { joinPaths } from "@stryke/path/join";
@@ -10,12 +11,30 @@ import { MarkdownFile } from "@powerlines/plugin-alloy/markdown/components/markd
10
11
  import { MarkdownTable } from "@powerlines/plugin-alloy/markdown/components/markdown-table";
11
12
 
12
13
  //#region src/components/docs.tsx
14
+ const __ΩPartial = [
15
+ "T",
16
+ "Partial",
17
+ "l+e#!e\"!fRb!Pde\"!gN#\"w\"y"
18
+ ];
19
+ function __assignType(fn, args) {
20
+ fn.__type = args;
21
+ return fn;
22
+ }
23
+ const __ΩEnvDocsFileProps = [
24
+ () => __ΩPartial,
25
+ "levelOffset",
26
+ 0,
27
+ "The heading level offset to apply to the generated documentation.",
28
+ "reflection",
29
+ "EnvDocsFileProps",
30
+ "P!o!\"'4\"8>#?$!4%Mw&y"
31
+ ];
13
32
  /**
14
33
  * Generates the environment configuration markdown documentation for the Powerlines project.
15
34
  */
16
35
  function EnvDocsFile(props) {
17
36
  const { levelOffset = 0, reflection, ...rest } = props;
18
- const context = usePowerlines();
37
+ const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
19
38
  return createComponent(MarkdownFile, mergeProps({ get path() {
20
39
  return joinPaths(getDocsOutputPath(context), "env.md");
21
40
  } }, rest, { get children() {
@@ -50,7 +69,16 @@ function EnvDocsFile(props) {
50
69
  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 to the public.`,
51
70
  createComponent(Spacing, {}),
52
71
  createComponent(MarkdownTable, { get data() {
53
- return reflection?.getProperties().filter((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__" && !property.isHidden()).sort((a, b) => a.getNameAsString().localeCompare(b.getNameAsString())).map((reflectionProperty) => {
72
+ return reflection?.getProperties().filter(__assignType((property) => property.getNameAsString() !== "__POWERLINES_INJECTED__" && !property.isHidden(), [
73
+ "property",
74
+ "",
75
+ "P\"2!\"/\""
76
+ ])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
77
+ "a",
78
+ "b",
79
+ "",
80
+ "P\"2!\"2\"\"/#"
81
+ ])).map(__assignType((reflectionProperty) => {
54
82
  return {
55
83
  name: reflectionProperty.getNameAsString().trim(),
56
84
  description: (reflectionProperty.getDescription() ?? "").trim(),
@@ -58,12 +86,23 @@ function EnvDocsFile(props) {
58
86
  defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
59
87
  required: reflectionProperty.isValueRequired() ? "" : "✔"
60
88
  };
61
- }) ?? [];
89
+ }, [
90
+ "reflectionProperty",
91
+ "",
92
+ "P\"2!\"/\""
93
+ ])) ?? [];
62
94
  } })
63
95
  ];
64
96
  } }));
65
97
  }
98
+ EnvDocsFile.__type = [
99
+ () => __ΩEnvDocsFileProps,
100
+ "props",
101
+ "EnvDocsFile",
102
+ "Generates the environment configuration markdown documentation for the Powerlines project.",
103
+ "Pn!2\"\"/#?$"
104
+ ];
66
105
 
67
106
  //#endregion
68
- export { EnvDocsFile };
107
+ export { EnvDocsFile, __ΩEnvDocsFileProps };
69
108
  //# sourceMappingURL=docs.mjs.map
@@ -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 { Heading, 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 {\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 to the public.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n property.getNameAsString() !== \"__POWERLINES_INJECTED__\" &&\n !property.isHidden()\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(\" | \", \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() 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A,CAAA,MAAA;MACvD,UAAA,mBAAA,iBAAA,GAAA,KAAA;MACC;MACD,IAAE,EAAA;MAEP,CAAC;GAAC;IAEN,CAAC,CAAC"}
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 { Heading, 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 {\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 to the public.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n property.getNameAsString() !== \"__POWERLINES_INJECTED__\" &&\n !property.isHidden()\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(\" | \", \", 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;;;;;;;;;;;;;;AAiCT,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;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