@powerlines/plugin-env 0.16.231 → 0.16.233
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.
- package/dist/babel/plugin.d.cts +1 -3
- package/dist/babel/plugin.d.cts.map +1 -1
- package/dist/babel/plugin.d.mts +1 -3
- package/dist/babel/plugin.d.mts.map +1 -1
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.d.cts +1 -2
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +1 -2
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/automd-generator.d.cts +1 -2
- package/dist/helpers/automd-generator.d.cts.map +1 -1
- package/dist/helpers/automd-generator.d.mts +1 -2
- package/dist/helpers/automd-generator.d.mts.map +1 -1
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/create-reflection-resource.d.cts.map +1 -1
- package/dist/helpers/create-reflection-resource.d.mts.map +1 -1
- package/dist/helpers/create-reflection-resource.mjs.map +1 -1
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/persistence.d.cts.map +1 -1
- package/dist/helpers/persistence.d.mts.map +1 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/reflect.d.cts.map +1 -1
- package/dist/helpers/reflect.d.mts.map +1 -1
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/helpers/source-file-env.d.cts.map +1 -1
- package/dist/helpers/source-file-env.d.mts.map +1 -1
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/helpers/template-helpers.mjs.map +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs.map +1 -1
- package/package.json +12 -12
package/dist/babel/plugin.d.cts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.cjs";
|
|
2
|
-
import * as _$_powerlines_plugin_babel0 from "@powerlines/plugin-babel";
|
|
3
|
-
|
|
4
2
|
//#region src/babel/plugin.d.ts
|
|
5
|
-
declare const envBabelPlugin:
|
|
3
|
+
declare const envBabelPlugin: import("@powerlines/plugin-babel").DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, object>;
|
|
6
4
|
//#endregion
|
|
7
5
|
export { envBabelPlugin };
|
|
8
6
|
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAgCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CAuM1B,uBAAA"}
|
package/dist/babel/plugin.d.mts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { EnvPluginContext, EnvPluginResolvedConfig } from "../types/plugin.mjs";
|
|
2
|
-
import * as _$_powerlines_plugin_babel0 from "@powerlines/plugin-babel";
|
|
3
|
-
|
|
4
2
|
//#region src/babel/plugin.d.ts
|
|
5
|
-
declare const envBabelPlugin:
|
|
3
|
+
declare const envBabelPlugin: import("@powerlines/plugin-babel").DeclareBabelTransformPluginReturn<EnvPluginContext<EnvPluginResolvedConfig>, object>;
|
|
6
4
|
//#endregion
|
|
7
5
|
export { envBabelPlugin };
|
|
8
6
|
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/babel/plugin.ts"],"mappings":";;cAgCa,cAAA,qCAAc,iCAAA,CAAA,gBAAA,CAuM1B,uBAAA"}
|
|
@@ -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 { 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 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 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 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 logger.debug({\n meta: {\n category: \"env\"\n },\n message: `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 logger.warn({\n meta: {\n category: \"env\"\n },\n message: `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?.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, 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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,CAAC;;;AAKR,YAAU,SAAO;EAAA;EAAM;EAAA;EAAA;EAAA;EAAA;EAAA;AACvB,QAAO,EACL,SAAS,EACP,kBAAS,aAAA,SAAA,iBAAA,MAAA,MAAA;AACP,MAAI,KAAE,IAAO,SAAS,EAAE,IAAE,WAAO,EAAA,aAAqB,EACpD,MAAM,OACP,CAAC,IAAI,KAAK,IAAC,SAAK,EAAA,IAAY,SAAA,EAAA,aAAyB,EACpD,MAAI;GAGJ,MAAA,aAAA,KAAA,IAAA,WAAA,EAAA;wBAEE;AAEF,cAAW,YAAK,MAAW,OAAA,MAAA;AAC3B,QAAI,wBAAuB,OAAO,WAAW,OAAS;AACtD,aAAM,MAAO;IACX,QAAI,GAAA,QAAA,OAAA,WAAA,QAAA,aAAA;IACJ,MAAM;IACN,UAAU;IACX,CAAC;aACE,KAAA,IAAA,SAAA,EAAA,IAAA,WAAA,EAAA,aAAA,EACJ,MAAE;;AAIF,OAAI,CAAC,WAAC,KACJ;AAEF,cAAK,YAAA,MAAA,OAAA,MAAA;AACL,QAAE,wBAAA,OAAA,WAAA,OAAA;;IAEA,QAAO,GAAA,QAAA,OAAA,WAAsB,QAAa,aAAM;IAClD,MAAA;IACA,UAAS;IACT,CAAA;aACS,KAAK,IAAG,SAAA,EAAY,aAAY,EACzC,MAAI,OACL,CAAC,IAAG,KAAA,IAAA,WAAA,EAAA,cAAA,EAAA;GAEH,MAAI,aAAU,KAAA,IAAY,WAAa,EAAC;AACxC,OAAI,CAAA,WAAA,KACF;AAEF,cAAW,YAAE,MAAA,OAAA,KAAA;;IAEd;EAAC;EAAQ;EAAA;EAAA;EAA4B;EAAA,CAAA,EACzC,EACF;GACA;CAAC;CAAU;CAAI;CAAS,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 { 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 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 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 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 logger.debug({\n meta: {\n category: \"env\"\n },\n message: `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 logger.warn({\n meta: {\n category: \"env\"\n },\n message: `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?.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, 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, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;CAE1B,OAAK;AACN;4HAWE,sBAEI;CACN,SAAW,WAAU,MAAM,MAAM,eAAA,OAAA,iBAAA,OAAA;EACjC,MAAS,0BAAwB,QAAO,IAAA,MAAW,KAAQ,cAAU,EAAA,OAAA,cAAA,SAAA,KAAA,SAAA,EAAA,SAA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AA,GAAA,aAAyB,EACpD,MAAI;GAGJ,MAAA,aAAA,KAAA,IAAA,UAAA,GAAA;yBAEE;GAEF,WAAW,YAAK,MAAW,OAAA,KAAA;GAC3B,KAAI,wBAAuB,OAAO,WAAW,MAAQ;GACrD,UAAM,MAAO;IACX,QAAI,GAAA,QAAA,OAAA,WAAA,QAAA,aAAA;IACJ,MAAM;IACN,UAAU;GACZ,CAAC;EACH,OAAM,IAAA,KAAA,IAAA,QAAA,GAAA,IAAA,UAAA,GAAA,aAAA,EACJ,MAAE;;GAIF,IAAI,CAAC,WAAC,MACJ;GAEF,WAAK,YAAA,MAAA,OAAA,KAAA;GACL,KAAE,wBAAA,OAAA,WAAA,MAAA;;IAEA,QAAO,GAAA,QAAA,OAAA,WAAsB,QAAa,aAAM;IAClD,MAAA;IACA,UAAS;GACT,CAAA;EACF,OAAK,IAAM,KAAK,IAAG,QAAA,GAAY,aAAY,EACzC,MAAI,MACN,CAAC,KAAI,KAAA,IAAA,UAAA,GAAA,aAAA,GAAA;GAEH,MAAI,aAAU,KAAA,IAAY,UAAA,GAAc;GACxC,IAAI,CAAA,WAAA,MACF;GAEF,WAAW,YAAE,MAAA,OAAA,IAAA;EACf;CACF,GAAG;EAAC;EAAQ;EAAA;EAAA;EAA4B;CAAA,CAAA,EAC1C,EACF;AACF,GAAG;CAAC;CAAU;CAAI;AAAS,CAAA,CAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
1
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
2
|
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
3
|
|
|
@@ -18,7 +17,7 @@ interface EnvDocsFileProps extends Partial<MarkdownFileProps> {
|
|
|
18
17
|
/**
|
|
19
18
|
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
20
19
|
*/
|
|
21
|
-
declare function EnvDocsFile(props: EnvDocsFileProps):
|
|
20
|
+
declare function EnvDocsFile(props: EnvDocsFileProps): import("@alloy-js/core").Children;
|
|
22
21
|
//#endregion
|
|
23
22
|
export { EnvDocsFile, EnvDocsFileProps };
|
|
24
23
|
//# sourceMappingURL=docs.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.d.cts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;UAoCiB,gBAAA,SAAyB,OAAA,CAAQ,iBAAA;;AAAlD;;;;;;;EASE,WAAA;EAEA,UAAA,EAAY,eAAA;AAAA;;;;iBAME,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
2
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
3
2
|
import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
|
|
4
3
|
|
|
5
4
|
//#region src/components/docs.d.ts
|
|
@@ -18,7 +17,7 @@ interface EnvDocsFileProps extends Partial<MarkdownFileProps> {
|
|
|
18
17
|
/**
|
|
19
18
|
* Generates the environment configuration markdown documentation for the Powerlines project.
|
|
20
19
|
*/
|
|
21
|
-
declare function EnvDocsFile(props: EnvDocsFileProps):
|
|
20
|
+
declare function EnvDocsFile(props: EnvDocsFileProps): import("@alloy-js/core").Children;
|
|
22
21
|
//#endregion
|
|
23
22
|
export { EnvDocsFile, EnvDocsFileProps };
|
|
24
23
|
//# sourceMappingURL=docs.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs.d.mts","names":[],"sources":["../../src/components/docs.tsx"],"mappings":";;;;UAoCiB,gBAAA,SAAyB,OAAA,CAAQ,iBAAA;;AAAlD;;;;;;;EASE,WAAA;EAEA,UAAA,EAAY,eAAA;AAAA;;;;iBAME,WAAA,CAAY,KAAA,EAAO,gBAAgB,4BAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n !property.isHidden() &&\n !property.isIgnored() &&\n !property.isReadonly() &&\n !property.isInternal()\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;
|
|
1
|
+
{"version":3,"file":"docs.mjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show } from \"@alloy-js/core\";\nimport { Link } from \"@alloy-js/markdown\";\nimport {\n ReflectionClass,\n stringifyType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { Heading } from \"@powerlines/plugin-alloy/markdown/components/heading\";\nimport {\n MarkdownFile,\n MarkdownFileProps\n} from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\nexport interface EnvDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n reflection: ReflectionClass<any>;\n}\n\n/**\n * Generates the environment configuration markdown documentation for the Powerlines project.\n */\nexport function EnvDocsFile(props: EnvDocsFileProps) {\n const { levelOffset = 0, reflection, ...rest } = props;\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context.config.root), \"env.md\")}\n {...rest}>\n <Heading level={1 + levelOffset}>Environment Configuration</Heading>\n {code`Below is a list of environment variables used by the`}\n <Show when={!!context.packageJson.name}>\n <Link\n href={`https://www.npmjs.com/package/${context.packageJson.name}`}\n title={context.packageJson.name!}\n />\n </Show>\n {code`package. These values can be updated in the \\`.env\\` file in the root of the project.`}\n <Spacing />\n <Heading level={2 + levelOffset}>Environment Variables</Heading>\n <Spacing />\n {code`The below list of environment variables are used as configuration parameters to drive the processing of the application. The data contained in these variables are **not** considered sensitive or confidential. Any values provided in these variables will be available in plain text.`}\n <Spacing />\n <MarkdownTable\n data={\n reflection\n ?.getProperties()\n .filter(\n property =>\n !property.isHidden() &&\n !property.isIgnored() &&\n !property.isReadonly() &&\n !property.isInternal()\n )\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n )\n .map(reflectionProperty => {\n return {\n name: reflectionProperty.getNameAsString().trim(),\n description: (reflectionProperty.getDescription() ?? \"\").trim(),\n type: stringifyType(reflectionProperty.getType())\n .trim()\n .replaceAll(/\\s*(?:\\||&)\\s*/g, \", or \"),\n defaultValue: reflectionProperty.hasDefault()\n ? String(reflectionProperty.getDefaultValue())?.includes('\"')\n ? reflectionProperty.getDefaultValue()\n : `\\`${reflectionProperty.getDefaultValue()}\\``\n : \"\",\n required: reflectionProperty.isValueRequired() ? \"\" : \"✔\"\n };\n }) ?? []\n }\n />\n </MarkdownFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;;;;;;;;;;;;;AAiCA,SAAM,YAAA,OAAA;CACJ,MAAG,EACF,cAAA,GACC,YACA,GAAA,SACF;;CAEA,OAAA,gBAAY,cAAoB,WAAA,EAClC,IAAA,OAAA;;CAEE,EACA,GAAC,MAAA,EACD,IAAA,WAAA;EACI,OAAC;GAAA,gBAAqB,SAAO;IAC3B,OAAE,IAAA;;GAER,CAAK;GAAC,IAAA;GAA2C,gBAAA,MAAA;;KAE1C,OAAA,CAAA,CAAA,QAAA,YAAA;IACJ;IACC,IAAM,WAAU;KACZ,OAAK,gBAAA,MAAA;MACR,IAAQ,OAAQ;OACX,OAAS,iCAAgC,QAAQ,YAAI;MACrD;MACH,IAAA,QAAA;OACK,OAAG,QAAY,YAAU;MAC7B;KACD,CAAA;IACD;GACF,CAAC;GAAA,IAAK;GAAsF,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,SAAA;IAC3F,OAAQ,IAAC;IACT,UAAQ;GACT,CAAC;GAAA,gBAAS,SAAA,CAAA,CAAA;GAAA,IAAA;GAAA,gBAAA,SAAA,CAAA,CAAA;GAAA,gBAAA,eAAA,EACT,IAAK,OAAI;IACT,OAAS,YAAA,cAAA,EAAA,OAAA,cAAA,aAAA,CAAA,SAAA,SAAA,KAAA,CAAA,SAAA,UAAA,KAAA,CAAA,SAAA,WAAA,KAAA,CAAA,SAAA,WAAA,GAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,KAAA,cAAA,GAAA,MAAA,EAAA,gBAAA,EAAA,cAAA,EAAA,gBAAA,CAAA,GAAA;KAAA;KAAA;KAAA;KAAA;IAAA,CAAA,CAAA,EAAA,IAAA,cAAA,uBAAA;KACT,OAAA;MACM,MAAA,mBAAA,gBAAA,EAAA,KAAA;MACH,cAAA,mBAAA,eAAA,KAAA,IAAA,KAAA;MACI,MAAA,cAAc,mBAAA,QAAA,CAAA,EAAA,KAAA,EAAA,WAAA,mBAAA,OAAA;MACf,cAAM,mBAAA,WAAA,IAAA,OAAA,mBAAA,gBAAA,CAAA,GAAA,SAAA,IAAA,IAAA,mBAAA,gBAAA,IAAA,KAAA,mBAAA,gBAAA,EAAA,MAAA;MACL,UAAU,mBAAA,gBAAA,IAAA,KAAA;KACZ;IACF,GAAG;KAAC;KAAsB;KAAG;IAAA,CAAA,CAAA,KAAA,CAAA;GAC/B,EACF,CAAC;EAAC;CACJ,EACF,CAAC,CAAC;AACJ;AACA,YAAY,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ClassDeclaration,\n ClassMethod,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceMember,\n NewExpression,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionProperty\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 { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { InterfaceDeclarationProps } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocExample,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns,\n TSDocThrows\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TSDocReflectionProperty } from \"@powerlines/plugin-alloy/typescript/components/tsdoc-reflection\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition(\n props: Omit<InterfaceDeclarationProps, \"name\">\n) {\n const [{ defaultValue, reflection }] = splitProps(props, [\n \"defaultValue\",\n \"reflection\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n defaultValue={defaultValue}\n reflection={reflection}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored()) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocReflectionProperty reflection={property} />\n <InterfaceMember\n name={`${prefix}_${property.getNameAsString()}`}\n type={`UnprefixedEnv[\"${property.getNameAsString()}\"]`}\n readonly={property.isReadonly()}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n property: ReflectionProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n reflection: ReflectionClass<any>;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\nconst envSerializerRefkey = refkey(\"EnvSerializer\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, reflection, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"reflection\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const envInstance = computed(() => {\n const result = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n description: `The initial environment configuration state for the ${titleCase(\n context?.config?.name\n )} project.`,\n types: []\n },\n reflection\n );\n\n result\n .getProperties()\n .filter(\n property => property.isRuntime() || property.getTags().runtime === true\n )\n .forEach(property => {\n result.removeProperty(property.getNameAsString());\n });\n\n return result;\n });\n\n const reflectionGetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored() && !property.isReadonly())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@powerlines/deepkit/vendor/type\": [\n \"serializeFunction\",\n \"deserializeFunction\",\n \"ReflectionKind\",\n \"Serializer\",\n \"NamingStrategy\",\n \"TemplateState\",\n \"Type\",\n \"TypeProperty\",\n \"TypePropertySignature\"\n ]\n },\n rest.imports ?? {}\n )}>\n <Show when={Boolean(reflection)}>\n <EnvTypeDefinition\n defaultValue={defaultValue}\n reflection={reflection}\n />\n <hbr />\n <hbr />\n </Show>\n\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n defaultValue={defaultValue}\n reflection={envInstance}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n\n <TSDoc heading=\"The environment configuration serializer for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <ClassDeclaration\n refkey={envSerializerRefkey}\n name=\"EnvSerializer\"\n extends=\"Serializer\"\n export>\n <ClassMethod\n name=\"constructor\"\n public\n doc=\"Initializes a new instance of the `EnvSerializer` class.\">\n {code`super(\"env\");\n\n this.deserializeRegistry.register(\n ReflectionKind.boolean,\n (type: Type, state: TemplateState) => {\n state.addSetter(\n \\`typeof \\${state.accessor.toString()} !== \"boolean\" ? \\${state.accessor.toString()} === 1 || \\${state.accessor.toString()} === \"1\" || \\${state.accessor.toString()}.toLowerCase() === \"t\" || \\${state.accessor.toString()}.toLowerCase() === \"true\" || \\${state.accessor.toString()}.toLowerCase() === \"y\" || \\${state.accessor.toString()}.toLowerCase() === \"yes\" : \\${state.accessor.toString()}\\`\n );\n }\n ); `}\n </ClassMethod>\n </ClassDeclaration>\n <Spacing />\n\n <VarDeclaration\n name=\"envNamingStrategy\"\n const\n doc=\"The environment naming strategy for the runtime.\"\n initializer={code`new class extends NamingStrategy {\n constructor() {\n super(\"env\");\n }\n\n getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined {\n const name = super.getPropertyName(type, forSerializer);\n if (!name) {\n return name;\n }\n\n return name.replace(/^(${getUnique(\n context.config.env.prefix\n )\n .map(prefix => prefix.replace(/_$/, \"\"))\n .join(\"|\")})_/, \"\");\n }\n }; `}\n />\n <Spacing />\n\n <TSDoc heading=\"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n name=\"envSerializer\"\n const\n initializer={<NewExpression args={[]} target=\"EnvSerializer\" />}\n />\n <Spacing />\n\n <VarDeclaration\n name=\"_serializeEnv\"\n const\n initializer={\"serializeFunction<Env>(envSerializer, envNamingStrategy)\"}\n />\n <Spacing />\n <TSDoc heading=\"Serialize a environment configuration object to JSON data objects (not a JSON string).\">\n <TSDocRemarks>\n {`The resulting JSON object can be stringified using \\`JSON.stringify()\\`.`}\n </TSDocRemarks>\n <TSDocExample>{`const json = serializeEnv(env);`}</TSDocExample>\n <Spacing />\n <TSDocParam name=\"input\">\n {`The environment configuration object to serialize.`}\n </TSDocParam>\n <TSDocReturns>\n {`The serialized environment configuration as JSON data objects.`}\n </TSDocReturns>\n <TSDocThrows>\n {`ValidationError when serialization or validation fails.`}\n </TSDocThrows>\n </TSDoc>\n <FunctionDeclaration\n name=\"serializeEnv\"\n export\n parameters={[\n {\n name: \"input\",\n type: \"Env\"\n }\n ]}>\n {code` return _serializeEnv(input, { loosely: true }); `}\n </FunctionDeclaration>\n <Spacing />\n\n <VarDeclaration\n name=\"_deserializeEnv\"\n const\n initializer=\"deserializeFunction<Env>(envSerializer, envNamingStrategy)\"\n />\n <Spacing />\n <TSDoc heading=\"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.\">\n <TSDocRemarks>\n {`Types that are already correct will be used as-is.`}\n </TSDocRemarks>\n <TSDocExample>{`const env = deserializeEnv(json);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when deserialization fails.`}\n </TSDocThrows>\n </TSDoc>\n <FunctionDeclaration\n name=\"deserializeEnv\"\n export\n parameters={[\n {\n name: \"input\",\n type: \"Env\"\n }\n ]}>\n {code` return _deserializeEnv(input, { loosely: true }); `}\n </FunctionDeclaration>\n <Spacing />\n\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n\n <For each={reflectionGetProperties}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties} ender={code` else `}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <hbr />\n\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;CAAG;;;;;;;AAItC,SAAS,aAAY,IAAI,MAAO;AAC/B,IAAI,SAAS;;;;;;AAsCd,SAAS,kBAAwB,OAAA;CACj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A,gBAAA,gBAAA;;KAET,SAAM;KACL,MAAC;KACD,KAAI;KACJ,aAAE,IAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAqDf,CAAC;IAAE,gBAAe,SAAO,EAAA,CAAA;IAAA,gBAAA,OAAA;KACxB,SAAQ;KACR,IAAI,WAAG;AACL,aAAG,gBAAA,cAAA,EACD,UAAG,IAAA;;;;aAKX,CAAA;;KAEH,CAAA;IAAA,gBAAA,gBAAA;KACO,UAAE;KACF,SAAI;KACL,MAAO;KACP,aAAK,IAAA;;;;KAEL,UAAM;KACL,SAAC;KACD,MAAI;KACJ,KAAE;KACF,aAAK,IAAA;KACN,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,UAAQ;KACR,SAAS;KACT,MAAM;KACN,KAAA;KACA,aAAA,IAAA;KACD,CAAC;IAAA,gBAAY,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACZ,UAAU;KACV,SAAA;KACD,MAAA;KACA,KAAA;;KAEA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,UAAA;KACA,SAAA;KACA,MAAM;KACN,KAAK;KACL,aAAa,IAAI;KAClB,CAAC;IAAE,gBAAQ,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KACV,IAAE,OAAI;AACJ,aAAI,QAAA,SAAe;;KAEf;KACP,CAAC;IAAC;;EAEN,CAAC,CAAC;;AAEL,WAAU,SAAI;OAAY;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
1
|
+
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n InterfaceDeclaration as BaseInterfaceDeclaration,\n ClassDeclaration,\n ClassMethod,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n InterfaceMember,\n NewExpression,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionProperty\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 { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { InterfaceDeclarationProps } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocExample,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns,\n TSDocThrows\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TSDocReflectionProperty } from \"@powerlines/plugin-alloy/typescript/components/tsdoc-reflection\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition(\n props: Omit<InterfaceDeclarationProps, \"name\">\n) {\n const [{ defaultValue, reflection }] = splitProps(props, [\n \"defaultValue\",\n \"reflection\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\"UnprefixedEnv\"\n defaultValue={defaultValue}\n reflection={reflection}\n export\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`UnprefixedEnv\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <BaseInterfaceDeclaration name=\"Env\" export extends=\"UnprefixedEnv\">\n <For\n each={getUnique(context.config.env.prefix).map(prefix =>\n prefix.replace(/_$/, \"\")\n )}\n doubleHardline>\n {prefix => (\n <For\n each={\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored()) ?? []\n }\n doubleHardline>\n {property => (\n <>\n <TSDocReflectionProperty reflection={property} />\n <InterfaceMember\n name={`${prefix}_${property.getNameAsString()}`}\n type={`UnprefixedEnv[\"${property.getNameAsString()}\"]`}\n readonly={property.isReadonly()}\n />\n </>\n )}\n </For>\n )}\n </For>\n </BaseInterfaceDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${getUnique(\n context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n ).join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n property: ReflectionProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n reflection: ReflectionClass<any>;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\nconst envSerializerRefkey = refkey(\"EnvSerializer\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, reflection, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"reflection\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const envInstance = computed(() => {\n const result = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n description: `The initial environment configuration state for the ${titleCase(\n context?.config?.name\n )} project.`,\n types: []\n },\n reflection\n );\n\n result\n .getProperties()\n .filter(\n property => property.isRuntime() || property.getTags().runtime === true\n )\n .forEach(property => {\n result.removeProperty(property.getNameAsString());\n });\n\n return result;\n });\n\n const reflectionGetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored() && !property.isReadonly())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@powerlines/deepkit/vendor/type\": [\n \"serializeFunction\",\n \"deserializeFunction\",\n \"ReflectionKind\",\n \"Serializer\",\n \"NamingStrategy\",\n \"TemplateState\",\n \"Type\",\n \"TypeProperty\",\n \"TypePropertySignature\"\n ]\n },\n rest.imports ?? {}\n )}>\n <Show when={Boolean(reflection)}>\n <EnvTypeDefinition\n defaultValue={defaultValue}\n reflection={reflection}\n />\n <hbr />\n <hbr />\n </Show>\n\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<Env>\"\n defaultValue={defaultValue}\n reflection={envInstance}\n export\n const\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n\n <TSDoc heading=\"The environment configuration serializer for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <ClassDeclaration\n refkey={envSerializerRefkey}\n name=\"EnvSerializer\"\n extends=\"Serializer\"\n export>\n <ClassMethod\n name=\"constructor\"\n public\n doc=\"Initializes a new instance of the `EnvSerializer` class.\">\n {code`super(\"env\");\n\n this.deserializeRegistry.register(\n ReflectionKind.boolean,\n (type: Type, state: TemplateState) => {\n state.addSetter(\n \\`typeof \\${state.accessor.toString()} !== \"boolean\" ? \\${state.accessor.toString()} === 1 || \\${state.accessor.toString()} === \"1\" || \\${state.accessor.toString()}.toLowerCase() === \"t\" || \\${state.accessor.toString()}.toLowerCase() === \"true\" || \\${state.accessor.toString()}.toLowerCase() === \"y\" || \\${state.accessor.toString()}.toLowerCase() === \"yes\" : \\${state.accessor.toString()}\\`\n );\n }\n ); `}\n </ClassMethod>\n </ClassDeclaration>\n <Spacing />\n\n <VarDeclaration\n name=\"envNamingStrategy\"\n const\n doc=\"The environment naming strategy for the runtime.\"\n initializer={code`new class extends NamingStrategy {\n constructor() {\n super(\"env\");\n }\n\n getPropertyName(type: TypeProperty | TypePropertySignature, forSerializer: string): string | undefined {\n const name = super.getPropertyName(type, forSerializer);\n if (!name) {\n return name;\n }\n\n return name.replace(/^(${getUnique(\n context.config.env.prefix\n )\n .map(prefix => prefix.replace(/_$/, \"\"))\n .join(\"|\")})_/, \"\");\n }\n }; `}\n />\n <Spacing />\n\n <TSDoc heading=\"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n name=\"envSerializer\"\n const\n initializer={<NewExpression args={[]} target=\"EnvSerializer\" />}\n />\n <Spacing />\n\n <VarDeclaration\n name=\"_serializeEnv\"\n const\n initializer={\"serializeFunction<Env>(envSerializer, envNamingStrategy)\"}\n />\n <Spacing />\n <TSDoc heading=\"Serialize a environment configuration object to JSON data objects (not a JSON string).\">\n <TSDocRemarks>\n {`The resulting JSON object can be stringified using \\`JSON.stringify()\\`.`}\n </TSDocRemarks>\n <TSDocExample>{`const json = serializeEnv(env);`}</TSDocExample>\n <Spacing />\n <TSDocParam name=\"input\">\n {`The environment configuration object to serialize.`}\n </TSDocParam>\n <TSDocReturns>\n {`The serialized environment configuration as JSON data objects.`}\n </TSDocReturns>\n <TSDocThrows>\n {`ValidationError when serialization or validation fails.`}\n </TSDocThrows>\n </TSDoc>\n <FunctionDeclaration\n name=\"serializeEnv\"\n export\n parameters={[\n {\n name: \"input\",\n type: \"Env\"\n }\n ]}>\n {code` return _serializeEnv(input, { loosely: true }); `}\n </FunctionDeclaration>\n <Spacing />\n\n <VarDeclaration\n name=\"_deserializeEnv\"\n const\n initializer=\"deserializeFunction<Env>(envSerializer, envNamingStrategy)\"\n />\n <Spacing />\n <TSDoc heading=\"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.\">\n <TSDocRemarks>\n {`Types that are already correct will be used as-is.`}\n </TSDocRemarks>\n <TSDocExample>{`const env = deserializeEnv(json);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when deserialization fails.`}\n </TSDocThrows>\n </TSDoc>\n <FunctionDeclaration\n name=\"deserializeEnv\"\n export\n parameters={[\n {\n name: \"input\",\n type: \"Env\"\n }\n ]}>\n {code` return _deserializeEnv(input, { loosely: true }); `}\n </FunctionDeclaration>\n <Spacing />\n\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n } as Env),\n {\n get: (target: UnprefixedEnv, propertyName: string) => { `}\n <hbr />\n\n <For each={reflectionGetProperties}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: UnprefixedEnv, propertyName: string, newValue: any) => { `}\n <hbr />\n <For each={reflectionSetProperties} ender={code` else `}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <hbr />\n\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export\n const\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n ); `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,MAAM,UAAU;CAAC;CAAI;CAAM;CAAQ;AAAG;;;;;;;AAItC,SAAS,aAAY,IAAI,MAAO;CAC/B,GAAI,SAAS;;AAEd;;;;AAoCA,SAAS,kBAAwB,OAAA;CACjC,MAAO,CAAA,EACL,cACA,gBACK,WAAE,OAAW,CAAM,gBAAO,YAAqB,CAAC;CACvD,MAAO,WAAO,cAAA,IAAA,CAAA,OAA4B,qBAAwB,IAAC,CAAA,GAAM,cA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BAAU;KAC1D;IACF,CAAC;IAAA,gBAAS,SAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;;KAET,SAAM;KACL,MAAC;KACD,KAAI;KACJ,aAAE,IAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAqDhB,CAAC;IAAG,gBAAe,SAAO,CAAA,CAAA;IAAA,gBAAA,OAAA;KACxB,SAAQ;KACR,IAAI,WAAG;MACL,OAAG,gBAAA,cAAA,EACD,UAAG,IAAA;;;;YAKX,CAAA;KACD;IACF,CAAA;IAAA,gBAAA,gBAAA;KACO,UAAE;KACF,SAAI;KACL,MAAO;KACP,aAAK,IAAA;;;;KAEL,UAAM;KACL,SAAC;KACD,MAAI;KACJ,KAAE;KACF,aAAK,IAAA;IACP,CAAC;IAAA,gBAAA,SAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,UAAQ;KACR,SAAS;KACT,MAAM;KACN,KAAA;KACA,aAAA,IAAA;IACF,CAAC;IAAC,gBAAY,SAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;KACZ,UAAU;KACV,SAAA;KACD,MAAA;KACA,KAAA;;IAED,CAAC;IAAA,gBAAA,SAAA,CAAA,CAAA;IAAA,gBAAA,gBAAA;KACC,UAAA;KACA,SAAA;KACA,MAAM;KACN,KAAK;KACL,aAAa,IAAI;IACnB,CAAC;IAAG,gBAAQ,SAAA,CAAA,CAAA;IAAA,gBAAA,MAAA;KACV,IAAE,OAAI;MACJ,OAAI,QAAA,QAAe;KACrB;KACM;IACR,CAAC;GAAC;EACJ;CACF,CAAC,CAAC;AACJ;AACA,WAAU,SAAI;OAAY;CAAA;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { UnresolvedContext } from "powerlines";
|
|
2
|
-
import * as _$automd from "automd";
|
|
3
2
|
|
|
4
3
|
//#region src/helpers/automd-generator.d.ts
|
|
5
4
|
/**
|
|
@@ -8,7 +7,7 @@ import * as _$automd from "automd";
|
|
|
8
7
|
* @param context - The generator context.
|
|
9
8
|
* @returns The generated documentation content.
|
|
10
9
|
*/
|
|
11
|
-
declare const env: (context: UnresolvedContext) =>
|
|
10
|
+
declare const env: (context: UnresolvedContext) => import("automd").Generator;
|
|
12
11
|
//#endregion
|
|
13
12
|
export { env };
|
|
14
13
|
//# sourceMappingURL=automd-generator.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"automd-generator.d.cts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;AA6BA;;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAiB,sBAAA,SAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$automd from "automd";
|
|
2
1
|
import { UnresolvedContext } from "powerlines";
|
|
3
2
|
|
|
4
3
|
//#region src/helpers/automd-generator.d.ts
|
|
@@ -8,7 +7,7 @@ import { UnresolvedContext } from "powerlines";
|
|
|
8
7
|
* @param context - The generator context.
|
|
9
8
|
* @returns The generated documentation content.
|
|
10
9
|
*/
|
|
11
|
-
declare const env: (context: UnresolvedContext) =>
|
|
10
|
+
declare const env: (context: UnresolvedContext) => import("automd").Generator;
|
|
12
11
|
//#endregion
|
|
13
12
|
export { env };
|
|
14
13
|
//# sourceMappingURL=automd-generator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"automd-generator.d.mts","names":[],"sources":["../../src/helpers/automd-generator.ts"],"mappings":";;;;;AA6BA;;;;cAAa,GAAA,GAAO,OAAA,EAAS,iBAAiB,sBAAA,SAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { getDocsOutputPath } from \"powerlines/plugin-utils\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n getDocsOutputPath(context.config.root),\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;CAE9B,OAAO;;;;;;;;AA4BT,MAAE,MAAgB,cAAA,YAAA,gBAAA;CAChB,MAAM;CACN,UAAQ,aAAW,eAAA,WAAA;EACjB,MAAE,aAAiB,UAAE,kBAAS,QAAA,OAAA,IAAA,GAAA,QAAA;EAC9B,IAAI,CAAA,QAAA,GAAA,WAAkB,UAAe,GACnC,OAAO,EACN,UAAA;EAIH,OAAM,EACJ,UAAG,MAFM,QAAA,GAAA,KAAA,UAAA,KAEN,GACL;;AAEJ,CAAC,GAAG;CAAC;CAAO;CAAQ;AAAS,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reflection-resource.d.cts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.cts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,QAA0B,EAAhB,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reflection-resource.d.mts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.d.mts","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"mappings":";;;;;AA0BA;;;;iBAAgB,gBAAA,CAAiB,QAA0B,EAAhB,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.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 { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.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 { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;;;;CAYC,OAAQ,CAAC;AA2CV;AACA,iBAAe,SAAQ;OAAK;CAAU;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context?.env?.types?.env)\n ? context.env.types.env?.getProperties().reduce(\n (ret, prop) => {\n ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;
|
|
1
|
+
{"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { tryGetWorkspaceConfig } from \"@storm-software/config-tools/get-config\";\nimport {\n isDevelopmentMode,\n isTestMode,\n toMode\n} from \"@stryke/env/environment-checks\";\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/constants\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n context: EnvPluginContext,\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig?: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: context.config.framework?.name || \"powerlines\",\n envName: mode,\n defaults: {\n NAME:\n workspaceConfig?.namespace && packageJson.name\n ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\")\n : context.config.name,\n MODE: mode,\n ORG: context.config.organization || workspaceConfig?.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput,\n workspaceConfig?: WorkspaceConfig\n) {\n return defu(\n {\n APP_NAME: kebabCase(context.config.name),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: workspaceConfig?.locale,\n DEFAULT_TIMEZONE: workspaceConfig?.timezone,\n LOG_LEVEL:\n context.config.logLevel.general === \"trace\"\n ? \"debug\"\n : context.config.logLevel.general,\n ERROR_URL: workspaceConfig?.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(workspaceConfig?.organization)\n ? workspaceConfig.organization.name\n : workspaceConfig?.organization),\n PLATFORM: context.config.platform,\n MODE: toMode(context.config.mode),\n TEST: isTestMode(context.config.mode),\n DEBUG: isDevelopmentMode(context.config.mode),\n STACKTRACE: context.config.mode !== \"production\",\n RUNTIME: context.config.environment.runtime,\n ENVIRONMENT:\n !context.config.environment.name ||\n context.config.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.config.environment.name\n },\n isSetObject(context?.env?.types?.env)\n ? context.env.types.env?.getProperties().reduce(\n (ret, prop) => {\n ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const workspaceConfig = await tryGetWorkspaceConfig();\n\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.config.cwd,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n context,\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env, workspaceConfig),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,SAAM,aAAS,IAAW,MAAM;CAC/B,GAAG,SAAU;CACb,OAAQ;AACT;AA4BA,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB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SAAA,WAAA,MAAA;AACzD;AACA,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,
|
|
1
|
+
{"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAiBV;;iBAAsB,2BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;iBAYR,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;iBAcd,yBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAe;AAlBvB;;;;;;;AAAA,iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAO;AA5Ef;;;;;;AAAA,iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;AAvFY;AAYvB;;;iBAkIsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;;iBA2DW,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;AA/LG;AAuC1B;;iBA8KgB,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,
|
|
1
|
+
{"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"mappings":";;;;;;;;AAgDA;;;;iBAAsB,sBAAA,CACpB,OAAA,EAAS,iBAAA,GACR,OAAO;;;;AAAA;AAiBV;;iBAAsB,2BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;iBAYR,+BAAA,kBACH,iBAAA,CAAA,CACjB,OAAA,EAAS,QAAA,GAAW,OAAA,CAAQ,cAAA;;;;;;;;iBAcd,yBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAe;AAlBvB;;;;;;;AAAA,iBA8BsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,IAAA,GAAM,OAAA,GACL,OAAA,CAAQ,eAAA;;;;;;;;iBAuCW,sBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;AAAA,iBAeP,qBAAA,CACd,OAAA,EAAS,gBAAA,EACT,IAAA,EAAM,OAAO;AA5Ef;;;;;;AAAA,iBAuFsB,iBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;AAvFY;AAYvB;;;iBAkIsB,qBAAA,CACpB,OAAA,EAAS,gBAAA,GACR,OAAA,CAAQ,eAAA;;;;;;;;iBA2DW,kBAAA,CACpB,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA,GAAe,OAAA;;;;;AA/LG;AAuC1B;;iBA8KgB,sBAAA,CACd,OAAA,EAAS,gBAAA,EACT,UAAA,EAAY,eAAA,OACZ,IAAA,GAAM,OAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile(\n context: UnresolvedContext\n): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getEnvDefaultTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getSecretsDefaultTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n writeFileBufferSync(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,eAAsB,uBAAc,SAAA;CACpC,MAAQ,WAAC,MAAA,QAAwB,GAAE,QAAA,mCAAW;AAC9C,KAAM,CAAC,SACP,OAAS,IAAA,MAAA,0JAAsC;AAE7C,QAAA;;AAEF,uBAAC,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAOD,eAAmB,4BAA2B,SAAW;AACvD,QAAK;EACH,MAAM,MAAI,uBAAK,QAAA;EACf,MAAG;EACJ;;;;;;;;;;;;;AAQH,eAAC,gCAAA,SAAA;AACC,QAAO;EACL,MAAA,MAAY,uBAAuB,QAAQ;EAC7C,MAAA;EACF;;AAEA,gCAA8B,SAAA;CAAA;CAAgB;CAAA;CAAA;;;;;;;;AAQ9C,SAAC,0BAAA,SAAA,OAAA,OAAA;AACC,QAAO,UAAU,mBAAmB,QAAA,EAAA,OAAA,GAAA,KAAA,YAAA;;AAEtC,0BAAE,SAAA;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQF,eAAA,sBAAA,SAAA,OAAA,OAAA;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AAC,KAAA,SAAY,UAAc;;AAEvE,SAAO,QAAQ,IAAA,KAAQ;;CAEzB,MAAM,SAAK,MAAA,eAAA,SAAA;CAEX,MAAM,cAAC,IADS,MAAA,QAAA,QAAA,MACT,CAAA,QAAA,gBAAA;CACP,MAAM,aAAA,iBAA6B,gBAAM,iBAAA,YAAA,MAAA,CAAA,CAAA;AACzC,SAAO,IAAG,KAAA,UAAU;AACpB,SAAI,IAAA,KAAW,QAAQ,cAAI;;AAE3B,QAAI;;AAEN,sBAAiB,SAAa;OAAQ;CAAe;CAAA;CAAA;CAAA;CAAA;;;;;;;;;CASnD,MAAM,aAAS,WAAM,eAAwB;CAC7C,MAAM,UAAU,IAAI,MAAM,SAAQ;4BAC5B,QAAc,SAAQ;AAE5B,OAAM,gBAAa,sBAAgB,SAAA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAErC,mBAAG,SAAA;OAAA;CAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;CASD,MAAA,aAAA,WAAA,eAAA;CACA,MAAM,UAAK,IAAO,MAAA,SAAY;AAE9B,gBAAe,YADhB,QAAA,SAAA,gBAC8B,CAAA,WAAO,WAAA,OAAA,CAAA;AACpC,qBAAc,sBAA2B,SAAA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAE3C,uBAAsB,SAAA;OAAA;CAAqB;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
1
|
+
{"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.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 { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { UnresolvedContext } from \"powerlines\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile(\n context: UnresolvedContext\n): Promise<string> {\n const resolved = await context.fs.resolve(\"@powerlines/plugin-env/types/env\");\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getEnvDefaultTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getSecretsDefaultTypeDefinition<\n TContext extends UnresolvedContext\n>(context: TContext): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTyp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I,MAAM,QAAQ;4BAC5B,QAAc,SAAQ;CAE5B,MAAM,gBAAa,sBAAgB,SAAA,IAAA,GAAA,QAAA,cAAA,CAAA;AACrC;AACA,mBAAG,SAAA;OAAA;CAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AAAA;;;;;;;;;CASD,MAAA,aAAA,WAAA,cAAA;CACA,MAAM,UAAK,IAAO,MAAA,QAAY;CAE9B,eAAe,YADhB,QAAA,SAAA,eAC8B,EAAA,WAAO,WAAA,MAAA,CAAA;CACpC,oBAAc,sBAA2B,SAAA,IAAA,GAAA,QAAA,cAAA,CAAA;AAC3C;AACA,uBAAsB,SAAA;OAAA;CAAqB;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/helpers/reflect.ts"],"mappings":";;;;;iBAuCgB,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,iBAQa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,UAQc,0BAAA;EACf,IAAA,GAAO,iBAAA,GAAoB,SAAA;EAC3B,eAAA,GAAkB,eAAA;AAAA;AAAA,cAGP,OAAA,YAAmB,
|
|
1
|
+
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/helpers/reflect.ts"],"mappings":";;;;;iBAuCgB,mBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,iBAQa,uBAAA,CACd,OAAA,EAAS,gBAAA,EACT,WAAA,EAAa,eAAA,UACZ,eAAA;AAAA,UAQc,0BAAA;EACf,IAAA,GAAO,iBAAA,GAAoB,SAAA;EAC3B,eAAA,GAAkB,eAAA;AAAA;AAAA,cAGP,OAAA,YAAmB,YAAY;EAC1C,QAAA;EAEA,WAAA;EAEA,QA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