@powerlines/plugin-env 0.16.62 → 0.16.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/babel/plugin.cjs +11 -83
- package/dist/babel/plugin.mjs +11 -83
- package/dist/babel/plugin.mjs.map +1 -1
- package/dist/components/docs.cjs +22 -47
- package/dist/components/docs.mjs +22 -47
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/env-builtin.cjs +219 -419
- package/dist/components/env-builtin.mjs +219 -419
- package/dist/components/env-builtin.mjs.map +1 -1
- package/dist/helpers/automd-generator.cjs +4 -14
- package/dist/helpers/automd-generator.d.mts +1 -1
- package/dist/helpers/automd-generator.mjs +4 -14
- package/dist/helpers/automd-generator.mjs.map +1 -1
- package/dist/helpers/create-reflection-resource.cjs +0 -8
- package/dist/helpers/create-reflection-resource.mjs +0 -9
- package/dist/helpers/create-reflection-resource.mjs.map +1 -1
- package/dist/helpers/docs-helper.cjs +0 -8
- package/dist/helpers/docs-helper.mjs +0 -8
- package/dist/helpers/docs-helper.mjs.map +1 -1
- package/dist/helpers/index.cjs +0 -1
- package/dist/helpers/index.mjs +2 -2
- package/dist/helpers/load.cjs +7 -58
- package/dist/helpers/load.mjs +7 -58
- package/dist/helpers/load.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +1 -108
- package/dist/helpers/persistence.mjs +1 -108
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/reflect.cjs +16 -156
- package/dist/helpers/reflect.mjs +17 -156
- package/dist/helpers/reflect.mjs.map +1 -1
- package/dist/helpers/source-file-env.cjs +4 -34
- package/dist/helpers/source-file-env.mjs +4 -34
- package/dist/helpers/source-file-env.mjs.map +1 -1
- package/dist/helpers/template-helpers.cjs +5 -33
- package/dist/helpers/template-helpers.mjs +5 -33
- package/dist/helpers/template-helpers.mjs.map +1 -1
- package/dist/index.cjs +2 -12
- package/dist/index.mjs +2 -12
- package/dist/index.mjs.map +1 -1
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs +0 -2
- package/dist/node_modules/.pnpm/confbox@0.2.4/node_modules/confbox/dist/_chunks/rolldown-runtime.mjs.map +1 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.mjs +0 -4
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +0 -1
- package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs.map +1 -1
- package/dist/types/index.cjs +0 -11
- package/dist/types/index.mjs +1 -4
- package/dist/types/plugin.cjs +0 -137
- package/dist/types/plugin.d.mts +4 -4
- package/dist/types/plugin.mjs +1 -132
- package/dist/types/runtime.cjs +0 -244
- package/dist/types/runtime.mjs +1 -242
- package/package.json +10 -10
- package/dist/types/plugin.mjs.map +0 -1
- package/dist/types/runtime.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env-builtin.mjs","names":["code","computed","For","Show","splitProps","ClassDeclaration","ClassMethod","ElseIfClause","FunctionDeclaration","IfStatement","NewExpression","TypeDeclaration","VarDeclaration","ReflectionClass","ReflectionKind","Spacing","usePowerlines","refkey","BuiltinFile","InterfaceDeclaration","ObjectDeclaration","TSDoc","TSDocExample","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","TSDocThrows","titleCase","defu","loadEnvFromContext","EnvTypeDefinition","props","defaultValue","reflection","context","_$createComponent","name","heading","children","config","env","prefix","map","replace","join","ConfigPropertyConditional","sort","a","b","startsWith","localeCompare","toLowerCase","ConfigPropertyGet","property","index","condition","getNameAsString","when","_$memo","getAlias","length","each","joiner","alias","ConfigPropertySet","createEnvRefkey","envRefkey","envSerializerRefkey","EnvBuiltin","defaultConfig","rest","process","envInstance","result","kind","objectLiteral","description","types","reflectionGetProperties","getProperties","filter","isIgnored","reflectionSetProperties","isReadonly","_$mergeProps","id","imports","Boolean","value","_$createIntrinsic","type","doc","initializer","args","target","entryPath","async","parameters","optional","default","returnType","ender"],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n ClassDeclaration,\n ClassMethod,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n NewExpression,\n TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { InterfaceDeclarationProps } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocExample,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns,\n TSDocThrows\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition(\n props: Omit<InterfaceDeclarationProps, \"name\">\n) {\n const [{ defaultValue, reflection }] = splitProps(props, [\n \"defaultValue\",\n \"reflection\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\" EnvBase\"\n defaultValue={defaultValue}\n reflection={reflection}\n export={true}\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`EnvBase\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <TypeDeclaration name=\"Env\" export={true}>\n {code` {\n [Key in keyof EnvBase as Key ${context.config.env.prefix\n .map(prefix => `| \\`${prefix.replace(/_$/g, \"\")}_\\${Key}\\``)\n .join(\" \")}]: EnvBase[Key];\n}\n`}\n </TypeDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n .join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n property: ReflectionProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n reflection: ReflectionClass<any>;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\nconst envSerializerRefkey = refkey(\"EnvSerializer\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, reflection, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"reflection\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const envInstance = computed(() => {\n const result = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n description: `The initial environment configuration state for the ${titleCase(\n context?.config?.name\n )} project.`,\n types: []\n },\n reflection\n );\n\n return result;\n });\n\n const reflectionGetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored() && !property.isReadonly())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@powerlines/deepkit/vendor/type\": [\n \"stringify\",\n \"serializer\",\n \"serializeFunction\",\n \"deserializeFunction\",\n \"ReflectionKind\",\n \"Serializer\",\n \"TemplateState\",\n \"Type\",\n \"TypeProperty\",\n \"TypePropertySignature\"\n ]\n },\n rest.imports ?? {}\n )}>\n <Show when={Boolean(reflection)}>\n <EnvTypeDefinition\n defaultValue={defaultValue.value}\n reflection={reflection}\n />\n <hbr />\n <hbr />\n </Show>\n\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<EnvBase>\"\n defaultValue={defaultValue}\n reflection={envInstance}\n export={true}\n const={true}\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n\n <TSDoc heading=\"The environment configuration serializer for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <ClassDeclaration\n refkey={envSerializerRefkey}\n name=\"EnvSerializer\"\n extends=\"Serializer\"\n export={true}>\n <ClassMethod\n name=\"constructor\"\n public={true}\n doc=\"Initializes a new instance of the `EnvSerializer` class.\">\n {code`super(\"env\");\n\n this.deserializeRegistry.register(\n ReflectionKind.boolean,\n (type: Type, state: TemplateState) => {\n state.addSetter(\n \\`typeof \\${state.accessor.toString()} !== \"boolean\" ? \\${state.accessor.toString()} === 1 || \\${state.accessor.toString()} === \"1\" || \\${state.accessor.toString()}.toLowerCase() === \"t\" || \\${state.accessor.toString()}.toLowerCase() === \"true\" || \\${state.accessor.toString()}.toLowerCase() === \"y\" || \\${state.accessor.toString()}.toLowerCase() === \"yes\" : \\${state.accessor.toString()}\\`\n );\n }\n ); `}\n </ClassMethod>\n </ClassDeclaration>\n <Spacing />\n\n <TSDoc heading=\"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n name=\"envSerializer\"\n export={false}\n const={true}\n initializer={<NewExpression args={[]} target=\"EnvSerializer\" />}\n />\n <Spacing />\n\n <TSDoc heading=\"Serialize a environment configuration object to JSON data objects (not a JSON string).\">\n <TSDocRemarks>\n {`The resulting JSON object can be stringified using \\`JSON.stringify()\\`.`}\n </TSDocRemarks>\n <TSDocExample>{`const json = serializeEnv(env);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when serialization or validation fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"serializeEnv\"\n export={true}\n const={true}\n initializer={\"serializeFunction<EnvBase>(envSerializer)\"}\n />\n <Spacing />\n\n <TSDoc heading=\"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.\">\n <TSDocRemarks>\n {`Types that are already correct will be used as-is.`}\n </TSDocRemarks>\n <TSDocExample>{`const env = deserializeEnv(json);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when deserialization fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"deserializeEnv\"\n export={true}\n const={true}\n initializer=\"deserializeFunction<EnvBase>(envSerializer)\"\n />\n <Spacing />\n\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export={true}\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n }) as Env,\n {\n get: (target: EnvBase, propertyName: string) => { `}\n <hbr />\n\n <For each={reflectionGetProperties}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: EnvBase, propertyName: string, newValue: any) => { `}\n <hbr />\n\n <For each={reflectionSetProperties} ender={code` else `}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <hbr />\n\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export={true}\n const={true}\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n );\n `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Bool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ACuD,OAAI;AAAA,aAAE8B,QAAQjD,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"env-builtin.mjs","names":[],"sources":["../../src/components/env-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n Children,\n code,\n computed,\n For,\n Show,\n splitProps\n} from \"@alloy-js/core\";\nimport {\n ClassDeclaration,\n ClassMethod,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n NewExpression,\n TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport {\n ReflectionClass,\n ReflectionKind,\n ReflectionProperty\n} from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { refkey } from \"@powerlines/plugin-alloy/helpers/refkey\";\nimport { ComponentProps } from \"@powerlines/plugin-alloy/types/components\";\nimport {\n BuiltinFile,\n BuiltinFileProps\n} from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport type { InterfaceDeclarationProps } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { InterfaceDeclaration } from \"@powerlines/plugin-alloy/typescript/components/interface-declaration\";\nimport { ObjectDeclaration } from \"@powerlines/plugin-alloy/typescript/components/object-declaration\";\nimport {\n TSDoc,\n TSDocExample,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns,\n TSDocThrows\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport defu from \"defu\";\nimport { loadEnvFromContext } from \"../helpers/load\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Generates the environment configuration typescript definition for the Powerlines project.\n */\nexport function EnvTypeDefinition(\n props: Omit<InterfaceDeclarationProps, \"name\">\n) {\n const [{ defaultValue, reflection }] = splitProps(props, [\n \"defaultValue\",\n \"reflection\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n\n return (\n <>\n <InterfaceDeclaration\n name=\" EnvBase\"\n defaultValue={defaultValue}\n reflection={reflection}\n export={true}\n />\n <Spacing />\n <TSDoc heading=\"The environment configuration object with prefixed keys.\">\n <TSDocRemarks>\n {`The \\`Env\\` type extends the \\`EnvBase\\` interface by including additional keys that are prefixed according to the project's configuration. This allows for flexibility in accessing environment variables with different naming conventions.`}\n </TSDocRemarks>\n </TSDoc>\n <TypeDeclaration name=\"Env\" export={true}>\n {code` {\n [Key in keyof EnvBase as Key ${context.config.env.prefix\n .map(prefix => `| \\`${prefix.replace(/_$/g, \"\")}_\\${Key}\\``)\n .join(\" \")}]: EnvBase[Key];\n}\n`}\n </TypeDeclaration>\n <Spacing />\n </>\n );\n}\n\ninterface ConfigPropertyConditionalProps extends ComponentProps {\n context: EnvPluginContext;\n name: string;\n}\n\nfunction ConfigPropertyConditional(props: ConfigPropertyConditionalProps) {\n const [{ context, name }] = splitProps(props, [\"context\", \"name\"]);\n\n return code`propertyName === \"${name}\" || propertyName.replace(/^(${context.config.env.prefix\n .sort((a, b) =>\n a.startsWith(b) ? -1 : b.startsWith(a) ? 1 : a.localeCompare(b)\n )\n .map(prefix => `${prefix.replace(/_$/, \"\")}_`)\n .join(\"|\")})/g, \"\").toLowerCase().replace(/[\\\\s\\\\-_]+/g, \"\") === \"${name\n .toLowerCase()\n .replace(/[\\s\\-_]+/g, \"\")}\"`;\n}\n\ninterface ConfigPropertyProps extends ComponentProps {\n index: number;\n context: EnvPluginContext;\n property: ReflectionProperty;\n}\n\nfunction ConfigPropertyGet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`return target[\"${property.getNameAsString()}\"];`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nfunction ConfigPropertySet(props: ConfigPropertyProps) {\n const [{ context, property, index }] = splitProps(props, [\n \"context\",\n \"property\",\n \"index\"\n ]);\n\n return (\n <>\n {index === 0 ? (\n <IfStatement\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </IfStatement>\n ) : (\n <ElseIfClause\n condition={\n <>\n <ConfigPropertyConditional\n name={property.getNameAsString()}\n context={context}\n />\n <Show\n when={property.getAlias() && property.getAlias().length > 0}>\n {code` || `}\n <For each={property.getAlias()} joiner={code` || `}>\n {alias => (\n <ConfigPropertyConditional name={alias} context={context} />\n )}\n </For>\n </Show>\n </>\n }>\n {code`\n target[\"${property.getNameAsString()}\"] = newValue;\n return true;\n`}\n </ElseIfClause>\n )}\n </>\n );\n}\n\nexport interface EnvBuiltinProps extends Omit<BuiltinFileProps, \"id\"> {\n defaultConfig?: Children;\n reflection: ReflectionClass<any>;\n}\n\nconst createEnvRefkey = refkey(\"createEnv\");\nconst envRefkey = refkey(\"env\");\nconst envSerializerRefkey = refkey(\"EnvSerializer\");\n\n/**\n * Generates the environment configuration module for the Powerlines project.\n */\nexport function EnvBuiltin(props: EnvBuiltinProps) {\n const [{ defaultConfig, reflection, children }, rest] = splitProps(props, [\n \"defaultConfig\",\n \"reflection\",\n \"children\"\n ]);\n\n const context = usePowerlines<EnvPluginContext>();\n const defaultValue = computed(\n () => context && loadEnvFromContext(context, process.env)\n );\n\n const envInstance = computed(() => {\n const result = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n description: `The initial environment configuration state for the ${titleCase(\n context?.config?.name\n )} project.`,\n types: []\n },\n reflection\n );\n\n return result;\n });\n\n const reflectionGetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n const reflectionSetProperties = computed(\n () =>\n reflection\n ?.getProperties()\n .filter(property => !property.isIgnored() && !property.isReadonly())\n .sort((a, b) =>\n a.getNameAsString().localeCompare(b.getNameAsString())\n ) ?? []\n );\n\n return (\n <BuiltinFile\n id=\"env\"\n description=\"The environment configuration module provides an interface to define environment configuration parameters.\"\n {...rest}\n imports={defu(\n {\n \"@powerlines/deepkit/vendor/type\": [\n \"stringify\",\n \"serializer\",\n \"serializeFunction\",\n \"deserializeFunction\",\n \"ReflectionKind\",\n \"Serializer\",\n \"TemplateState\",\n \"Type\",\n \"TypeProperty\",\n \"TypePropertySignature\"\n ]\n },\n rest.imports ?? {}\n )}>\n <Show when={Boolean(reflection)}>\n <EnvTypeDefinition\n defaultValue={defaultValue.value}\n reflection={reflection}\n />\n <hbr />\n <hbr />\n </Show>\n\n <ObjectDeclaration\n name=\"initialEnv\"\n type=\"Partial<EnvBase>\"\n defaultValue={defaultValue}\n reflection={envInstance}\n export={true}\n const={true}\n doc=\"The initial environment configuration object values for the runtime.\"\n />\n <Spacing />\n\n <TSDoc heading=\"The environment configuration serializer for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <ClassDeclaration\n refkey={envSerializerRefkey}\n name=\"EnvSerializer\"\n extends=\"Serializer\"\n export={true}>\n <ClassMethod\n name=\"constructor\"\n public={true}\n doc=\"Initializes a new instance of the `EnvSerializer` class.\">\n {code`super(\"env\");\n\n this.deserializeRegistry.register(\n ReflectionKind.boolean,\n (type: Type, state: TemplateState) => {\n state.addSetter(\n \\`typeof \\${state.accessor.toString()} !== \"boolean\" ? \\${state.accessor.toString()} === 1 || \\${state.accessor.toString()} === \"1\" || \\${state.accessor.toString()}.toLowerCase() === \"t\" || \\${state.accessor.toString()}.toLowerCase() === \"true\" || \\${state.accessor.toString()}.toLowerCase() === \"y\" || \\${state.accessor.toString()}.toLowerCase() === \"yes\" : \\${state.accessor.toString()}\\`\n );\n }\n ); `}\n </ClassMethod>\n </ClassDeclaration>\n <Spacing />\n\n <TSDoc heading=\"A {@link EnvSerializer | environment configuration serializer} instance for the Powerlines application.\">\n <TSDocLink>\n {`https://deepkit.io/docs/serialization/serializers`}\n </TSDocLink>\n <TSDocLink>\n {`https://github.com/marcj/untitled-code/blob/master/packages/type/src/serializer.ts#L1918`}\n </TSDocLink>\n <TSDocRemarks>\n {`This serializer is used to serialize and deserialize the Powerlines environment configuration.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n name=\"envSerializer\"\n export={false}\n const={true}\n initializer={<NewExpression args={[]} target=\"EnvSerializer\" />}\n />\n <Spacing />\n\n <TSDoc heading=\"Serialize a environment configuration object to JSON data objects (not a JSON string).\">\n <TSDocRemarks>\n {`The resulting JSON object can be stringified using \\`JSON.stringify()\\`.`}\n </TSDocRemarks>\n <TSDocExample>{`const json = serializeEnv(env);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when serialization or validation fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"serializeEnv\"\n export={true}\n const={true}\n initializer={\"serializeFunction<EnvBase>(envSerializer)\"}\n />\n <Spacing />\n\n <TSDoc heading=\"Deserialize a environment configuration object from JSON data objects to JavaScript objects, without running any validators.\">\n <TSDocRemarks>\n {`Types that are already correct will be used as-is.`}\n </TSDocRemarks>\n <TSDocExample>{`const env = deserializeEnv(json);`}</TSDocExample>\n <TSDocThrows>\n {`ValidationError when deserialization fails.`}\n </TSDocThrows>\n </TSDoc>\n <VarDeclaration\n name=\"deserializeEnv\"\n export={true}\n const={true}\n initializer=\"deserializeFunction<EnvBase>(envSerializer)\"\n />\n <Spacing />\n\n <TSDoc heading=\"Initializes the Powerlines environment configuration module.\">\n <TSDocRemarks>\n {`This function initializes the Powerlines environment configuration object.`}\n </TSDocRemarks>\n <TSDocParam name=\"environmentConfig\">\n {`The dynamic/runtime configuration - this could include the current environment variables or any other environment-specific settings provided by the runtime.`}\n </TSDocParam>\n <TSDocReturns>\n {`The initialized Powerlines configuration object.`}\n </TSDocReturns>\n </TSDoc>\n <Show when={Boolean(context?.entryPath)}>\n <FunctionDeclaration\n refkey={createEnvRefkey}\n async={false}\n export={true}\n name=\"createEnv\"\n parameters={[\n {\n name: \"environmentConfig\",\n type: `Partial<Env>`,\n optional: false,\n default: \"{}\"\n }\n ]}\n returnType=\"Env\">\n {code`\n return new Proxy<Env>(\n deserializeEnv({\n ...initialEnv,\n ...environmentConfig\n }) as Env,\n {\n get: (target: EnvBase, propertyName: string) => { `}\n <hbr />\n\n <For each={reflectionGetProperties}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertyGet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n {code`\n return undefined;\n }, `}\n\n <Spacing />\n {code` set: (target: EnvBase, propertyName: string, newValue: any) => { `}\n <hbr />\n\n <For each={reflectionSetProperties} ender={code` else `}>\n {(property: ReflectionProperty, index: number) => (\n <ConfigPropertySet\n index={index}\n context={context}\n property={property}\n />\n )}\n </For>\n\n <hbr />\n {code`return false;\n }\n }\n );\n`}\n </FunctionDeclaration>\n </Show>\n <Spacing />\n <hbr />\n\n <TSDoc heading=\"The environment configuration object.\">\n <TSDocRemarks>\n {`This object provides access to the environment configuration parameters in the application runtime.`}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n refkey={envRefkey}\n name=\"env\"\n type=\"Env\"\n export={true}\n const={true}\n initializer={\n <>{code`createEnv(${defaultConfig || \"{}\"} as Partial<Env>);`}</>\n }\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isCI\"\n doc=\"Detect if the application is running in a continuous integration (CI) environment.\"\n initializer={code`Boolean(\n env.CI ||\n env.RUN_ID ||\n env.AGOLA_GIT_REF ||\n env.AC_APPCIRCLE ||\n env.APPVEYOR ||\n env.CODEBUILD ||\n env.TF_BUILD ||\n env.bamboo_planKey ||\n env.BITBUCKET_COMMIT ||\n env.BITRISE_IO ||\n env.BUDDY_WORKSPACE_ID ||\n env.BUILDKITE ||\n env.CIRCLECI ||\n env.CIRRUS_CI ||\n env.CF_BUILD_ID ||\n env.CM_BUILD_ID ||\n env.CI_NAME ||\n env.DRONE ||\n env.DSARI ||\n env.EARTHLY_CI ||\n env.EAS_BUILD ||\n env.GERRIT_PROJECT ||\n env.GITEA_ACTIONS ||\n env.GITHUB_ACTIONS ||\n env.GITLAB_CI ||\n env.GOCD ||\n env.BUILDER_OUTPUT ||\n env.HARNESS_BUILD_ID ||\n env.JENKINS_URL ||\n env.LAYERCI ||\n env.MAGNUM ||\n env.NETLIFY ||\n env.NEVERCODE ||\n env.PROW_JOB_ID ||\n env.RELEASE_BUILD_ID ||\n env.RENDER ||\n env.SAILCI ||\n env.HUDSON ||\n env.SCREWDRIVER ||\n env.SEMAPHORE ||\n env.SOURCEHUT ||\n env.STRIDER ||\n env.TASK_ID ||\n env.RUN_ID ||\n env.TEAMCITY_VERSION ||\n env.TRAVIS ||\n env.VELA ||\n env.NOW_BUILDER ||\n env.APPCENTER_BUILD_ID ||\n env.CI_XCODE_PROJECT ||\n env.XCS || false\n );\n `}\n />\n <Spacing />\n\n <TSDoc heading=\"Detect the \\`mode\\` of the current runtime environment.\">\n <TSDocRemarks>\n {code`The \\`mode\\` is determined by the \\`MODE\\` environment variable, or falls back to the \\`NEXT_PUBLIC_VERCEL_ENV\\`, \\`NODE_ENV\\`, or defaults to \\`production\\`. While the value can potentially be any string, it is generally recommended to only allow a value in the following list:\n - \\`production\\`\n - \\`test\\`\n - \\`development\\`\n `}\n </TSDocRemarks>\n </TSDoc>\n <VarDeclaration\n export\n const\n name=\"mode\"\n initializer={code`String(env.MODE) || \"production\"; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isProduction\"\n doc='Detect if the application is running in `\"production\"` mode'\n initializer={code`[\"prd\", \"prod\", \"production\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isTest\"\n doc='Detect if the application is running in `\"test\"` mode'\n initializer={code`[\"tst\", \"test\", \"testing\", \"stg\", \"stage\", \"staging\"].includes(mode.toLowerCase()) || env.TEST; `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDevelopment\"\n doc='Detect if the application is running in `\"development\"` mode'\n initializer={code`[\"dev\", \"development\"].includes(mode.toLowerCase()); `}\n />\n <Spacing />\n\n <VarDeclaration\n export\n const\n name=\"isDebug\"\n doc=\"Detect if the application is currently being debugged\"\n initializer={code`Boolean(isDevelopment && env.DEBUG); `}\n />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqEA,SAAgB,kBACd,OACA;CACA,MAAM,CAAC,EAAE,cAAc,gBAAgB,WAAW,OAAO,CACvD,gBACA,aACD,CAAC;CAEF,MAAM,UAAU,eAAiC;AAEjD,QACE,EAAE;MACA,CAAC,qBACC,gBACA,cAAc,cACd,YAAY,YACZ,QAAQ,QACR;MACF,CAAC,UAAU;MACX,CAAC,MAAM,mEAAmE;QACxE,CAAC,aAAa;WACX,gPAAgP;QACnP,EAAE,aAAa;MACjB,EAAE,MAAM;MACR,CAAC,gBAAgB,WAAW,QAAQ,MAAM;SACvC,IAAI;mCACsB,QAAQ,OAAO,IAAI,OAC/C,KAAI,WAAU,OAAO,OAAO,QAAQ,OAAO,GAAG,CAAC,YAAY,CAC3D,KAAK,IAAI,CAAC;;EAEf;MACI,EAAE,gBAAgB;MAClB,CAAC,UAAU;IACb;;AASJ,SAAS,0BAA0B,OAAuC;CACxE,MAAM,CAAC,EAAE,SAAS,UAAU,WAAW,OAAO,CAAC,WAAW,OAAO,CAAC;AAElE,QAAO,IAAI,qBAAqB,KAAK,+BAA+B,QAAQ,OAAO,IAAI,OACpF,MAAM,GAAG,MACR,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,cAAc,EAAE,CAChE,CACA,KAAI,WAAU,GAAG,OAAO,QAAQ,MAAM,GAAG,CAAC,GAAG,CAC7C,KAAK,IAAI,CAAC,yDAAyD,KACnE,aAAa,CACb,QAAQ,aAAa,GAAG,CAAC;;AAS9B,SAAS,kBAAkB,OAA4B;CACrD,MAAM,CAAC,EAAE,SAAS,UAAU,WAAW,WAAW,OAAO;EACvD;EACA;EACA;EACD,CAAC;AAEF,QACE,EAAE;OACC,UAAU,IACT,CAAC,YACC,WACE,EAAE;cACA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,EAAE,KAAK;MACP,CAAC,UAAU;MACX,CAAC,MAAM;;MAEP,CAAC,MAAM,gDAAgD;QACrD,CAAC,aAAa;WACX,sGAAsG;QACzG,EAAE,aAAa;MACjB,EAAE,MAAM;MACR,CAAC,eACC,QAAQ,WACR,WACA,WACA,QAAQ,MACR,OAAO,MACP,aACE,GAAG,IAAI,aAAa,iBAAiB,KAAK,oBAAoB,OAEhE;MACF,CAAC,UAAU;;MAEX,CAAC,eACC,OACA,MACA,YACA,yFACA,aAAa,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAsDjB;MACF,CAAC,UAAU;;MAEX,CAAC,MAAM,kEAAkE;QACvE,CAAC,aAAa;WACX,IAAI;;;;YAIH;QACJ,EAAE,aAAa;MACjB,EAAE,MAAM;MACR,CAAC,eACC,OACA,MACA,YACA,aAAa,IAAI,wCACjB;MACF,CAAC,UAAU;;MAEX,CAAC,eACC,OACA,MACA,oBACA,kEACA,aAAa,IAAI,kEACjB;MACF,CAAC,UAAU;;MAEX,CAAC,eACC,OACA,MACA,cACA,4DACA,aAAa,IAAI,sGACjB;MACF,CAAC,UAAU;;MAEX,CAAC,eACC,OACA,MACA,qBACA,mEACA,aAAa,IAAI,2DACjB;MACF,CAAC,UAAU;;MAEX,CAAC,eACC,OACA,MACA,eACA,4DACA,aAAa,IAAI,2CACjB;MACF,CAAC,UAAU;MACX,CAAC,KAAK,MAAM,QAAQ,SAAS,GAAG,SAAS,EAAE,KAAK;IAClD,EAAE"}
|
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let powerlines = require("powerlines");
|
|
4
3
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
4
|
let automd = require("automd");
|
|
6
5
|
|
|
7
6
|
//#region src/helpers/automd-generator.ts
|
|
8
|
-
function __assignType(fn, args) {
|
|
9
|
-
fn.__type = args;
|
|
10
|
-
return fn;
|
|
11
|
-
}
|
|
12
7
|
/**
|
|
13
8
|
* AutoMD generator to generate environment variable documentation
|
|
14
9
|
*
|
|
15
10
|
* @param context - The generator context.
|
|
16
11
|
* @returns The generated documentation content.
|
|
17
12
|
*/
|
|
18
|
-
const env =
|
|
13
|
+
const env = (context) => (0, automd.defineGenerator)({
|
|
19
14
|
name: "env",
|
|
20
|
-
|
|
15
|
+
async generate() {
|
|
21
16
|
const envDocFile = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "docs", "generated", "env.md");
|
|
22
17
|
if (!context.fs.existsSync(envDocFile)) return { contents: "" };
|
|
23
18
|
return { contents: await context.fs.read(envDocFile) || "" };
|
|
24
|
-
}
|
|
25
|
-
})
|
|
26
|
-
() => powerlines.__ΩUnresolvedContext,
|
|
27
|
-
"context",
|
|
28
|
-
"",
|
|
29
|
-
"Pn!2\"\"/#"
|
|
30
|
-
]);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
31
21
|
|
|
32
22
|
//#endregion
|
|
33
23
|
exports.env = env;
|
|
@@ -1,31 +1,21 @@
|
|
|
1
|
-
import { __ΩUnresolvedContext } from "powerlines";
|
|
2
1
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
3
2
|
import { defineGenerator } from "automd";
|
|
4
3
|
|
|
5
4
|
//#region src/helpers/automd-generator.ts
|
|
6
|
-
function __assignType(fn, args) {
|
|
7
|
-
fn.__type = args;
|
|
8
|
-
return fn;
|
|
9
|
-
}
|
|
10
5
|
/**
|
|
11
6
|
* AutoMD generator to generate environment variable documentation
|
|
12
7
|
*
|
|
13
8
|
* @param context - The generator context.
|
|
14
9
|
* @returns The generated documentation content.
|
|
15
10
|
*/
|
|
16
|
-
const env =
|
|
11
|
+
const env = (context) => defineGenerator({
|
|
17
12
|
name: "env",
|
|
18
|
-
|
|
13
|
+
async generate() {
|
|
19
14
|
const envDocFile = joinPaths(context.config.root, "docs", "generated", "env.md");
|
|
20
15
|
if (!context.fs.existsSync(envDocFile)) return { contents: "" };
|
|
21
16
|
return { contents: await context.fs.read(envDocFile) || "" };
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
() => __ΩUnresolvedContext,
|
|
25
|
-
"context",
|
|
26
|
-
"",
|
|
27
|
-
"Pn!2\"\"/#"
|
|
28
|
-
]);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
29
19
|
|
|
30
20
|
//#endregion
|
|
31
21
|
export { env };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"automd-generator.mjs","names":[],"sources":["../../src/helpers/automd-generator.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { defineGenerator } from \"automd\";\nimport { UnresolvedContext } from \"powerlines\";\n\n/**\n * AutoMD generator to generate environment variable documentation\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const env = (context: UnresolvedContext) =>\n defineGenerator({\n name: \"env\",\n async generate() {\n const envDocFile = joinPaths(\n context.config.root,\n \"docs\",\n \"generated\",\n \"env.md\"\n );\n\n if (!context.fs.existsSync(envDocFile)) {\n return {\n contents: \"\"\n };\n }\n\n const contents = await context.fs.read(envDocFile);\n\n return {\n contents: contents || \"\"\n };\n }\n });\n"],"mappings":";;;;;;;;;;AA4BA,MAAa,OAAO,YAClB,gBAAgB;CACd,MAAM;CACN,MAAM,WAAW;EACf,MAAM,aAAa,UACjB,QAAQ,OAAO,MACf,QACA,aACA,SACD;AAED,MAAI,CAAC,QAAQ,GAAG,WAAW,WAAW,CACpC,QAAO,EACL,UAAU,IACX;AAKH,SAAO,EACL,UAHe,MAAM,QAAQ,GAAG,KAAK,WAAW,IAG1B,IACvB;;CAEJ,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_types_plugin = require('../types/plugin.cjs');
|
|
3
2
|
|
|
4
3
|
//#region src/helpers/create-reflection-resource.ts
|
|
5
4
|
/**
|
|
@@ -11,13 +10,6 @@ const require_types_plugin = require('../types/plugin.cjs');
|
|
|
11
10
|
function createReflection(_context) {
|
|
12
11
|
return {};
|
|
13
12
|
}
|
|
14
|
-
createReflection.__type = [
|
|
15
|
-
() => require_types_plugin.__ΩEnvPluginContext,
|
|
16
|
-
"_context",
|
|
17
|
-
"createReflection",
|
|
18
|
-
"Creates a reflection resource for the environment configuration.",
|
|
19
|
-
"Pn!2\"\"/#?$"
|
|
20
|
-
];
|
|
21
13
|
|
|
22
14
|
//#endregion
|
|
23
15
|
exports.createReflection = createReflection;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
|
-
|
|
3
1
|
//#region src/helpers/create-reflection-resource.ts
|
|
4
2
|
/**
|
|
5
3
|
* Creates a reflection resource for the environment configuration.
|
|
@@ -10,13 +8,6 @@ import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
|
10
8
|
function createReflection(_context) {
|
|
11
9
|
return {};
|
|
12
10
|
}
|
|
13
|
-
createReflection.__type = [
|
|
14
|
-
() => __ΩEnvPluginContext,
|
|
15
|
-
"_context",
|
|
16
|
-
"createReflection",
|
|
17
|
-
"Creates a reflection resource for the environment configuration.",
|
|
18
|
-
"Pn!2\"\"/#?$"
|
|
19
|
-
];
|
|
20
11
|
|
|
21
12
|
//#endregion
|
|
22
13
|
export { createReflection };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-reflection-resource.mjs","names":[],"sources":["../../src/helpers/create-reflection-resource.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Creates a reflection resource for the environment configuration.\n *\n * @param _context - The environment plugin context.\n * @returns A resource that provides the reflection of the environment configuration.\n */\nexport function createReflection(_context: EnvPluginContext) {\n // const defaultValue = computed(\n // () => context && loadEnvFromContext(context, process.env)\n // );\n\n return {};\n\n // return computed(() => {\n // result.getProperties().forEach(prop => {\n // const aliases = prop.getAlias();\n // aliases.filter(Boolean).forEach(alias => {\n // result.addProperty({\n // name: alias,\n // optional: prop.isOptional() ? true : undefined,\n // readonly: prop.isReadonly() ? true : undefined,\n // description: prop.getDescription(),\n // visibility: prop.getVisibility(),\n // type: prop.getType(),\n // default: prop.getDefaultValue(),\n // tags: {\n // hidden: prop.isHidden(),\n // ignore: prop.isIgnored(),\n // internal: prop.isInternal(),\n // alias: prop\n // .getAlias()\n // .filter(a => a !== alias)\n // .concat(prop.name),\n // title: prop.getTitle() || titleCase(prop.name),\n // readonly: prop.isReadonly(),\n // permission: prop.getPermission(),\n // domain: prop.getDomain()\n // }\n // });\n // });\n // });\n\n // result.getProperties().forEach(prop => {\n // prop.setDefaultValue(\n // (defaultValue.value as Record<string, any>)?.[prop.getNameAsString()] ??\n // prop\n // .getAlias()\n // .reduce(\n // (ret, alias) =>\n // ret ?? (defaultValue.value as Record<string, any>)?.[alias],\n // undefined\n // ) ??\n // prop.getDefaultValue()\n // );\n // });\n // });\n}\n"],"mappings":";;;;;;;AA0BA,SAAgB,iBAAiB,UAA4B;AAK3D,QAAO,EAAE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
3
|
let _stryke_path_join = require("@stryke/path/join");
|
|
5
4
|
|
|
6
5
|
//#region src/helpers/docs-helper.ts
|
|
@@ -13,13 +12,6 @@ let _stryke_path_join = require("@stryke/path/join");
|
|
|
13
12
|
function getDocsOutputPath(context) {
|
|
14
13
|
return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
|
|
15
14
|
}
|
|
16
|
-
getDocsOutputPath.__type = [
|
|
17
|
-
() => require_types_plugin.__ΩEnvPluginContext,
|
|
18
|
-
"context",
|
|
19
|
-
"getDocsOutputPath",
|
|
20
|
-
"Gets the output path for the generated environment documentation.",
|
|
21
|
-
"Pn!2\"&/#?$"
|
|
22
|
-
];
|
|
23
15
|
|
|
24
16
|
//#endregion
|
|
25
17
|
exports.getDocsOutputPath = getDocsOutputPath;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __ΩEnvPluginContext } from "../types/plugin.mjs";
|
|
2
1
|
import { joinPaths } from "@stryke/path/join";
|
|
3
2
|
|
|
4
3
|
//#region src/helpers/docs-helper.ts
|
|
@@ -11,13 +10,6 @@ import { joinPaths } from "@stryke/path/join";
|
|
|
11
10
|
function getDocsOutputPath(context) {
|
|
12
11
|
return joinPaths(context.config.root, "docs", "generated");
|
|
13
12
|
}
|
|
14
|
-
getDocsOutputPath.__type = [
|
|
15
|
-
() => __ΩEnvPluginContext,
|
|
16
|
-
"context",
|
|
17
|
-
"getDocsOutputPath",
|
|
18
|
-
"Gets the output path for the generated environment documentation.",
|
|
19
|
-
"Pn!2\"&/#?$"
|
|
20
|
-
];
|
|
21
13
|
|
|
22
14
|
//#endregion
|
|
23
15
|
export { getDocsOutputPath };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"docs-helper.mjs","names":[],"sources":["../../src/helpers/docs-helper.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join\";\nimport { EnvPluginContext } from \"../types/plugin\";\n\n/**\n * Gets the output path for the generated environment documentation.\n *\n * @param context - The environment plugin context.\n * @returns The output path for the generated environment documentation.\n */\nexport function getDocsOutputPath(context: EnvPluginContext): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AA2BA,SAAgB,kBAAkB,SAAmC;AACnE,QAAO,UAAU,QAAQ,OAAO,MAAM,QAAQ,YAAY"}
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -8,7 +8,6 @@ const require_helpers_create_reflection_resource = require('./create-reflection-
|
|
|
8
8
|
|
|
9
9
|
exports.BaseEnv = require_helpers_reflect.BaseEnv;
|
|
10
10
|
exports.BaseSecrets = require_helpers_reflect.BaseSecrets;
|
|
11
|
-
exports.__ΩCreateEnvReflectionOptions = require_helpers_reflect.__ΩCreateEnvReflectionOptions;
|
|
12
11
|
exports.createEnvReflection = require_helpers_reflect.createEnvReflection;
|
|
13
12
|
exports.createReflection = require_helpers_create_reflection_resource.createReflection;
|
|
14
13
|
exports.createSecretsReflection = require_helpers_reflect.createSecretsReflection;
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { BaseEnv, BaseSecrets,
|
|
1
|
+
import { BaseEnv, BaseSecrets, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./reflect.mjs";
|
|
2
2
|
import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./persistence.mjs";
|
|
3
3
|
import { createTemplateReflection } from "./template-helpers.mjs";
|
|
4
4
|
import { formatEnvField, removeEnvPrefix } from "./source-file-env.mjs";
|
|
5
5
|
import { loadEnv, loadEnvFromContext } from "./load.mjs";
|
|
6
6
|
import { createReflection } from "./create-reflection-resource.mjs";
|
|
7
7
|
|
|
8
|
-
export { BaseEnv, BaseSecrets,
|
|
8
|
+
export { BaseEnv, BaseSecrets, createEnvReflection, createReflection, createSecretsReflection, createTemplateReflection, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
|
package/dist/helpers/load.cjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_types_plugin = require('../types/plugin.cjs');
|
|
4
3
|
const require_helpers_source_file_env = require('./source-file-env.cjs');
|
|
5
4
|
const require_index = require('../node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.cjs');
|
|
6
|
-
let powerlines = require("powerlines");
|
|
7
5
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
8
6
|
let _stryke_env_load_env = require("@stryke/env/load-env");
|
|
9
7
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
@@ -13,32 +11,16 @@ defu = require_runtime.__toESM(defu);
|
|
|
13
11
|
let powerlines_utils = require("powerlines/utils");
|
|
14
12
|
|
|
15
13
|
//#region src/helpers/load.ts
|
|
16
|
-
function __assignType(fn, args) {
|
|
17
|
-
fn.__type = args;
|
|
18
|
-
return fn;
|
|
19
|
-
}
|
|
20
14
|
async function loadEnvFiles(options, mode, cwd) {
|
|
21
15
|
let env = await (0, _stryke_env_load_env.loadEnv)(cwd, mode);
|
|
22
16
|
if (options.additionalFiles && options.additionalFiles?.length > 0) {
|
|
23
|
-
const additionalEnvFiles = await Promise.all(options.additionalFiles.map(
|
|
24
|
-
"additionalEnvFile",
|
|
25
|
-
"",
|
|
26
|
-
"P\"2!\"/\""
|
|
27
|
-
])));
|
|
17
|
+
const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => (0, _stryke_env_load_env.loadEnvFile)(additionalEnvFile, cwd)));
|
|
28
18
|
for (const additionalEnvFile of additionalEnvFiles) env = (0, defu.default)(additionalEnvFile, env);
|
|
29
19
|
}
|
|
30
20
|
return require_helpers_source_file_env.removeEnvPrefix(env);
|
|
31
21
|
}
|
|
32
|
-
loadEnvFiles.__type = [
|
|
33
|
-
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
34
|
-
"options",
|
|
35
|
-
"mode",
|
|
36
|
-
"cwd",
|
|
37
|
-
"loadEnvFiles",
|
|
38
|
-
"Pn!2\"&2#&2$\"`/%"
|
|
39
|
-
];
|
|
40
22
|
async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson, workspaceConfig) {
|
|
41
|
-
const [envResult, c12Result] = await Promise.all([
|
|
23
|
+
const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), require_index.loadConfig({
|
|
42
24
|
cwd: directory,
|
|
43
25
|
name: "storm",
|
|
44
26
|
envName: mode,
|
|
@@ -57,18 +39,6 @@ async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson,
|
|
|
57
39
|
})]);
|
|
58
40
|
return (0, defu.default)(envResult, c12Result.config, workspaceConfig);
|
|
59
41
|
}
|
|
60
|
-
loadEnvDirectory.__type = [
|
|
61
|
-
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
62
|
-
"options",
|
|
63
|
-
"directory",
|
|
64
|
-
"mode",
|
|
65
|
-
"cacheDir",
|
|
66
|
-
"packageJson",
|
|
67
|
-
() => powerlines.__ΩWorkspaceConfig,
|
|
68
|
-
"workspaceConfig",
|
|
69
|
-
"loadEnvDirectory",
|
|
70
|
-
"Pn!2\"&2#&2$&2%!2&n'2(\"`/)"
|
|
71
|
-
];
|
|
72
42
|
/**
|
|
73
43
|
* Retrieves various dotenv configuration parameters from the context.
|
|
74
44
|
*
|
|
@@ -96,40 +66,19 @@ function loadEnvFromContext(context, parsed) {
|
|
|
96
66
|
DEBUG: context.config.mode === "development",
|
|
97
67
|
STACKTRACE: context.config.mode !== "production",
|
|
98
68
|
ENVIRONMENT: !context.environment.name || context.environment.name === powerlines_utils.DEFAULT_ENVIRONMENT ? context.config.mode : context.environment.name
|
|
99
|
-
}, (0, _stryke_type_checks_is_set_object.isSetObject)(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce(
|
|
69
|
+
}, (0, _stryke_type_checks_is_set_object.isSetObject)(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce((ret, prop) => {
|
|
100
70
|
ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();
|
|
101
71
|
return ret;
|
|
102
|
-
},
|
|
103
|
-
"ret",
|
|
104
|
-
"prop",
|
|
105
|
-
"",
|
|
106
|
-
"P\"2!\"2\"\"/#"
|
|
107
|
-
]), {}) : {});
|
|
72
|
+
}, {}) : {});
|
|
108
73
|
}
|
|
109
|
-
loadEnvFromContext.__type = [
|
|
110
|
-
() => require_types_plugin.__ΩEnvPluginContext,
|
|
111
|
-
"context",
|
|
112
|
-
"parsed",
|
|
113
|
-
"loadEnvFromContext",
|
|
114
|
-
"Retrieves various dotenv configuration parameters from the context.",
|
|
115
|
-
"Pn!2\"!2#\"/$?%"
|
|
116
|
-
];
|
|
117
74
|
async function loadEnv(context, options) {
|
|
118
75
|
const [project, workspace, config] = await Promise.all([
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
76
|
+
loadEnvDirectory(options, context.config.root, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
|
|
77
|
+
loadEnvDirectory(options, context.workspaceConfig.workspaceRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
|
|
78
|
+
loadEnvDirectory(options, context.envPaths.config, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)
|
|
122
79
|
]);
|
|
123
80
|
return (0, defu.default)(loadEnvFromContext(context, process.env), project, workspace, config);
|
|
124
81
|
}
|
|
125
|
-
loadEnv.__type = [
|
|
126
|
-
() => require_types_plugin.__ΩEnvPluginContext,
|
|
127
|
-
"context",
|
|
128
|
-
() => require_types_plugin.__ΩEnvPluginOptions,
|
|
129
|
-
"options",
|
|
130
|
-
"loadEnv",
|
|
131
|
-
"Pn!2\"n#2$\"`/%"
|
|
132
|
-
];
|
|
133
82
|
|
|
134
83
|
//#endregion
|
|
135
84
|
exports.loadEnv = loadEnv;
|
package/dist/helpers/load.mjs
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { __ΩEnvPluginContext, __ΩEnvPluginOptions } from "../types/plugin.mjs";
|
|
2
1
|
import { removeEnvPrefix } from "./source-file-env.mjs";
|
|
3
2
|
import { loadConfig } from "../node_modules/.pnpm/c12@3.3.3_magicast@0.5.2/node_modules/c12/dist/index.mjs";
|
|
4
|
-
import { __ΩWorkspaceConfig } from "powerlines";
|
|
5
3
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
6
4
|
import { loadEnv as loadEnv$1, loadEnvFile } from "@stryke/env/load-env";
|
|
7
5
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
@@ -10,32 +8,16 @@ import defu from "defu";
|
|
|
10
8
|
import { DEFAULT_ENVIRONMENT } from "powerlines/utils";
|
|
11
9
|
|
|
12
10
|
//#region src/helpers/load.ts
|
|
13
|
-
function __assignType(fn, args) {
|
|
14
|
-
fn.__type = args;
|
|
15
|
-
return fn;
|
|
16
|
-
}
|
|
17
11
|
async function loadEnvFiles(options, mode, cwd) {
|
|
18
12
|
let env = await loadEnv$1(cwd, mode);
|
|
19
13
|
if (options.additionalFiles && options.additionalFiles?.length > 0) {
|
|
20
|
-
const additionalEnvFiles = await Promise.all(options.additionalFiles.map(
|
|
21
|
-
"additionalEnvFile",
|
|
22
|
-
"",
|
|
23
|
-
"P\"2!\"/\""
|
|
24
|
-
])));
|
|
14
|
+
const additionalEnvFiles = await Promise.all(options.additionalFiles.map(async (additionalEnvFile) => loadEnvFile(additionalEnvFile, cwd)));
|
|
25
15
|
for (const additionalEnvFile of additionalEnvFiles) env = defu(additionalEnvFile, env);
|
|
26
16
|
}
|
|
27
17
|
return removeEnvPrefix(env);
|
|
28
18
|
}
|
|
29
|
-
loadEnvFiles.__type = [
|
|
30
|
-
() => __ΩEnvPluginOptions,
|
|
31
|
-
"options",
|
|
32
|
-
"mode",
|
|
33
|
-
"cwd",
|
|
34
|
-
"loadEnvFiles",
|
|
35
|
-
"Pn!2\"&2#&2$\"`/%"
|
|
36
|
-
];
|
|
37
19
|
async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson, workspaceConfig) {
|
|
38
|
-
const [envResult, c12Result] = await Promise.all([
|
|
20
|
+
const [envResult, c12Result] = await Promise.all([loadEnvFiles(options, mode, directory), loadConfig({
|
|
39
21
|
cwd: directory,
|
|
40
22
|
name: "storm",
|
|
41
23
|
envName: mode,
|
|
@@ -54,18 +36,6 @@ async function loadEnvDirectory(options, directory, mode, cacheDir, packageJson,
|
|
|
54
36
|
})]);
|
|
55
37
|
return defu(envResult, c12Result.config, workspaceConfig);
|
|
56
38
|
}
|
|
57
|
-
loadEnvDirectory.__type = [
|
|
58
|
-
() => __ΩEnvPluginOptions,
|
|
59
|
-
"options",
|
|
60
|
-
"directory",
|
|
61
|
-
"mode",
|
|
62
|
-
"cacheDir",
|
|
63
|
-
"packageJson",
|
|
64
|
-
() => __ΩWorkspaceConfig,
|
|
65
|
-
"workspaceConfig",
|
|
66
|
-
"loadEnvDirectory",
|
|
67
|
-
"Pn!2\"&2#&2$&2%!2&n'2(\"`/)"
|
|
68
|
-
];
|
|
69
39
|
/**
|
|
70
40
|
* Retrieves various dotenv configuration parameters from the context.
|
|
71
41
|
*
|
|
@@ -93,40 +63,19 @@ function loadEnvFromContext(context, parsed) {
|
|
|
93
63
|
DEBUG: context.config.mode === "development",
|
|
94
64
|
STACKTRACE: context.config.mode !== "production",
|
|
95
65
|
ENVIRONMENT: !context.environment.name || context.environment.name === DEFAULT_ENVIRONMENT ? context.config.mode : context.environment.name
|
|
96
|
-
}, isSetObject(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce(
|
|
66
|
+
}, isSetObject(context?.env?.types?.env) ? context.env.types.env?.getProperties().reduce((ret, prop) => {
|
|
97
67
|
ret[prop.name] = parsed[prop.name] ?? prop.getDefaultValue();
|
|
98
68
|
return ret;
|
|
99
|
-
},
|
|
100
|
-
"ret",
|
|
101
|
-
"prop",
|
|
102
|
-
"",
|
|
103
|
-
"P\"2!\"2\"\"/#"
|
|
104
|
-
]), {}) : {});
|
|
69
|
+
}, {}) : {});
|
|
105
70
|
}
|
|
106
|
-
loadEnvFromContext.__type = [
|
|
107
|
-
() => __ΩEnvPluginContext,
|
|
108
|
-
"context",
|
|
109
|
-
"parsed",
|
|
110
|
-
"loadEnvFromContext",
|
|
111
|
-
"Retrieves various dotenv configuration parameters from the context.",
|
|
112
|
-
"Pn!2\"!2#\"/$?%"
|
|
113
|
-
];
|
|
114
71
|
async function loadEnv(context, options) {
|
|
115
72
|
const [project, workspace, config] = await Promise.all([
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
73
|
+
loadEnvDirectory(options, context.config.root, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
|
|
74
|
+
loadEnvDirectory(options, context.workspaceConfig.workspaceRoot, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig),
|
|
75
|
+
loadEnvDirectory(options, context.envPaths.config, context.config.mode, context.cachePath, context.packageJson, context.workspaceConfig)
|
|
119
76
|
]);
|
|
120
77
|
return defu(loadEnvFromContext(context, process.env), project, workspace, config);
|
|
121
78
|
}
|
|
122
|
-
loadEnv.__type = [
|
|
123
|
-
() => __ΩEnvPluginContext,
|
|
124
|
-
"context",
|
|
125
|
-
() => __ΩEnvPluginOptions,
|
|
126
|
-
"options",
|
|
127
|
-
"loadEnv",
|
|
128
|
-
"Pn!2\"n#2$\"`/%"
|
|
129
|
-
];
|
|
130
79
|
|
|
131
80
|
//#endregion
|
|
132
81
|
export { loadEnv, loadEnvFromContext };
|