@powerlines/plugin-env 0.13.56 → 0.13.58

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 (76) hide show
  1. package/README.md +5 -1
  2. package/dist/config-BgxhYOhP.d.mts +1 -2
  3. package/dist/config-DO3dqNWo.d.cts +1 -2
  4. package/dist/create-reflection-resource-BQ5mItFl.d.mts +1 -2
  5. package/dist/create-reflection-resource-Cwclmcyo.d.cts +1 -2
  6. package/dist/create-reflection-resource-UtOwX4Ml.mjs +1 -2
  7. package/dist/docs-BDiEhcDa.mjs +1 -2
  8. package/dist/docs-BoZkRBO4.d.cts +1 -2
  9. package/dist/docs-BwK6pC_c.d.mts +1 -2
  10. package/dist/env-BpSAx122.d.mts +1 -2
  11. package/dist/env-D4MK9BWK.mjs +1 -2
  12. package/dist/env-Mgv4u8VY.d.cts +1 -2
  13. package/dist/index-DPDDjaRF.d.cts +1 -2
  14. package/dist/index-DZnZEdDI.d.mts +1 -2
  15. package/dist/index.mjs +1 -2
  16. package/dist/load-BZTlThWg.mjs +1 -2
  17. package/dist/load-C4lA54bJ.d.mts +1 -2
  18. package/dist/load-CN-Mm8-g.d.cts +1 -2
  19. package/dist/persistence-Br-YMVb1.mjs +1 -2
  20. package/dist/persistence-CeAmYbDK.d.cts +1 -2
  21. package/dist/persistence-DSKai3M7.d.mts +1 -2
  22. package/dist/plugin-CYiqhftf.d.cts +1 -2
  23. package/dist/plugin-CdupbOcS.d.mts +1 -2
  24. package/dist/plugin-Cx61c9gw.mjs +1 -2
  25. package/dist/reflect-biXSZqcW.d.mts +1 -2
  26. package/dist/reflect-gaw4hJ9H.d.cts +1 -2
  27. package/dist/runtime-BWa_ko5I.d.mts +1 -2
  28. package/dist/runtime-BYdaCpVq.d.cts +1 -2
  29. package/dist/source-file-CjFSCK1w.mjs +1 -2
  30. package/dist/source-file-env-BDFTs5WJ.mjs +1 -2
  31. package/dist/source-file-env-DonDJDV1.d.cts +1 -2
  32. package/dist/source-file-env-DzpWKluw.d.mts +1 -2
  33. package/dist/template-helpers-BaMJZc5X.d.cts +1 -2
  34. package/dist/template-helpers-CLrM_TtO.mjs +1 -2
  35. package/dist/template-helpers-LJwCi0e-.d.mts +1 -2
  36. package/dist/type-CnPIyotQ.d.mts +1 -2
  37. package/dist/type-D6dRgWJT.d.cts +1 -2
  38. package/dist/utilities-4S--uN0L.mjs +1 -2
  39. package/package.json +8 -8
  40. package/dist/config-BgxhYOhP.d.mts.map +0 -1
  41. package/dist/config-DO3dqNWo.d.cts.map +0 -1
  42. package/dist/create-reflection-resource-BQ5mItFl.d.mts.map +0 -1
  43. package/dist/create-reflection-resource-Cwclmcyo.d.cts.map +0 -1
  44. package/dist/create-reflection-resource-UtOwX4Ml.mjs.map +0 -1
  45. package/dist/docs-BDiEhcDa.mjs.map +0 -1
  46. package/dist/docs-BoZkRBO4.d.cts.map +0 -1
  47. package/dist/docs-BwK6pC_c.d.mts.map +0 -1
  48. package/dist/env-BpSAx122.d.mts.map +0 -1
  49. package/dist/env-D4MK9BWK.mjs.map +0 -1
  50. package/dist/env-Mgv4u8VY.d.cts.map +0 -1
  51. package/dist/index-DPDDjaRF.d.cts.map +0 -1
  52. package/dist/index-DZnZEdDI.d.mts.map +0 -1
  53. package/dist/index.mjs.map +0 -1
  54. package/dist/load-BZTlThWg.mjs.map +0 -1
  55. package/dist/load-C4lA54bJ.d.mts.map +0 -1
  56. package/dist/load-CN-Mm8-g.d.cts.map +0 -1
  57. package/dist/persistence-Br-YMVb1.mjs.map +0 -1
  58. package/dist/persistence-CeAmYbDK.d.cts.map +0 -1
  59. package/dist/persistence-DSKai3M7.d.mts.map +0 -1
  60. package/dist/plugin-CYiqhftf.d.cts.map +0 -1
  61. package/dist/plugin-CdupbOcS.d.mts.map +0 -1
  62. package/dist/plugin-Cx61c9gw.mjs.map +0 -1
  63. package/dist/reflect-biXSZqcW.d.mts.map +0 -1
  64. package/dist/reflect-gaw4hJ9H.d.cts.map +0 -1
  65. package/dist/runtime-BWa_ko5I.d.mts.map +0 -1
  66. package/dist/runtime-BYdaCpVq.d.cts.map +0 -1
  67. package/dist/source-file-CjFSCK1w.mjs.map +0 -1
  68. package/dist/source-file-env-BDFTs5WJ.mjs.map +0 -1
  69. package/dist/source-file-env-DonDJDV1.d.cts.map +0 -1
  70. package/dist/source-file-env-DzpWKluw.d.mts.map +0 -1
  71. package/dist/template-helpers-BaMJZc5X.d.cts.map +0 -1
  72. package/dist/template-helpers-CLrM_TtO.mjs.map +0 -1
  73. package/dist/template-helpers-LJwCi0e-.d.mts.map +0 -1
  74. package/dist/type-CnPIyotQ.d.mts.map +0 -1
  75. package/dist/type-D6dRgWJT.d.cts.map +0 -1
  76. package/dist/utilities-4S--uN0L.mjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin-Cx61c9gw.mjs","names":["_generate","parse","parseAst","code","opts","plugins","sourceType","allowImportExportEverywhere","allowAwaitOutsideFunction","generate","default","generateFromAst","ast","importAttributesKeyword","sourceMaps","undefined","getLogFn","getLogLevel","LogLevelLabel","getColor","noop","titleCase","chalk","createLog","name","options","logLevel","SILENT","INFO","customLogger","type","args","bold","hex","gray","join","trim","BADGE_COLORS","extendLog","logFn","inverse","split","map","char","charCodeAt","reduce","ret","charCode","length","declare","LogLevelLabel","chalk","extendLog","createBabelPlugin","name","builder","plugin","context","api","options","dirname","cache","using","meta","checksum","assertVersion","log","TRACE","bold","cyanBright","result","$$name","t","isString","parseAst","findExport","ast","key","type","node","program","body","declaration","declarations","id","name","init","listExports","codeOrAst","flatMap","i","map","d","filter","Boolean","listImports","specifiers","s","imported","value","isImportCall","calleePath","isImport","callee","getImport","specifier","named","importDeclaration","importSpecifier","identifier","stringLiteral","addImport","path","addImportsToProgram","scope","getProgramParent","isNonNamespacedImport","importDeclPath","get","every","isImportSpecifier","importKind","getExistingImports","existingImports","Map","traverse","ImportDeclaration","set","source","module","unshiftContainer","convertFromCapnp","SerializedTypes","CapnpSerializedTypes","stringifyDefaultValue","deserializeType","ReflectionClass","ReflectionKind","resolveClassType","createBabelPlugin","addImport","LogLevelLabel","capnp","readFileBufferSync","existsSync","getEnvReflectionsPath","envBabelPlugin","log","context","extractEnv","node","pass","isInjectable","envTypesAliasProperties","env","types","getProperties","filter","prop","getAlias","length","name","prefix","config","find","pre","startsWith","hasProperty","replace","some","includes","TRACE","filename","envProperty","getProperty","isIgnored","used","addProperty","property","inject","value","parsed","undefined","getDefaultValue","isValueRequired","Error","getPropertyNames","sort","a","b","String","localeCompare","map","typeDef","getNameAsString","join","visitor","MemberExpression","path","get","isIdentifier","identifier","replaceWithSourceString","module","imported","isCallExpression","callee","type","isMetaProperty","post","persistedEnv","from","kind","objectLiteral","description","reflectionPath","Message","getRoot","forEach","getDescription","default","optional","isOptional","readonly","isReadonly","visibility","getVisibility","getType","tags","getTags"],"sources":["../../plugin-babel/src/helpers/ast-utils.ts","../../powerlines/src/lib/logger.ts","../../plugin-babel/src/helpers/create-plugin.ts","../../plugin-babel/src/helpers/module-helpers.ts","../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 type { GeneratorOptions, GeneratorResult } from \"@babel/generator\";\nimport _generate from \"@babel/generator\";\nimport type { ParseResult, ParserOptions } from \"@babel/parser\";\nimport { parse } from \"@babel/parser\";\nimport type * as t from \"@babel/types\";\n\n/**\n * Parse the given code into an AST.\n *\n * @param code - The code to parse.\n * @param opts - The options for parsing.\n * @returns The parsed AST.\n */\nexport function parseAst(\n code: string,\n opts: ParserOptions = {}\n): ParseResult<t.File> {\n return parse(code, {\n plugins: [\"typescript\"],\n sourceType: \"module\",\n allowImportExportEverywhere: true,\n allowAwaitOutsideFunction: true,\n ...opts\n });\n}\n\nlet generate = _generate;\nif (\"default\" in generate) {\n generate = generate.default as typeof generate;\n}\n\nexport type GenerateFromAstOptions = GeneratorOptions &\n Required<Pick<GeneratorOptions, \"sourceFileName\" | \"filename\">>;\n\nexport function generateFromAst(\n ast: t.Node,\n opts?: GenerateFromAstOptions\n): GeneratorResult {\n return generate(\n ast,\n opts\n ? { importAttributesKeyword: \"with\", sourceMaps: true, ...opts }\n : undefined\n );\n}\n\nexport type { GeneratorResult } from \"@babel/generator\";\n","/* -------------------------------------------------------------------\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 { getLogFn, getLogLevel } from \"@storm-software/config-tools/logger\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport { getColor } from \"@storm-software/config-tools/utilities/colors\";\nimport { noop } from \"@stryke/helpers/noop\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport chalk from \"chalk\";\nimport type { LogFn, WorkspaceConfig } from \"../types\";\n\nexport interface CreateLogOptions {\n name?: string;\n logLevel?: LogLevelLabel | null;\n customLogger?: LogFn;\n colors?: WorkspaceConfig[\"colors\"];\n}\n\n/**\n * Create a logging function with a specific name and options.\n *\n * @param name - The name of the logging function.\n * @param options - The options to configure the logging function.\n * @returns A logging function.\n */\nexport const createLog = (\n name: string | null,\n options: CreateLogOptions = {}\n): LogFn => {\n const logLevel =\n options.logLevel === null\n ? LogLevelLabel.SILENT\n : options.logLevel || LogLevelLabel.INFO;\n if (logLevel === LogLevelLabel.SILENT) {\n return noop;\n }\n\n if (options.customLogger) {\n return options.customLogger;\n }\n\n return (type: LogLevelLabel, ...args: string[]) =>\n getLogFn(getLogLevel(type), {\n ...options,\n logLevel\n })(\n `${chalk.bold.hex(\n getColor(\"brand\", options as Parameters<typeof getColor>[1])\n )(\n `powerlines${name ? `:${name}` : \"\"}${\n options.name ? ` ${chalk.gray(\"> \")}${options.name}` : \"\"\n } ${chalk.gray(\"> \")}`\n )}${args.join(\" \")} `.trim()\n );\n};\n\nconst BADGE_COLORS = [\n \"#00A0DD\",\n \"#6FCE4E\",\n \"#FBBF24\",\n \"#F43F5E\",\n \"#3B82F6\",\n \"#A855F7\",\n \"#469592\",\n \"#288EDF\",\n \"#10B981\",\n \"#EF4444\",\n \"#F0EC56\",\n \"#F472B6\",\n \"#22D3EE\",\n \"#EAB308\",\n \"#84CC16\",\n \"#F87171\",\n \"#0EA5E9\",\n \"#D946EF\",\n \"#FACC15\",\n \"#34D399\"\n] as const;\n\nexport const extendLog = (logFn: LogFn, name: string): LogFn => {\n return (type: LogLevelLabel, ...args: string[]) =>\n logFn(\n type,\n ` ${chalk.inverse.hex(\n BADGE_COLORS[\n name\n .split(\"\")\n .map(char => char.charCodeAt(0))\n .reduce((ret, charCode) => ret + charCode, 0) % BADGE_COLORS.length\n ] || BADGE_COLORS[0]\n )(` ${titleCase(name)} `)} ${args.join(\" \")} `\n );\n};\n","/* -------------------------------------------------------------------\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 { declare } from \"@babel/helper-plugin-utils\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport chalk from \"chalk\";\nimport { extendLog } from \"powerlines/lib/logger\";\nimport {\n BabelTransformPluginBuilder,\n DeclareBabelTransformPluginReturn\n} from \"powerlines/types/babel\";\nimport { Context } from \"powerlines/types/context\";\n\n/**\n * Create a Babel plugin using the provided builder function.\n *\n * @param name - The name of the plugin.\n * @param builder - The builder function that defines the plugin behavior.\n * @returns A Babel plugin declaration.\n */\nexport function createBabelPlugin<\n TContext extends Context = Context,\n TOptions extends Record<string, any> = Record<string, any>\n>(\n name: string,\n builder: BabelTransformPluginBuilder<TContext, TOptions>\n): DeclareBabelTransformPluginReturn<TContext, TOptions> {\n const plugin = (context: TContext) => {\n return declare<TOptions>((api, options, dirname) => {\n api.cache.using(() => context.meta.checksum);\n api.assertVersion(\"^7.0.0-0\");\n\n const log = extendLog(context.log, name);\n log(\n LogLevelLabel.TRACE,\n `Initializing the ${chalk.bold.cyanBright(name)} Babel plugin`\n );\n\n const result = builder({\n log,\n name,\n api,\n options,\n context,\n dirname\n });\n result.name = name;\n\n log(\n LogLevelLabel.TRACE,\n `Completed initialization of the ${chalk.bold.cyanBright(name)} Babel plugin`\n );\n\n return result;\n });\n };\n plugin.$$name = name;\n\n return plugin;\n}\n","/* -------------------------------------------------------------------\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 { ParseResult } from \"@babel/parser\";\nimport * as t from \"@babel/types\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { ImportSpecifier } from \"powerlines/types/babel\";\nimport { parseAst } from \"./ast-utils\";\n\n/**\n * Finds an export in the given Babel AST program by its key.\n *\n * @param ast - The parsed Babel AST result containing the program body.\n * @param key - The name of the export to find (e.g., \"default\" or a named export).\n * @returns The declaration of the export if found, otherwise undefined.\n */\nexport function findExport(ast: ParseResult<t.File>, key: string) {\n const type =\n key === \"default\" ? \"ExportDefaultDeclaration\" : \"ExportNamedDeclaration\";\n\n for (const node of ast.program.body) {\n if (node.type === type) {\n if (key === \"default\") {\n return node.declaration;\n }\n if (node.declaration && \"declarations\" in node.declaration) {\n const declaration = node.declaration.declarations[0];\n if (\n declaration &&\n \"name\" in declaration.id &&\n declaration.id.name === key\n ) {\n return declaration.init as any;\n }\n }\n }\n }\n}\n\n/**\n * Lists all exports from the given Babel AST program.\n *\n * @param codeOrAst - The parsed Babel AST result containing the program body.\n * @returns An array of export names, including \"default\" for default exports.\n */\nexport function listExports(codeOrAst: ParseResult<t.File> | string) {\n const ast = isString(codeOrAst) ? parseAst(codeOrAst) : codeOrAst;\n\n return ast.program.body\n .flatMap(i => {\n if (i.type === \"ExportDefaultDeclaration\") {\n return [\"default\"];\n }\n if (\n i.type === \"ExportNamedDeclaration\" &&\n i.declaration &&\n \"declarations\" in i.declaration\n ) {\n return i.declaration.declarations.map(d =>\n \"name\" in d.id ? d.id.name : \"\"\n );\n }\n return [];\n })\n .filter(Boolean);\n}\n\n/**\n * Lists all imports from the given Babel AST program.\n *\n * @param ast - The parsed Babel AST result containing the program body.\n * @returns An array of import names, including \"default\" for default imports.\n */\nexport function listImports(ast: ParseResult<t.File> | t.File) {\n return ast.program.body\n .flatMap(i => {\n if (i.type === \"ImportDeclaration\") {\n return i.specifiers.map(s => {\n if (s.type === \"ImportDefaultSpecifier\") {\n return \"default\";\n }\n if (s.type === \"ImportSpecifier\" && \"imported\" in s) {\n return s.imported.type === \"Identifier\"\n ? s.imported.name\n : s.imported.value;\n }\n return \"\";\n });\n }\n\n return [];\n })\n .filter(Boolean);\n}\n\nexport function isImportCall(\n calleePath: NodePath<t.CallExpression | t.NewExpression>\n) {\n return t.isImport(calleePath.node.callee);\n}\n\n/**\n * Gets the import declaration for a given name and specifier.\n *\n * @param specifier - The specifier of the import.\n * @param name - The name of the import.\n * @param named - Optional named import.\n * @returns The import declaration.\n */\nexport function getImport(\n specifier: string,\n name: string,\n named?: string\n): t.ImportDeclaration {\n return t.importDeclaration(\n [t.importSpecifier(t.identifier(name), t.stringLiteral(named || name))],\n t.stringLiteral(specifier)\n );\n}\n\n/**\n * Adds an import to the program if it doesn't already exist.\n *\n * @param path - The current NodePath in the AST.\n * @param specifier - The import specifier.\n */\nexport function addImport(path: NodePath<any>, specifier: ImportSpecifier) {\n addImportsToProgram(\n path.scope.getProgramParent().path as NodePath<t.Program>,\n specifier\n );\n}\n\n/*\n * Matches `import { ... } from <moduleName>;`\n * but not `import * as React from <moduleName>;`\n * `import type { Foo } from <moduleName>;`\n */\nfunction isNonNamespacedImport(\n importDeclPath: NodePath<t.ImportDeclaration>\n): boolean {\n return (\n importDeclPath\n .get(\"specifiers\")\n .filter(Boolean)\n .every(specifier => specifier?.isImportSpecifier()) &&\n importDeclPath.node.importKind !== \"type\" &&\n importDeclPath.node.importKind !== \"typeof\"\n );\n}\n\nfunction getExistingImports(\n program: NodePath<t.Program>\n): Map<string, NodePath<t.ImportDeclaration>> {\n const existingImports = new Map<string, NodePath<t.ImportDeclaration>>();\n program.traverse({\n ImportDeclaration(path) {\n if (isNonNamespacedImport(path)) {\n existingImports.set(path.node.source.value, path);\n }\n }\n });\n return existingImports;\n}\n\nexport function addImportsToProgram(\n path: NodePath<t.Program>,\n specifier: ImportSpecifier\n): void {\n const existingImports = getExistingImports(path);\n\n /**\n * If an existing import of this module exists (ie \\`import \\{ ... \\} from\n * '<moduleName>'\\`), inject new imported specifiers into the list of\n * destructured variables.\n */\n if (!existingImports.get(specifier.module)) {\n path.unshiftContainer(\n \"body\",\n t.importDeclaration(\n [\n t.importSpecifier(\n t.identifier(specifier.name || specifier.imported),\n t.identifier(specifier.imported)\n )\n ],\n t.stringLiteral(specifier.module)\n )\n );\n }\n}\n","/* -------------------------------------------------------------------\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 { convertFromCapnp } from \"@powerlines/deepkit/capnp\";\nimport { SerializedTypes as CapnpSerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { stringifyDefaultValue } from \"@powerlines/deepkit/utilities\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport { createBabelPlugin } from \"@powerlines/plugin-babel/helpers/create-plugin\";\nimport { addImport } from \"@powerlines/plugin-babel/helpers/module-helpers\";\nimport { LogLevelLabel } from \"@storm-software/config-tools/types\";\nimport * as capnp from \"@stryke/capnp\";\nimport { readFileBufferSync } from \"@stryke/fs/buffer\";\nimport { existsSync } from \"node:fs\";\nimport { BabelPluginPass } from \"powerlines/types/babel\";\nimport { getEnvReflectionsPath } from \"../helpers/persistence\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/*\n * The Powerlines - Environment Configuration Babel Plugin\n *\n * @param babel - The Babel core module\n * @returns The Babel plugin object\n */\nexport const envBabelPlugin = createBabelPlugin<EnvPluginContext>(\n \"env\",\n ({ log, context }) => {\n function extractEnv(\n node: t.Identifier,\n pass: BabelPluginPass,\n isInjectable = false\n ) {\n const envTypesAliasProperties = context.env.types.env\n ?.getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n if (node.name) {\n const prefix = context.config.env.prefix.find(\n pre =>\n node.name &&\n node.name.startsWith(pre) &&\n (context.env.types.env?.hasProperty(\n node.name.replace(`${pre}_`, \"\")\n ) ||\n envTypesAliasProperties.some(prop =>\n prop.getAlias().includes(node.name.replace(`${pre}_`, \"\"))\n ))\n );\n\n let name = node.name;\n if (prefix) {\n name = node.name.replace(`${prefix}_`, \"\");\n }\n\n log(\n LogLevelLabel.TRACE,\n `Environment variable ${name} found in ${\n pass.filename || \"unknown file\"\n }.`\n );\n\n if (\n context.env.types.env?.hasProperty(name) ||\n envTypesAliasProperties.some(prop => prop.getAlias().includes(name))\n ) {\n const envProperty = context.env.types.env.hasProperty(name)\n ? context.env.types.env.getProperty(name)\n : envTypesAliasProperties.find(prop =>\n prop.getAlias().includes(name)\n );\n if (!envProperty || envProperty.isIgnored()) {\n return;\n }\n\n if (!context.env.used.env.hasProperty(name)) {\n 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 {\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 }\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: \"$storm\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // $storm.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: \"storm: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\n .get(\"object\")\n ?.get(\"object\")\n ?.isCallExpression({\n callee: { name: \"useStorm\", type: \"Identifier\" }\n }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // useStorm().env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: \"storm: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\n .get(\"object\")\n ?.get(\"object\")\n ?.isIdentifier({ name: \"process\" }) &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // process.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: \"storm:env\",\n name: \"env\",\n imported: \"env\"\n });\n } else if (\n path\n .get(\"object\")\n ?.get(\"property\")\n ?.isIdentifier({ name: \"env\" }) &&\n path.get(\"object\")?.get(\"object\")?.isMetaProperty() &&\n path.get(\"property\")?.isIdentifier()\n ) {\n // import.meta.env.CONFIG_NAME\n\n const identifier = path.get(\"property\")?.node as t.Identifier;\n if (!identifier.name) {\n return;\n }\n\n extractEnv(identifier, pass, false);\n\n path.replaceWithSourceString(`env.${identifier.name}`);\n addImport(path, {\n module: \"storm:env\",\n name: \"env\",\n imported: \"env\"\n });\n }\n }\n },\n post(this: BabelPluginPass) {\n log(\n LogLevelLabel.TRACE,\n `Adding environment variables from ${\n this.filename || \"unknown file\"\n } to env.json.`\n );\n\n let persistedEnv = ReflectionClass.from({\n kind: ReflectionKind.objectLiteral,\n description: `An object containing the environment variables used by the application.`,\n types: []\n });\n\n const reflectionPath = getEnvReflectionsPath(context, \"env\");\n if (reflectionPath && existsSync(reflectionPath)) {\n log(\n LogLevelLabel.TRACE,\n `Environment reflection file found at ${\n reflectionPath\n }, reading existing reflection.`\n );\n\n persistedEnv = resolveClassType(\n deserializeType(\n convertFromCapnp(\n new capnp.Message(\n readFileBufferSync(reflectionPath),\n false\n ).getRoot(CapnpSerializedTypes).types\n )\n )\n );\n }\n\n log(\n LogLevelLabel.TRACE,\n `Adding new variables to env reflection at ${reflectionPath}.`\n );\n\n persistedEnv\n .getProperties()\n .filter(\n property =>\n property.getNameAsString() &&\n !context.env.used.env.hasProperty(property.getNameAsString())\n )\n .forEach(property => {\n context.env.used.env.addProperty({\n ...property,\n name: property.getNameAsString(),\n description:\n property.getDescription() ??\n `The ${property.getNameAsString()} variable.`,\n default: property.getDefaultValue(),\n optional: property.isOptional() ? true : undefined,\n readonly: property.isReadonly() ? true : undefined,\n visibility: property.getVisibility(),\n type: property.getType(),\n tags: property.getTags()\n } as Parameters<typeof persistedEnv.addProperty>[0]);\n });\n }\n };\n }\n);\n"],"mappings":"+rBA4CA,IAAIS,EAAWT,EACX,YAAaS,IACfA,EAAWA,EAASC,SCyBtB,MAAM2B,EAAe,CACnB,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACA,UACQ,CAEGC,GAAaC,EAAcf,KAC9BM,EAAqB,GAAGC,IAC9BQ,EACET,EACA,IAAIR,EAAMkB,QAAQP,IAChBI,EACEb,EACGiB,MAAM,GAAG,CACTC,IAAIC,GAAQA,EAAKC,WAAW,EAAE,CAAC,CAC/BC,QAAQC,EAAKC,IAAaD,EAAMC,EAAU,EAAE,CAAGV,EAAaW,SAC5DX,EAAa,GACnB,CAAC,IAAIhB,EAAUG,EAAK,CAAA,GAAI,CAAA,IAAKO,EAAKI,KAAK,IAAI,CAAA,GAC7C,CCvEL,SAAgBkB,EAIdC,EACAC,EACuD,CACvD,IAAMC,EAAUC,GACPR,GAAmBS,EAAKC,EAASC,IAAY,CAClDF,EAAIG,MAAMC,UAAYL,EAAQM,KAAKC,SAAS,CAC5CN,EAAIO,cAAc,WAAW,CAE7B,IAAMC,EAAMd,EAAUK,EAAQS,IAAKZ,EAAK,CACxCY,EACEhB,EAAciB,MACd,oBAAoBhB,EAAMiB,KAAKC,WAAWf,EAAK,CAAA,eAChD,CAED,IAAMgB,EAASf,EAAQ,CACrBW,MACAZ,OACAI,MACAC,UACAF,UACAG,UACD,CAAC,CAQF,MAPAU,GAAOhB,KAAOA,EAEdY,EACEhB,EAAciB,MACd,mCAAmChB,EAAMiB,KAAKC,WAAWf,EAAK,CAAA,eAC/D,CAEMgB,GACP,CAIJ,MAFAd,GAAOe,OAASjB,EAETE,ECqET,SAAgBuD,EAAUC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AA4B,CAC1B9D,EACEN,EAAc8B,MACd,qCACE,KAAKC,UAAY,eAAc,eAElC,CAED,IAAIsC,EAAe1E,EAAAA,gBAAgB2E,KAAK,CACtCC,KAAM3E,EAAAA,eAAe4E,cACrBC,YAAa,0EACb3D,MAAO,EAAA,CACR,CAAC,CAEI4D,EAAiBtE,EAAsBG,EAAS,MAAM,CACxDmE,GAAkBvE,EAAWuE,EAAe,GAC9CpE,EACEN,EAAc8B,MACd,wCACE4C,EAAc,gCAEjB,CAEDL,GAAAA,EAAAA,EAAAA,mBAAAA,EAAAA,EAAAA,iBAEI/E,EACE,IAAIW,EAAM0E,QACRzE,EAAmBwE,EAAe,CAClC,GACD,CAACE,QAAQpF,EAAqB,CAACsB,MAEpC,CACF,CAAC,EAGHR,EACEN,EAAc8B,MACd,6CAA6C4C,EAAc,GAC5D,CAEDL,EACGtD,eAAe,CACfC,OACCqB,GACEA,EAASgB,iBAAiB,EAC1B,CAAC9C,EAAQM,IAAIsB,KAAKtB,IAAIa,YAAYW,EAASgB,iBAAiB,CAChE,CAAC,CACAwB,QAAQxC,GAAY,CACnB9B,EAAQM,IAAIsB,KAAKtB,IAAIuB,YAAY,CAC/B,GAAGC,EACHjB,KAAMiB,EAASgB,iBAAiB,CAChCoB,YACEpC,EAASyC,gBAAgB,EACzB,OAAOzC,EAASgB,iBAAiB,CAAA,YACnC0B,QAAS1C,EAASK,iBAAiB,CACnCsC,SAAU3C,EAAS4C,YAAY,CAAG,GAAOxC,IAAAA,GACzCyC,SAAU7C,EAAS8C,YAAY,CAAG,GAAO1C,IAAAA,GACzC2C,WAAY/C,EAASgD,eAAe,CACpCnB,KAAM7B,EAASiD,SAAS,CACxBC,KAAMlD,EAASmD,SAAQ,CAC0B,CAAC,EACpD,EAEP,EAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"reflect-biXSZqcW.d.mts","names":[],"sources":["../src/helpers/reflect.ts"],"sourcesContent":[],"mappings":";;;;;iBAuCgB,mBAAA,UACL,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;;;;;;;;;;;;;;;;;;;;;;;;;;cA8RH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;UAgkBG,gBAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-file-CjFSCK1w.mjs","names":["createContext","useContext","PowerlinesContext","usePowerlinesContext","usePowerlines","powerlines","ref","value","Prose","SingleLineComment","props","variant","children","commentStart","_$createIntrinsic","string","_$createComponent","getContext","Show","SourceDirectoryContext","SourceFileContext","splitProps","useContext","useFormatOptions","appendPath","defu","SourceFile","props","children","meta","path","header","preset","filetype","reference","parentDirectory","context","addContent","printOptions","printWidth","tabWidth","useTabs","insertFinalNewLine","nodeContext","sourceFile","output","_$createComponent","Provider","value","when","undefined","_$createIntrinsic"],"sources":["../../alloy/src/core/contexts/context.ts","../../alloy/src/core/components/single-line-comment.tsx","../../alloy/src/core/components/source-file.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 type { ComponentContext, Ref } from \"@alloy-js/core\";\nimport { createContext, useContext } from \"@alloy-js/core\";\nimport type { PluginContext } from \"powerlines/types/context\";\n\nexport interface PowerlinesContextInterface<\n TContext extends PluginContext = PluginContext\n> {\n ref: Ref<TContext>;\n}\n\n/**\n * The Powerlines context used in template rendering.\n */\nexport const PowerlinesContext: ComponentContext<\n PowerlinesContextInterface<any>\n> = createContext<PowerlinesContextInterface<any>>();\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The Context.\n */\nexport function usePowerlinesContext<\n TContext extends PluginContext = PluginContext\n>(): PowerlinesContextInterface<TContext> | undefined {\n return useContext<PowerlinesContextInterface<TContext>>(PowerlinesContext);\n}\n\n/**\n * Hook to access the Powerlines Context.\n *\n * @returns The reactive context ref.\n */\nexport function usePowerlines<\n TContext extends PluginContext = PluginContext\n>(): TContext | undefined {\n const powerlines = usePowerlinesContext<TContext>();\n\n return powerlines?.ref?.value;\n}\n","/* -------------------------------------------------------------------\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 { Prose } from \"@alloy-js/core\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type SingleLineCommentVariant =\n | \"double-slash\"\n | \"triple-slash\"\n | \"slash-star\"\n | \"slash-star-star\"\n | \"markdown\";\n\nexport interface SingleLineCommentProps extends ComponentProps {\n /**\n * The variant of the single line comment.\n *\n * @defaultValue \"double-slash\"\n */\n variant?: SingleLineCommentVariant;\n}\n\n/**\n * A single line comment block. The children are rendered as a prose element, which means that they\n * are broken into multiple lines\n */\nexport function SingleLineComment(props: SingleLineCommentProps) {\n const { variant = \"double-slash\", children } = props;\n\n const commentStart =\n variant === \"slash-star\"\n ? \"/* \"\n : variant === \"slash-star-star\"\n ? \"/** \"\n : variant === \"triple-slash\"\n ? \"/// \"\n : variant === \"markdown\"\n ? \"<!-- \"\n : \"// \";\n\n return (\n <>\n {commentStart}\n <align string={commentStart}>\n <Prose>{children}</Prose>\n\n {variant === \"slash-star\" || variant === \"slash-star-star\"\n ? \" */ \"\n : variant === \"markdown\"\n ? \" -->\"\n : \"\"}\n </align>\n </>\n );\n}\n","/* -------------------------------------------------------------------\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 getContext,\n Show,\n SourceDirectoryContext,\n SourceFileContext,\n SourceFileProps as SourceFilePropsExternal,\n splitProps,\n useContext,\n useFormatOptions\n} from \"@alloy-js/core\";\nimport { appendPath } from \"@stryke/path/append\";\nimport defu from \"defu\";\nimport type { StoragePreset } from \"powerlines/types/fs\";\nimport { ComponentProps } from \"../../types/components\";\n\nexport type SourceFileProps = SourceFilePropsExternal &\n ComponentProps & {\n /**\n * If true, indicates that the file is virtual and should not be written to disk.\n *\n * @defaultValue false\n */\n preset?: StoragePreset;\n\n /**\n * The metadata associated with the source file.\n *\n * @remarks\n * The values stored in the metadata will be available in the rendering context.\n */\n meta?: Record<string, any>;\n };\n\n/**\n * A base component representing a Powerlines generated source file.\n *\n * @param props - The properties for the source file.\n * @returns The rendered source file component.\n */\nexport function SourceFile(props: SourceFileProps) {\n const [{ children, meta, path, header, preset, filetype, reference }] =\n splitProps(props, [\n \"children\",\n \"meta\",\n \"path\",\n \"header\",\n \"preset\",\n \"filetype\",\n \"reference\"\n ]);\n\n const parentDirectory = useContext(SourceDirectoryContext)!;\n\n const context: SourceFileContext = {\n path: appendPath(path, parentDirectory.path),\n filetype,\n reference\n };\n parentDirectory?.addContent(context);\n\n const printOptions = useFormatOptions({\n printWidth: props.printWidth,\n tabWidth: props.tabWidth,\n useTabs: props.useTabs,\n insertFinalNewLine: props.insertFinalNewLine\n });\n\n const nodeContext = getContext()!;\n nodeContext.meta = defu(\n {\n sourceFile: context,\n printOptions,\n output: {\n preset\n }\n },\n meta ?? {}\n );\n\n return (\n <SourceFileContext.Provider value={context}>\n <Show when={header !== undefined}>\n {header}\n <hbr />\n </Show>\n {children}\n </SourceFileContext.Provider>\n );\n}\n"],"mappings":"oVA+BA,MAAaE,EAETF,GAAgD,CAOpD,SAAgBG,GAEsC,CACpD,OAAOF,EAAiDC,EAAkB,CAQ5E,SAAgBE,GAEU,CAGxB,OAFmBD,GAAgC,EAEhCG,KAAKC,MCf1B,SAAgBE,EAAkBC,EAA+B,CAC/D,GAAM,CAAEC,UAAU,eAAgBC,YAAaF,EAEzCG,EACJF,IAAY,aACR,MACAA,IAAY,kBACV,OACAA,IAAY,eACV,OACAA,IAAY,WACV,QACA,MAEZ,MAAA,CAEKE,EAAYC,EAAA,QAAA,CACNC,OAAQF,EAAY,IAAAD,UAAA,CAAA,MAAA,CAAAI,EACxBR,EAAK,CAAEI,WAAQ,CAAA,CAEfD,IAAY,cAAgBA,IAAY,kBACrC,OACAA,IAAY,WACV,OACA,GAAE,EAAA,CAAA,CAAA,CCRhB,SAAgBe,EAAWC,EAAwB,CACjD,GAAM,CAAC,CAAEC,WAAUC,OAAMC,OAAMC,SAAQC,SAAQC,WAAUC,cACvDb,EAAWM,EAAO,CAChB,WACA,OACA,OACA,SACA,SACA,WACA,YACD,CAAC,CAEEQ,EAAkBb,EAAWH,EAAwB,CAErDiB,EAA6B,CACjCN,KAAMN,EAAWM,EAAMK,EAAgBL,KAAK,CAC5CG,WACAC,YACD,CACDC,GAAiBE,WAAWD,EAAQ,CAEpC,IAAME,EAAef,EAAiB,CACpCgB,WAAYZ,EAAMY,WAClBC,SAAUb,EAAMa,SAChBC,QAASd,EAAMc,QACfC,mBAAoBf,EAAMe,mBAC3B,CAAC,CAEIC,EAAc1B,GAAa,CAYjC,MAXA0B,GAAYd,KAAOJ,EACjB,CACEmB,WAAYR,EACZE,eACAO,OAAQ,CACNb,SACF,CACD,CACDH,GAAQ,EACV,CAAC,CAEDiB,EACG1B,EAAkB2B,SAAQ,CAACC,MAAOZ,EAAO,IAAAR,UAAA,CAAA,MAAA,CAAAkB,EACvC5B,EAAI,CAAC+B,KAAMlB,IAAWmB,IAAAA,GAAS,IAAAtB,UAAA,CAAA,MAAA,CAC7BG,EAAMoB,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA,CAAA,CAGRvB,EAAQ,EAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-file-env-BDFTs5WJ.mjs","names":["ENV_PREFIXES","camelCase","isString","removeEnvPrefix","env","name","reduce","ret","prefix","startsWith","slice","length","toUpperCase","Object","keys","key","formatEnvField"],"sources":["../src/helpers/source-file-env.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 type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isString } from \"@stryke/type-checks/is-string\";\n\ntype TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;\n\nexport function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(\n env: TEnv\n): TReturned<TEnv> {\n if (isString(env)) {\n let name: string = ENV_PREFIXES.reduce((ret, prefix) => {\n if (ret.startsWith(prefix)) {\n ret = ret.slice(prefix.length);\n }\n\n return ret;\n }, env.toUpperCase());\n\n while (name.startsWith(\"_\")) {\n name = name.slice(1);\n }\n\n return name as TReturned<TEnv>;\n }\n\n return Object.keys(env).reduce((ret, key) => {\n const name = removeEnvPrefix(key);\n if (name) {\n (ret as DotenvParseOutput)[name] = env[key];\n }\n\n return ret;\n }, {} as TReturned<TEnv>);\n}\n\nexport function formatEnvField(key: string): string {\n return camelCase(removeEnvPrefix(key));\n}\n"],"mappings":"uKAyBA,SAAgBG,EACdC,EACiB,CACjB,GAAIF,EAASE,EAAI,CAAE,CACjB,IAAIC,EAAeL,EAAaM,QAAQC,EAAKC,KACvCD,EAAIE,WAAWD,EAAO,GACxBD,EAAMA,EAAIG,MAAMF,EAAOG,OAAO,EAGzBJ,GACNH,EAAIQ,aAAa,CAAC,CAErB,KAAOP,EAAKI,WAAW,IAAI,EACzBJ,EAAOA,EAAKK,MAAM,EAAE,CAGtB,OAAOL,EAGT,OAAOQ,OAAOC,KAAKV,EAAI,CAACE,QAAQC,EAAKQ,IAAQ,CAC3C,IAAMV,EAAOF,EAAgBY,EAAI,CAKjC,OAJIV,IACDE,EAA0BF,GAAQD,EAAIW,IAGlCR,GACN,EAAqB,CAAC,CAG3B,SAAgBS,EAAeD,EAAqB,CAClD,OAAOd,EAAUE,EAAgBY,EAAI,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-file-env-DonDJDV1.d.cts","names":[],"sources":["../src/helpers/source-file-env.ts"],"sourcesContent":[],"mappings":";;;KAuBK,kBAAkB,+BAA+B;iBAEtC,6BAA6B,iCACtC,OACJ,UAAU;AAJR,iBA+BW,cAAA,CA/BsC,GAAA,EAAA,MAAA,CAAA,EAAA,MAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"source-file-env-DzpWKluw.d.mts","names":[],"sources":["../src/helpers/source-file-env.ts"],"sourcesContent":[],"mappings":";;;KAuBK,kBAAkB,+BAA+B;iBAEtC,6BAA6B,iCACtC,OACJ,UAAU;AAJR,iBA+BW,cAAA,CA/BsC,GAAA,EAAA,MAAA,CAAA,EAAA,MAAiB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-helpers-BaMJZc5X.d.cts","names":[],"sources":["../src/helpers/template-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;AA8BA;;;;;AAGU,iBAHY,wBAAA,CAGZ,OAAA,EAFC,gBAED,EAAA,IAAA,CAAA,EADD,OACC,CAAA,EAAP,OAAO,CAAC,cAAA,CAAA,eAAD,CAAA,GAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-helpers-CLrM_TtO.mjs","names":["titleCase","readEnvTypeReflection","createTemplateReflection","context","name","reflection","getProperties","forEach","prop","aliases","getAlias","filter","Boolean","alias","addProperty","optional","isOptional","undefined","readonly","isReadonly","description","getDescription","visibility","getVisibility","type","getType","default","getDefaultValue","tags","hidden","isHidden","ignore","isIgnored","internal","isInternal","a","concat","title","getTitle","permission","getPermission","domain","getDomain"],"sources":["../src/helpers/template-helpers.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 { ReflectionClass } from \"@powerlines/deepkit/vendor/type\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext, EnvType } from \"../types/plugin\";\nimport { readEnvTypeReflection } from \"./persistence\";\n\n/**\n * Creates the reflection data used when generating runtime template files.\n *\n * @param context - The context for the configuration plugin.\n * @param name - The name of the configuration template.\n * @returns The reflection for the specified configuration template.\n */\nexport async function createTemplateReflection(\n context: EnvPluginContext,\n name?: EnvType\n): Promise<ReflectionClass<any>> {\n const reflection = await readEnvTypeReflection(context, name);\n\n reflection.getProperties().forEach(prop => {\n const aliases = prop.getAlias();\n aliases.filter(Boolean).forEach(alias => {\n reflection.addProperty({\n name: alias,\n optional: prop.isOptional() ? true : undefined,\n readonly: prop.isReadonly() ? true : undefined,\n description: prop.getDescription(),\n visibility: prop.getVisibility(),\n type: prop.getType(),\n default: prop.getDefaultValue(),\n tags: {\n hidden: prop.isHidden(),\n ignore: prop.isIgnored(),\n internal: prop.isInternal(),\n alias: prop\n .getAlias()\n .filter(a => a !== alias)\n .concat(prop.name),\n title: prop.getTitle() || titleCase(prop.name),\n readonly: prop.isReadonly(),\n permission: prop.getPermission(),\n domain: prop.getDomain()\n }\n });\n });\n });\n\n return reflection;\n}\n"],"mappings":"4GA8BA,eAAsBE,EACpBC,EACAC,EAC+B,CAC/B,IAAMC,EAAa,MAAMJ,EAAsBE,EAASC,EAAK,CA8B7D,OA5BAC,EAAWC,eAAe,CAACC,QAAQC,GAAQ,CACzBA,EAAKE,UAAU,CACvBC,OAAOC,QAAQ,CAACL,QAAQM,GAAS,CACvCR,EAAWS,YAAY,CACrBV,KAAMS,EACNE,SAAUP,EAAKQ,YAAY,CAAG,GAAOC,IAAAA,GACrCC,SAAUV,EAAKW,YAAY,CAAG,GAAOF,IAAAA,GACrCG,YAAaZ,EAAKa,gBAAgB,CAClCC,WAAYd,EAAKe,eAAe,CAChCC,KAAMhB,EAAKiB,SAAS,CACpBC,QAASlB,EAAKmB,iBAAiB,CAC/BC,KAAM,CACJC,OAAQrB,EAAKsB,UAAU,CACvBC,OAAQvB,EAAKwB,WAAW,CACxBC,SAAUzB,EAAK0B,YAAY,CAC3BrB,MAAOL,EACJE,UAAU,CACVC,OAAOwB,GAAKA,IAAMtB,EAAM,CACxBuB,OAAO5B,EAAKJ,KAAK,CACpBiC,MAAO7B,EAAK8B,UAAU,EAAItC,EAAUQ,EAAKJ,KAAK,CAC9Cc,SAAUV,EAAKW,YAAY,CAC3BoB,WAAY/B,EAAKgC,eAAe,CAChCC,OAAQjC,EAAKkC,WAAU,CACzB,CACD,CAAC,EACF,EACF,CAEKrC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"template-helpers-LJwCi0e-.d.mts","names":[],"sources":["../src/helpers/template-helpers.ts"],"sourcesContent":[],"mappings":";;;;;;;AA8BA;;;;;AAGU,iBAHY,wBAAA,CAGZ,OAAA,EAFC,gBAED,EAAA,IAAA,CAAA,EADD,OACC,CAAA,EAAP,OAAO,CAAC,cAAA,CAAA,eAAD,CAAA,GAAA,CAAA,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-CnPIyotQ.d.mts","names":[],"sources":["../../deepkit/src/vendor/type.ts"],"sourcesContent":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"type-D6dRgWJT.d.cts","names":[],"sources":["../../deepkit/src/vendor/type.ts"],"sourcesContent":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utilities-4S--uN0L.mjs","names":["ReflectionKind","getUniqueBy","StormJSON","isNull","isString","isUndefined","stringifyDefaultValue","property","value","stringifyValue","type","getDefaultValue","stringifyStringValue","String","replaceAll","kind","boolean","trim","toLowerCase","string","literal","enum","getEnumReflectionType","union","isStringUnion","array","stringify","object","objectLiteral","parameter","Error","unique","values","filter","undefined","enumMember","number","length","getUnionTypes","types","member","some","kindToName","void","never","null","symbol","bigint","class","regexp","templateLiteral","method","function","promise","typeParameter","tuple","tupleMember","rest","indexSignature","propertySignature","methodSignature","infer","callSignature","any","intersection"],"sources":["../../deepkit/src/utilities.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 {\n ReflectionKind,\n ReflectionParameter,\n ReflectionProperty,\n Type,\n TypeNumber,\n TypeString\n} from \"@powerlines/deepkit/vendor/type\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport { isNull } from \"@stryke/type-checks/is-null\";\nimport { isString } from \"@stryke/type-checks/is-string\";\nimport { isUndefined } from \"@stryke/type-checks/is-undefined\";\n\n/**\n * Converts any {@link ReflectionProperty} or {@link ReflectionParameter}'s value to string representation.\n *\n * @param property - The {@link ReflectionProperty} or {@link ReflectionParameter} containing the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyDefaultValue(\n property: ReflectionProperty | ReflectionParameter,\n value?: any\n): string {\n return stringifyValue(property.type, value ?? property.getDefaultValue());\n}\n\n/**\n * Stringifies a value as a string.\n *\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyStringValue(value?: any): string {\n return `\"${String(value).replaceAll('\"', '\\\\\"')}\"`;\n}\n\n/**\n * Converts any {@link Type}'s actual value to string representation.\n *\n * @param type - The {@link Type} of the value to stringify.\n * @param value - The value to stringify.\n * @returns A string representation of the value.\n */\nexport function stringifyValue(type: Type, value: any): string {\n return isUndefined(value)\n ? \"undefined\"\n : isNull(value)\n ? \"null\"\n : type.kind === ReflectionKind.boolean\n ? String(value).trim().toLowerCase() === \"true\"\n ? \"true\"\n : \"false\"\n : type.kind === ReflectionKind.string ||\n (type.kind === ReflectionKind.literal && isString(type.literal))\n ? stringifyStringValue(value)\n : type.kind === ReflectionKind.enum\n ? getEnumReflectionType(type).kind === ReflectionKind.string\n ? stringifyStringValue(value)\n : `${String(value)}`\n : type.kind === ReflectionKind.union\n ? isStringUnion(type)\n ? stringifyStringValue(value)\n : `${String(value)}`\n : type.kind === ReflectionKind.array\n ? stringifyStringValue(StormJSON.stringify(value))\n : type.kind === ReflectionKind.object ||\n type.kind === ReflectionKind.objectLiteral\n ? StormJSON.stringify(value)\n : type.kind === ReflectionKind.property ||\n type.kind === ReflectionKind.parameter\n ? stringifyValue(type.type, value)\n : String(value);\n}\n\n/**\n * Converts a {@link TypeEnum} to its underlying primitive type representation.\n *\n * @param type - The {@link TypeEnum} to evaluate.\n * @returns A string representation of the primitive type.\n */\nexport function getEnumReflectionType(type: Type): TypeString | TypeNumber {\n if (type.kind !== ReflectionKind.enum) {\n throw new Error(`Expected a TypeEnum, but received ${type.kind}.`);\n }\n\n const unique = getUniqueBy(\n type.values.filter(value => value !== undefined && value !== null),\n enumMember =>\n isString(enumMember)\n ? {\n kind: ReflectionKind.string\n }\n : {\n kind: ReflectionKind.number\n }\n );\n if (unique.length === 0) {\n throw new Error(`No valid enum members could be found.`);\n }\n\n return unique[0] && isString(unique[0])\n ? {\n kind: ReflectionKind.string\n }\n : {\n kind: ReflectionKind.number\n };\n}\n\n/**\n * Converts a {@link TypeUnion} to its underlying primitive type representation.\n *\n * @param type - The {@link TypeUnion} to evaluate.\n * @returns A string representation of the primitive type.\n */\nexport function getUnionTypes(type: Type): Type[] {\n if (type.kind === ReflectionKind.union && type.types.length > 0) {\n return getUniqueBy(type.types, member => member.kind);\n }\n\n throw new Error(`Expected a TypeUnion, but received ${type.kind}.`);\n}\n\nexport function isStringUnion(type: Type): boolean {\n return getUnionTypes(type).some(\n member =>\n member.kind === ReflectionKind.string ||\n (member.kind === ReflectionKind.literal && isString(member.literal))\n );\n}\n\n/**\n * Converts a ReflectionKind to its string representation.\n *\n * @param kind - The {@link ReflectionKind} to convert.\n * @returns A string representation of the kind.\n */\nexport function kindToName(kind: ReflectionKind): string {\n if (kind === ReflectionKind.void) {\n return \"void\";\n } else if (kind === ReflectionKind.never) {\n return \"never\";\n } else if (kind === ReflectionKind.null) {\n return \"null\";\n } else if (kind === ReflectionKind.undefined) {\n return \"undefined\";\n } else if (kind === ReflectionKind.symbol) {\n return \"symbol\";\n } else if (kind === ReflectionKind.bigint) {\n return \"bigint\";\n } else if (kind === ReflectionKind.number) {\n return \"number\";\n } else if (kind === ReflectionKind.string) {\n return \"string\";\n } else if (kind === ReflectionKind.boolean) {\n return \"boolean\";\n } else if (kind === ReflectionKind.literal) {\n return \"literal\";\n } else if (kind === ReflectionKind.class) {\n return \"class\";\n } else if (kind === ReflectionKind.array) {\n return \"array\";\n } else if (kind === ReflectionKind.object) {\n return \"object\";\n } else if (kind === ReflectionKind.objectLiteral) {\n return \"objectLiteral\";\n } else if (kind === ReflectionKind.union) {\n return \"union\";\n } else if (kind === ReflectionKind.enum) {\n return \"enum\";\n } else if (kind === ReflectionKind.regexp) {\n return \"regexp\";\n } else if (kind === ReflectionKind.templateLiteral) {\n return \"templateLiteral\";\n } else if (kind === ReflectionKind.property) {\n return \"property\";\n } else if (kind === ReflectionKind.method) {\n return \"method\";\n } else if (kind === ReflectionKind.function) {\n return \"function\";\n } else if (kind === ReflectionKind.parameter) {\n return \"parameter\";\n } else if (kind === ReflectionKind.promise) {\n return \"promise\";\n } else if (kind === ReflectionKind.typeParameter) {\n return \"typeParameter\";\n } else if (kind === ReflectionKind.tuple) {\n return \"tuple\";\n } else if (kind === ReflectionKind.tupleMember) {\n return \"tupleMember\";\n } else if (kind === ReflectionKind.enumMember) {\n return \"enumMember\";\n } else if (kind === ReflectionKind.rest) {\n return \"rest\";\n } else if (kind === ReflectionKind.indexSignature) {\n return \"indexSignature\";\n } else if (kind === ReflectionKind.propertySignature) {\n return \"propertySignature\";\n } else if (kind === ReflectionKind.methodSignature) {\n return \"methodSignature\";\n } else if (kind === ReflectionKind.infer) {\n return \"infer\";\n } else if (kind === ReflectionKind.callSignature) {\n return \"callSignature\";\n } else if (kind === ReflectionKind.any) {\n return \"any\";\n } else if (kind === ReflectionKind.intersection) {\n return \"intersection\";\n }\n\n return \"unknown\";\n}\n"],"mappings":"yUAuCA,SAAgBM,EACdC,EACAC,EACQ,CACR,OAAOC,EAAeF,EAASG,KAAMF,GAASD,EAASI,iBAAiB,CAAC,CAS3E,SAAgBC,EAAqBJ,EAAqB,CACxD,MAAO,IAAIK,OAAOL,EAAM,CAACM,WAAW,IAAK,MAAM,CAAA,GAUjD,SAAgBL,EAAeC,EAAYF,EAAoB,CAC7D,OAAOH,EAAYG,EAAM,CACrB,YACAL,EAAOK,EAAM,CACX,OACAE,EAAKK,OAASf,EAAAA,eAAegB,QAC3BH,OAAOL,EAAM,CAACS,MAAM,CAACC,aAAa,GAAK,OACrC,OACA,QACFR,EAAKK,OAASf,EAAAA,eAAemB,QAC1BT,EAAKK,OAASf,EAAAA,eAAeoB,SAAWhB,EAASM,EAAKU,QAAS,CAChER,EAAqBJ,EAAM,CAC3BE,EAAKK,OAASf,EAAAA,eAAeqB,KAC3BC,EAAsBZ,EAAK,CAACK,OAASf,EAAAA,eAAemB,OAClDP,EAAqBJ,EAAM,CAC3B,GAAGK,OAAOL,EAAM,GAClBE,EAAKK,OAASf,EAAAA,eAAeuB,MAC3BC,EAAcd,EAAK,CACjBE,EAAqBJ,EAAM,CAC3B,GAAGK,OAAOL,EAAM,GAClBE,EAAKK,OAASf,EAAAA,eAAeyB,MAC3Bb,EAAqBV,EAAUwB,UAAUlB,EAAM,CAAC,CAChDE,EAAKK,O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