@powerlines/plugin-env 0.16.125 → 0.16.126

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,7 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
2
  const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
3
  const require_types_plugin = require('../types/plugin.cjs');
4
- let _babel_core = require("@babel/core");
5
4
  let _powerlines_deepkit_utilities = require("@powerlines/deepkit/utilities");
6
5
  let _powerlines_plugin_babel_helpers_create_plugin = require("@powerlines/plugin-babel/helpers/create-plugin");
7
6
  let _powerlines_plugin_babel_helpers_module_helpers = require("@powerlines/plugin-babel/helpers/module-helpers");
@@ -115,11 +114,11 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
115
114
  extractEnv(identifier, pass, false, true);
116
115
  }
117
116
  }, [
118
- () => _babel_core.NodePath,
117
+ "NodePath",
119
118
  "path",
120
119
  "pass",
121
120
  "MemberExpression",
122
- "PP!7!2\"!2#\"/$"
121
+ "P\"w!2\"!2#\"/$"
123
122
  ]) } };
124
123
  }, [
125
124
  "param0",
@@ -2,7 +2,7 @@ import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.cjs";
2
2
  import * as _$_powerlines_plugin_babel0 from "@powerlines/plugin-babel";
3
3
 
4
4
  //#region src/babel/plugin.d.ts
5
- declare const envBabelPlugin: _$_powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
5
+ declare const envBabelPlugin: _$_powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, object>;
6
6
  //#endregion
7
7
  export { envBabelPlugin };
8
8
  //# sourceMappingURL=plugin.d.cts.map
@@ -1 +1 @@
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
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CAgM1B,uBAAA"}
@@ -2,7 +2,7 @@ import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.mjs";
2
2
  import * as _$_powerlines_plugin_babel0 from "@powerlines/plugin-babel";
3
3
 
4
4
  //#region src/babel/plugin.d.ts
5
- declare const envBabelPlugin: _$_powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, Record<string, any>>;
5
+ declare const envBabelPlugin: _$_powerlines_plugin_babel0.DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, object>;
6
6
  //#endregion
7
7
  export { envBabelPlugin };
8
8
  //# sourceMappingURL=plugin.d.mts.map
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;;;cAiCa,cAAA,EAAc,2BAAA,CAAA,iCAAA,CAAA,gBAAA,CAgM1B,uBAAA"}
@@ -1,5 +1,4 @@
1
1
  import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
- import { NodePath } from "@babel/core";
3
2
  import { stringifyDefaultValue } from "@powerlines/deepkit/utilities";
4
3
  import { createBabelPlugin } from "@powerlines/plugin-babel/helpers/create-plugin";
5
4
  import { addImport } from "@powerlines/plugin-babel/helpers/module-helpers";
@@ -113,11 +112,11 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
113
112
  extractEnv(identifier, pass, false, true);
114
113
  }
115
114
  }, [
116
- () => NodePath,
115
+ "NodePath",
117
116
  "path",
118
117
  "pass",
119
118
  "MemberExpression",
120
- "PP!7!2\"!2#\"/$"
119
+ "P\"w!2\"!2#\"/$"
121
120
  ]) } };
122
121
  }, [
123
122
  "param0",
@@ -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 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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AAA,iBAAA,MAAA,MAAA;AACb,MAAC,KACF,IAAA,SAAA,EACH,IAAA,WAAA,mCAEO,KACT,IAAA,SAAA,EACgB,IAAC,SAAW,EACb,aAAA,EAAA,MAAA,WAAA,CAAA,IACL,KAAK,IAAE,WAAY,EAAA,cAAgB,EAAA;GAE1C,MAAA,aAAA,KAAA,IAAA,WAAA,EAAA;wBAEW;AAEJ,cAAQ,YAAU,MAAA,OAAc,MAAU;AAC9C,QAAA,wBAAA,OAAA,WAAA,OAAA;AACF,aAAS,MAAA;IACD,QAAO,GAAA,QAAW,OAAA,aAAA,aAAA;IACtB,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
+ {"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;;AAYX,MAAa,kBAAkB,kBAAkB,IAAI,CAAC,OAAO,qBAAS,KAAA,CAAA,EAAA,kBAAA,OAAA,cAAA,EAAA,KAAA,cAAA;;EAE9D,MAAC,0BAA6B,QAAA,IAAA,MAAA,KACxB,eAAa,CAClB,OAAA,cAAwB,SAAO,KAAA,UAAW,CAAA,SAAQ,GAAU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AAA,KACF;AAEQ,cAAE,YAAY,MAAe,OAAE,MAAA;;AAEnC,aAAY,MAAA;IACJ,QAAK,GAAA,QAAA,OAAA,aAAA,aAAA;IACZ,MAAY;IACd,UAAA;IACH,CAAA;aAEO,KACT,IAAA,SAAA,EACS,IAAO,WAAW,EACjB,aAAK,EAAA,MAAA,OAAA,CAAA,IACL,KAAK,IAAE,SAAW,EAAC,IAAA,SAAY,EAAI,gBAAgB,IACpD,KAAA,IAAU,WAAM,EAAA,cAAmB,EAAA;;AAGxC,OAAU,CAAA,WAAY,KACtB;AAEE,cAAA,YAAA,MAAA,OAAA,MAAA;AACF,QAAS,wBAAA,OAAA,WAAA,OAAA;AACH,aAAS,MAAO;IAClB,QAAA,GAAA,QAAwB,OAAI,aAAA,aAAA;IACtB,MAAE;IACJ,UAAK;IACN,CAAC;aAEE,KAAM,IAAG,SAAA,EAAA,aAAA,EAAA,MAAA,OAAA,CAAA,IACb,KAAK,IAAC,WAAI,EAAA,cAAA,EAAA;GAEV,MAAI,aAAA,KAAA,IAAA,WAAA,EAAA;AACJ,OAAI,CAAC,WAAU,KACX;AAEP,cAAA,YAAA,MAAA,OAAA,KAAA;;IAEJ;EAAA;EAAI;EAAA;EAAA;EAAA;EAAA,CAAA,EACR,EACJ;GACF;CAAC;CAAS;CAAI;CAAW,CAAC,CAAC"}
@@ -37,65 +37,55 @@ const __ΩEnvDocsFileProps = [
37
37
  function EnvDocsFile(props) {
38
38
  const { levelOffset = 0, reflection, ...rest } = props;
39
39
  const context = (_powerlines_plugin_alloy_core_contexts_context.usePowerlines.Ω = [[() => require_types_plugin.__ΩEnvPluginContext, "n!"]], (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)());
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() {
41
- return (0, _stryke_path_join.joinPaths)(require_helpers_docs_helper.getDocsOutputPath(context), "env.md");
42
- } }, rest, { get children() {
43
- return [
44
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
40
+ return (0, _alloy_js_core_jsx_runtime.jsxs)(_powerlines_plugin_alloy_markdown_components_markdown_file.MarkdownFile, {
41
+ path: (0, _stryke_path_join.joinPaths)(require_helpers_docs_helper.getDocsOutputPath(context), "env.md"),
42
+ ...rest,
43
+ children: [
44
+ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_markdown.Heading, {
45
45
  level: 1 + levelOffset,
46
46
  children: "Environment Configuration"
47
47
  }),
48
48
  _alloy_js_core.code`Below is a list of environment variables used by the`,
49
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
50
- get when() {
51
- return !!context.packageJson.name;
52
- },
53
- get children() {
54
- return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Link, {
55
- get href() {
56
- return `https://www.npmjs.com/package/${context.packageJson.name}`;
57
- },
58
- get title() {
59
- return context.packageJson.name;
60
- }
61
- });
62
- }
49
+ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_core.Show, {
50
+ when: !!context.packageJson.name,
51
+ children: (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_markdown.Link, {
52
+ href: `https://www.npmjs.com/package/${context.packageJson.name}`,
53
+ title: context.packageJson.name
54
+ })
63
55
  }),
64
56
  _alloy_js_core.code`package. These values can be updated in the \`.env\` file in the root of the project.`,
65
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
66
- (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
57
+ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
58
+ (0, _alloy_js_core_jsx_runtime.jsx)(_alloy_js_markdown.Heading, {
67
59
  level: 2 + levelOffset,
68
60
  children: "Environment Variables"
69
61
  }),
70
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
62
+ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
71
63
  _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.`,
72
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
73
- (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { get data() {
74
- return reflection?.getProperties().filter(__assignType((property) => !property.isHidden() && !property.isIgnored() && !property.isReadonly() && !property.isInternal(), [
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) => {
84
- return {
85
- name: reflectionProperty.getNameAsString().trim(),
86
- description: (reflectionProperty.getDescription() ?? "").trim(),
87
- type: (0, _powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
88
- defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
89
- required: reflectionProperty.isValueRequired() ? "" : "✔"
90
- };
91
- }, [
92
- "reflectionProperty",
93
- "",
94
- "P\"2!\"/\""
95
- ])) ?? [];
96
- } })
97
- ];
98
- } }));
64
+ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
65
+ (0, _alloy_js_core_jsx_runtime.jsx)(_powerlines_plugin_alloy_markdown_components_markdown_table.MarkdownTable, { data: reflection?.getProperties().filter(__assignType((property) => !property.isHidden() && !property.isIgnored() && !property.isReadonly() && !property.isInternal(), [
66
+ "property",
67
+ "",
68
+ "P\"2!\"/\""
69
+ ])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
70
+ "a",
71
+ "b",
72
+ "",
73
+ "P\"2!\"2\"\"/#"
74
+ ])).map(__assignType((reflectionProperty) => {
75
+ return {
76
+ name: reflectionProperty.getNameAsString().trim(),
77
+ description: (reflectionProperty.getDescription() ?? "").trim(),
78
+ type: (0, _powerlines_deepkit_vendor_type.stringifyType)(reflectionProperty.getType()).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
79
+ defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
80
+ required: reflectionProperty.isValueRequired() ? "" : ""
81
+ };
82
+ }, [
83
+ "reflectionProperty",
84
+ "",
85
+ "P\"2!\"/\""
86
+ ])) ?? [] })
87
+ ]
88
+ });
99
89
  }
100
90
  EnvDocsFile.__type = [
101
91
  () => __ΩEnvDocsFileProps,
@@ -2,7 +2,7 @@ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
2
2
  import { getDocsOutputPath } from "../helpers/docs-helper.mjs";
3
3
  import { stringifyType } from "@powerlines/deepkit/vendor/type";
4
4
  import { joinPaths } from "@stryke/path/join";
5
- import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
5
+ import { jsx, jsxs } from "@alloy-js/core/jsx-runtime";
6
6
  import { Show, code } from "@alloy-js/core";
7
7
  import { Heading, Link } from "@alloy-js/markdown";
8
8
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
@@ -35,65 +35,55 @@ const __ΩEnvDocsFileProps = [
35
35
  function EnvDocsFile(props) {
36
36
  const { levelOffset = 0, reflection, ...rest } = props;
37
37
  const context = (usePowerlines.Ω = [[() => __ΩEnvPluginContext, "n!"]], usePowerlines());
38
- return createComponent(MarkdownFile, mergeProps({ get path() {
39
- return joinPaths(getDocsOutputPath(context), "env.md");
40
- } }, rest, { get children() {
41
- return [
42
- createComponent(Heading, {
38
+ return jsxs(MarkdownFile, {
39
+ path: joinPaths(getDocsOutputPath(context), "env.md"),
40
+ ...rest,
41
+ children: [
42
+ jsx(Heading, {
43
43
  level: 1 + levelOffset,
44
44
  children: "Environment Configuration"
45
45
  }),
46
46
  code`Below is a list of environment variables used by the`,
47
- createComponent(Show, {
48
- get when() {
49
- return !!context.packageJson.name;
50
- },
51
- get children() {
52
- return createComponent(Link, {
53
- get href() {
54
- return `https://www.npmjs.com/package/${context.packageJson.name}`;
55
- },
56
- get title() {
57
- return context.packageJson.name;
58
- }
59
- });
60
- }
47
+ jsx(Show, {
48
+ when: !!context.packageJson.name,
49
+ children: jsx(Link, {
50
+ href: `https://www.npmjs.com/package/${context.packageJson.name}`,
51
+ title: context.packageJson.name
52
+ })
61
53
  }),
62
54
  code`package. These values can be updated in the \`.env\` file in the root of the project.`,
63
- createComponent(Spacing, {}),
64
- createComponent(Heading, {
55
+ jsx(Spacing, {}),
56
+ jsx(Heading, {
65
57
  level: 2 + levelOffset,
66
58
  children: "Environment Variables"
67
59
  }),
68
- createComponent(Spacing, {}),
60
+ jsx(Spacing, {}),
69
61
  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.`,
70
- createComponent(Spacing, {}),
71
- createComponent(MarkdownTable, { get data() {
72
- return reflection?.getProperties().filter(__assignType((property) => !property.isHidden() && !property.isIgnored() && !property.isReadonly() && !property.isInternal(), [
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) => {
82
- return {
83
- name: reflectionProperty.getNameAsString().trim(),
84
- description: (reflectionProperty.getDescription() ?? "").trim(),
85
- type: stringifyType(reflectionProperty.getType()).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
86
- defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
87
- required: reflectionProperty.isValueRequired() ? "" : "✔"
88
- };
89
- }, [
90
- "reflectionProperty",
91
- "",
92
- "P\"2!\"/\""
93
- ])) ?? [];
94
- } })
95
- ];
96
- } }));
62
+ jsx(Spacing, {}),
63
+ jsx(MarkdownTable, { data: reflection?.getProperties().filter(__assignType((property) => !property.isHidden() && !property.isIgnored() && !property.isReadonly() && !property.isInternal(), [
64
+ "property",
65
+ "",
66
+ "P\"2!\"/\""
67
+ ])).sort(__assignType((a, b) => a.getNameAsString().localeCompare(b.getNameAsString()), [
68
+ "a",
69
+ "b",
70
+ "",
71
+ "P\"2!\"2\"\"/#"
72
+ ])).map(__assignType((reflectionProperty) => {
73
+ return {
74
+ name: reflectionProperty.getNameAsString().trim(),
75
+ description: (reflectionProperty.getDescription() ?? "").trim(),
76
+ type: stringifyType(reflectionProperty.getType()).trim().replaceAll(/\s*(?:\||&)\s*/g, ", or "),
77
+ defaultValue: reflectionProperty.hasDefault() ? String(reflectionProperty.getDefaultValue())?.includes("\"") ? reflectionProperty.getDefaultValue() : `\`${reflectionProperty.getDefaultValue()}\`` : "",
78
+ required: reflectionProperty.isValueRequired() ? "" : ""
79
+ };
80
+ }, [
81
+ "reflectionProperty",
82
+ "",
83
+ "P\"2!\"/\""
84
+ ])) ?? [] })
85
+ ]
86
+ });
97
87
  }
98
88
  EnvDocsFile.__type = [
99
89
  () => __ΩEnvDocsFileProps,
@@ -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.`}\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;;;;;;;;;;;;;;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;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 { 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.`}\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;AAC5B,IAAA,SAAW;AACd,QAAS;;;;;;;;;;;;;;AAiCV,SAAM,YAAA,OAAA;CACF,MAAM,EAAE,cAAa,GAAA,YAAY,GAAA,SAAc;CAChD,MAAA,WAAA,cAAA,IAAA,CAAA,OAAA,qBAAA,KAAA,CAAA,EAAA,eAAA;AACC,QAAE,KAAY,cAAC;EAAA,MAAA,UAAA,kBAAA,QAAA,EAAA,SAAA;EAAA,GAAA;EAAA,UAAA;GAAA,IAAA,SAAA;IAAA,OAAA,IAAA;IAAA,UAAA;IAAA,CAAA;GAAA,IAAA;GAAA,IAAA,MAAA;IAAA,MAAA,CAAA,CAAA,QAAA,YAAA;IAAA,UAAA,IAAA,MAAA;KAAA,MAAA,iCAAA,QAAA,YAAA;KAAA,OAAA,QAAA,YAAA;KAAA,CAAA;IAAA,CAAA;GAAA,IAAA;GAAA,IAAA,SAAA,EAAA,CAAA;GAAA,IAAA,SAAA;IAAA,OA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