@powerlines/plugin-env 0.16.192 → 0.16.195

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.
@@ -102,7 +102,7 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
102
102
  extractEnv(identifier, pass, false, false);
103
103
  path.replaceWithSourceString(`env.${identifier.name}`);
104
104
  (0, _powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
105
- module: `${context.config.framework || "powerlines"}:env`,
105
+ module: `${context.config.framework?.name || "powerlines"}:env`,
106
106
  name: "env",
107
107
  imported: "env"
108
108
  });
@@ -112,7 +112,7 @@ const envBabelPlugin = (_powerlines_plugin_babel_helpers_create_plugin.createBab
112
112
  extractEnv(identifier, pass, false, false);
113
113
  path.replaceWithSourceString(`env.${identifier.name}`);
114
114
  (0, _powerlines_plugin_babel_helpers_module_helpers.addImport)(path, {
115
- module: `${context.config.framework || "powerlines"}:env`,
115
+ module: `${context.config.framework?.name || "powerlines"}:env`,
116
116
  name: "env",
117
117
  imported: "env"
118
118
  });
@@ -100,7 +100,7 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
100
100
  extractEnv(identifier, pass, false, false);
101
101
  path.replaceWithSourceString(`env.${identifier.name}`);
102
102
  addImport(path, {
103
- module: `${context.config.framework || "powerlines"}:env`,
103
+ module: `${context.config.framework?.name || "powerlines"}:env`,
104
104
  name: "env",
105
105
  imported: "env"
106
106
  });
@@ -110,7 +110,7 @@ const envBabelPlugin = (createBabelPlugin.Ω = [[() => __ΩEnvPluginContext, "n!
110
110
  extractEnv(identifier, pass, false, false);
111
111
  path.replaceWithSourceString(`env.${identifier.name}`);
112
112
  addImport(path, {
113
- module: `${context.config.framework || "powerlines"}:env`,
113
+ module: `${context.config.framework?.name || "powerlines"}:env`,
114
114
  name: "env",
115
115
  imported: "env"
116
116
  });
@@ -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 || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: `${context.config.framework || \"powerlines\"}:env`,\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path.get(\"object\")?.isIdentifier({ name: \"env\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false, true);\n }\n }\n }\n };\n }\n);\n"],"mappings":";;;;;;AAEA,SAAS,aAAY,IAAK,MAAC;;AAE1B,QAAK;;4HAYJ,sBAEI;CACN,SAAW,WAAU,MAAM,MAAM,eAAA,OAAA,iBA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AAA,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,aAAA,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,aAAsB,aAAmB;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;;AAE1B,QAAK;;4HAYJ,sBAEI;CACN,SAAW,WAAU,MAAM,MAAM,eAAA,OAAA,iBAAA,OAAA;EACjC,MAAS,0BAAwB,QAAO,IAAA,MAAW,KAAQ,eAAU,CAAA,OAAA,cAAA,SAAA,KAAA,UAAA,CAAA,SAAA,GAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;AACrE,MAAQ,KAAC,MAAA;GACH,MAAG,OAAU,KAAE,KAAO,QAAA,IAAW,OAAO,KAAM,QAAQ,OAAO,IAAA,OAAQ,KAAA,IAAA,CAAA,IAAA,EAAA,GAAA;AACrE,UAAG,MAAA;I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AAU;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"}
@@ -41,7 +41,7 @@ loadEnvFiles.__type = [
41
41
  async function loadEnvDirectory(context, options, directory, mode, cacheDir, packageJson, workspaceConfig) {
42
42
  const [envResult, c12Result] = await Promise.all([(loadEnvFiles.Ω = [["!"]], loadEnvFiles(options, mode, directory)), (0, c12.loadConfig)({
43
43
  cwd: directory,
44
- name: context.config.framework,
44
+ name: context.config.framework?.name || "powerlines",
45
45
  envName: mode,
46
46
  defaults: {
47
47
  NAME: workspaceConfig?.namespace && packageJson.name ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, "") : context.config.name,
@@ -13,14 +13,14 @@ import { DotenvParseOutput } from "@stryke/env/types";
13
13
  declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput, workspaceConfig?: WorkspaceConfig): {
14
14
  APP_NAME: string;
15
15
  APP_VERSION: string | undefined;
16
- BUILD_ID: string;
16
+ BUILD_ID: any;
17
17
  BUILD_TIMESTAMP: string;
18
18
  BUILD_CHECKSUM: string;
19
19
  RELEASE_ID: string;
20
20
  RELEASE_TAG: string;
21
21
  DEFAULT_LOCALE: string | undefined;
22
22
  DEFAULT_TIMEZONE: string | undefined;
23
- LOG_LEVEL: "error" | "warn" | "info" | "debug" | "silent";
23
+ LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
24
24
  ERROR_URL: string | undefined;
25
25
  ORGANIZATION: string | undefined;
26
26
  PLATFORM: "node" | "browser" | "neutral";
@@ -13,14 +13,14 @@ import { WorkspaceConfig } from "powerlines";
13
13
  declare function loadEnvFromContext(context: EnvPluginContext, parsed: DotenvParseOutput, workspaceConfig?: WorkspaceConfig): {
14
14
  APP_NAME: string;
15
15
  APP_VERSION: string | undefined;
16
- BUILD_ID: string;
16
+ BUILD_ID: any;
17
17
  BUILD_TIMESTAMP: string;
18
18
  BUILD_CHECKSUM: string;
19
19
  RELEASE_ID: string;
20
20
  RELEASE_TAG: string;
21
21
  DEFAULT_LOCALE: string | undefined;
22
22
  DEFAULT_TIMEZONE: string | undefined;
23
- LOG_LEVEL: "error" | "warn" | "info" | "debug" | "silent";
23
+ LOG_LEVEL: "silent" | "error" | "warn" | "info" | "debug";
24
24
  ERROR_URL: string | undefined;
25
25
  ORGANIZATION: string | undefined;
26
26
  PLATFORM: "node" | "browser" | "neutral";
@@ -38,7 +38,7 @@ loadEnvFiles.__type = [
38
38
  async function loadEnvDirectory(context, options, directory, mode, cacheDir, packageJson, workspaceConfig) {
39
39
  const [envResult, c12Result] = await Promise.all([(loadEnvFiles.Ω = [["!"]], loadEnvFiles(options, mode, directory)), loadConfig({
40
40
  cwd: directory,
41
- name: context.config.framework,
41
+ name: context.config.framework?.name || "powerlines",
42
42
  envName: mode,
43
43
  defaults: {
44
44
  NAME: workspaceConfig?.namespace && packageJson.name ? packageJson.name?.replace(`@${workspaceConfig.namespace}/`, "") : context.config.name,
@@ -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,\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;AAC/B,IAAG,SAAU;AACb,QAAQ;;AA6BT,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB,KAAK,KAAE;AACrC,KAAM,QAAG,mBAAkB,QAAA,iBAA4B,SAAY,GAAC;EACpE,MAAS,qBAAsB,MAAI,QAAO,IAAK,QAAI,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,IAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA,CAAA;qDAE7C,OAAA,KAAS,mBAAkB,IAAO;;AAGtC,QAAK,gBAAA,IAAA;;AAEP,a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QAAA,OAAA,KAAA;EACjB,YAAE,QAAA,OAAA,SAAA;EACF,SAAC,QAAA,OAAA,YAAA;EACD,aAAA,CAAA,QAAA,OAAA,YAAA,QAAA,QAAA,OAAA,YAAA,SAAA,sBAAA,QAAA,OAAA,OAAA,QAAA,OAAA,YAAA;;AAEF,MAAM,KAAK,QAAC,OAAa,KAAK,SAAU,KAAA,iBAAQ;AAClD,SAAA;;;;;;;;AAGA,mBAAa,SAAe;OAAA;CAAyB;CAAS;CAAO;CAAA;CAAA;CAAA;CAAA;AACrE,eAAC,QAAA,SAAA,SAAA;CACC,MAAE,kBAAoB,MAAQ,uBAAuB;CACrD,MAAE,CAAK,SAAS,WAAW,UAAQ,MAAA,QAAa,IAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,MAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;EAAA,CAAA;AAChD,QAAE,KAAU,mBAAmB,SAAI,QAAO,KAAA,gBAAa,EAAA,SAAA,WAAA,OAAA;;AAEzD,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;CAAA;CAAA;CAAA"}
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;AAC/B,IAAG,SAAU;AACb,QAAQ;;AA6BT,eAAS,aAAkB,SAAM,MAAU,KAAC;CAC5C,IAAM,MAAG,MAAA,UAAqB,KAAK,KAAE;AACrC,KAAM,QAAG,mBAAkB,QAAA,iBAA4B,SAAY,GAAC;EACpE,MAAS,qBAAsB,MAAI,QAAO,IAAK,QAAI,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,IAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA,CAAA;qDAE7C,OAAA,KAAS,mBAAkB,IAAO;;AAGtC,QAAK,gBAAA,IAAA;;AAEP,aAAY,SAAM;OAAW;CAAW;CAAA;CAAA;CAAA;CAAA;CAAA;AACxC,eAAc,iBAAkB,SAAS,SAAA,WA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A;EACD,aAAA,CAAA,QAAA,OAAA,YAAA,QAAA,QAAA,OAAA,YAAA,SAAA,sBAAA,QAAA,OAAA,OAAA,QAAA,OAAA,YAAA;;AAEF,MAAM,KAAK,QAAC,OAAa,KAAK,SAAU,KAAA,iBAAQ;AAClD,SAAA;;;;;;;;AAGA,mBAAa,SAAe;OAAA;CAAyB;CAAS;CAAO;CAAA;CAAA;CAAA;CAAA;AACrE,eAAC,QAAA,SAAA,SAAA;CACC,MAAE,kBAAoB,MAAQ,uBAAuB;CACrD,MAAE,CAAK,SAAS,WAAW,UAAQ,MAAA,QAAa,IAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,MAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,OAAA,KAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;GAAA,iBAAA,IAAA,CAAA,CAAA,IAAA,CAAA,EAAA,iBAAA,SAAA,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,gBAAA;EAAA,CAAA;AAChD,QAAE,KAAU,mBAAmB,SAAI,QAAO,KAAA,gBAAa,EAAA,SAAA,WAAA,OAAA;;AAEzD,QAAO,SAAS;OAAA;CAAkB;OAAA;CAAA;CAAA;CAAA;CAAA"}
package/dist/index.cjs CHANGED
@@ -82,7 +82,7 @@ const plugin = __assignType((options = {}) => {
82
82
  "prefix",
83
83
  "",
84
84
  "P&F2!&2\"\"/#"
85
- ]), ["POWERLINES_", this.config.framework && this.config.framework !== "powerlines" && `${(0, _stryke_string_format_constant_case.constantCase)(this.config.framework)}_`].filter(Boolean));
85
+ ]), ["POWERLINES_", this.config.framework?.name && this.config.framework?.name !== "powerlines" && `${(0, _stryke_string_format_constant_case.constantCase)(this.config.framework?.name)}_`].filter(Boolean));
86
86
  config.env.prefix = (0, _stryke_helpers_get_unique.getUnique)((0, _stryke_convert_to_array.toArray)(config.env.prefix).reduce(__assignType((ret, prefix) => {
87
87
  if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
88
88
  return ret;
@@ -92,7 +92,7 @@ const plugin = __assignType((options = {}) => {
92
92
  "",
93
93
  "P\"2!\"2\"\"/#"
94
94
  ]), []));
95
- config.tsc.filter = { id: { include: [(0, powerlines_plugin_utils.createVirtualPrefixRegex)((0, _stryke_path_join.joinPaths)(this.builtinsPath, "env.ts")), (0, powerlines_plugin_utils.createVirtualPrefixRegex)(`${this.config.framework}:env`)] } };
95
+ config.tsc.filter = { id: { include: [(0, powerlines_plugin_utils.createVirtualPrefixRegex)((0, _stryke_path_join.joinPaths)(this.builtinsPath, "env.ts")), (0, powerlines_plugin_utils.createVirtualPrefixRegex)(`${this.config.framework?.name || "powerlines"}:env`)] } };
96
96
  return config;
97
97
  },
98
98
  async configResolved() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA6dJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA+dJ,MAAA,CAAO,QAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA6dJ,MAAA,CAAO,QAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;YAmEY,MAAA;IACR,GAAA,GAAM,gBAAA;EAAA;AAAA;;;;cAOG,MAAA,oBAA2B,gBAAA,GAAmB,gBAAA,EACzD,OAAA,GAAS,gBAAA,KA+dJ,MAAA,CAAO,QAAA"}
package/dist/index.mjs CHANGED
@@ -76,7 +76,7 @@ const plugin = __assignType((options = {}) => {
76
76
  "prefix",
77
77
  "",
78
78
  "P&F2!&2\"\"/#"
79
- ]), ["POWERLINES_", this.config.framework && this.config.framework !== "powerlines" && `${constantCase(this.config.framework)}_`].filter(Boolean));
79
+ ]), ["POWERLINES_", this.config.framework?.name && this.config.framework?.name !== "powerlines" && `${constantCase(this.config.framework?.name)}_`].filter(Boolean));
80
80
  config.env.prefix = getUnique(toArray(config.env.prefix).reduce(__assignType((ret, prefix) => {
81
81
  if (!ret.includes(prefix.replace(/_$/g, ""))) ret.push(prefix.replace(/_$/g, ""));
82
82
  return ret;
@@ -86,7 +86,7 @@ const plugin = __assignType((options = {}) => {
86
86
  "",
87
87
  "P\"2!\"2\"\"/#"
88
88
  ]), []));
89
- config.tsc.filter = { id: { include: [createVirtualPrefixRegex(joinPaths(this.builtinsPath, "env.ts")), createVirtualPrefixRegex(`${this.config.framework}:env`)] } };
89
+ config.tsc.filter = { id: { include: [createVirtualPrefixRegex(joinPaths(this.builtinsPath, "env.ts")), createVirtualPrefixRegex(`${this.config.framework?.name || "powerlines"}:env`)] } };
90
90
  return config;
91
91
  },
92
92
  async configResolved() {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines\";\nimport {\n createVirtualPrefixRegex,\n getDocsOutputPath\n} from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit({\n ...options.deepkit,\n reflection: \"default\",\n level: \"all\",\n filter: {}\n }),\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n !isSetString(config.env.types) &&\n !isSetString(config.env.types?.file)\n ) {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.types = await getEnvDefaultTypeDefinition(this);\n }\n\n if (\n !isSetString(config.env.secrets) &&\n !isSetString(config.env.secrets?.file)\n ) {\n config.env.secrets = await getSecretsDefaultTypeDefinition(this);\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n config.tsc.filter = {\n id: {\n include: [\n createVirtualPrefixRegex(joinPaths(this.builtinsPath, \"env.ts\")),\n createVirtualPrefixRegex(`${this.config.framework}:env`)\n ]\n }\n };\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n isSetString(this.config.env.types) ||\n (this.config.env.types && isSetString(this.config.env.types.file))\n ) {\n this.config.env.types = parseTypeDefinition(\n this.config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(this.config.env.types.file);\n if (file) {\n this.config.env.types.file = file;\n }\n }\n\n if (\n isSetString(this.config.env.secrets) ||\n (this.config.env.secrets && isSetString(this.config.env.secrets.file))\n ) {\n this.config.env.secrets = parseTypeDefinition(\n this.config.env.secrets\n )!;\n\n const file = await this.fs.resolve(this.config.env.secrets.file);\n if (file) {\n this.config.env.secrets.file = file;\n }\n }\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n this.config.env.types.file\n }${this.config.env.types.name ? `#${this.config.env.types.name}` : \"\"}${\n this.config.env.secrets\n ? `\\nSecrets configuration definition file: ${this.config.env.secrets?.file}${\n this.config.env.secrets?.name\n ? `#${this.config.env.secrets?.name}`\n : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${this.config.env.prefix.join(\", \")}\\nShould inject values: ${\n this.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n this.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAA2B,UAAA,EAAA,KAAA;AAC3B,QAAA;EAAA,QAAA;GACA,GAAA,QAAA;GACA,YAAA;GACA,OAAA;GACA,QAAA,EAAA;GACA,CAAA;EAAA,MAAA,QAAA,MAAqB;EAAA;GACrB,MAAA;GACA,MAAA,SAAA;AACI,SAAI,MAAO,yEAAa;IACxB,MAAG,SAAY;KACb,KAAC,KAAA,SAAkB;;MAElB,UAAQ;;MAET,QAAQ,EAAA;MACd,CAAA;KACM,OAAE;MACR,GAAA,QAAA;MACF,eAAA,CAAA,QAAA;;MAEE;KACG,SAAW;MACd,YAAA;MACK,OAAM;MACJ;KACJ,KAAA,EAAA;KACH;AACE,QAAA,CAAO,YAAC,OAAA,IAAA,MAAA,IAAA,CAAA,YAAA,OAAA,IAAA,OAAA,KAAA,EAAA;AACJ,UAAC,KAAQ,4FAAO;AAClB,YAAA,IAAa,QAAQ,MAAA,4BAAA,KAAA;;AAErB,QAAA,CAAA,YAAS,OAAA,IAAA,QAAA,IAAA,CAAA,YAAA,OAAA,IAAA,SAAA,KAAA,CACT,QAAA,IAAA,UAAA,MAAA,gCAAA,KAAA;AAEF,WAAA,IAAA,SAAA,QAAA,OAAA,IAAA,UAAA,EAAA,CAAA,CAAA,OAAA,cAAA,KAAA,WAAA;KACE,MAAO,kBAAI,aAAA,OAAA;AACX,SAAM,CAAA,IAAA,SAAS,gBAAA,CACb,KAAK,KAAK,gBAAA;AAEV,YAAC;;;;;;;AAEH,WAAO,IAAC,SAAS,UAAA,QAAA,OAAA,IAAA,OAAA,CAAA,OAAA,cAAA,K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ACL,QAAQ,KAAA,QAAA,UAAA,EAAA,EAAA,EACN,YAAY,EACV,KAAE,IAAA,KAAA,EACJ,KAEH;MACA,CAAC,UAAS,QAAI,CAAK;GACvB;EAAE;GACD,MAAM;GACN,MAAM;AAEF,WAAO,EACL,WAAS,KAAM,QAAA,KAAA,QAChB;MACA;UAAO;IAAgB;IAAA;IAAA;IAAA,CAAA,EAC3B;GACF;EAAE,OAAO,QAAI,OAAU;EAAA;GACvB;OAAO;CAAS;QAAc,EAAA;CAAA;CAAA;CAAA,CAAA"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport { TypeScriptCompilerPluginUserConfig } from \"@powerlines/plugin-tsc\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport {\n createVirtualPrefixRegex,\n getDocsOutputPath\n} from \"powerlines/plugin-utils\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env-builtin\";\nimport { env } from \"./helpers/automd-generator\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n env?: EnvPluginOptions;\n }\n}\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n deepkit({\n ...options.deepkit,\n reflection: \"default\",\n level: \"all\",\n filter: {}\n }),\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n validate: false,\n inject: false,\n prefix: []\n }),\n babel: {\n ...options.babel,\n skipTransform: !options.inject,\n plugins: [envBabelPlugin]\n },\n deepkit: {\n reflection: \"default\",\n level: \"all\"\n },\n tsc: {} as TypeScriptCompilerPluginUserConfig[\"tsc\"]\n };\n\n if (\n !isSetString(config.env.types) &&\n !isSetString(config.env.types?.file)\n ) {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n config.env.types = await getEnvDefaultTypeDefinition(this);\n }\n\n if (\n !isSetString(config.env.secrets) &&\n !isSetString(config.env.secrets?.file)\n ) {\n config.env.secrets = await getSecretsDefaultTypeDefinition(this);\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n \"POWERLINES_\",\n this.config.framework?.name &&\n this.config.framework?.name !== \"powerlines\" &&\n `${constantCase(this.config.framework?.name)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = getUnique(\n toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[])\n );\n\n config.tsc.filter = {\n id: {\n include: [\n createVirtualPrefixRegex(joinPaths(this.builtinsPath, \"env.ts\")),\n createVirtualPrefixRegex(\n `${this.config.framework?.name || \"powerlines\"}:env`\n )\n ]\n }\n };\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n );\n\n if (\n isSetString(this.config.env.types) ||\n (this.config.env.types && isSetString(this.config.env.types.file))\n ) {\n this.config.env.types = parseTypeDefinition(\n this.config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(this.config.env.types.file);\n if (file) {\n this.config.env.types.file = file;\n }\n }\n\n if (\n isSetString(this.config.env.secrets) ||\n (this.config.env.secrets && isSetString(this.config.env.secrets.file))\n ) {\n this.config.env.secrets = parseTypeDefinition(\n this.config.env.secrets\n )!;\n\n const file = await this.fs.resolve(this.config.env.secrets.file);\n if (file) {\n this.config.env.secrets.file = file;\n }\n }\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Environment configuration definition file: ${\n this.config.env.types.file\n }${this.config.env.types.name ? `#${this.config.env.types.name}` : \"\"}${\n this.config.env.secrets\n ? `\\nSecrets configuration definition file: ${this.config.env.secrets?.file}${\n this.config.env.secrets?.name\n ? `#${this.config.env.secrets?.name}`\n : \"\"\n }`\n : \"\"\n }\\nEnvironment variable Prefixes: ${this.config.env.prefix.join(\", \")}\\nShould inject values: ${\n this.config.env.inject ? \"Yes\" : \"No\"\n }\\nShould validate configuration: ${\n this.config.env.validate ? \"Yes\" : \"No\"\n }`\n });\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameters used in project: \\n${this.env.used.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()}${\n prop.getAlias().length > 0\n ? ` (aliases: ${prop.getAlias().join(\", \")})`\n : \"\"\n }`\n )\n .join(\"\\n\")}`\n });\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameters used in project: \\n${this.env.used.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following environment configuration parameter definitions: \\n${this.env.types.env\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n if (this.env.types.secrets.getProperties().length > 0) {\n this.debug({\n meta: {\n category: \"env\"\n },\n message: `Found the following secret configuration parameter definitions: \\n${this.env.types.secrets\n .getProperties()\n .map(\n prop =>\n `- ${prop.getNameAsString()} (aliases: ${prop.getAlias().join(\", \")})`\n )\n .join(\"\\n\")}`\n });\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.info({\n meta: {\n category: \"env\"\n },\n message: `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n });\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvBuiltin\n defaultConfig={this.config.env.defaultConfig}\n reflection={result}\n />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this.config.root),\n \"env.md\"\n )}\"`\n );\n\n const result = await readEnvTypeReflection(this, \"env\");\n\n return render(\n this,\n <EnvDocsFile levelOffset={0} reflection={result} />\n );\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n env: env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,SAAI,aAAc,IAAM,MAAQ;AAC/B,IAAI,SAAK;AACT,QAAI;;;;;AA4CL,MAAE,SAAA,cAA2B,UAAA,EAAA,KAAA;AAC3B,QAAA;EAAA,QAAA;GACA,GAAA,QAAA;GACA,YAAA;GACA,OAAA;GACA,QAAA,EAAA;GACA,CAAA;EAAA,MAAA,QAAA,MAAqB;EAAA;GACrB,MAAA;GACA,MAAA,SAAA;AACI,SAAI,MAAO,yEAAa;IACxB,MAAG,SAAY;KACb,KAAC,KAAA,SAAkB;;MAElB,UAAQ;;MAET,QAAQ,EAAA;MACd,CAAA;KACM,OAAE;MACR,GAAA,QAAA;MACF,eAAA,CAAA,QAAA;;MAEE;KACG,SAAW;MACd,YAAA;MACK,OAAM;MACJ;KACJ,KAAA,EAAA;KACH;AACE,QAAA,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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.16.192",
3
+ "version": "0.16.195",
4
4
  "private": false,
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "keywords": ["dotenv", "powerlines", "storm-software", "powerlines-plugin"],
@@ -12,7 +12,7 @@
12
12
  "repository": {
13
13
  "type": "github",
14
14
  "url": "https://github.com/storm-software/powerlines.git",
15
- "directory": "packages/plugin-env"
15
+ "directory": "packages/plugins/plugin-env"
16
16
  },
17
17
  "funding": {
18
18
  "type": "github",
@@ -40,281 +40,109 @@
40
40
  ],
41
41
  "type": "module",
42
42
  "exports": {
43
- ".": {
44
- "require": {
45
- "types": "./dist/index.d.cts",
46
- "default": "./dist/index.cjs"
47
- },
48
- "import": {
49
- "types": "./dist/index.d.mts",
50
- "default": "./dist/index.mjs"
51
- },
52
- "default": {
53
- "types": "./dist/index.d.mts",
54
- "default": "./dist/index.mjs"
55
- }
56
- },
43
+ ".": { "import": "./dist/index.mjs", "require": "./dist/index.cjs" },
57
44
  "./babel": {
58
- "require": {
59
- "types": "./dist/babel/index.d.cts",
60
- "default": "./dist/babel/index.cjs"
61
- },
62
- "import": {
63
- "types": "./dist/babel/index.d.mts",
64
- "default": "./dist/babel/index.mjs"
65
- },
66
- "default": {
67
- "types": "./dist/babel/index.d.mts",
68
- "default": "./dist/babel/index.mjs"
69
- }
45
+ "import": "./dist/babel/index.mjs",
46
+ "require": "./dist/babel/index.cjs"
70
47
  },
71
48
  "./babel/plugin": {
72
- "require": {
73
- "types": "./dist/babel/plugin.d.cts",
74
- "default": "./dist/babel/plugin.cjs"
75
- },
76
- "import": {
77
- "types": "./dist/babel/plugin.d.mts",
78
- "default": "./dist/babel/plugin.mjs"
79
- },
80
- "default": {
81
- "types": "./dist/babel/plugin.d.mts",
82
- "default": "./dist/babel/plugin.mjs"
83
- }
49
+ "import": "./dist/babel/plugin.mjs",
50
+ "require": "./dist/babel/plugin.cjs"
84
51
  },
85
52
  "./components": {
86
- "require": {
87
- "types": "./dist/components/index.d.cts",
88
- "default": "./dist/components/index.cjs"
89
- },
90
- "import": {
91
- "types": "./dist/components/index.d.mts",
92
- "default": "./dist/components/index.mjs"
93
- },
94
- "default": {
95
- "types": "./dist/components/index.d.mts",
96
- "default": "./dist/components/index.mjs"
97
- }
53
+ "import": "./dist/components/index.mjs",
54
+ "require": "./dist/components/index.cjs"
98
55
  },
99
56
  "./components/docs": {
100
- "require": {
101
- "types": "./dist/components/docs.d.cts",
102
- "default": "./dist/components/docs.cjs"
103
- },
104
- "import": {
105
- "types": "./dist/components/docs.d.mts",
106
- "default": "./dist/components/docs.mjs"
107
- },
108
- "default": {
109
- "types": "./dist/components/docs.d.mts",
110
- "default": "./dist/components/docs.mjs"
111
- }
57
+ "import": "./dist/components/docs.mjs",
58
+ "require": "./dist/components/docs.cjs"
112
59
  },
113
60
  "./components/env-builtin": {
114
- "require": {
115
- "types": "./dist/components/env-builtin.d.cts",
116
- "default": "./dist/components/env-builtin.cjs"
117
- },
118
- "import": {
119
- "types": "./dist/components/env-builtin.d.mts",
120
- "default": "./dist/components/env-builtin.mjs"
121
- },
122
- "default": {
123
- "types": "./dist/components/env-builtin.d.mts",
124
- "default": "./dist/components/env-builtin.mjs"
125
- }
61
+ "import": "./dist/components/env-builtin.mjs",
62
+ "require": "./dist/components/env-builtin.cjs"
126
63
  },
127
64
  "./helpers": {
128
- "require": {
129
- "types": "./dist/helpers/index.d.cts",
130
- "default": "./dist/helpers/index.cjs"
131
- },
132
- "import": {
133
- "types": "./dist/helpers/index.d.mts",
134
- "default": "./dist/helpers/index.mjs"
135
- },
136
- "default": {
137
- "types": "./dist/helpers/index.d.mts",
138
- "default": "./dist/helpers/index.mjs"
139
- }
65
+ "import": "./dist/helpers/index.mjs",
66
+ "require": "./dist/helpers/index.cjs"
140
67
  },
141
68
  "./helpers/automd-generator": {
142
- "require": {
143
- "types": "./dist/helpers/automd-generator.d.cts",
144
- "default": "./dist/helpers/automd-generator.cjs"
145
- },
146
- "import": {
147
- "types": "./dist/helpers/automd-generator.d.mts",
148
- "default": "./dist/helpers/automd-generator.mjs"
149
- },
150
- "default": {
151
- "types": "./dist/helpers/automd-generator.d.mts",
152
- "default": "./dist/helpers/automd-generator.mjs"
153
- }
69
+ "import": "./dist/helpers/automd-generator.mjs",
70
+ "require": "./dist/helpers/automd-generator.cjs"
154
71
  },
155
72
  "./helpers/create-reflection-resource": {
156
- "require": {
157
- "types": "./dist/helpers/create-reflection-resource.d.cts",
158
- "default": "./dist/helpers/create-reflection-resource.cjs"
159
- },
160
- "import": {
161
- "types": "./dist/helpers/create-reflection-resource.d.mts",
162
- "default": "./dist/helpers/create-reflection-resource.mjs"
163
- },
164
- "default": {
165
- "types": "./dist/helpers/create-reflection-resource.d.mts",
166
- "default": "./dist/helpers/create-reflection-resource.mjs"
167
- }
73
+ "import": "./dist/helpers/create-reflection-resource.mjs",
74
+ "require": "./dist/helpers/create-reflection-resource.cjs"
168
75
  },
169
76
  "./helpers/load": {
170
- "require": {
171
- "types": "./dist/helpers/load.d.cts",
172
- "default": "./dist/helpers/load.cjs"
173
- },
174
- "import": {
175
- "types": "./dist/helpers/load.d.mts",
176
- "default": "./dist/helpers/load.mjs"
177
- },
178
- "default": {
179
- "types": "./dist/helpers/load.d.mts",
180
- "default": "./dist/helpers/load.mjs"
181
- }
77
+ "import": "./dist/helpers/load.mjs",
78
+ "require": "./dist/helpers/load.cjs"
182
79
  },
183
80
  "./helpers/persistence": {
184
- "require": {
185
- "types": "./dist/helpers/persistence.d.cts",
186
- "default": "./dist/helpers/persistence.cjs"
187
- },
188
- "import": {
189
- "types": "./dist/helpers/persistence.d.mts",
190
- "default": "./dist/helpers/persistence.mjs"
191
- },
192
- "default": {
193
- "types": "./dist/helpers/persistence.d.mts",
194
- "default": "./dist/helpers/persistence.mjs"
195
- }
81
+ "import": "./dist/helpers/persistence.mjs",
82
+ "require": "./dist/helpers/persistence.cjs"
196
83
  },
197
84
  "./helpers/reflect": {
198
- "require": {
199
- "types": "./dist/helpers/reflect.d.cts",
200
- "default": "./dist/helpers/reflect.cjs"
201
- },
202
- "import": {
203
- "types": "./dist/helpers/reflect.d.mts",
204
- "default": "./dist/helpers/reflect.mjs"
205
- },
206
- "default": {
207
- "types": "./dist/helpers/reflect.d.mts",
208
- "default": "./dist/helpers/reflect.mjs"
209
- }
85
+ "import": "./dist/helpers/reflect.mjs",
86
+ "require": "./dist/helpers/reflect.cjs"
210
87
  },
211
88
  "./helpers/source-file-env": {
212
- "require": {
213
- "types": "./dist/helpers/source-file-env.d.cts",
214
- "default": "./dist/helpers/source-file-env.cjs"
215
- },
216
- "import": {
217
- "types": "./dist/helpers/source-file-env.d.mts",
218
- "default": "./dist/helpers/source-file-env.mjs"
219
- },
220
- "default": {
221
- "types": "./dist/helpers/source-file-env.d.mts",
222
- "default": "./dist/helpers/source-file-env.mjs"
223
- }
89
+ "import": "./dist/helpers/source-file-env.mjs",
90
+ "require": "./dist/helpers/source-file-env.cjs"
224
91
  },
225
92
  "./helpers/template-helpers": {
226
- "require": {
227
- "types": "./dist/helpers/template-helpers.d.cts",
228
- "default": "./dist/helpers/template-helpers.cjs"
229
- },
230
- "import": {
231
- "types": "./dist/helpers/template-helpers.d.mts",
232
- "default": "./dist/helpers/template-helpers.mjs"
233
- },
234
- "default": {
235
- "types": "./dist/helpers/template-helpers.d.mts",
236
- "default": "./dist/helpers/template-helpers.mjs"
237
- }
93
+ "import": "./dist/helpers/template-helpers.mjs",
94
+ "require": "./dist/helpers/template-helpers.cjs"
238
95
  },
239
- "./package.json": "./package.json",
240
96
  "./types": {
241
- "require": {
242
- "types": "./dist/types/index.d.cts",
243
- "default": "./dist/types/index.cjs"
244
- },
245
- "import": {
246
- "types": "./dist/types/index.d.mts",
247
- "default": "./dist/types/index.mjs"
248
- },
249
- "default": {
250
- "types": "./dist/types/index.d.mts",
251
- "default": "./dist/types/index.mjs"
252
- }
97
+ "import": "./dist/types/index.mjs",
98
+ "require": "./dist/types/index.cjs"
253
99
  },
254
100
  "./types/env": {
255
- "require": {
256
- "types": "./dist/types/env.d.cts",
257
- "default": "./dist/types/env.cjs"
258
- },
259
- "import": {
260
- "types": "./dist/types/env.d.mts",
261
- "default": "./dist/types/env.mjs"
262
- },
263
- "default": {
264
- "types": "./dist/types/env.d.mts",
265
- "default": "./dist/types/env.mjs"
266
- }
101
+ "import": "./dist/types/env.mjs",
102
+ "require": "./dist/types/env.cjs"
267
103
  },
268
104
  "./types/plugin": {
269
- "require": {
270
- "types": "./dist/types/plugin.d.cts",
271
- "default": "./dist/types/plugin.cjs"
272
- },
273
- "import": {
274
- "types": "./dist/types/plugin.d.mts",
275
- "default": "./dist/types/plugin.mjs"
276
- },
277
- "default": {
278
- "types": "./dist/types/plugin.d.mts",
279
- "default": "./dist/types/plugin.mjs"
280
- }
281
- }
105
+ "import": "./dist/types/plugin.mjs",
106
+ "require": "./dist/types/plugin.cjs"
107
+ },
108
+ "./package.json": "./package.json"
282
109
  },
283
110
  "main": "./dist/index.cjs",
284
111
  "module": "./dist/index.mjs",
285
112
  "types": "./dist/index.d.cts",
286
113
  "typings": "dist/index.d.mts",
287
- "files": ["dist/**/*"],
114
+ "files": ["dist"],
288
115
  "dependencies": {
289
116
  "@alloy-js/core": "0.23.0-dev.8",
290
117
  "@alloy-js/json": "0.23.0-dev.2",
291
118
  "@alloy-js/markdown": "0.23.0-dev.1",
292
119
  "@alloy-js/typescript": "0.23.0-dev.4",
293
- "@babel/core": "8.0.0-rc.4",
294
- "@babel/types": "8.0.0-rc.4",
295
- "@powerlines/plugin-alloy": "^0.26.84",
296
- "@powerlines/plugin-automd": "^0.1.465",
297
- "@powerlines/plugin-babel": "^0.13.1",
298
- "@powerlines/plugin-plugin": "^0.12.416",
299
- "@powerlines/deepkit": "^0.8.64",
300
- "@powerlines/plugin-deepkit": "^0.11.347",
301
- "@storm-software/config-tools": "^1.190.1",
302
- "@stryke/capnp": "^0.12.96",
303
- "@stryke/convert": "^0.7.3",
304
- "@stryke/env": "^0.20.87",
305
- "@stryke/helpers": "^0.10.12",
306
- "@stryke/fs": "^0.33.70",
307
- "@stryke/json": "^0.14.16",
308
- "@stryke/path": "^0.28.2",
309
- "@stryke/string-format": "^0.17.13",
310
- "@stryke/type-checks": "^0.6.5",
311
- "@stryke/types": "^0.12.0",
120
+ "@babel/core": "8.0.0-rc.5",
121
+ "@babel/types": "8.0.0-rc.5",
122
+ "@powerlines/core": "^0.9.2",
123
+ "@powerlines/deepkit": "^0.9.2",
124
+ "@powerlines/plugin-alloy": "^0.26.87",
125
+ "@powerlines/plugin-automd": "^0.1.468",
126
+ "@powerlines/plugin-babel": "^0.13.4",
127
+ "@powerlines/plugin-deepkit": "^0.11.350",
128
+ "@powerlines/plugin-plugin": "^0.12.419",
129
+ "@storm-software/config-tools": "^1.190.2",
130
+ "@stryke/capnp": "^0.12.101",
131
+ "@stryke/convert": "^0.7.6",
132
+ "@stryke/env": "^0.20.92",
133
+ "@stryke/fs": "^0.33.75",
134
+ "@stryke/helpers": "^0.10.15",
135
+ "@stryke/json": "^0.14.20",
136
+ "@stryke/path": "^0.29.2",
137
+ "@stryke/string-format": "^0.17.17",
138
+ "@stryke/type-checks": "^0.6.8",
139
+ "@stryke/types": "^0.12.3",
312
140
  "automd": "^0.4.3",
141
+ "c12": "^3.3.4",
313
142
  "defu": "^6.1.7",
314
- "powerlines": "^0.47.4",
315
- "c12": "^3.3.4"
143
+ "powerlines": "^0.47.7"
316
144
  },
317
- "devDependencies": { "@types/node": "^25.6.0", "vite": "^8.0.10" },
145
+ "devDependencies": { "@types/node": "^25.7.0", "vite": "^8.0.12" },
318
146
  "publishConfig": { "access": "public" },
319
- "gitHead": "af32ddb830394bb40196113171aa009dd5b7e28a"
147
+ "gitHead": "3c5c701e16af74006dd70b965009d41eb22ace2a"
320
148
  }