@powerlines/plugin-env 0.16.240 → 0.16.250

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/babel/plugin.cjs +8 -10
  2. package/dist/babel/plugin.d.cts.map +1 -1
  3. package/dist/babel/plugin.d.mts.map +1 -1
  4. package/dist/babel/plugin.mjs +9 -10
  5. package/dist/babel/plugin.mjs.map +1 -1
  6. package/dist/components/docs.cjs +14 -11
  7. package/dist/components/docs.d.cts.map +1 -1
  8. package/dist/components/docs.d.mts.map +1 -1
  9. package/dist/components/docs.mjs +15 -11
  10. package/dist/components/docs.mjs.map +1 -1
  11. package/dist/components/env-builtin.cjs +19 -22
  12. package/dist/components/env-builtin.d.cts.map +1 -1
  13. package/dist/components/env-builtin.d.mts.map +1 -1
  14. package/dist/components/env-builtin.mjs +19 -21
  15. package/dist/components/env-builtin.mjs.map +1 -1
  16. package/dist/helpers/automd-generator.cjs +0 -1
  17. package/dist/helpers/index.cjs +2 -4
  18. package/dist/helpers/index.d.cts +2 -2
  19. package/dist/helpers/index.d.mts +2 -2
  20. package/dist/helpers/index.mjs +2 -2
  21. package/dist/helpers/load.cjs +1 -1
  22. package/dist/helpers/load.d.cts +3 -3
  23. package/dist/helpers/load.d.mts +3 -3
  24. package/dist/helpers/load.mjs +1 -1
  25. package/dist/helpers/load.mjs.map +1 -1
  26. package/dist/helpers/schema.cjs +24 -75
  27. package/dist/helpers/schema.d.cts +2 -16
  28. package/dist/helpers/schema.d.cts.map +1 -1
  29. package/dist/helpers/schema.d.mts +2 -16
  30. package/dist/helpers/schema.d.mts.map +1 -1
  31. package/dist/helpers/schema.mjs +25 -74
  32. package/dist/helpers/schema.mjs.map +1 -1
  33. package/dist/helpers/source-file-env.cjs +0 -1
  34. package/dist/index.cjs +3 -3
  35. package/dist/index.d.cts +2 -2
  36. package/dist/index.d.mts +2 -2
  37. package/dist/index.mjs +5 -5
  38. package/dist/index.mjs.map +1 -1
  39. package/dist/types/index.cjs +1 -1
  40. package/dist/types/index.d.cts +2 -2
  41. package/dist/types/index.d.mts +2 -2
  42. package/dist/types/index.mjs +2 -2
  43. package/dist/types/plugin.cjs +12 -14
  44. package/dist/types/plugin.d.cts +14 -8
  45. package/dist/types/plugin.d.cts.map +1 -1
  46. package/dist/types/plugin.d.mts +14 -8
  47. package/dist/types/plugin.d.mts.map +1 -1
  48. package/dist/types/plugin.mjs +12 -14
  49. package/dist/types/plugin.mjs.map +1 -1
  50. package/package.json +11 -11
@@ -1,10 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_types_plugin = require('../types/plugin.cjs');
4
- let _powerlines_schema = require("@powerlines/schema");
5
3
  let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
6
4
  let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
7
5
  let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
6
+ let _powerlines_schema = require("@powerlines/schema");
8
7
  let _stryke_type_checks_is_undefined = require("@stryke/type-checks/is-undefined");
9
8
 
10
9
  //#region src/babel/plugin.ts
@@ -13,7 +12,7 @@ function __assignType(fn, args) {
13
12
  return fn;
14
13
  }
15
14
  const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_babel_helpers_create_plugin.createBabelPlugin)("env", __assignType(({ logger, context }) => {
16
- const vars = (0, _powerlines_schema.getProperties)(context.env.vars);
15
+ const vars = (_powerlines_schema.getProperties.Ω = [[() => require_types_plugin.__ΩEnv, "n!"]], (0, _powerlines_schema.getProperties)(context.env.vars));
17
16
  function extractEnv(node, pass, isInjectable = false) {
18
17
  if (node.name) {
19
18
  const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
@@ -21,17 +20,16 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
21
20
  meta: { category: "env" },
22
21
  message: `Environment variable ${name} found in ${pass.filename || "unknown file"}.`
23
22
  });
24
- if (name in vars && (0, _stryke_type_checks_is_set_object.isSetObject)(vars[name]) && !vars[name]?.metadata?.isIgnored) {
25
- vars[name].metadata ??= {};
23
+ if (name in vars && (0, _stryke_type_checks_is_set_object.isSetObject)(vars[name]) && !vars[name]?.isIgnored) {
24
+ vars[name] ??= {};
26
25
  logger.debug({
27
26
  meta: { category: "env" },
28
27
  message: `The "${name}" environment variable is used in the source code file "${pass.filename || "unknown file"}" and will be added to the environment schema's active variables list.`
29
28
  });
30
- vars[name].metadata.active ??= [];
31
- vars[name].metadata.active.push(name);
32
- if (!vars[name].metadata.isRuntime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
33
- if (context.config.env.validate && !vars[name].optional && (0, _stryke_type_checks_is_undefined.isUndefined)(vars[name].metadata.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
34
- return (0, _powerlines_schema.stringifyValue)(vars[name].metadata.default);
29
+ vars[name].active = true;
30
+ if (!vars[name].runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
31
+ if (context.config.env.validate && !vars[name].optional && (0, _stryke_type_checks_is_undefined.isUndefined)(vars[name].default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
32
+ return (0, _powerlines_schema.stringifyValue)(vars[name].default);
35
33
  }
36
34
  } else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`vars\` schema. Please check the \`env.vars\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`);
37
35
  else logger.warn({
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAkCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CA4J1B,uBAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAkCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CAuJ1B,uBAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAkCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CA4J1B,uBAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAkCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CAuJ1B,uBAAA"}
@@ -1,8 +1,8 @@
1
- import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { getProperties, stringifyValue } from "@powerlines/schema";
1
+ import { __ΩEnv, __ΩEnvPluginContext } from "../types/plugin.mjs";
3
2
  import { isSetObject } from "@stryke/type-checks/is-set-object";
4
3
  import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
5
4
  import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
5
+ import { getProperties, stringifyValue } from "@powerlines/schema";
6
6
  import { isUndefined } from "@stryke/type-checks/is-undefined";
7
7
 
8
8
  //#region src/babel/plugin.ts
@@ -11,7 +11,7 @@ function __assignType(fn, args) {
11
11
  return fn;
12
12
  }
13
13
  const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!"]], createBabelPlugin("env", __assignType(({ logger, context }) => {
14
- const vars = getProperties(context.env.vars);
14
+ const vars = (getProperties.Ω = [[() => __ΩEnv, "n!"]], getProperties(context.env.vars));
15
15
  function extractEnv(node, pass, isInjectable = false) {
16
16
  if (node.name) {
17
17
  const name = node.name.replace(new RegExp(`^(${context.config.env.prefix.join("|")})_`), "");
@@ -19,17 +19,16 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
19
19
  meta: { category: "env" },
20
20
  message: `Environment variable ${name} found in ${pass.filename || "unknown file"}.`
21
21
  });
22
- if (name in vars && isSetObject(vars[name]) && !vars[name]?.metadata?.isIgnored) {
23
- vars[name].metadata ??= {};
22
+ if (name in vars && isSetObject(vars[name]) && !vars[name]?.isIgnored) {
23
+ vars[name] ??= {};
24
24
  logger.debug({
25
25
  meta: { category: "env" },
26
26
  message: `The "${name}" environment variable is used in the source code file "${pass.filename || "unknown file"}" and will be added to the environment schema's active variables list.`
27
27
  });
28
- vars[name].metadata.active ??= [];
29
- vars[name].metadata.active.push(name);
30
- if (!vars[name].metadata.isRuntime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
31
- if (context.config.env.validate && !vars[name].optional && isUndefined(vars[name].metadata.default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
32
- return stringifyValue(vars[name].metadata.default);
28
+ vars[name].active = true;
29
+ if (!vars[name].runtime && (context.config.env.inject && isInjectable || context.config.env.validate)) {
30
+ if (context.config.env.validate && !vars[name].optional && isUndefined(vars[name].default)) throw new Error(`Environment variable \`${name}\` is missing a default value, but is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}.\n\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`);
31
+ return stringifyValue(vars[name].default);
33
32
  }
34
33
  } else if (context.config.env.validate) throw new Error(`Environment variable \`${name}\` is active in the source code${pass.filename ? ` file \`${pass.filename}\`` : ""}, but is not defined in the \`vars\` schema. Please check the \`env.vars\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`);
35
34
  else logger.warn({
@@ -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 { 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 { getProperties, stringifyValue } from \"@powerlines/schema\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { EnvPluginContext, EnvSchemaMetadata } 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 ({ logger, context }) => {\n const vars = getProperties(context.env.vars);\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n logger.trace({\n meta: {\n category: \"env\"\n },\n message: `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n });\n\n if (\n name in vars &&\n isSetObject(vars[name]) &&\n !vars[name]?.metadata?.isIgnored\n ) {\n vars[name].metadata ??= {} as EnvSchemaMetadata;\n\n logger.debug({\n meta: {\n category: \"env\"\n },\n message: `The \"${name}\" environment variable is used in the source code file \"${\n pass.filename || \"unknown file\"\n }\" and will be added to the environment schema's active variables list.`\n });\n\n vars[name].metadata.active ??= [];\n vars[name].metadata.active.push(name);\n if (\n !vars[name].metadata.isRuntime &&\n ((context.config.env.inject && isInjectable) ||\n context.config.env.validate)\n ) {\n if (\n context.config.env.validate &&\n !vars[name].optional &&\n isUndefined(vars[name].metadata.default)\n ) {\n throw new Error(\n `Environment variable \\`${\n name\n }\\` is missing a default value, but is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }.\\n\\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`\n );\n }\n\n return stringifyValue(vars[name].metadata.default);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`vars\\` schema. Please check the \\`env.vars\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n );\n } else {\n logger.warn({\n meta: {\n category: \"env\"\n },\n message: `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`vars\\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \\`env.vars\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source 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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;4HAaA,QACA,cACM;CACN,MAAQ,OAAC,cAAmB,QAAA,IAAW,IAAM;CAC7C,SAAS,WAAA,MAAkB,MAAO,eAAW,OAAO;EACpD,IAAQ,KAAC,MAAA;GACH,MAAG,OAAA,KAAc,KAAM,QAAQ,IAAI,OAAO,KAAI,QAAI,OAAO,IAAA,OAAA,KAAA,GAAA,EAAA,GAAA,GAAA,EAAA;GACzD,OAAG,MAAA;IACD,MAAC,kBAER;IACM,SAAU,wBAAe,KAAc,YAAM,KAAA,YAAA,eAAA;GACnD,CAAA;GACG,IAAM,QAAQ,QAAI,YAAW,KAAA,KAAA,KAAA,CAAA,KAAA,OAAA,UAAA,WAAA;IAC7B,KAAQ,MAAI,aAAa,CAAA;IAC3B,OAAA,MAAA;KACK,MAAM,EACN,UAAA,MACF;KACK,SAAO,QAAA,KAAc,0DAAiB,KAAA,YAA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AAA,GAAA,eAAA,KAAA,KAAA,IAAA,UAAA,GAAA,aAAA,GAAA;GAE1B,MAAI,aAAA,KAAA,IAAA,UAAA,GAAA;GACJ,IAAI,CAAA,WAAU,MACZ;GAEF,WAAU,YAAa,MAAA,KAAQ;GAC/B,KAAK,wBAAqB,OAAS,WAAK,MAAa;GACrD,UAAU,MAAC;IACT,QAAG,GAAA,QAAA,OAAA,WAAA,QAAA,aAAA;IACH,MAAA;;GAEF,CAAC;EACH,OAAE,IAAA,KAAA,IAAA,QAAA,GAAA,aAAA,EACA,MAAK,MACP,CAAC,KAAC,KAAS,IAAC,UAAK,GAAA,aAAA,GAAA;GAEf,MAAI,aAAe,KAAG,IAAM,UAAQ,GAAA;GACpC,IAAI,CAAC,WAAW,MACf;GAED,WAAW,YAAC,MAAA,KAAA;EACd;CACF,GAAG;EAAC;EAAY;EAAM;EAAA;EAAA;CAAA,CAAA,EACxB,EACF;AACF,GAAG;CAAC;CAAU;CAAI;AAAS,CAAC,CAAC"}
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 { 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 { getProperties, stringifyValue } from \"@powerlines/schema\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\nimport { Env, 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 ({ logger, context }) => {\n const vars = getProperties<Env>(context.env.vars);\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n if (node.name) {\n const name = node.name.replace(\n new RegExp(`^(${context.config.env.prefix.join(\"|\")})_`),\n \"\"\n );\n\n logger.trace({\n meta: {\n category: \"env\"\n },\n message: `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n });\n\n if (name in vars && isSetObject(vars[name]) && !vars[name]?.isIgnored) {\n vars[name] ??= {} as Env[string];\n\n logger.debug({\n meta: {\n category: \"env\"\n },\n message: `The \"${name}\" environment variable is used in the source code file \"${\n pass.filename || \"unknown file\"\n }\" and will be added to the environment schema's active variables list.`\n });\n\n vars[name]!.active = true;\n if (\n !vars[name]!.runtime &&\n ((context.config.env.inject && isInjectable) ||\n context.config.env.validate)\n ) {\n if (\n context.config.env.validate &&\n !vars[name]!.optional &&\n isUndefined(vars[name]!.default)\n ) {\n throw new Error(\n `Environment variable \\`${\n name\n }\\` is missing a default value, but is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }.\\n\\nPlease add a default value to the schema, or if this variable is optional, please mark it as optional in the type definition.`\n );\n }\n\n return stringifyValue(vars[name]!.default);\n }\n } else if (context.config.env.validate) {\n throw new Error(\n `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`vars\\` schema. Please check the \\`env.vars\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source code.`\n );\n } else {\n logger.warn({\n meta: {\n category: \"env\"\n },\n message: `Environment variable \\`${name}\\` is active in the source code${\n pass.filename ? ` file \\`${pass.filename}\\`` : \"\"\n }, but is not defined in the \\`vars\\` schema. If this is intentional, you can ignore this warning. Otherwise, please check the \\`env.vars\\` configuration option. If you are using a custom env schema, please make sure that the configuration variable names match the ones used in the source 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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework?.name || \"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);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU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;AAEJ,GAAG;CAAC;CAAS;CAAA;AAAS,CAAA,CAAA"}
@@ -1,8 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_types_plugin = require('../types/plugin.cjs');
4
3
  let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
5
- let _stryke_path_join = require("@stryke/path/join");
6
4
  let powerlines_plugin_utils = require("powerlines/plugin-utils");
7
5
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
8
6
  let _alloy_js_core = require("@alloy-js/core");
@@ -13,6 +11,7 @@ let _powerlines_plugin_alloy_markdown_components_heading = require("@powerlines/
13
11
  let _powerlines_plugin_alloy_markdown_components_markdown_file = require("@powerlines/plugin-alloy/markdown/components/markdown-file");
14
12
  let _powerlines_plugin_alloy_markdown_components_markdown_table = require("@powerlines/plugin-alloy/markdown/components/markdown-table");
15
13
  let _powerlines_schema_codegen = require("@powerlines/schema/codegen");
14
+ let _stryke_path_join = require("@stryke/path/join");
16
15
 
17
16
  //#region src/components/docs.tsx
18
17
  const __ΩPartial = [
@@ -46,7 +45,7 @@ function EnvDocsFile(props) {
46
45
  level: 1 + levelOffset,
47
46
  children: "Environment Configuration"
48
47
  }),
49
- _alloy_js_core.code`Below is a list of environment variables used by the`,
48
+ _alloy_js_core.code`Below is a list of environment configuration parameters used by the`,
50
49
  (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
51
50
  get when() {
52
51
  return !!context.packageJson.name;
@@ -66,28 +65,32 @@ function EnvDocsFile(props) {
66
65
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
67
66
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_heading.Heading, {
68
67
  level: 2 + levelOffset,
69
- children: "Environment Variables"
68
+ children: "Variables"
70
69
  }),
71
70
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
72
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.`,
73
72
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
74
73
  (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
75
- return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars).filter(__assignType((property) => context.env.vars.active?.includes(property.name) && !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
74
+ return (_powerlines_schema_helpers.getPropertiesList.Ω = [[() => require_types_plugin.__ΩEnv, "n!"]], (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars)).filter(__assignType((property) => (_powerlines_schema_helpers.getPropertiesList.Ω = [[() => require_types_plugin.__ΩEnv, "n!"]], (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars)).some(__assignType((p) => p.name === property.name && p.active, [
75
+ "p",
76
+ "",
77
+ "P\"2!\"/\""
78
+ ])) && !property?.hidden && !property?.ignore && !property?.readOnly && !property?.internal, [
76
79
  "property",
77
80
  "",
78
81
  "P\"2!\"/\""
79
- ])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
82
+ ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a.name.localeCompare(b.name), [
80
83
  "a",
81
84
  "b",
82
85
  "",
83
86
  "P\"2!\"2\"\"/#"
84
87
  ])).map(__assignType((property) => {
85
88
  return {
86
- name: property.metadata?.name?.trim(),
87
- description: (property.metadata?.description ?? "").trim(),
88
- type: (0, _powerlines_schema_codegen.stringifyType)(property).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
89
- defaultValue: property.metadata?.defaultValue ? (0, _powerlines_schema_codegen.stringifyType)(property.metadata.defaultValue) : "",
90
- required: property.optional ? "" : "✔"
89
+ name: property.name?.trim(),
90
+ description: (property.description ?? "").trim(),
91
+ type: (_powerlines_schema_codegen.stringifyType.Ω = [["\""]], (0, _powerlines_schema_codegen.stringifyType)(property)).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
92
+ defaultValue: property.default ? (0, _powerlines_schema_codegen.stringifyType)(property.default) : "",
93
+ required: property.nullable ? "" : "✔"
91
94
  };
92
95
  }, [
93
96
  "property",
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
1
+ {"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAmCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAkCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
1
+ {"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;UAmCiB,gBAAA,SAAyB,OAAO,CAAC,iBAAA;;AAAlD;;;;;;;EASE,WAAA;AAAA;AAMF;;;AAAA,iBAAgB,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
@@ -1,6 +1,5 @@
1
- import { __ΩEnvPluginContext } from "../types/plugin.mjs";
1
+ import { __ΩEnv, __ΩEnvPluginContext } from "../types/plugin.mjs";
2
2
  import { getPropertiesList } from "@powerlines/schema/helpers";
3
- import { joinPaths } from "@stryke/path/join";
4
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";
@@ -11,6 +10,7 @@ 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";
13
12
  import { stringifyType } from "@powerlines/schema/codegen";
13
+ import { joinPaths } from "@stryke/path/join";
14
14
 
15
15
  //#region src/components/docs.tsx
16
16
  const __ΩPartial = [
@@ -44,7 +44,7 @@ function EnvDocsFile(props) {
44
44
  level: 1 + levelOffset,
45
45
  children: "Environment Configuration"
46
46
  }),
47
- code`Below is a list of environment variables used by the`,
47
+ code`Below is a list of environment configuration parameters used by the`,
48
48
  createComponent(Show, {
49
49
  get when() {
50
50
  return !!context.packageJson.name;
@@ -64,28 +64,32 @@ function EnvDocsFile(props) {
64
64
  createComponent(Spacing, {}),
65
65
  createComponent(Heading, {
66
66
  level: 2 + levelOffset,
67
- children: "Environment Variables"
67
+ children: "Variables"
68
68
  }),
69
69
  createComponent(Spacing, {}),
70
70
  code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`,
71
71
  createComponent(Spacing, {}),
72
72
  createComponent(MarkdownTable, { get data() {
73
- return getPropertiesList(context.env.vars).filter(__assignType((property) => context.env.vars.active?.includes(property.name) && !property?.metadata?.isHidden && !property?.metadata?.isIgnored && !property?.metadata?.isReadonly && !property?.metadata?.isInternal, [
73
+ return (getPropertiesList.Ω = [[() => __ΩEnv, "n!"]], getPropertiesList(context.env.vars)).filter(__assignType((property) => (getPropertiesList.Ω = [[() => __ΩEnv, "n!"]], getPropertiesList(context.env.vars)).some(__assignType((p) => p.name === property.name && p.active, [
74
+ "p",
75
+ "",
76
+ "P\"2!\"/\""
77
+ ])) && !property?.hidden && !property?.ignore && !property?.readOnly && !property?.internal, [
74
78
  "property",
75
79
  "",
76
80
  "P\"2!\"/\""
77
- ])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
81
+ ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a.name.localeCompare(b.name), [
78
82
  "a",
79
83
  "b",
80
84
  "",
81
85
  "P\"2!\"2\"\"/#"
82
86
  ])).map(__assignType((property) => {
83
87
  return {
84
- name: property.metadata?.name?.trim(),
85
- description: (property.metadata?.description ?? "").trim(),
86
- type: stringifyType(property).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
87
- defaultValue: property.metadata?.defaultValue ? stringifyType(property.metadata.defaultValue) : "",
88
- required: property.optional ? "" : "✔"
88
+ name: property.name?.trim(),
89
+ description: (property.description ?? "").trim(),
90
+ type: (stringifyType.Ω = [["\""]], stringifyType(property)).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
91
+ defaultValue: property.default ? stringifyType(property.default) : "",
92
+ required: property.nullable ? "" : "✔"
89
93
  };
90
94
  }, [
91
95
  "property",
@@ -1 +1 @@
1
- {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { stringifyType } from \"@powerlines/schema/codegen\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList(context.env.vars)\n .filter(\n property =>\n context.env.vars.active?.includes(property.name) &&\n !property?.metadata?.isHidden &&\n !property?.metadata?.isIgnored &&\n !property?.metadata?.isReadonly &&\n !property?.metadata?.isInternal\n )\n .sort((a, b) =>\n !a.metadata?.name && !b.metadata?.name\n ? 0\n : !a.metadata?.name\n ? 1\n : !b.metadata?.name\n ? -1\n : a.metadata?.name.localeCompare(b.metadata?.name)\n )\n .map(property => {\n return {\n name: property.metadata?.name?.trim(),\n description: (property.metadata?.description ?? \"\").trim(),\n type: stringifyType(property)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.metadata?.defaultValue\n ? stringifyType(property.metadata.defaultValue)\n : \"\",\n required: property.optional ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA6BA,MAAK,sBAAkB;OAAU;CAAa;CAAU;CAAA;CAAa;CAAA;AAAA;;;;AAKrE,SAAM,YAAa,OAAA;CACjB,MAAE,EACF,cAAc,GAChB,GAAA;CAEE,MAAA,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,IAAA,CAAA,GAAA,cAAA;CACA,OAAC,gBAAc,cAAY,WAAuB,EAClD,IAAA,OAAA;EACI,OAAC,UAAS,kBAAmB,QAAA,OAAkB,IAAA,GAAA,QAAA;CACnD,aAEA,IAAM,WAAU;;;IAEV,OAAC,IAAA;IACJ,UAAA;GACC,CAAA;GAAI,IAAE;GAA0D,gBAAC,MAAA;IAC/D,IAAE,OAAK;KACR,OAAQ,CAAA,CAAA,QAAW,YAAa;IAChC;IACA,IAAK,WAAQ;KACX,OAA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;OAAE;CAAA;CAAA;CAAA;CAAA;AAAA"}
1
+ {"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { JsonSchema } from \"@powerlines/schema\";\nimport { stringifyType } from \"@powerlines/schema/codegen\";\nimport { getPropertiesList } from \"@powerlines/schema/helpers\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { Env, EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment configuration parameters 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}>Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n getPropertiesList<Env>(context.env.vars)\n .filter(\n property =>\n getPropertiesList<Env>(context.env.vars).some(\n p => p.name === property.name && p.active\n ) &&\n !property?.hidden &&\n !property?.ignore &&\n !property?.readOnly &&\n !property?.internal\n )\n .sort((a, b) =>\n !a?.name && !b?.name\n ? 0\n : !a?.name\n ? 1\n : !b?.name\n ? -1\n : a.name.localeCompare(b.name)\n )\n .map(property => {\n return {\n name: property.name?.trim(),\n description: (property.description ?? \"\").trim(),\n type: stringifyType<any>(property as JsonSchema<any>)\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: property.default\n ? stringifyType(property.default)\n : \"\",\n required: property.nullable ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAMA,SAAS,aAAY,IAAI,MAAO;CAC/B,GAAI,SAAS;;AAEd;AA6BA,MAAG,sBAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAAA;;;;AAKH,SAAI,YAAA,OAAA;CACF,MAAA,EACF,cAAA,eAEE;CACA,MAAC,WAAc,cAAY,IAAA,CAAA,OAAc,qBAAuB,IAAI,CAAA,GAAI,cAAW;CACnF,OAAA,gBAAA,cAAA,WAAA,EACF,IAAO,OAAQ;EACb,OAAQ,UA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I;MACF,MAAM,SAAS,MAAK,KAAA;MACpB,cAAK,SAAA,eAAA,IAAA,KAAA;MACL,OAAG,cAAkB,IAAA,CAAA,CAAA,IAAA,CAAA,GAAA,cAAA,QAAA,GAAA,KAAA,EAAA,WAAA,mBAAA,OAAA;MACrB,cAAa,SAAQ,UAAA,cAAA,SAAA,OAAA,IAAA;MACrB,UAAG,SAAU,WAAU,KAAA;KACzB;IACF,GAAE;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,KAAA,CAAA;GACJ,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAS;OAAG;CAAA;CAAA;CAAA;CAAA;AAAA"}
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
2
  const require_helpers_load = require('../helpers/load.cjs');
4
3
  let _powerlines_schema_helpers = require("@powerlines/schema/helpers");
5
4
  let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
@@ -74,7 +73,7 @@ function EnvTypeDefinition() {
74
73
  get children() {
75
74
  return __assignType((prefix) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
76
75
  get each() {
77
- return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
76
+ return (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property?.isIgnored, [
78
77
  "property",
79
78
  "",
80
79
  "P\"2!\"/\""
@@ -84,13 +83,13 @@ function EnvTypeDefinition() {
84
83
  get children() {
85
84
  return __assignType((property) => [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.TSDocSchemaProperty, { schema: property }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components.InterfaceMember, {
86
85
  get name() {
87
- return `${prefix}_${property.metadata?.name}`;
86
+ return `${prefix}_${property?.name}`;
88
87
  },
89
88
  get type() {
90
- return `UnprefixedEnv["${property.metadata?.name}"]`;
89
+ return `UnprefixedEnv["${property?.name}"]`;
91
90
  },
92
- get isReadonly() {
93
- return property.metadata?.isReadonly;
91
+ get readOnly() {
92
+ return property?.readOnly;
94
93
  }
95
94
  })], [
96
95
  "property",
@@ -164,12 +163,12 @@ function ConfigPropertyGet(props) {
164
163
  context
165
164
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
166
165
  get when() {
167
- return property.metadata?.alias && property.metadata?.alias.length > 0;
166
+ return property?.alias && property?.alias.length > 0;
168
167
  },
169
168
  get children() {
170
169
  return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
171
170
  get each() {
172
- return property.metadata?.alias ?? [];
171
+ return property?.alias ?? [];
173
172
  },
174
173
  joiner: _alloy_js_core.code` || `,
175
174
  get children() {
@@ -194,12 +193,12 @@ function ConfigPropertyGet(props) {
194
193
  context
195
194
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
196
195
  get when() {
197
- return property.metadata?.alias && property.metadata?.alias.length > 0;
196
+ return property?.alias && property?.alias.length > 0;
198
197
  },
199
198
  get children() {
200
199
  return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
201
200
  get each() {
202
- return property.metadata?.alias ?? [];
201
+ return property?.alias ?? [];
203
202
  },
204
203
  joiner: _alloy_js_core.code` || `,
205
204
  get children() {
@@ -239,12 +238,12 @@ function ConfigPropertySet(props) {
239
238
  context
240
239
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
241
240
  get when() {
242
- return property.metadata?.alias && property.metadata?.alias.length > 0;
241
+ return property?.alias && property?.alias.length > 0;
243
242
  },
244
243
  get children() {
245
244
  return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
246
245
  get each() {
247
- return property.metadata?.alias ?? [];
246
+ return property?.alias ?? [];
248
247
  },
249
248
  joiner: _alloy_js_core.code` || `,
250
249
  get children() {
@@ -272,12 +271,12 @@ function ConfigPropertySet(props) {
272
271
  context
273
272
  }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
274
273
  get when() {
275
- return property.metadata?.alias && property.metadata?.alias.length > 0;
274
+ return property?.alias && property?.alias.length > 0;
276
275
  },
277
276
  get children() {
278
277
  return [_alloy_js_core.code` || `, (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
279
278
  get each() {
280
- return property.metadata?.alias ?? [];
279
+ return property?.alias ?? [];
281
280
  },
282
281
  joiner: _alloy_js_core.code` || `,
283
282
  get children() {
@@ -323,21 +322,21 @@ function EnvBuiltin(props) {
323
322
  const [{ defaultConfig, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["defaultConfig", "children"]);
324
323
  const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [["EnvPluginContext", "\"w!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
325
324
  const defaultValue = (0, _alloy_js_core.computed)(() => context && require_helpers_load.loadEnvFromContext(context, process.env));
326
- const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored, [
325
+ const reflectionGetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property?.isIgnored, [
327
326
  "property",
328
327
  "",
329
328
  "P\"2!\"/\""
330
- ])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
329
+ ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
331
330
  "a",
332
331
  "b",
333
332
  "",
334
333
  "P\"2!\"2\"\"/#"
335
334
  ])) ?? []);
336
- const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property.metadata?.isIgnored && !property.metadata?.isReadonly, [
335
+ const reflectionSetProperties = (0, _alloy_js_core.computed)(() => (0, _powerlines_schema_helpers.getPropertiesList)(context.env.vars.schema).filter(__assignType((property) => !property?.isIgnored && !property?.readOnly, [
337
336
  "property",
338
337
  "",
339
338
  "P\"2!\"/\""
340
- ])).sort(__assignType((a, b) => !a.metadata?.name && !b.metadata?.name ? 0 : !a.metadata?.name ? 1 : !b.metadata?.name ? -1 : a.metadata?.name.localeCompare(b.metadata?.name), [
339
+ ])).sort(__assignType((a, b) => !a?.name && !b?.name ? 0 : !a?.name ? 1 : !b?.name ? -1 : a?.name.localeCompare(b?.name), [
341
340
  "a",
342
341
  "b",
343
342
  "",
@@ -421,11 +420,10 @@ function EnvBuiltin(props) {
421
420
  },
422
421
  property
423
422
  }), [
424
- "name",
425
423
  "property",
426
424
  "index",
427
425
  "",
428
- "PP!P&4!MK2\"'2#\"/$"
426
+ "P!2!'2\"\"/#"
429
427
  ]);
430
428
  }
431
429
  }),
@@ -449,11 +447,10 @@ function EnvBuiltin(props) {
449
447
  },
450
448
  property
451
449
  }), [
452
- "name",
453
450
  "property",
454
451
  "index",
455
452
  "",
456
- "PP!P&4!MK2\"'2#\"/$"
453
+ "P!2!'2\"\"/#"
457
454
  ]);
458
455
  }
459
456
  }),
@@ -1 +1 @@
1
- {"version":3,"file":"env-builtin.d.cts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;AA4DA;iBAAgB,iBAAA,CAAA,GAAiB,QAAA;AAAA,UAmMhB,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;AAAA;AADlB;;;AAAA,iBAUgB,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA"}
1
+ {"version":3,"file":"env-builtin.d.cts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;AA4DA;iBAAgB,iBAAA,CAAA,GAAiB,QAAA;AAAA,UAmLhB,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;AAAA;AADlB;;;AAAA,iBAUgB,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"env-builtin.d.mts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;AA4DA;iBAAgB,iBAAA,CAAA,GAAiB,QAAA;AAAA,UAmMhB,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;AAAA;AADlB;;;AAAA,iBAUgB,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA"}
1
+ {"version":3,"file":"env-builtin.d.mts","names":[],"sources":["../../src/components/env-builtin.tsx"],"mappings":";;;;;;AA4DA;iBAAgB,iBAAA,CAAA,GAAiB,QAAA;AAAA,UAmLhB,eAAA,SAAwB,IAAA,CAAK,gBAAA;EAC5C,aAAA,GAAgB,QAAA;AAAA;AADlB;;;AAAA,iBAUgB,UAAA,CAAW,KAAA,EAAO,eAAA,GAAe,QAAA"}