@powerlines/plugin-env 0.16.83 → 0.16.84

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/package.json +9 -9
  2. package/dist/_virtual/_rolldown/runtime.cjs +0 -29
  3. package/dist/_virtual/_rolldown/runtime.mjs +0 -3
  4. package/dist/babel/index.cjs +0 -4
  5. package/dist/babel/index.d.cts +0 -2
  6. package/dist/babel/index.d.mts +0 -2
  7. package/dist/babel/index.mjs +0 -3
  8. package/dist/babel/plugin.cjs +0 -144
  9. package/dist/babel/plugin.d.cts +0 -8
  10. package/dist/babel/plugin.d.cts.map +0 -1
  11. package/dist/babel/plugin.d.mts +0 -8
  12. package/dist/babel/plugin.d.mts.map +0 -1
  13. package/dist/babel/plugin.mjs +0 -143
  14. package/dist/babel/plugin.mjs.map +0 -1
  15. package/dist/components/docs.cjs +0 -70
  16. package/dist/components/docs.d.cts +0 -25
  17. package/dist/components/docs.d.cts.map +0 -1
  18. package/dist/components/docs.d.mts +0 -25
  19. package/dist/components/docs.d.mts.map +0 -1
  20. package/dist/components/docs.mjs +0 -69
  21. package/dist/components/docs.mjs.map +0 -1
  22. package/dist/components/env-builtin.cjs +0 -568
  23. package/dist/components/env-builtin.d.cts +0 -22
  24. package/dist/components/env-builtin.d.cts.map +0 -1
  25. package/dist/components/env-builtin.d.mts +0 -22
  26. package/dist/components/env-builtin.d.mts.map +0 -1
  27. package/dist/components/env-builtin.mjs +0 -565
  28. package/dist/components/env-builtin.mjs.map +0 -1
  29. package/dist/components/index.cjs +0 -7
  30. package/dist/components/index.d.cts +0 -3
  31. package/dist/components/index.d.mts +0 -3
  32. package/dist/components/index.mjs +0 -4
  33. package/dist/helpers/automd-generator.cjs +0 -33
  34. package/dist/helpers/automd-generator.d.cts +0 -14
  35. package/dist/helpers/automd-generator.d.cts.map +0 -1
  36. package/dist/helpers/automd-generator.d.mts +0 -14
  37. package/dist/helpers/automd-generator.d.mts.map +0 -1
  38. package/dist/helpers/automd-generator.mjs +0 -32
  39. package/dist/helpers/automd-generator.mjs.map +0 -1
  40. package/dist/helpers/create-reflection-resource.cjs +0 -23
  41. package/dist/helpers/create-reflection-resource.d.cts +0 -13
  42. package/dist/helpers/create-reflection-resource.d.cts.map +0 -1
  43. package/dist/helpers/create-reflection-resource.d.mts +0 -13
  44. package/dist/helpers/create-reflection-resource.d.mts.map +0 -1
  45. package/dist/helpers/create-reflection-resource.mjs +0 -23
  46. package/dist/helpers/create-reflection-resource.mjs.map +0 -1
  47. package/dist/helpers/docs-helper.cjs +0 -25
  48. package/dist/helpers/docs-helper.d.cts +0 -13
  49. package/dist/helpers/docs-helper.d.cts.map +0 -1
  50. package/dist/helpers/docs-helper.d.mts +0 -13
  51. package/dist/helpers/docs-helper.d.mts.map +0 -1
  52. package/dist/helpers/docs-helper.mjs +0 -24
  53. package/dist/helpers/docs-helper.mjs.map +0 -1
  54. package/dist/helpers/index.cjs +0 -34
  55. package/dist/helpers/index.d.cts +0 -7
  56. package/dist/helpers/index.d.mts +0 -7
  57. package/dist/helpers/index.mjs +0 -8
  58. package/dist/helpers/load.cjs +0 -136
  59. package/dist/helpers/load.d.cts +0 -35
  60. package/dist/helpers/load.d.cts.map +0 -1
  61. package/dist/helpers/load.d.mts +0 -35
  62. package/dist/helpers/load.d.mts.map +0 -1
  63. package/dist/helpers/load.mjs +0 -133
  64. package/dist/helpers/load.mjs.map +0 -1
  65. package/dist/helpers/persistence.cjs +0 -323
  66. package/dist/helpers/persistence.d.cts +0 -84
  67. package/dist/helpers/persistence.d.cts.map +0 -1
  68. package/dist/helpers/persistence.d.mts +0 -84
  69. package/dist/helpers/persistence.d.mts.map +0 -1
  70. package/dist/helpers/persistence.mjs +0 -311
  71. package/dist/helpers/persistence.mjs.map +0 -1
  72. package/dist/helpers/reflect.cjs +0 -299
  73. package/dist/helpers/reflect.d.cts +0 -69
  74. package/dist/helpers/reflect.d.cts.map +0 -1
  75. package/dist/helpers/reflect.d.mts +0 -69
  76. package/dist/helpers/reflect.d.mts.map +0 -1
  77. package/dist/helpers/reflect.mjs +0 -290
  78. package/dist/helpers/reflect.mjs.map +0 -1
  79. package/dist/helpers/source-file-env.cjs +0 -59
  80. package/dist/helpers/source-file-env.d.cts +0 -9
  81. package/dist/helpers/source-file-env.d.cts.map +0 -1
  82. package/dist/helpers/source-file-env.d.mts +0 -9
  83. package/dist/helpers/source-file-env.d.mts.map +0 -1
  84. package/dist/helpers/source-file-env.mjs +0 -57
  85. package/dist/helpers/source-file-env.mjs.map +0 -1
  86. package/dist/helpers/template-helpers.cjs +0 -71
  87. package/dist/helpers/template-helpers.d.cts +0 -15
  88. package/dist/helpers/template-helpers.d.cts.map +0 -1
  89. package/dist/helpers/template-helpers.d.mts +0 -15
  90. package/dist/helpers/template-helpers.d.mts.map +0 -1
  91. package/dist/helpers/template-helpers.mjs +0 -70
  92. package/dist/helpers/template-helpers.mjs.map +0 -1
  93. package/dist/index.cjs +0 -195
  94. package/dist/index.d.cts +0 -17
  95. package/dist/index.d.cts.map +0 -1
  96. package/dist/index.d.mts +0 -17
  97. package/dist/index.d.mts.map +0 -1
  98. package/dist/index.mjs +0 -189
  99. package/dist/index.mjs.map +0 -1
  100. package/dist/types/index.cjs +0 -11
  101. package/dist/types/index.d.cts +0 -3
  102. package/dist/types/index.d.mts +0 -3
  103. package/dist/types/index.mjs +0 -4
  104. package/dist/types/plugin.cjs +0 -137
  105. package/dist/types/plugin.d.cts +0 -168
  106. package/dist/types/plugin.d.cts.map +0 -1
  107. package/dist/types/plugin.d.mts +0 -168
  108. package/dist/types/plugin.d.mts.map +0 -1
  109. package/dist/types/plugin.mjs +0 -132
  110. package/dist/types/plugin.mjs.map +0 -1
  111. package/dist/types/runtime.cjs +0 -244
  112. package/dist/types/runtime.d.cts +0 -792
  113. package/dist/types/runtime.d.cts.map +0 -1
  114. package/dist/types/runtime.d.mts +0 -792
  115. package/dist/types/runtime.d.mts.map +0 -1
  116. package/dist/types/runtime.mjs +0 -242
  117. package/dist/types/runtime.mjs.map +0 -1
@@ -1 +0,0 @@
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 alloy from \"@powerlines/plugin-alloy\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { existsSync } from \"@stryke/fs/exists\";\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 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 { getDocsOutputPath } from \"./helpers/docs-helper\";\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 type * 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 alloy(options.alloy),\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 transform: {\n babel: {\n plugins: [envBabelPlugin]\n }\n }\n };\n\n if (\n isSetString(config.env.types) ||\n (config.env.types && isSetString(config.env.types.file))\n ) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.types.file);\n if (file) {\n config.env.types.file = file;\n }\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(envDefaultTypeDefinition.file);\n if (file) {\n config.env.types = parseTypeDefinition(\n `${file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n }\n\n if (\n isSetString(config.env.secrets) ||\n (config.env.secrets && isSetString(config.env.secrets.file))\n ) {\n config.env.secrets = parseTypeDefinition(\n config.env.secrets\n ) as TypeDefinition;\n\n const file = await this.fs.resolve(config.env.secrets.file);\n if (file) {\n config.env.secrets.file = file;\n }\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n\n const file = await this.fs.resolve(secretsDefaultTypeDefinition.file);\n if (file) {\n config.env.secrets = parseTypeDefinition(\n `${file}#${secretsDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\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 ...ENV_PREFIXES,\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 = 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 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 ) as EnvPluginContext[\"env\"];\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 if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\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 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 await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.debug(\n `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),\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAE,UAAkB,UAAA,EAAA,KAAA;AAClB,QAAA;EAAA,MAAA,QAAA,MAAA;EAAA,MAAA,QAAA,MAAA;EAAA;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IAAW,MAAC,QAAO;AACrB,YAAA,mBAAA,MAAA,KAAA,IAAA,KAAA,SAAA,UAAA;;;;GAIL,MAAM,UAAU;IACd,MAAK,SAAA;AACL,SAAI,MAAK,0EAAS;IAClB,MAAI,SAAA,MAAA,sBAAA,MAAA,MAAA;AACJ,WAAM,OAAO,MAAA,gBAAA,YAAA;KACX,IAAI,gBAAQ;AACV,aAAG,OAAA,OAAA,IAAA;;KAEL,YAAY;KACb,CAAC,CAAC;;GAEL,WAAQ;IACN,OAAM;IACN,MAAI,UAAA;AACF,SAAI,KAAC,IAAA,KAAA,IAAiB,eAAM,CAAA,SAAA,GAAA;;AAE1B,YAAC,mBAAA,MAAA,KAAA,IAAA,KAAA,KAAA,MAAA;;AAEH,SAAG,KAAK,IAAA,KAAO,QAAW,eAAA,CAAA,SAAA,GAAA;AACxB,WAAK,MAAA,uDAAgD,sBAAA,MAAA,UAAA,CAAA,GAAA;AACrD,YAAA,mBAAW,MAAA,KAAyB,IAAC,KAAO,SAAK,UAAA;;;IAGtD;GACD,MAAM,OAAC;;IAEL,MAAI,SAAS,MAAM,sBAAY,MAAA,MAAsB;;KAEnD,aAAM;KACN,YAAY;KACb,CAAC,CAAC;;GAEL,MAAM,WAAI;IACR,MAAM,iBAAe,sBAAgB,MAAA,MAAA;AACrC,SAAK,MAAG,mCAAI,eAAA,GAAA;AACZ,UAAM,mBAAU,MAAA,KAAA,IAAA,KAAA,KAAA,MAAA;;GAEnB;EAAE;;GAED,SAAS;AACP,WAAM,EACJ,QAAE,KAAA,QAAA,UAAA,EAAA,EAAA,EACA,YAAK,EACL,KAAK,IAAK,KAAA,EACT,EACF,CAAC;;GAGP;EAAE;GACD,MAAM;GACN,MAAM,EACJ,iBAAK;AACH,WAAO,EACL,WAAW,KAAC,QAAK,KAAA,QAClB;MAEJ"}
@@ -1,11 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_types_runtime = require('./runtime.cjs');
3
- const require_types_plugin = require('./plugin.cjs');
4
-
5
- exports.__ΩEnvInterface = require_types_runtime.__ΩEnvInterface;
6
- exports.__ΩEnvPluginContext = require_types_plugin.__ΩEnvPluginContext;
7
- exports.__ΩEnvPluginOptions = require_types_plugin.__ΩEnvPluginOptions;
8
- exports.__ΩEnvPluginResolvedConfig = require_types_plugin.__ΩEnvPluginResolvedConfig;
9
- exports.__ΩEnvPluginUserConfig = require_types_plugin.__ΩEnvPluginUserConfig;
10
- exports.__ΩEnvType = require_types_plugin.__ΩEnvType;
11
- exports.__ΩSecretsInterface = require_types_runtime.__ΩSecretsInterface;
@@ -1,3 +0,0 @@
1
- import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./runtime.cjs";
2
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./plugin.cjs";
3
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface };
@@ -1,3 +0,0 @@
1
- import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./runtime.mjs";
2
- import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./plugin.mjs";
3
- export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface };
@@ -1,4 +0,0 @@
1
- import { __ΩEnvInterface, __ΩSecretsInterface } from "./runtime.mjs";
2
- import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./plugin.mjs";
3
-
4
- export { __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface };
@@ -1,137 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
- const require_types_runtime = require('./runtime.cjs');
4
- let _powerlines_plugin_babel_types = require("@powerlines/plugin-babel/types");
5
- let _powerlines_plugin_automd_types_plugin = require("@powerlines/plugin-automd/types/plugin");
6
- let _powerlines_plugin_alloy_types = require("@powerlines/plugin-alloy/types");
7
- let _powerlines_deepkit_types = require("@powerlines/deepkit/types");
8
-
9
- //#region src/types/plugin.ts
10
- const __ΩOmit = [
11
- "T",
12
- "K",
13
- () => __ΩPick,
14
- () => __ΩExclude,
15
- "Omit",
16
- "b!b\"e!!e!!ge!\"o$#o##w%y"
17
- ];
18
- const __ΩRequired = [
19
- "T",
20
- "Required",
21
- "l+e#!e\"!fRb!Pde\"!gN##w\"y"
22
- ];
23
- const __ΩPick = [
24
- "T",
25
- "K",
26
- "Pick",
27
- "l+e#!e\"!fRb!b\"Pde\"\"N#!w#y"
28
- ];
29
- const __ΩExclude = [
30
- "T",
31
- "U",
32
- "Exclude",
33
- "l6!Re$!RPe#!e$\"qk#%QRb!b\"Pde\"!p)w#y"
34
- ];
35
- const __ΩEnvType = [
36
- "env",
37
- "secrets",
38
- "EnvType",
39
- "P.!.\"Jw#y"
40
- ];
41
- const __ΩEnvPluginOptions = [
42
- () => __ΩOmit,
43
- "types",
44
- "types",
45
- "A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigConfiguration\"`.",
46
- "secrets",
47
- "A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `\":\"` or `\"#\"` character. For example: `\"./src/types/env.ts#ConfigSecrets\"`.",
48
- "prefix",
49
- "An additional prefix (or list of additional prefixes) to apply to the environment variables",
50
- "inject",
51
- true,
52
- "Should the plugin inject the env variables in the source code with their values?",
53
- "validate",
54
- "Should the plugin validate the loaded environment variables against the provided type definitions?",
55
- "Children",
56
- "defaultConfig",
57
- "The default configuration to use when loading environment variables.",
58
- () => _powerlines_plugin_babel_types.__ΩBabelPluginOptions,
59
- "babel",
60
- "Babel configuration options to use when injecting environment variables into the source code.",
61
- () => _powerlines_plugin_automd_types_plugin.__ΩAutoMDPluginOptions,
62
- "automd",
63
- "AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.",
64
- () => _powerlines_plugin_alloy_types.__ΩAlloyPluginOptions,
65
- "alloy",
66
- "Alloy configuration options to use when injecting environment variables into the source code.",
67
- "EnvPluginOptions",
68
- "P!.\"o!#P!4#8?$!4%8?&P&&FJ4'8?()4)8>*?+)4,8>*?-\"w.4/8?0n1428?3n4458?6n7488?9MKw:y"
69
- ];
70
- const __ΩEnvPluginUserConfig = [
71
- () => _powerlines_plugin_babel_types.__ΩBabelPluginUserConfig,
72
- () => _powerlines_plugin_alloy_types.__ΩAlloyPluginUserConfig,
73
- () => __ΩEnvPluginOptions,
74
- "env",
75
- "EnvPluginUserConfig",
76
- "Pn!n\"Pn#4$MKw%y"
77
- ];
78
- const __ΩEnvPluginResolvedConfig = [
79
- () => _powerlines_plugin_babel_types.__ΩBabelPluginResolvedConfig,
80
- () => _powerlines_plugin_alloy_types.__ΩAlloyPluginResolvedConfig,
81
- () => __ΩRequired,
82
- () => __ΩPick,
83
- "additionalFiles",
84
- () => __ΩRequired,
85
- () => __ΩPick,
86
- () => __ΩEnvPluginOptions,
87
- "defaultConfig",
88
- "types",
89
- "The type definition for the expected env variable parameters",
90
- "secrets",
91
- "The type definition for the expected env secret parameters",
92
- "inject",
93
- "Should the plugin inject the env variables in the source code with their values?",
94
- "validate",
95
- "Should the plugin validate the loaded environment variables against the provided type definitions?",
96
- "prefix",
97
- "The prefix used for environment variables",
98
- "env",
99
- "EnvPluginResolvedConfig",
100
- "Pn!n\"PP!.%o$#o#\"n(.)o'#o&\"P!4*?+!4,?-)4.?/)40?1&F42?3MK44MKw5y"
101
- ];
102
- const __ΩEnvPluginContext = [
103
- () => __ΩEnvPluginResolvedConfig,
104
- "TResolvedConfig",
105
- () => _powerlines_plugin_babel_types.__ΩBabelPluginContext,
106
- () => _powerlines_plugin_alloy_types.__ΩAlloyPluginContext,
107
- () => _powerlines_deepkit_types.__ΩReflection,
108
- "env",
109
- "The type definitions for the expected env variables",
110
- () => _powerlines_deepkit_types.__ΩReflection,
111
- "secrets",
112
- "The type definitions for the expected env secrets",
113
- "The type definitions reflection for the env variables and secrets",
114
- "types",
115
- () => _powerlines_deepkit_types.__ΩReflection,
116
- () => require_types_runtime.__ΩEnvInterface,
117
- "The current env variables reflection",
118
- () => _powerlines_deepkit_types.__ΩReflection,
119
- () => require_types_runtime.__ΩSecretsInterface,
120
- "The current env secrets reflection",
121
- "The current **used** environment variables and secrets reflection",
122
- "used",
123
- "parsed",
124
- "The parsed .env configuration object",
125
- () => _powerlines_deepkit_types.__ΩReflection,
126
- "injected",
127
- "The injected environment variables and secrets reflection",
128
- "EnvPluginContext",
129
- "n!c\"Pe\"!o#\"e\"!o$\"PPn%4&?'n(4)?*M?+4,?+Pn.o-\"4&?/n1o0\"4)?2M?344?3!45?6n748?9M4&Mw:y"
130
- ];
131
-
132
- //#endregion
133
- exports.__ΩEnvPluginContext = __ΩEnvPluginContext;
134
- exports.__ΩEnvPluginOptions = __ΩEnvPluginOptions;
135
- exports.__ΩEnvPluginResolvedConfig = __ΩEnvPluginResolvedConfig;
136
- exports.__ΩEnvPluginUserConfig = __ΩEnvPluginUserConfig;
137
- exports.__ΩEnvType = __ΩEnvType;
@@ -1,168 +0,0 @@
1
- import { EnvInterface, SecretsInterface } from "./runtime.cjs";
2
- import { Children } from "@alloy-js/core";
3
- import { Reflection } from "@powerlines/deepkit/types";
4
- import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
5
- import { AutoMDPluginOptions } from "@powerlines/plugin-automd/types/plugin";
6
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
7
- import { DotenvParseOutput } from "@stryke/env/types";
8
- import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
9
-
10
- //#region src/types/plugin.d.ts
11
- type EnvType = "env" | "secrets";
12
- type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
13
- /**
14
- * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigConfiguration"`.
15
- */
16
- types?: TypeDefinitionParameter;
17
- /**
18
- * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigSecrets"`.
19
- */
20
- secrets?: TypeDefinitionParameter;
21
- /**
22
- * An additional prefix (or list of additional prefixes) to apply to the environment variables
23
- *
24
- * @remarks
25
- * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
26
- */
27
- prefix?: string | string[];
28
- /**
29
- * Should the plugin inject the env variables in the source code with their values?
30
- *
31
- * @defaultValue false
32
- */
33
- inject?: boolean;
34
- /**
35
- * Should the plugin validate the loaded environment variables against the provided type definitions?
36
- *
37
- * @defaultValue false
38
- */
39
- validate?: boolean;
40
- /**
41
- * The default configuration to use when loading environment variables.
42
- *
43
- * @remarks
44
- * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
45
- */
46
- defaultConfig?: Children;
47
- /**
48
- * Babel configuration options to use when injecting environment variables into the source code.
49
- *
50
- * @remarks
51
- * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
52
- */
53
- babel?: BabelPluginOptions;
54
- /**
55
- * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
56
- *
57
- * @remarks
58
- * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
59
- */
60
- automd?: AutoMDPluginOptions;
61
- /**
62
- * Alloy configuration options to use when injecting environment variables into the source code.
63
- *
64
- * @remarks
65
- * This option allows you to customize the Alloy transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Alloy settings.
66
- */
67
- alloy?: AlloyPluginOptions;
68
- };
69
- type EnvPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
70
- env: EnvPluginOptions;
71
- };
72
- type EnvPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
73
- env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
74
- /**
75
- * The type definition for the expected env variable parameters
76
- *
77
- * @remarks
78
- * This value is parsed from the {@link EnvPluginOptions.types} option.
79
- */
80
- types: TypeDefinition;
81
- /**
82
- * The type definition for the expected env secret parameters
83
- *
84
- * @remarks
85
- * This value is parsed from the {@link EnvPluginOptions.secrets} option.
86
- */
87
- secrets: TypeDefinition;
88
- /**
89
- * Should the plugin inject the env variables in the source code with their values?
90
- *
91
- * @remarks
92
- * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
93
- */
94
- inject: boolean;
95
- /**
96
- * Should the plugin validate the loaded environment variables against the provided type definitions?
97
- *
98
- * @remarks
99
- * This value is the result of reflecting the {@link EnvPluginOptions.validate} option.
100
- */
101
- validate: boolean;
102
- /**
103
- * The prefix used for environment variables
104
- *
105
- * @remarks
106
- * This value is used to filter environment variables that are loaded from the .env file and the process environment.
107
- */
108
- prefix: string[];
109
- };
110
- };
111
- interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
112
- env: {
113
- /**
114
- * The type definitions reflection for the env variables and secrets
115
- *
116
- * @remarks
117
- * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
118
- */
119
- types: {
120
- /**
121
- * The type definitions for the expected env variables
122
- */
123
- env: Reflection;
124
- /**
125
- * The type definitions for the expected env secrets
126
- */
127
- secrets: Reflection;
128
- };
129
- /**
130
- * The current **used** environment variables and secrets reflection
131
- *
132
- * @remarks
133
- * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
134
- */
135
- used: {
136
- /**
137
- * The current env variables reflection
138
- */
139
- env: Reflection<EnvInterface>;
140
- /**
141
- * The current env secrets reflection
142
- */
143
- secrets: Reflection<SecretsInterface>;
144
- };
145
- /**
146
- * The parsed .env configuration object
147
- *
148
- * @remarks
149
- * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
150
- */
151
- parsed: DotenvParseOutput;
152
- /**
153
- * The injected environment variables and secrets reflection
154
- *
155
- * @remarks
156
- * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
157
- */
158
- injected: Reflection;
159
- };
160
- }
161
- declare type __ΩEnvType = any[];
162
- declare type __ΩEnvPluginOptions = any[];
163
- declare type __ΩEnvPluginUserConfig = any[];
164
- declare type __ΩEnvPluginResolvedConfig = any[];
165
- declare type __ΩEnvPluginContext = any[];
166
- //#endregion
167
- export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩE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,iBAAA;;;;;;;IAQR,QAAA,EAAU,UAAA;EAAA;AAAA;AAAA"}
@@ -1,168 +0,0 @@
1
- import { EnvInterface, SecretsInterface } from "./runtime.mjs";
2
- import { BabelPluginContext, BabelPluginOptions, BabelPluginResolvedConfig, BabelPluginUserConfig } from "@powerlines/plugin-babel/types";
3
- import { AutoMDPluginOptions } from "@powerlines/plugin-automd/types/plugin";
4
- import { AlloyPluginContext, AlloyPluginOptions, AlloyPluginResolvedConfig, AlloyPluginUserConfig } from "@powerlines/plugin-alloy/types";
5
- import { Reflection } from "@powerlines/deepkit/types";
6
- import { DotenvParseOutput } from "@stryke/env/types";
7
- import { Children } from "@alloy-js/core";
8
- import { DotenvConfiguration, TypeDefinition, TypeDefinitionParameter } from "@stryke/types/configuration";
9
-
10
- //#region src/types/plugin.d.ts
11
- type EnvType = "env" | "secrets";
12
- type EnvPluginOptions = Omit<DotenvConfiguration, "types"> & {
13
- /**
14
- * A path to the type definition for the expected env configuration parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigConfiguration"`.
15
- */
16
- types?: TypeDefinitionParameter;
17
- /**
18
- * A path to the type definition for the expected env secret parameters. This value can include both a path to the typescript file and the name of the type definition to use separated by a `":"` or `"#"` character. For example: `"./src/types/env.ts#ConfigSecrets"`.
19
- */
20
- secrets?: TypeDefinitionParameter;
21
- /**
22
- * An additional prefix (or list of additional prefixes) to apply to the environment variables
23
- *
24
- * @remarks
25
- * By default, the plugin will use the `POWERLINES_` prefix. This option is useful for avoiding conflicts with other environment variables.
26
- */
27
- prefix?: string | string[];
28
- /**
29
- * Should the plugin inject the env variables in the source code with their values?
30
- *
31
- * @defaultValue false
32
- */
33
- inject?: boolean;
34
- /**
35
- * Should the plugin validate the loaded environment variables against the provided type definitions?
36
- *
37
- * @defaultValue false
38
- */
39
- validate?: boolean;
40
- /**
41
- * The default configuration to use when loading environment variables.
42
- *
43
- * @remarks
44
- * This configuration is used as the base configuration when loading environment variables, and will be overridden by any values found in the `.env` file or the process environment.
45
- */
46
- defaultConfig?: Children;
47
- /**
48
- * Babel configuration options to use when injecting environment variables into the source code.
49
- *
50
- * @remarks
51
- * This option allows you to customize the Babel transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Babel settings.
52
- */
53
- babel?: BabelPluginOptions;
54
- /**
55
- * AutoMD configuration options to allow injecting environment variables documentation into a markdown file such as a README.md.
56
- *
57
- * @remarks
58
- * The README.md file should contain the `<!-- automd:env --><!-- /automd -->` comment block where the documentation will be injected.
59
- */
60
- automd?: AutoMDPluginOptions;
61
- /**
62
- * Alloy configuration options to use when injecting environment variables into the source code.
63
- *
64
- * @remarks
65
- * This option allows you to customize the Alloy transformation process used to inject environment variables into the source code. If not provided, the plugin will use default Alloy settings.
66
- */
67
- alloy?: AlloyPluginOptions;
68
- };
69
- type EnvPluginUserConfig = BabelPluginUserConfig & AlloyPluginUserConfig & {
70
- env: EnvPluginOptions;
71
- };
72
- type EnvPluginResolvedConfig = BabelPluginResolvedConfig & AlloyPluginResolvedConfig & {
73
- env: Required<Pick<DotenvConfiguration, "additionalFiles">> & Required<Pick<EnvPluginOptions, "defaultConfig">> & {
74
- /**
75
- * The type definition for the expected env variable parameters
76
- *
77
- * @remarks
78
- * This value is parsed from the {@link EnvPluginOptions.types} option.
79
- */
80
- types: TypeDefinition;
81
- /**
82
- * The type definition for the expected env secret parameters
83
- *
84
- * @remarks
85
- * This value is parsed from the {@link EnvPluginOptions.secrets} option.
86
- */
87
- secrets: TypeDefinition;
88
- /**
89
- * Should the plugin inject the env variables in the source code with their values?
90
- *
91
- * @remarks
92
- * This value is the result of reflecting the {@link EnvPluginOptions.inject} option.
93
- */
94
- inject: boolean;
95
- /**
96
- * Should the plugin validate the loaded environment variables against the provided type definitions?
97
- *
98
- * @remarks
99
- * This value is the result of reflecting the {@link EnvPluginOptions.validate} option.
100
- */
101
- validate: boolean;
102
- /**
103
- * The prefix used for environment variables
104
- *
105
- * @remarks
106
- * This value is used to filter environment variables that are loaded from the .env file and the process environment.
107
- */
108
- prefix: string[];
109
- };
110
- };
111
- interface EnvPluginContext<TResolvedConfig extends EnvPluginResolvedConfig = EnvPluginResolvedConfig> extends BabelPluginContext<TResolvedConfig>, AlloyPluginContext<TResolvedConfig> {
112
- env: {
113
- /**
114
- * The type definitions reflection for the env variables and secrets
115
- *
116
- * @remarks
117
- * These reflections contains the structure of the expected environment variables and secrets as defined by the type definitions provided in the plugin configuration.
118
- */
119
- types: {
120
- /**
121
- * The type definitions for the expected env variables
122
- */
123
- env: Reflection;
124
- /**
125
- * The type definitions for the expected env secrets
126
- */
127
- secrets: Reflection;
128
- };
129
- /**
130
- * The current **used** environment variables and secrets reflection
131
- *
132
- * @remarks
133
- * This reflection contains the structure of the current environment variables and secrets as defined during the plugin initialization by extracting the values from the source code.
134
- */
135
- used: {
136
- /**
137
- * The current env variables reflection
138
- */
139
- env: Reflection<EnvInterface>;
140
- /**
141
- * The current env secrets reflection
142
- */
143
- secrets: Reflection<SecretsInterface>;
144
- };
145
- /**
146
- * The parsed .env configuration object
147
- *
148
- * @remarks
149
- * This value is the result of loading the .env configuration file found in the project root directory and merging it with the values provided at {@link EnvPluginOptions.values}
150
- */
151
- parsed: DotenvParseOutput;
152
- /**
153
- * The injected environment variables and secrets reflection
154
- *
155
- * @remarks
156
- * This reflection contains the structure of the injected environment variables and secrets that were injected into the source code during the build process.
157
- */
158
- injected: Reflection;
159
- };
160
- }
161
- declare type __ΩEnvType = any[];
162
- declare type __ΩEnvPluginOptions = any[];
163
- declare type __ΩEnvPluginUserConfig = any[];
164
- declare type __ΩEnvPluginResolvedConfig = any[];
165
- declare type __ΩEnvPluginContext = any[];
166
- //#endregion
167
- export { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType };
168
- //# sourceMappingURL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