@powerlines/plugin-env 0.16.56 → 0.16.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.
- package/dist/babel/index.d.cts +2 -0
- package/dist/babel/index.d.mts +2 -0
- package/dist/babel/plugin.d.cts +9 -0
- package/dist/babel/plugin.d.cts.map +1 -0
- package/dist/babel/plugin.d.mts +9 -0
- package/dist/babel/plugin.d.mts.map +1 -0
- package/dist/babel/plugin.mjs +2 -1
- package/dist/babel/plugin.mjs.map +1 -0
- package/dist/components/docs.d.cts +25 -0
- package/dist/components/docs.d.cts.map +1 -0
- package/dist/components/docs.d.mts +25 -0
- package/dist/components/docs.d.mts.map +1 -0
- package/dist/components/docs.mjs +2 -1
- package/dist/components/docs.mjs.map +1 -0
- package/dist/components/env-builtin.d.cts +23 -0
- package/dist/components/env-builtin.d.cts.map +1 -0
- package/dist/components/env-builtin.d.mts +23 -0
- package/dist/components/env-builtin.d.mts.map +1 -0
- package/dist/components/env-builtin.mjs +2 -1
- package/dist/components/env-builtin.mjs.map +1 -0
- package/dist/components/index.d.cts +3 -0
- package/dist/components/index.d.mts +3 -0
- package/dist/helpers/automd-generator.d.cts +15 -0
- package/dist/helpers/automd-generator.d.cts.map +1 -0
- package/dist/helpers/automd-generator.d.mts +15 -0
- package/dist/helpers/automd-generator.d.mts.map +1 -0
- package/dist/helpers/automd-generator.mjs +2 -1
- package/dist/helpers/automd-generator.mjs.map +1 -0
- package/dist/helpers/create-reflection-resource.d.cts +14 -0
- package/dist/helpers/create-reflection-resource.d.cts.map +1 -0
- package/dist/helpers/create-reflection-resource.d.mts +14 -0
- package/dist/helpers/create-reflection-resource.d.mts.map +1 -0
- package/dist/helpers/create-reflection-resource.mjs +2 -1
- package/dist/helpers/create-reflection-resource.mjs.map +1 -0
- package/dist/helpers/docs-helper.d.cts +14 -0
- package/dist/helpers/docs-helper.d.cts.map +1 -0
- package/dist/helpers/docs-helper.d.mts +14 -0
- package/dist/helpers/docs-helper.d.mts.map +1 -0
- package/dist/helpers/docs-helper.mjs +2 -1
- package/dist/helpers/docs-helper.mjs.map +1 -0
- package/dist/helpers/index.d.cts +7 -0
- package/dist/helpers/index.d.mts +7 -0
- package/dist/helpers/load.d.cts +36 -0
- package/dist/helpers/load.d.cts.map +1 -0
- package/dist/helpers/load.d.mts +36 -0
- package/dist/helpers/load.d.mts.map +1 -0
- package/dist/helpers/load.mjs +2 -1
- package/dist/helpers/load.mjs.map +1 -0
- package/dist/helpers/persistence.d.cts +85 -0
- package/dist/helpers/persistence.d.cts.map +1 -0
- package/dist/helpers/persistence.d.mts +85 -0
- package/dist/helpers/persistence.d.mts.map +1 -0
- package/dist/helpers/persistence.mjs +2 -1
- package/dist/helpers/persistence.mjs.map +1 -0
- package/dist/helpers/reflect.d.cts +69 -0
- package/dist/helpers/reflect.d.cts.map +1 -0
- package/dist/helpers/reflect.d.mts +69 -0
- package/dist/helpers/reflect.d.mts.map +1 -0
- package/dist/helpers/reflect.mjs +2 -1
- package/dist/helpers/reflect.mjs.map +1 -0
- package/dist/helpers/source-file-env.d.cts +9 -0
- package/dist/helpers/source-file-env.d.cts.map +1 -0
- package/dist/helpers/source-file-env.d.mts +9 -0
- package/dist/helpers/source-file-env.d.mts.map +1 -0
- package/dist/helpers/source-file-env.mjs +2 -1
- package/dist/helpers/source-file-env.mjs.map +1 -0
- package/dist/helpers/template-helpers.d.cts +16 -0
- package/dist/helpers/template-helpers.d.cts.map +1 -0
- package/dist/helpers/template-helpers.d.mts +16 -0
- package/dist/helpers/template-helpers.d.mts.map +1 -0
- package/dist/helpers/template-helpers.mjs +2 -1
- package/dist/helpers/template-helpers.mjs.map +1 -0
- package/dist/index.d.cts +18 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/parse-type-definition.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/parse-type-definition.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/to-array.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/to-array.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_convert@0.6.53/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-parent-path.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-parent-path.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-type.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/is-type.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/join-paths.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/join-paths.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/regex.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/regex.mjs.map +1 -0
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/slash.mjs +2 -1
- package/dist/node_modules/.pnpm/@stryke_path@0.26.19/node_modules/@stryke/path/dist/slash.mjs.map +1 -0
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/_format.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/json.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/js-yaml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/json5.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/jsonc-parser.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/libs/smol-toml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/json5.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/jsonc.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/toml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs +2 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/yaml.mjs.map +1 -0
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs +2 -1
- package/dist/node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs.map +1 -0
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/destr@2.0.5/node_modules/destr/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs +2 -1
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/lib/main.mjs.map +1 -0
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs +2 -1
- package/dist/node_modules/.pnpm/dotenv@17.3.1/node_modules/dotenv/package.mjs.map +1 -0
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/exsolve@1.0.8/node_modules/exsolve/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +2 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +1 -0
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs +2 -1
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/dist/jiti.mjs.map +1 -0
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs +2 -1
- package/dist/node_modules/.pnpm/jiti@2.6.1/node_modules/jiti/lib/jiti.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/chunks/multipart-parser.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/node.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/shared/node-fetch-native.DhEqb06g.mjs.map +1 -0
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs +2 -1
- package/dist/node_modules/.pnpm/node-fetch-native@1.6.7/node_modules/node-fetch-native/lib/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/nypm@0.6.5/node_modules/nypm/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs +2 -1
- package/dist/node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/crypto/node/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs +2 -1
- package/dist/node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs.map +1 -0
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +2 -1
- package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs.map +1 -0
- package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs +2 -1
- package/dist/node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.mjs.map +1 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/plugin.d.cts +168 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +168 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +2 -1
- package/dist/types/plugin.mjs.map +1 -0
- package/dist/types/runtime.d.cts +792 -0
- package/dist/types/runtime.d.cts.map +1 -0
- package/dist/types/runtime.d.mts +792 -0
- package/dist/types/runtime.d.mts.map +1 -0
- package/dist/types/runtime.mjs +2 -1
- package/dist/types/runtime.mjs.map +1 -0
- package/package.json +9 -9
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.mjs","names":[],"sources":["../../src/helpers/load.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n loadEnv as loadEnvBase,\n loadEnvFile as loadEnvFileBase\n} from \"@stryke/env/load-env\";\nimport type { DotenvParseOutput } from \"@stryke/env/types\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport type { PackageJson } from \"@stryke/types/package-json\";\nimport { loadConfig } from \"c12\";\nimport defu from \"defu\";\nimport { WorkspaceConfig } from \"powerlines\";\nimport { DEFAULT_ENVIRONMENT } from \"powerlines/utils\";\nimport { EnvPluginContext, EnvPluginOptions } from \"../types/plugin\";\nimport { removeEnvPrefix } from \"./source-file-env\";\n\nasync function loadEnvFiles<TEnv extends DotenvParseOutput = DotenvParseOutput>(\n options: EnvPluginOptions,\n mode: string,\n cwd: string\n): Promise<TEnv> {\n let env = await loadEnvBase(cwd, mode);\n if (options.additionalFiles && options.additionalFiles?.length > 0) {\n const additionalEnvFiles = await Promise.all(\n options.additionalFiles.map(async additionalEnvFile =>\n loadEnvFileBase(additionalEnvFile, cwd)\n )\n );\n\n for (const additionalEnvFile of additionalEnvFiles) {\n env = defu(additionalEnvFile, env);\n }\n }\n\n return removeEnvPrefix(env) as TEnv;\n}\n\nasync function loadEnvDirectory<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(\n options: EnvPluginOptions,\n directory: string,\n mode: string,\n cacheDir: string,\n packageJson: PackageJson,\n workspaceConfig: WorkspaceConfig\n): Promise<TEnv> {\n const [envResult, c12Result] = await Promise.all([\n loadEnvFiles<TEnv>(options, mode, directory),\n loadConfig({\n cwd: directory,\n name: \"storm\",\n envName: mode,\n defaults: {\n NAME: packageJson.name?.replace(`@${workspaceConfig.namespace}/`, \"\"),\n MODE: mode,\n ORG: workspaceConfig.organization\n },\n globalRc: true,\n packageJson: true,\n dotenv: true,\n jitiOptions: {\n fsCache: joinPaths(cacheDir, \"jiti\"),\n moduleCache: true\n }\n })\n ]);\n\n return defu(envResult as any, c12Result.config, workspaceConfig) as TEnv;\n}\n\n/**\n * Retrieves various dotenv configuration parameters from the context.\n *\n * @param context - The context to retrieve the dotenv configuration from.\n * @param parsed - The parsed dotenv configuration.\n * @returns An object containing the dotenv configuration.\n */\nexport function loadEnvFromContext(\n context: EnvPluginContext,\n parsed: DotenvParseOutput\n) {\n return defu(\n {\n APP_NAME: kebabCase(\n context.config.name ||\n context.packageJson.name?.replace(\n `/${context.workspaceConfig.namespace}`,\n \"\"\n )\n ),\n APP_VERSION: context.packageJson.version,\n BUILD_ID: context.meta.buildId,\n BUILD_TIMESTAMP: new Date(context.meta.timestamp).toISOString(),\n BUILD_CHECKSUM: context.meta.checksum,\n RELEASE_ID: context.meta.releaseId,\n RELEASE_TAG: `${kebabCase(context.config.name)}@${context.packageJson.version}`,\n DEFAULT_LOCALE: context.workspaceConfig.locale,\n DEFAULT_TIMEZONE: context.workspaceConfig.timezone,\n LOG_LEVEL:\n context.config.logLevel === \"trace\" ? \"debug\" : context.config.logLevel,\n ERROR_URL: context.workspaceConfig.error?.url,\n ORGANIZATION:\n context.config.organization ||\n (isSetObject(context.workspaceConfig.organization)\n ? context.workspaceConfig.organization.name\n : context.workspaceConfig.organization),\n PLATFORM: context.config.platform,\n MODE: context.config.mode,\n TEST: context.config.mode === \"test\",\n DEBUG: context.config.mode === \"development\",\n STACKTRACE: context.config.mode !== \"production\",\n ENVIRONMENT:\n !context.environment.name ||\n context.environment.name === DEFAULT_ENVIRONMENT\n ? context.config.mode\n : context.environment.name\n },\n isSetObject(context?.env?.types?.env)\n ? context.env.types.env?.getProperties().reduce(\n (ret, prop) => {\n ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();\n return ret;\n },\n {} as Record<string, any>\n )\n : {}\n );\n}\n\nexport async function loadEnv<\n TEnv extends DotenvParseOutput = DotenvParseOutput\n>(context: EnvPluginContext, options: EnvPluginOptions): Promise<TEnv> {\n const [project, workspace, config] = await Promise.all([\n loadEnvDirectory<TEnv>(\n options,\n context.config.root,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n options,\n context.workspaceConfig.workspaceRoot,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n ),\n loadEnvDirectory<TEnv>(\n options,\n context.envPaths.config,\n context.config.mode,\n context.cachePath,\n context.packageJson,\n context.workspaceConfig\n )\n ]);\n\n return defu(\n loadEnvFromContext(context, process.env),\n project,\n workspace,\n config\n ) as TEnv;\n}\n"],"mappings":";;;;;;;;;;;;AAMA,SAAS,aAAa,IAAI,MAAM;AAC5B,IAAG,SAAS;;;AA4BhB,eAAe,aAAY,SAAA,MAAA,KAAA;CACvB,IAAI,MAAM,MAAA,UAAA,KAAA,KAAA;AACV,KAAI,QAAI,mBAAA,QAAA,iBAAA,SAAA,GAAA;EACJ,MAAM,qBAAG,MAAA,QAAA,IAAA,QAAA,gBAAA,IAAA,aAAA,OAAA,sBAAA,YAAA,mBAAA,IAAA,EAAA;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA,CAAA;AACT,OAAK,MAAM,qBAAqB,mBAC5B,OAAM,KAAK,mBAAmB,IAAI;;AAG1C,QAAO,gBAAgB,IAAI;;AAE/B,aAAK,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;CAED,MAAM,CAAC,WAAW,aAAa,MAAM,QAAQ,IAAI,EAC5C,aAAa,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,aAAK,SAAA,MAAA,UAAA,GACpC,WAAA;EACF,KAAA;;EAEU,SAAS;EACrB,UAAA;;GAEgB,MAAM;GACN,KAAK,gBAAgB;GACpC;EACW,UAAU;EACV,aAAO;EACP,QAAE;EACF,aAAM;GACF,SAAS,UAAC,UAAA,OAAA;GACV,aAAa;GACjB;EACH,CAAC,CACL,CAAC;AACF,QAAO,KAAI,WAAA,UAAA,QAAA,gBAAA;;AAEf,iBAAiB,SAAE;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQnB,SAAgB,mBAAO,SAAA,QAAA;AACnB,QAAO,KAAK;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AAK,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,QAAA,gBAAA;GAC5E,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,iBAAa,SAAA,QAAA,gBAAA,eAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,QAAA,gBAAA;GAC3C,iBAAiB,IAAI,CAAC,CAAC,IAAI,CAAC,EAAE,iBAAiB,SAAA,QAAA,SAAA,QAAA,QAAA,OAAA,MAAA,QAAA,WAAA,QAAA,aAAA,QAAA,gBAAA;EACnD,CAAC;AACF,QAAO,KAAK,mBAAmB,SAAS,QAAQ,IAAI,EAAE,SAAS,WAAW,OAAC;;AAE/E,QAAQ,SAAS;OAAC;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginResolvedConfig, EnvType } from "../types/plugin.cjs";
|
|
2
|
+
import { Context, UnresolvedContext } from "powerlines";
|
|
3
|
+
import { TypeDefinition } from "@stryke/types/configuration";
|
|
4
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/persistence.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the runtime type definition file for the environment variables.
|
|
10
|
+
*
|
|
11
|
+
* @param context - The plugin context.
|
|
12
|
+
* @returns The runtime type definition file for the environment variables.
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the default type definition for the environment variables.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The plugin context.
|
|
19
|
+
* @returns The default type definition for the environment variables.
|
|
20
|
+
*/
|
|
21
|
+
declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
|
|
22
|
+
/** Gets the default type definition for the environment secrets.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The plugin context.
|
|
25
|
+
* @returns The default type definition for the environment secrets.
|
|
26
|
+
*/
|
|
27
|
+
declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the path to the environment type reflections.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The plugin context.
|
|
32
|
+
* @param name - The name of the type reflections.
|
|
33
|
+
* @returns The path to the environment type reflections.
|
|
34
|
+
*/
|
|
35
|
+
declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
|
|
36
|
+
/**
|
|
37
|
+
* Reads the environment type reflection from the file system.
|
|
38
|
+
*
|
|
39
|
+
* @param context - The plugin context.
|
|
40
|
+
* @param name - The name of the type reflections.
|
|
41
|
+
* @returns The environment type reflection.
|
|
42
|
+
*/
|
|
43
|
+
declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
44
|
+
/**
|
|
45
|
+
* Writes the environment type reflection to the file system.
|
|
46
|
+
*
|
|
47
|
+
* @param context - The plugin context.
|
|
48
|
+
* @param reflection - The environment type reflection to write.
|
|
49
|
+
* @param name - The name of the type reflections.
|
|
50
|
+
*/
|
|
51
|
+
declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
52
|
+
declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
|
|
53
|
+
/**
|
|
54
|
+
* Reads the environment reflection data from the file system.
|
|
55
|
+
*
|
|
56
|
+
* @param context - The plugin context.
|
|
57
|
+
* @returns The environment reflection data.
|
|
58
|
+
*/
|
|
59
|
+
declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
60
|
+
/**
|
|
61
|
+
* Reads the secret environment reflection data from the file system.
|
|
62
|
+
*
|
|
63
|
+
* @param context - The plugin context.
|
|
64
|
+
* @returns The environment reflection data.
|
|
65
|
+
*/
|
|
66
|
+
declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
67
|
+
/**
|
|
68
|
+
* Writes the environment reflection data to the file system.
|
|
69
|
+
*
|
|
70
|
+
* @param context - The plugin context.
|
|
71
|
+
* @param reflection - The reflection data to write.
|
|
72
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
73
|
+
*/
|
|
74
|
+
declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Writes the environment reflection data to the file system.
|
|
77
|
+
*
|
|
78
|
+
* @param context - The plugin context.
|
|
79
|
+
* @param reflection - The reflection data to write.
|
|
80
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
81
|
+
*/
|
|
82
|
+
declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
85
|
+
//# sourceMappingURL=persistence.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.cts","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAoDA;;;;AAEU,iBAFY,sBAAA,CAEZ,OAAA,EADC,iBACD,CADmB,uBACnB,CAAA,CAAA,EAAP,OAAO,CAAA,MAAA,CAAA;AAmBV;;;;;;AAcsB,iBAdA,2BAAA,CAc+B,OAAA,EAb1C,iBAa0C,CAbxB,uBAawB,CAAA,CAAA,EAZlD,OAYkD,CAZ1C,cAY0C,CAAA;;;;;;AAgBrC,iBAhBM,+BAAA,CAgBmB,OAAA,EAf9B,iBAe8B,CAfZ,uBAeY,CAAA,CAAA,EAdtC,OAcsC,CAd9B,cAc8B,CAAA;;;;;AAczC;;;AAGW,iBAjBK,yBAAA,CAiBL,OAAA,EAhBA,OAgBA,CAhBQ,uBAgBR,CAAA,EAAA,IAAA,CAAA,EAfH,OAeG,CAAA,EAAA,MAAA;;;AAuCX;;;;;AAGuB,iBA7CD,qBAAA,CA6CC,OAAA,EA5CZ,gBA4CY,EAAA,IAAA,CAAA,EA3Cf,OA2Ce,CAAA,EA1CpB,OA0CoB,CA1CZ,eA0CY,CAAA,GAAA,CAAA,CAAA;AAevB;AAaA;;;;;AAyDA;AACW,iBAzFW,sBAAA,CAyFX,OAAA,EAxFA,gBAwFA,EAAA,UAAA,EAvFG,eAuFH,CAAA,GAAA,CAAA,EAAA,IAAA,CAAA,EAtFH,OAsFG,CAAA,EAtFY,OAsFZ,CAAA,IAAA,CAAA;AACA,iBAxEK,qBAAA,CAwEL,OAAA,EAvEA,gBAuEA,EAAA,IAAA,EAtEH,OAsEG,CAAA,EAAA,MAAA;;;AA2DX;;;;AAGuB,iBAzHD,iBAAA,CAyHC,OAAA,EAxHZ,gBAwHY,CAAA,EAvHpB,OAuHoB,CAvHZ,eAuHY,CAAA,GAAA,CAAA,CAAA;;AAsBvB;;;;;iBAtFsB,qBAAA,UACX,mBACR,QAAQ;;;;;;;;iBA2DW,kBAAA,UACX,8BACG,6BACN,UAAe;;;;;;;;iBAsBP,sBAAA,UACL,8BACG,6BACN"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvPluginResolvedConfig, EnvType } from "../types/plugin.mjs";
|
|
2
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
import { Context, UnresolvedContext } from "powerlines";
|
|
4
|
+
import { TypeDefinition } from "@stryke/types/configuration";
|
|
5
|
+
|
|
6
|
+
//#region src/helpers/persistence.d.ts
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Resolves the runtime type definition file for the environment variables.
|
|
10
|
+
*
|
|
11
|
+
* @param context - The plugin context.
|
|
12
|
+
* @returns The runtime type definition file for the environment variables.
|
|
13
|
+
*/
|
|
14
|
+
declare function resolveRuntimeTypeFile(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* Gets the default type definition for the environment variables.
|
|
17
|
+
*
|
|
18
|
+
* @param context - The plugin context.
|
|
19
|
+
* @returns The default type definition for the environment variables.
|
|
20
|
+
*/
|
|
21
|
+
declare function getEnvDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
|
|
22
|
+
/** Gets the default type definition for the environment secrets.
|
|
23
|
+
*
|
|
24
|
+
* @param context - The plugin context.
|
|
25
|
+
* @returns The default type definition for the environment secrets.
|
|
26
|
+
*/
|
|
27
|
+
declare function getSecretsDefaultTypeDefinition(context: UnresolvedContext<EnvPluginResolvedConfig>): Promise<TypeDefinition>;
|
|
28
|
+
/**
|
|
29
|
+
* Gets the path to the environment type reflections.
|
|
30
|
+
*
|
|
31
|
+
* @param context - The plugin context.
|
|
32
|
+
* @param name - The name of the type reflections.
|
|
33
|
+
* @returns The path to the environment type reflections.
|
|
34
|
+
*/
|
|
35
|
+
declare function getEnvTypeReflectionsPath(context: Context<EnvPluginResolvedConfig>, name?: EnvType): string;
|
|
36
|
+
/**
|
|
37
|
+
* Reads the environment type reflection from the file system.
|
|
38
|
+
*
|
|
39
|
+
* @param context - The plugin context.
|
|
40
|
+
* @param name - The name of the type reflections.
|
|
41
|
+
* @returns The environment type reflection.
|
|
42
|
+
*/
|
|
43
|
+
declare function readEnvTypeReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
44
|
+
/**
|
|
45
|
+
* Writes the environment type reflection to the file system.
|
|
46
|
+
*
|
|
47
|
+
* @param context - The plugin context.
|
|
48
|
+
* @param reflection - The environment type reflection to write.
|
|
49
|
+
* @param name - The name of the type reflections.
|
|
50
|
+
*/
|
|
51
|
+
declare function writeEnvTypeReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
52
|
+
declare function getEnvReflectionsPath(context: EnvPluginContext, name: EnvType): string;
|
|
53
|
+
/**
|
|
54
|
+
* Reads the environment reflection data from the file system.
|
|
55
|
+
*
|
|
56
|
+
* @param context - The plugin context.
|
|
57
|
+
* @returns The environment reflection data.
|
|
58
|
+
*/
|
|
59
|
+
declare function readEnvReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
60
|
+
/**
|
|
61
|
+
* Reads the secret environment reflection data from the file system.
|
|
62
|
+
*
|
|
63
|
+
* @param context - The plugin context.
|
|
64
|
+
* @returns The environment reflection data.
|
|
65
|
+
*/
|
|
66
|
+
declare function readSecretsReflection(context: EnvPluginContext): Promise<ReflectionClass<any>>;
|
|
67
|
+
/**
|
|
68
|
+
* Writes the environment reflection data to the file system.
|
|
69
|
+
*
|
|
70
|
+
* @param context - The plugin context.
|
|
71
|
+
* @param reflection - The reflection data to write.
|
|
72
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
73
|
+
*/
|
|
74
|
+
declare function writeEnvReflection(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Writes the environment reflection data to the file system.
|
|
77
|
+
*
|
|
78
|
+
* @param context - The plugin context.
|
|
79
|
+
* @param reflection - The reflection data to write.
|
|
80
|
+
* @param name - The name of the reflection (either "env" or "secrets").
|
|
81
|
+
*/
|
|
82
|
+
declare function writeEnvReflectionSync(context: EnvPluginContext, reflection: ReflectionClass<any>, name?: EnvType): void;
|
|
83
|
+
//#endregion
|
|
84
|
+
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
85
|
+
//# sourceMappingURL=persistence.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.d.mts","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":[],"mappings":";;;;;;;;;AAoDA;;;;AAEU,iBAFY,sBAAA,CAEZ,OAAA,EADC,iBACD,CADmB,uBACnB,CAAA,CAAA,EAAP,OAAO,CAAA,MAAA,CAAA;AAmBV;;;;;;AAcsB,iBAdA,2BAAA,CAc+B,OAAA,EAb1C,iBAa0C,CAbxB,uBAawB,CAAA,CAAA,EAZlD,OAYkD,CAZ1C,cAY0C,CAAA;;;;;;AAgBrC,iBAhBM,+BAAA,CAgBmB,OAAA,EAf9B,iBAe8B,CAfZ,uBAeY,CAAA,CAAA,EAdtC,OAcsC,CAd9B,cAc8B,CAAA;;;;;AAczC;;;AAGW,iBAjBK,yBAAA,CAiBL,OAAA,EAhBA,OAgBA,CAhBQ,uBAgBR,CAAA,EAAA,IAAA,CAAA,EAfH,OAeG,CAAA,EAAA,MAAA;;;AAuCX;;;;;AAGuB,iBA7CD,qBAAA,CA6CC,OAAA,EA5CZ,gBA4CY,EAAA,IAAA,CAAA,EA3Cf,OA2Ce,CAAA,EA1CpB,OA0CoB,CA1CZ,eA0CY,CAAA,GAAA,CAAA,CAAA;AAevB;AAaA;;;;;AAyDA;AACW,iBAzFW,sBAAA,CAyFX,OAAA,EAxFA,gBAwFA,EAAA,UAAA,EAvFG,eAuFH,CAAA,GAAA,CAAA,EAAA,IAAA,CAAA,EAtFH,OAsFG,CAAA,EAtFY,OAsFZ,CAAA,IAAA,CAAA;AACA,iBAxEK,qBAAA,CAwEL,OAAA,EAvEA,gBAuEA,EAAA,IAAA,EAtEH,OAsEG,CAAA,EAAA,MAAA;;;AA2DX;;;;AAGuB,iBAzHD,iBAAA,CAyHC,OAAA,EAxHZ,gBAwHY,CAAA,EAvHpB,OAuHoB,CAvHZ,eAuHY,CAAA,GAAA,CAAA,CAAA;;AAsBvB;;;;;iBAtFsB,qBAAA,UACX,mBACR,QAAQ;;;;;;;;iBA2DW,kBAAA,UACX,8BACG,6BACN,UAAe;;;;;;;;iBAsBP,sBAAA,UACL,8BACG,6BACN"}
|
|
@@ -307,4 +307,5 @@ writeEnvReflectionSync.__type = [
|
|
|
307
307
|
];
|
|
308
308
|
|
|
309
309
|
//#endregion
|
|
310
|
-
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
310
|
+
export { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
|
311
|
+
//# sourceMappingURL=persistence.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"persistence.mjs","names":[],"sources":["../../src/helpers/persistence.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { convertFromCapnp, convertToCapnp } from \"@powerlines/deepkit/capnp\";\nimport { getReflectionsPath } from \"@powerlines/deepkit/resolve-reflections\";\nimport { SerializedTypes } from \"@powerlines/deepkit/schemas/reflection\";\nimport { Reflection } from \"@powerlines/deepkit/types\";\nimport {\n deserializeType,\n ReflectionClass,\n ReflectionKind,\n resolveClassType\n} from \"@powerlines/deepkit/vendor/type\";\nimport * as capnp from \"@stryke/capnp\";\nimport {\n readFileBuffer,\n writeFileBuffer,\n writeFileBufferSync\n} from \"@stryke/fs/buffer\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { isEmptyObject } from \"@stryke/type-checks/is-empty-object\";\nimport type { TypeDefinition } from \"@stryke/types/configuration\";\nimport { existsSync } from \"node:fs\";\nimport { Context, UnresolvedContext } from \"powerlines\";\nimport {\n EnvPluginContext,\n EnvPluginResolvedConfig,\n EnvType\n} from \"../types/plugin\";\nimport { createEnvReflection } from \"./reflect\";\n\n/**\n * Resolves the runtime type definition file for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The runtime type definition file for the environment variables.\n */\nexport async function resolveRuntimeTypeFile(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<string> {\n const resolved = await context.fs.resolve(\n \"@powerlines/plugin-env/types/runtime\"\n );\n if (!resolved) {\n throw new Error(\n `Failed to resolve the runtime type definition file for the environment variables. Please ensure that the \"@powerlines/plugin-env\" package is installed.`\n );\n }\n\n return resolved;\n}\n\n/**\n * Gets the default type definition for the environment variables.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment variables.\n */\nexport async function getEnvDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"EnvInterface\"\n };\n}\n\n/** Gets the default type definition for the environment secrets.\n *\n * @param context - The plugin context.\n * @returns The default type definition for the environment secrets.\n */\nexport async function getSecretsDefaultTypeDefinition(\n context: UnresolvedContext<EnvPluginResolvedConfig>\n): Promise<TypeDefinition> {\n return {\n file: await resolveRuntimeTypeFile(context),\n name: \"SecretsInterface\"\n };\n}\n\n/**\n * Gets the path to the environment type reflections.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The path to the environment type reflections.\n */\nexport function getEnvTypeReflectionsPath(\n context: Context<EnvPluginResolvedConfig>,\n name: EnvType = \"env\"\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}-types.bin`);\n}\n\n/**\n * Reads the environment type reflection from the file system.\n *\n * @param context - The plugin context.\n * @param name - The name of the type reflections.\n * @returns The environment type reflection.\n */\nexport async function readEnvTypeReflection(\n context: EnvPluginContext,\n name: EnvType = \"env\"\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvTypeReflectionsPath(context, name);\n if (!existsSync(filePath)) {\n if (!context.env.types.env || isEmptyObject(context.env.types.env)) {\n const reflection = createEnvReflection(context) as Reflection;\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.types.env = reflection;\n await writeEnvTypeReflection(context, context.env.types.env, name);\n }\n\n return context.env.types.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.types[name] = reflection;\n context.env.types[name].messageRoot = messageRoot;\n context.env.types[name].dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment type reflection to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The environment type reflection to write.\n * @param name - The name of the type reflections.\n */\nexport async function writeEnvTypeReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvTypeReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\nexport function getEnvReflectionsPath(\n context: EnvPluginContext,\n name: EnvType\n): string {\n return joinPaths(getReflectionsPath(context), \"env\", `${name}.bin`);\n}\n\n/**\n * Reads the environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readEnvReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"env\");\n if (!existsSync(filePath)) {\n if (!context.env.types.env) {\n context.env.types.env = await readEnvTypeReflection(context, \"env\");\n }\n\n if (!context.env.used.env || isEmptyObject(context.env.used.env)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.env\n }) as Reflection;\n reflection.name = \"Env\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.env = reflection;\n await writeEnvReflection(context, context.env.used.env, \"env\");\n }\n\n return context.env.used.env;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.env = reflection;\n context.env.used.env.messageRoot = messageRoot;\n context.env.used.env.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Reads the secret environment reflection data from the file system.\n *\n * @param context - The plugin context.\n * @returns The environment reflection data.\n */\nexport async function readSecretsReflection(\n context: EnvPluginContext\n): Promise<ReflectionClass<any>> {\n const filePath = getEnvReflectionsPath(context, \"secrets\");\n if (!existsSync(filePath)) {\n if (!context.env.types.secrets) {\n context.env.types.secrets = await readEnvTypeReflection(\n context,\n \"secrets\"\n );\n }\n\n if (!context.env.used.secrets || isEmptyObject(context.env.used.secrets)) {\n const reflection = createEnvReflection(context, {\n type: {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters that are used (at least once) by the ${\n context.config.name\n ? `${context.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n superReflection: context.env.types.secrets\n }) as Reflection;\n reflection.name = \"Secrets\";\n\n const message = new capnp.Message();\n reflection.messageRoot = message.initRoot(SerializedTypes);\n reflection.dataBuffer = message.toArrayBuffer();\n\n context.env.used.secrets = reflection;\n await writeEnvReflection(context, context.env.used.secrets, \"secrets\");\n }\n\n return context.env.used.secrets;\n }\n\n const buffer = await readFileBuffer(filePath);\n const message = new capnp.Message(buffer, false);\n const messageRoot = message.getRoot(SerializedTypes);\n\n const reflection = resolveClassType(\n deserializeType(convertFromCapnp(messageRoot.types))\n );\n\n context.env.used.secrets = reflection;\n context.env.used.secrets.messageRoot = messageRoot;\n context.env.used.secrets.dataBuffer = buffer;\n\n return reflection;\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport async function writeEnvReflection(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n await writeFileBuffer(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n\n/**\n * Writes the environment reflection data to the file system.\n *\n * @param context - The plugin context.\n * @param reflection - The reflection data to write.\n * @param name - The name of the reflection (either \"env\" or \"secrets\").\n */\nexport function writeEnvReflectionSync(\n context: EnvPluginContext,\n reflection: ReflectionClass<any>,\n name: EnvType = \"env\"\n) {\n const serialized = reflection.serializeType();\n\n const message = new capnp.Message();\n const root = message.initRoot(SerializedTypes);\n\n convertToCapnp(serialized, root._initTypes(serialized.length));\n\n writeFileBufferSync(\n getEnvReflectionsPath(context, name),\n message.toArrayBuffer()\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA2CA,eAAsB,uBAAE,SAAA;CACpB,M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AA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAEnC,mBAAmB,SAAS;OAAO;CAAO;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;AAQ1C,SAAgB,uBAAsB,SAAA,YAAA,OAAA,OAAA;CAClC,MAAM,aAAa,WAAW,eAAS;CACzC,MAAA,UAAA,IAAA,MAAA,SAAA;AAEE,gBAAe,YADF,QAAQ,SAAS,gBAAS,CACjB,WAAA,WAAA,OAAA,CAAA;AACtB,qBAAoB,sBAAS,SAAA,KAAA,EAAA,QAAA,eAAA,CAAA;;AAEjC,uBAAuB,SAAM;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { EnvInterface, SecretsInterface } from "../types/runtime.cjs";
|
|
2
|
+
import { EnvPluginContext } from "../types/plugin.cjs";
|
|
3
|
+
import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/reflect.d.ts
|
|
6
|
+
declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
7
|
+
declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
8
|
+
interface CreateEnvReflectionOptions {
|
|
9
|
+
type?: TypeObjectLiteral | TypeClass;
|
|
10
|
+
superReflection?: ReflectionClass<any>;
|
|
11
|
+
}
|
|
12
|
+
declare class BaseEnv implements EnvInterface {
|
|
13
|
+
APP_NAME: string;
|
|
14
|
+
APP_VERSION: string;
|
|
15
|
+
BUILD_ID: string;
|
|
16
|
+
BUILD_TIMESTAMP: string;
|
|
17
|
+
BUILD_CHECKSUM: string;
|
|
18
|
+
RELEASE_ID: string;
|
|
19
|
+
RELEASE_TAG: string;
|
|
20
|
+
ORGANIZATION: string;
|
|
21
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
22
|
+
MODE: "development" | "test" | "production";
|
|
23
|
+
ENVIRONMENT: string;
|
|
24
|
+
DEBUG: boolean;
|
|
25
|
+
TEST: boolean;
|
|
26
|
+
MINIMAL: boolean;
|
|
27
|
+
NO_COLOR: boolean;
|
|
28
|
+
FORCE_COLOR: number | boolean;
|
|
29
|
+
FORCE_HYPERLINK: number | boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
INCLUDE_ERROR_DATA: boolean;
|
|
32
|
+
ERROR_URL: string;
|
|
33
|
+
DEFAULT_TIMEZONE: string;
|
|
34
|
+
DEFAULT_LOCALE: string;
|
|
35
|
+
CI: boolean;
|
|
36
|
+
}
|
|
37
|
+
declare class BaseSecrets implements SecretsInterface {
|
|
38
|
+
ENCRYPTION_KEY: string;
|
|
39
|
+
}
|
|
40
|
+
declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
41
|
+
declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
|
|
47
|
+
*
|
|
48
|
+
* @param context - The plugin context
|
|
49
|
+
* @param file - The file path to reflect the environment configuration type definition from
|
|
50
|
+
* @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
|
|
51
|
+
* @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
|
|
52
|
+
*/
|
|
53
|
+
declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
54
|
+
/**
|
|
55
|
+
* Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
|
|
59
|
+
*
|
|
60
|
+
* @param context - The plugin context
|
|
61
|
+
* @param file - The file path to reflect the secrets configuration type definition from
|
|
62
|
+
* @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
|
|
63
|
+
* @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
|
|
64
|
+
*/
|
|
65
|
+
declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
66
|
+
declare type __ΩCreateEnvReflectionOptions = any[];
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
69
|
+
//# sourceMappingURL=reflect.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.cts","names":[],"sources":["../../src/helpers/reflect.ts"],"sourcesContent":[],"mappings":";;;;;iBAuCgB,mBAAA,UACL,+BACI,yBACZ;iBAQa,uBAAA,UACL,+BACI,yBACZ;AAda,UAsBC,0BAAA,CAtBkB;EACxB,IAAA,CAAA,EAsBF,iBAtBE,GAsBkB,SAtBlB;EACI,eAAA,CAAA,EAsB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3
|
+
import { ReflectionClass, TypeClass, TypeObjectLiteral } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
|
|
5
|
+
//#region src/helpers/reflect.d.ts
|
|
6
|
+
declare function mergeEnvReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
7
|
+
declare function mergeSecretsReflections(context: EnvPluginContext, reflections: ReflectionClass<any>[]): ReflectionClass<any>;
|
|
8
|
+
interface CreateEnvReflectionOptions {
|
|
9
|
+
type?: TypeObjectLiteral | TypeClass;
|
|
10
|
+
superReflection?: ReflectionClass<any>;
|
|
11
|
+
}
|
|
12
|
+
declare class BaseEnv implements EnvInterface {
|
|
13
|
+
APP_NAME: string;
|
|
14
|
+
APP_VERSION: string;
|
|
15
|
+
BUILD_ID: string;
|
|
16
|
+
BUILD_TIMESTAMP: string;
|
|
17
|
+
BUILD_CHECKSUM: string;
|
|
18
|
+
RELEASE_ID: string;
|
|
19
|
+
RELEASE_TAG: string;
|
|
20
|
+
ORGANIZATION: string;
|
|
21
|
+
PLATFORM: "node" | "browser" | "neutral";
|
|
22
|
+
MODE: "development" | "test" | "production";
|
|
23
|
+
ENVIRONMENT: string;
|
|
24
|
+
DEBUG: boolean;
|
|
25
|
+
TEST: boolean;
|
|
26
|
+
MINIMAL: boolean;
|
|
27
|
+
NO_COLOR: boolean;
|
|
28
|
+
FORCE_COLOR: number | boolean;
|
|
29
|
+
FORCE_HYPERLINK: number | boolean;
|
|
30
|
+
STACKTRACE: boolean;
|
|
31
|
+
INCLUDE_ERROR_DATA: boolean;
|
|
32
|
+
ERROR_URL: string;
|
|
33
|
+
DEFAULT_TIMEZONE: string;
|
|
34
|
+
DEFAULT_LOCALE: string;
|
|
35
|
+
CI: boolean;
|
|
36
|
+
}
|
|
37
|
+
declare class BaseSecrets implements SecretsInterface {
|
|
38
|
+
ENCRYPTION_KEY: string;
|
|
39
|
+
}
|
|
40
|
+
declare function createEnvReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
41
|
+
declare function createSecretsReflection(context: EnvPluginContext, options?: CreateEnvReflectionOptions): ReflectionClass<any>;
|
|
42
|
+
/**
|
|
43
|
+
* Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.
|
|
44
|
+
*
|
|
45
|
+
* @remarks
|
|
46
|
+
* The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
|
|
47
|
+
*
|
|
48
|
+
* @param context - The plugin context
|
|
49
|
+
* @param file - The file path to reflect the environment configuration type definition from
|
|
50
|
+
* @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
|
|
51
|
+
* @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.
|
|
52
|
+
*/
|
|
53
|
+
declare function reflectEnv(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
54
|
+
/**
|
|
55
|
+
* Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
|
|
59
|
+
*
|
|
60
|
+
* @param context - The plugin context
|
|
61
|
+
* @param file - The file path to reflect the secrets configuration type definition from
|
|
62
|
+
* @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.
|
|
63
|
+
* @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.
|
|
64
|
+
*/
|
|
65
|
+
declare function reflectSecrets(context: EnvPluginContext, file?: string, name?: string): Promise<ReflectionClass<any>>;
|
|
66
|
+
declare type __ΩCreateEnvReflectionOptions = any[];
|
|
67
|
+
//#endregion
|
|
68
|
+
export { BaseEnv, BaseSecrets, CreateEnvReflectionOptions, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
69
|
+
//# sourceMappingURL=reflect.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.d.mts","names":[],"sources":["../../src/helpers/reflect.ts"],"sourcesContent":[],"mappings":";;;;;iBAuCgB,mBAAA,UACL,+BACI,yBACZ;iBAQa,uBAAA,UACL,+BACI,yBACZ;AAda,UAsBC,0BAAA,CAtBkB;EACxB,IAAA,CAAA,EAsBF,iBAtBE,GAsBkB,SAtBlB;EACI,eAAA,CAAA,EAsBK,eAtBL,CAAA,GAAA,CAAA;;AACG,cAwBL,OAAA,YAAmB,YAxBd,CAAA;EAQF,QAAA,EAAA,MAAA;EACL,WAAA,EAAA,MAAA;EACI,QAAA,EAAA,MAAA;EACZ,eAAA,EAAA,MAAA;EAAe,cAAA,EAAA,MAAA;EAQD,UAAA,EAAA,MAAA;EACR,WAAA,EAAA,MAAA;EAAoB,YAAA,EAAA,MAAA;EACT,QAAA,EAAA,MAAA,GAAA,SAAA,GAAA,SAAA;EAAe,IAAA,EAAA,aAAA,GAAA,MAAA,GAAA,YAAA;EAGtB,WAAQ,EAAA,MAAA;EAgDR,KAAA,EAAA,OAAY;EAIT,IAAA,EAAA,OAAA;EACL,OAAA,EAAA,OAAA;EACA,QAAA,EAAA,OAAA;EACR,WAAA,EAAA,MAAA,GAAA,OAAA;EAAe,eAAA,EAAA,MAAA,GAAA,OAAA;EAyCF,UAAA,EAAA,OAAA;EACL,kBAAA,EAAA,OAAA;EACA,SAAA,EAAA,MAAA;EACR,gBAAA,EAAA,MAAA;EAAe,cAAA,EAAA,MAAA;EAoDI,EAAA,EAAA,OAAA;;AAGP,cA1GF,WAAA,YAAuB,gBA0GrB,CAAA;EAAA,cAAA,EAAA,MAAA;;AAqCO,iBA3IN,mBAAA,CA2IoB,OAAA,EA1IzB,gBA0IyB,EAAA,OAAA,CAAA,EAzIzB,0BAyIyB,CAAA,EAxIjC,eAwIiC,CAAA,GAAA,CAAA;AACzB,iBAhGK,uBAAA,CAgGL,OAAA,EA/FA,gBA+FA,EAAA,OAAA,CAAA,EA9FA,0BA8FA,CAAA,EA7FR,eA6FQ,CAAA,GAAA,CAAA;;;;;;;;;;;;iBAzCW,UAAA,UACX,iDAEI,QAAA;;;;;;;;;;;;iBAqCO,cAAA,UACX,iDAEI,QAAA"}
|
package/dist/helpers/reflect.mjs
CHANGED
|
@@ -273,4 +273,5 @@ reflectSecrets.__type = [
|
|
|
273
273
|
];
|
|
274
274
|
|
|
275
275
|
//#endregion
|
|
276
|
-
export { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
276
|
+
export { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets };
|
|
277
|
+
//# sourceMappingURL=reflect.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reflect.mjs","names":[],"sources":["../../src/helpers/reflect.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 { reflectType } from \"@powerlines/deepkit/reflect-type\";\nimport {\n merge,\n ReflectionClass,\n ReflectionKind,\n resolveClassType,\n TypeClass,\n TypeObjectLiteral\n} from \"@powerlines/deepkit/vendor/type\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { EnvPluginContext } from \"../types/plugin\";\nimport { EnvInterface, SecretsInterface } from \"../types/runtime\";\nimport {\n getEnvDefaultTypeDefinition,\n getSecretsDefaultTypeDefinition,\n readEnvTypeReflection,\n readSecretsReflection\n} from \"./persistence\";\n\nexport function mergeEnvReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createEnvReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport function mergeSecretsReflections(\n context: EnvPluginContext,\n reflections: ReflectionClass<any>[]\n): ReflectionClass<any> {\n const reflection = createSecretsReflection(context, {\n type: merge(reflections.map(reflection => reflection.type))\n });\n\n return reflection;\n}\n\nexport interface CreateEnvReflectionOptions {\n type?: TypeObjectLiteral | TypeClass;\n superReflection?: ReflectionClass<any>;\n}\n\nexport class BaseEnv implements EnvInterface {\n APP_NAME!: string;\n\n APP_VERSION!: string;\n\n BUILD_ID!: string;\n\n BUILD_TIMESTAMP!: string;\n\n BUILD_CHECKSUM!: string;\n\n RELEASE_ID!: string;\n\n RELEASE_TAG!: string;\n\n ORGANIZATION!: string;\n\n PLATFORM: \"node\" | \"browser\" | \"neutral\" = \"neutral\";\n\n MODE: \"development\" | \"test\" | \"production\" = \"production\";\n\n ENVIRONMENT!: string;\n\n DEBUG: boolean = false;\n\n TEST: boolean = false;\n\n MINIMAL: boolean = false;\n\n NO_COLOR: boolean = false;\n\n FORCE_COLOR: number | boolean = false;\n\n FORCE_HYPERLINK: number | boolean = false;\n\n STACKTRACE: boolean = false;\n\n INCLUDE_ERROR_DATA: boolean = false;\n\n ERROR_URL!: string;\n\n DEFAULT_TIMEZONE!: string;\n\n DEFAULT_LOCALE!: string;\n\n CI: boolean = false;\n}\n\nexport class BaseSecrets implements SecretsInterface {\n ENCRYPTION_KEY!: string;\n}\n\nexport function createEnvReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base environment configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseEnv,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"EnvInterface\",\n description: `The environment configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Env\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `A schema describing the list of available environment variables that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Env\";\n\n return result;\n}\n\nexport function createSecretsReflection(\n context: EnvPluginContext,\n options: CreateEnvReflectionOptions = {}\n): ReflectionClass<any> {\n const parent =\n options.superReflection ??\n new ReflectionClass({\n kind: ReflectionKind.class,\n description: `The base secrets configuration definition for the ${titleCase(\n context.config.name\n )} project.`,\n classType: BaseSecrets,\n types: [],\n implements: [\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"SecretsInterface\",\n description: `The secrets configuration interface definition for the ${titleCase(\n context.config.name\n )} project.`,\n types: []\n }\n ]\n });\n parent.name = \"Secrets\";\n\n const result = new ReflectionClass(\n options.type ?? {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `A schema describing the list of available environment secrets that can be used by the ${\n context.config.name\n ? `${titleCase(context.config.name)} application`\n : \"application\"\n }.`,\n types: []\n },\n parent\n );\n result.name = \"Secrets\";\n\n return result;\n}\n\n/**\n * Reflects the environment configuration type definition from the provided file and name, and merges it with the default environment configuration reflection and the currently used environment configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the environment configuration type definition from\n * @param name - The name of the type definition to reflect the environment configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the environment configuration type definition, merged with the default environment configuration reflection and the currently used environment configuration reflection. The resulting reflection will contain the structure of the expected environment variables as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default environment configuration reflection.\n */\nexport async function reflectEnv(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeEnvReflections(\n context,\n [\n await readEnvTypeReflection(context, \"env\"),\n config,\n resolveClassType(\n await reflectType(context, await getEnvDefaultTypeDefinition(context))\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n\n/**\n * Reflects the secrets configuration type definition from the provided file and name, and merges it with the default secrets configuration reflection and the currently used secrets configuration reflection.\n *\n * @remarks\n * The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n *\n * @param context - The plugin context\n * @param file - The file path to reflect the secrets configuration type definition from\n * @param name - The name of the type definition to reflect the secrets configuration from, if the file contains multiple type definitions. If not provided, the first type definition found in the file will be used.\n * @returns A reflection of the secrets configuration type definition, merged with the default secrets configuration reflection and the currently used secrets configuration reflection. The resulting reflection will contain the structure of the expected environment secrets as defined by the type definitions provided in the plugin configuration, as well as any additional properties that are currently used in the source code and defined in the default secrets configuration reflection.\n */\nexport async function reflectSecrets(\n context: EnvPluginContext,\n file?: string,\n name?: string\n) {\n let config: ReflectionClass<any> | undefined;\n if (file) {\n const configType = await reflectType(context, {\n file: !isParentPath(file, context.workspaceConfig.workspaceRoot)\n ? joinPaths(context.workspaceConfig.workspaceRoot, file)\n : file,\n name\n });\n\n config = resolveClassType(configType);\n }\n\n return mergeSecretsReflections(\n context,\n [\n await readSecretsReflection(context),\n config,\n resolveClassType(\n await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n )\n )\n ].filter(Boolean) as ReflectionClass<any>[]\n );\n}\n"],"mappings":";;;;;;;;;;AAUA,SAAS,aAAa,IAAI,MAAM;AAC5B,IAAG,SAAS;AACZ,QAAO;;AAyBX,SAAgB,oBAAM,SAAA,aAAA;AAIlB,uCAFI,MAAM,MAAM,YAAY,IAAG,cAAA,eAAA,WAAA,MAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,EAC9B,CAAC;;AAGN,oBAAoB,SAAS;OAAO;CAAc;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AAClD,SAAgB,wBAAwB,SAAS,aAAa;AAI9D,QAHI,wBAAA,SAAA;;;;OAEC,CAAC;;AAGN,wBAAwB,SAAS;OAAM;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;AACvC,MAAM,gCAAqB;OAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;AAE3B,IAAa,UAAb,MAAqB;CASjB,WAAW;CACX,OAAO;;CAGP,OAAO;CACP,UAAU;;CAEV,cAAc;;CAEd,aAAa;;;CAMb,OAAO,SAAS;EAAC;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA,WAAA;AAAA,UAAA;;EAAA;EAAA;EAAA;EAAA;EAAA,WAAA;AAAA,UAAA;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gBAC9B,cAAa;EACnB,OAAO,EAAA;EACV,EAAE,OAAO;AACV,QAAO,OAAO;AACd,QAAO;;AAEX,wBAAM,SAAA;OAAA;CAAA;OAAA;CAAA;QAAA,EAAA;OAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;AAYN,eAAS,WAAA,SAAA,MAAA,MAAA;CACL,IAAI;AACJ,KAAC,gCACI,MAAA,YAAA,SAAA;EACN,MAAA,CAAA,aAAA,MAAA,QAAA,gBAAA,cAAA,GACe,UAAG,QAAA,gBAAA,eAAA,KAAA;EAET;EACZ,CAAA;AAGI,QAAO,oBAAgB,SAAA;EACnB,MAAM,sBAAsB,SAAK,MAAA;EACjC;EACA,iBAAO,MAAA,YAAA,SAAA,MAAA,4BAAA,QAAA,CAAA,CAAA;EACV,CAAC,OAAO,QAAQ,CAAC;;AAEtB,WAAW,SAAS;OAAO;CAAK;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;;;;AAYhC,eAAsB,eAAA,SAAA,MAAA,MAAA;CAClB,IAAI;AACJ,KAAI,KAOA,UAAS,iBANX,MAAA,YAAA,SAAA;EACA,MAAA,CAAA,aAAA,MAAA,QAAA,gBAAA,cAAA,GACY,UAAO,QAAA,gBAAA,eAAA,KAAA;EAEb;EACH,CAAC,CAC8B;AAEpC,QAAO,wBAAwB,SAAS;EACpC,MAAM,sBAAY,QAAA;EAClB;EACA,iBAAgB,MAAA,YAAA,SAAA,MAAA,gCAAA,QAAA,CAAA,CAAA;EACnB,CAAC,OAAG,QAAA,CAAA;;AAET,eAAK,SAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/source-file-env.d.ts
|
|
4
|
+
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
5
|
+
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
6
|
+
declare function formatEnvField(key: string): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { formatEnvField, removeEnvPrefix };
|
|
9
|
+
//# sourceMappingURL=source-file-env.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-env.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"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DotenvParseOutput } from "@stryke/env/types";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/source-file-env.d.ts
|
|
4
|
+
type TReturned<TEnv> = TEnv extends string ? string : DotenvParseOutput;
|
|
5
|
+
declare function removeEnvPrefix<TEnv extends DotenvParseOutput | string>(env: TEnv): TReturned<TEnv>;
|
|
6
|
+
declare function formatEnvField(key: string): string;
|
|
7
|
+
//#endregion
|
|
8
|
+
export { formatEnvField, removeEnvPrefix };
|
|
9
|
+
//# sourceMappingURL=source-file-env.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-env.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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source-file-env.mjs","names":[],"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":";;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AAKX,MAAM,eAAe;CAAC;CAAQ;CAAa;CAAiC;;AAExE,KAAI,SAAS,IAAI,EAAE;EACf,IAAI,OAAO,aAAa,OAAO,cAAc,KAAK,WAAW;AACzD,OAAI,IAAI,WAAW,OAAO,CACtB,OAAM,IAAI,MAAM,OAAO,OAAO;AAElC,UAAO;;;;;;;AAEX,SAAO,KAAK,WAAW,IAAI;AAG3B,SAAO;;AAEX,QAAO,OAAO,KAAK,IAAI,CAAC,OAAO,cAAc,KAAK,QAAE;;AAEhD,MAAI;AAGJ,SAAE;IACH;EAAC;EAAO;EAAI;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEnB,gBAAgB,SAAS;CAAC;OAAa;CAAc;CAAO;CAAA;AAC5D,SAAgB,eAAe,KAAG;AAC9B,QAAO,UAAU,gBAAgB,IAAC,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvType } from "../types/plugin.cjs";
|
|
2
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/template-helpers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates the reflection data used when generating runtime template files.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context for the configuration plugin.
|
|
10
|
+
* @param name - The name of the configuration template.
|
|
11
|
+
* @returns The reflection for the specified configuration template.
|
|
12
|
+
*/
|
|
13
|
+
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createTemplateReflection };
|
|
16
|
+
//# sourceMappingURL=template-helpers.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-helpers.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,eAAD,CAAA,GAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { EnvPluginContext, EnvType } from "../types/plugin.mjs";
|
|
2
|
+
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers/template-helpers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Creates the reflection data used when generating runtime template files.
|
|
8
|
+
*
|
|
9
|
+
* @param context - The context for the configuration plugin.
|
|
10
|
+
* @param name - The name of the configuration template.
|
|
11
|
+
* @returns The reflection for the specified configuration template.
|
|
12
|
+
*/
|
|
13
|
+
declare function createTemplateReflection(context: EnvPluginContext, name?: EnvType): Promise<ReflectionClass<any>>;
|
|
14
|
+
//#endregion
|
|
15
|
+
export { createTemplateReflection };
|
|
16
|
+
//# sourceMappingURL=template-helpers.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-helpers.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,eAAD,CAAA,GAAA,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-helpers.mjs","names":[],"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":";;;;;;AAIA,SAAS,aAAa,IAAI,MAAM;AAC5B,IAAG,SAAS;AACZ,QAAO;;;;;;;;;;CA8BP,MAAM,aAAa,MAAM,sBAAgB,SAAA,KAAA;AACzC,YAAW,eAAe,CAAC,QAAI,cAAA,SAAA;AAE3B,EADgB,KAAK,UAAU,CACvB,OAAO,QAAM,CAAA,QAAA,cAAA,UAAA;AACjB,cAAO,YAAA;IACH,MAAM;IACN,UAAU,KAAK,YAAY,GAAG,OAAO;IACrC,UAAU,KAAK,YAAW,GAAA,OAAA;IAC1B,aAAa,KAAK,gBAAM;IACxB,YAAY,KAAA,eAAA;IACZ,MAAM,KAAK,SAAS;IACtB,SAAA,KAAA,iBAAA;IACE,MAAM;KACF,QAAQ,KAAK,UAAC;KACd,QAAQ,KAAK,WAAI;KACjB,UAAA,KAAA,YAAA;KACA,OAAE,KACG,UAAU,CACV,OAAK,cAAA,MAAA,MAAA,OAAA;MAAA;MAAA;MAAA;MAAA,CAAA,CAAA,CACL,OAAO,KAAK,KAAK;KACtB,OAAO,KAAK,UAAK,IAAA,UAAA,KAAA,KAAA;KACjB,UAAU,KAAK,YAAO;KACtB,YAAY,KAAC,eAAA;KACzB,QAAA,KAAA,WAAA;KACA;IACF,CAAA;KACF;GAAA;GAAA;GAAA;GAAA,CAAA,CAAA;;;;;;AAEA,QAAO"}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.cjs";
|
|
2
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.cjs";
|
|
3
|
+
import "./types/index.cjs";
|
|
4
|
+
import { Plugin } from "powerlines";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
declare module "powerlines" {
|
|
8
|
+
interface Config {
|
|
9
|
+
env?: EnvPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A Powerlines plugin to inject environment variables into the source code.
|
|
14
|
+
*/
|
|
15
|
+
declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
|
|
18
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAgEU;EAJmB;;;;;AAWhB,cAAA,MA6VZ,EAAA,CAAA,iBA7VuC,gBA6VvC,GA7V0D,gBA6V1D,CAAA,CAAA,OAAA,CAAA,EA5VU,gBA4VV,EAAA,GADM,MACN,CADa,QACb,CAAA,EAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EnvInterface, SecretsInterface, __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.mjs";
|
|
2
|
+
import { EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
4
|
+
import { Plugin } from "powerlines";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
declare module "powerlines" {
|
|
8
|
+
interface Config {
|
|
9
|
+
env?: EnvPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A Powerlines plugin to inject environment variables into the source code.
|
|
14
|
+
*/
|
|
15
|
+
declare const plugin: <TContext extends EnvPluginContext = EnvPluginContext>(options?: EnvPluginOptions) => Plugin<TContext>[];
|
|
16
|
+
//#endregion
|
|
17
|
+
export { EnvInterface, EnvPluginContext, EnvPluginOptions, EnvPluginResolvedConfig, EnvPluginUserConfig, EnvType, SecretsInterface, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface, plugin as default, plugin };
|
|
18
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;;UAgEU;EAJmB;;;;;AAWhB,cAAA,MA6VZ,EAAA,CAAA,iBA7VuC,gBA6VvC,GA7V0D,gBA6V1D,CAAA,CAAA,OAAA,CAAA,EA5VU,gBA4VV,EAAA,GADM,MACN,CADa,QACb,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED