@powerlines/plugin-env 0.15.158 → 0.15.160
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/{automd-generator-DoKLIMuw.mjs → automd-generator-BpvZRK0k.mjs} +2 -2
- package/dist/{automd-generator-DoKLIMuw.mjs.map → automd-generator-BpvZRK0k.mjs.map} +1 -1
- package/dist/{automd-generator-BNg74tyV.cjs → automd-generator-CxG1owAE.cjs} +1 -1
- package/dist/components/docs.cjs +3 -3
- package/dist/components/docs.mjs +3 -3
- package/dist/components/env.cjs +3 -3
- package/dist/components/env.mjs +3 -3
- package/dist/components/index.cjs +5 -5
- package/dist/components/index.mjs +5 -5
- package/dist/{docs-ClXTdyjQ.cjs → docs-E0aCTO7H.cjs} +2 -2
- package/dist/{docs-B4Bd2HuK.mjs → docs-WdCIcQmw.mjs} +3 -3
- package/dist/{docs-B4Bd2HuK.mjs.map → docs-WdCIcQmw.mjs.map} +1 -1
- package/dist/{docs-helper-2fe7M3Th.mjs → docs-helper-BSYSI2cH.mjs} +2 -2
- package/dist/{docs-helper-2fe7M3Th.mjs.map → docs-helper-BSYSI2cH.mjs.map} +1 -1
- package/dist/{docs-helper-4MoQ5-R3.cjs → docs-helper-BWe1dt1m.cjs} +1 -1
- package/dist/{env-iQh74nl2.cjs → env-BSCEigpj.cjs} +1 -1
- package/dist/{env-z7LbFLP0.mjs → env-DqI7dwC-.mjs} +2 -2
- package/dist/{env-z7LbFLP0.mjs.map → env-DqI7dwC-.mjs.map} +1 -1
- package/dist/helpers/automd-generator.cjs +2 -2
- package/dist/helpers/automd-generator.mjs +2 -2
- package/dist/helpers/docs-helper.cjs +2 -2
- package/dist/helpers/docs-helper.mjs +2 -2
- package/dist/helpers/index.cjs +4 -4
- package/dist/helpers/index.mjs +4 -4
- package/dist/helpers/load.cjs +2 -2
- package/dist/helpers/load.mjs +2 -2
- package/dist/helpers/persistence.cjs +2 -2
- package/dist/helpers/persistence.mjs +2 -2
- package/dist/helpers/reflect.cjs +2 -2
- package/dist/helpers/reflect.mjs +2 -2
- package/dist/helpers/template-helpers.cjs +3 -3
- package/dist/helpers/template-helpers.mjs +3 -3
- package/dist/index-Bdi8CvaN.d.cts.map +1 -1
- package/dist/index-Drhzdkqe.d.mts.map +1 -1
- package/dist/index.cjs +25 -36
- package/dist/index.mjs +25 -36
- package/dist/index.mjs.map +1 -1
- package/dist/{join-paths-Bc4rM2TX.cjs → join-paths-B0RBTuuw.cjs} +30 -15
- package/dist/{join-paths-BMg51Ddi.mjs → join-paths-Dd9KxuyL.mjs} +31 -16
- package/dist/join-paths-Dd9KxuyL.mjs.map +1 -0
- package/dist/{load-DPB0maqs.cjs → load-CC_Pu2Om.cjs} +1 -1
- package/dist/{load-Dr5ybfL7.mjs → load-EM4edkA2.mjs} +2 -2
- package/dist/{load-Dr5ybfL7.mjs.map → load-EM4edkA2.mjs.map} +1 -1
- package/dist/{persistence-BsBxs9wt.mjs → persistence-5S3EirDm.mjs} +3 -3
- package/dist/{persistence-BsBxs9wt.mjs.map → persistence-5S3EirDm.mjs.map} +1 -1
- package/dist/{persistence-D_clXRxP.cjs → persistence-DzS7SzMj.cjs} +2 -2
- package/dist/{template-helpers-CCEjhw1B.mjs → template-helpers-Cw8aba1r.mjs} +2 -2
- package/dist/{template-helpers-CCEjhw1B.mjs.map → template-helpers-Cw8aba1r.mjs.map} +1 -1
- package/dist/{template-helpers-YVcwxmoF.cjs → template-helpers-DoFoTIAC.cjs} +1 -1
- package/package.json +16 -16
- package/dist/join-paths-BMg51Ddi.mjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { n as __ΩSecretsInterface, t as __ΩEnvInterface } from "./runtime-C5ukCv3P.mjs";
|
|
2
2
|
import { a as __ΩEnvType, r as __ΩEnvPluginResolvedConfig, t as __ΩEnvPluginContext } from "./plugin-eBjQJP6x.mjs";
|
|
3
|
-
import { n as slash, t as joinPaths } from "./join-paths-
|
|
3
|
+
import { n as slash, t as joinPaths } from "./join-paths-Dd9KxuyL.mjs";
|
|
4
4
|
import { ReflectionClass, ReflectionKind, __ΩTypeClass, __ΩTypeObjectLiteral, deserializeType, merge, resolveClassType } from "@powerlines/deepkit/vendor/type";
|
|
5
5
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
6
6
|
import { __ΩContext, __ΩUnresolvedContext } from "powerlines/types/context";
|
|
@@ -13,7 +13,7 @@ import { isEmptyObject } from "@stryke/type-checks/is-empty-object";
|
|
|
13
13
|
import { existsSync } from "node:fs";
|
|
14
14
|
import { reflectType } from "@powerlines/deepkit/reflect-type";
|
|
15
15
|
|
|
16
|
-
//#region ../../node_modules/.pnpm/@stryke+path@0.26.
|
|
16
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.26.4/node_modules/@stryke/path/dist/is-parent-path.mjs
|
|
17
17
|
/**
|
|
18
18
|
* Check if a given path is a parent of another path.
|
|
19
19
|
*
|
|
@@ -583,4 +583,4 @@ writeEnvReflectionSync.__type = [
|
|
|
583
583
|
|
|
584
584
|
//#endregion
|
|
585
585
|
export { mergeEnvReflections as _, readEnvReflection as a, reflectSecrets as b, resolveRuntimeTypeFile as c, writeEnvTypeReflection as d, BaseEnv as f, createSecretsReflection as g, createEnvReflection as h, getSecretsDefaultTypeDefinition as i, writeEnvReflection as l, __ΩCreateEnvReflectionOptions as m, getEnvReflectionsPath as n, readEnvTypeReflection as o, BaseSecrets as p, getEnvTypeReflectionsPath as r, readSecretsReflection as s, getEnvDefaultTypeDefinition as t, writeEnvReflectionSync as u, mergeSecretsReflections as v, isParentPath as x, reflectEnv as y };
|
|
586
|
-
//# sourceMappingURL=persistence-
|
|
586
|
+
//# sourceMappingURL=persistence-5S3EirDm.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"persistence-BsBxs9wt.mjs","names":[],"sources":["../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-parent-path.mjs","../src/helpers/reflect.ts","../src/helpers/persistence.ts"],"sourcesContent":["import { slash } from \"./slash.mjs\";\n\n//#region src/is-parent-path.ts\n/**\n* Check if a given path is a parent of another path.\n*\n* @example\n* ```ts\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src\");\n* // returns true\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n* // returns true\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/other\");\n* // returns false\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/other\");\n* // returns false\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/index.ts\");\n* // returns false\n* ```\n*\n* @param childPath - The path to check if it is a child of the parent path.\n* @param parentPath - The path to check if it is a parent of the child path.\n* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.\n*/\nfunction isParentPath(childPath, parentPath) {\n\tconst normalizedChild = slash(childPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\"))?.toLowerCase();\n\tconst normalizedParent = slash(parentPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\"))?.toLowerCase();\n\treturn childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);\n}\n\n//#endregion\nexport { isParentPath };\n//# sourceMappingURL=is-parent-path.mjs.map","/* -------------------------------------------------------------------\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\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 const defaultConfigType = await reflectType(\n context,\n await getEnvDefaultTypeDefinition(context)\n );\n\n const reflection = await readEnvTypeReflection(context, \"env\");\n\n // const defaultConfig = resolveClassType(defaultConfigType);\n // if (config) {\n // defaultConfig.getProperties().forEach(prop => {\n // if (!config!.hasProperty(prop.getName())) {\n // config!.addProperty(prop.property);\n // }\n // });\n // } else {\n // config = defaultConfig;\n // }\n\n return mergeEnvReflections(\n context,\n [reflection, config, resolveClassType(defaultConfigType)].filter(\n Boolean\n ) as ReflectionClass<any>[]\n );\n}\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 const defaultSecretsType = await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n );\n\n const reflection = await readSecretsReflection(context);\n\n // const defaultConfig = resolveClassType(defaultConfigType);\n // if (config) {\n // defaultConfig.getProperties().forEach(prop => {\n // if (!config!.hasProperty(prop.getName())) {\n // config!.addProperty(prop.property);\n // }\n // });\n // } else {\n // config = defaultConfig;\n // }\n\n return mergeSecretsReflections(\n context,\n [reflection, config, resolveClassType(defaultSecretsType)].filter(\n Boolean\n ) as ReflectionClass<any>[]\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { 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/types/context\";\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"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,aAAa,WAAW,YAAY;CAC5C,MAAM,kBAAkB,MAAM,UAAU,WAAW,OAAO,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAC,EAAE,aAAa;CAClG,MAAM,mBAAmB,MAAM,WAAW,WAAW,OAAO,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAC,EAAE,aAAa;AACpG,QAAO,cAAc,cAAc,oBAAoB,oBAAoB,gBAAgB,WAAW,GAAG,iBAAiB,GAAG;;;;;ACjB9H,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,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AA;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"}
|
|
1
|
+
{"version":3,"file":"persistence-5S3EirDm.mjs","names":[],"sources":["../../../node_modules/.pnpm/@stryke+path@0.26.4/node_modules/@stryke/path/dist/is-parent-path.mjs","../src/helpers/reflect.ts","../src/helpers/persistence.ts"],"sourcesContent":["import { slash } from \"./slash.mjs\";\n\n//#region src/is-parent-path.ts\n/**\n* Check if a given path is a parent of another path.\n*\n* @example\n* ```ts\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src\");\n* // returns true\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project\");\n* // returns true\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/other\");\n* // returns false\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/other\");\n* // returns false\n* isParentPath(\"/home/user/project/src/index.ts\", \"/home/user/project/src/index.ts\");\n* // returns false\n* ```\n*\n* @param childPath - The path to check if it is a child of the parent path.\n* @param parentPath - The path to check if it is a parent of the child path.\n* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.\n*/\nfunction isParentPath(childPath, parentPath) {\n\tconst normalizedChild = slash(childPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\"))?.toLowerCase();\n\tconst normalizedParent = slash(parentPath.replaceAll(/\\\\/g, \"/\").replace(/\\/*$/, \"\"))?.toLowerCase();\n\treturn childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);\n}\n\n//#endregion\nexport { isParentPath };\n//# sourceMappingURL=is-parent-path.mjs.map","/* -------------------------------------------------------------------\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\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 const defaultConfigType = await reflectType(\n context,\n await getEnvDefaultTypeDefinition(context)\n );\n\n const reflection = await readEnvTypeReflection(context, \"env\");\n\n // const defaultConfig = resolveClassType(defaultConfigType);\n // if (config) {\n // defaultConfig.getProperties().forEach(prop => {\n // if (!config!.hasProperty(prop.getName())) {\n // config!.addProperty(prop.property);\n // }\n // });\n // } else {\n // config = defaultConfig;\n // }\n\n return mergeEnvReflections(\n context,\n [reflection, config, resolveClassType(defaultConfigType)].filter(\n Boolean\n ) as ReflectionClass<any>[]\n );\n}\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 const defaultSecretsType = await reflectType(\n context,\n await getSecretsDefaultTypeDefinition(context)\n );\n\n const reflection = await readSecretsReflection(context);\n\n // const defaultConfig = resolveClassType(defaultConfigType);\n // if (config) {\n // defaultConfig.getProperties().forEach(prop => {\n // if (!config!.hasProperty(prop.getName())) {\n // config!.addProperty(prop.property);\n // }\n // });\n // } else {\n // config = defaultConfig;\n // }\n\n return mergeSecretsReflections(\n context,\n [reflection, config, resolveClassType(defaultSecretsType)].filter(\n Boolean\n ) as ReflectionClass<any>[]\n );\n}\n","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { 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/types/context\";\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"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,SAAS,aAAa,WAAW,YAAY;CAC5C,MAAM,kBAAkB,MAAM,UAAU,WAAW,OAAO,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAC,EAAE,aAAa;CAClG,MAAM,mBAAmB,MAAM,WAAW,WAAW,OAAO,IAAI,CAAC,QAAQ,QAAQ,GAAG,CAAC,EAAE,aAAa;AACpG,QAAO,cAAc,cAAc,oBAAoB,oBAAoB,gBAAgB,WAAW,GAAG,iBAAiB,GAAG;;;;;ACjB9H,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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,SAAC,QAAA,IAAA,KAAA;;CAEL,MAAM,SAAS,MAAG,eAAA,SAAA;qBACF,IAAI,MAAK,QAAA,QAAA,MAAA;CAEzB,MAAM,aAAa,iBAAiB,gBAAC,iBAAA,YAAA,MAAA,CAAA,CAAA;AACrC,SAAQ,IAAI,KAAK,UAAU;AAC3B,SAAQ,IAAI,KAAK,QAAQ,cAAc;;AAEvC,QAAO;;AAEX,sBAAI,SAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;;;CASA,MAAM,aAAa,WAAW,eAAG;CACjC,MAAM,UAAU,IAAI,MAAM,SAAS;4BACpC,QAAA,SAAA,gBAAA;AAEC,OAAM,gBAAgB,sBAAS,SAAA,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"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CNVrAnJR.cjs');
|
|
2
2
|
const require_runtime = require('./runtime-g0TEIoZK.cjs');
|
|
3
3
|
const require_plugin = require('./plugin-CM1TSv1B.cjs');
|
|
4
|
-
const require_join_paths = require('./join-paths-
|
|
4
|
+
const require_join_paths = require('./join-paths-B0RBTuuw.cjs');
|
|
5
5
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
6
6
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
7
7
|
let powerlines_types_context = require("powerlines/types/context");
|
|
@@ -15,7 +15,7 @@ let __stryke_type_checks_is_empty_object = require("@stryke/type-checks/is-empty
|
|
|
15
15
|
let node_fs = require("node:fs");
|
|
16
16
|
let __powerlines_deepkit_reflect_type = require("@powerlines/deepkit/reflect-type");
|
|
17
17
|
|
|
18
|
-
//#region ../../node_modules/.pnpm/@stryke+path@0.26.
|
|
18
|
+
//#region ../../node_modules/.pnpm/@stryke+path@0.26.4/node_modules/@stryke/path/dist/is-parent-path.mjs
|
|
19
19
|
/**
|
|
20
20
|
* Check if a given path is a parent of another path.
|
|
21
21
|
*
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as __ΩEnvType, t as __ΩEnvPluginContext } from "./plugin-eBjQJP6x.mjs";
|
|
2
|
-
import { o as readEnvTypeReflection } from "./persistence-
|
|
2
|
+
import { o as readEnvTypeReflection } from "./persistence-5S3EirDm.mjs";
|
|
3
3
|
import { ReflectionClass } from "@powerlines/deepkit/vendor/type";
|
|
4
4
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
5
5
|
|
|
@@ -67,4 +67,4 @@ createTemplateReflection.__type = [
|
|
|
67
67
|
|
|
68
68
|
//#endregion
|
|
69
69
|
export { createTemplateReflection as t };
|
|
70
|
-
//# sourceMappingURL=template-helpers-
|
|
70
|
+
//# sourceMappingURL=template-helpers-Cw8aba1r.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-helpers-
|
|
1
|
+
{"version":3,"file":"template-helpers-Cw8aba1r.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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CNVrAnJR.cjs');
|
|
2
2
|
const require_plugin = require('./plugin-CM1TSv1B.cjs');
|
|
3
|
-
const require_persistence = require('./persistence-
|
|
3
|
+
const require_persistence = require('./persistence-DzS7SzMj.cjs');
|
|
4
4
|
let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type");
|
|
5
5
|
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
6
6
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-env",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.160",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
|
|
6
6
|
"repository": {
|
|
@@ -305,28 +305,28 @@
|
|
|
305
305
|
"@alloy-js/typescript": "^0.22.0",
|
|
306
306
|
"@babel/core": "^7.28.6",
|
|
307
307
|
"@babel/types": "^7.28.6",
|
|
308
|
-
"@powerlines/plugin-alloy": "^0.19.
|
|
309
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
310
|
-
"@powerlines/plugin-babel": "^0.12.
|
|
311
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
308
|
+
"@powerlines/plugin-alloy": "^0.19.32",
|
|
309
|
+
"@powerlines/plugin-automd": "^0.1.253",
|
|
310
|
+
"@powerlines/plugin-babel": "^0.12.262",
|
|
311
|
+
"@powerlines/plugin-plugin": "^0.12.204",
|
|
312
312
|
"@storm-software/config-tools": "^1.189.0",
|
|
313
|
-
"@stryke/capnp": "^0.12.
|
|
314
|
-
"@stryke/env": "^0.20.
|
|
315
|
-
"@stryke/fs": "^0.33.
|
|
316
|
-
"@stryke/json": "^0.9.
|
|
317
|
-
"@stryke/string-format": "^0.13.
|
|
318
|
-
"@stryke/type-checks": "^0.5.
|
|
319
|
-
"@stryke/types": "^0.10.
|
|
313
|
+
"@stryke/capnp": "^0.12.65",
|
|
314
|
+
"@stryke/env": "^0.20.57",
|
|
315
|
+
"@stryke/fs": "^0.33.40",
|
|
316
|
+
"@stryke/json": "^0.9.41",
|
|
317
|
+
"@stryke/string-format": "^0.13.7",
|
|
318
|
+
"@stryke/type-checks": "^0.5.23",
|
|
319
|
+
"@stryke/types": "^0.10.37",
|
|
320
320
|
"automd": "^0.4.3",
|
|
321
|
-
"powerlines": "^0.38.
|
|
321
|
+
"powerlines": "^0.38.20"
|
|
322
322
|
},
|
|
323
323
|
"devDependencies": {
|
|
324
|
-
"@powerlines/deepkit": "^0.6.
|
|
325
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
324
|
+
"@powerlines/deepkit": "^0.6.33",
|
|
325
|
+
"@powerlines/plugin-deepkit": "^0.11.132",
|
|
326
326
|
"@types/node": "^24.10.9",
|
|
327
327
|
"vite": "8.0.0-beta.2"
|
|
328
328
|
},
|
|
329
329
|
"publishConfig": { "access": "public" },
|
|
330
330
|
"types": "./dist/index.d.cts",
|
|
331
|
-
"gitHead": "
|
|
331
|
+
"gitHead": "e049a581a8652a74e908a98ae4e5309c1c41c02f"
|
|
332
332
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"join-paths-BMg51Ddi.mjs","names":[],"sources":["../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/regex.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/slash.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-type.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/join-paths.mjs"],"sourcesContent":["//#region src/regex.ts\nconst DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nconst DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\nconst UNC_REGEX = /^[/\\\\]{2}/;\nconst ABSOLUTE_PATH_REGEX = /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\nconst ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\nconst FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\nconst FULL_FILE_EXTENSION_REGEX = /(\\.d)?\\.[0-9a-z]+(\\.map)?$/i;\nconst PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nconst NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\n\n//#endregion\nexport { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FULL_FILE_EXTENSION_REGEX, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX };\n//# sourceMappingURL=regex.mjs.map","import { isAbsolutePath } from \"./is-type.mjs\";\n\n//#region src/slash.ts\n/**\n* Replace backslash to slash\n*\n* @param path - The string to replace\n* @returns The string with replaced backslashes\n*/\nfunction slash(path) {\n\tif (path.startsWith(\"\\\\\\\\?\\\\\")) return path;\n\treturn path.replace(/\\\\/g, \"/\");\n}\n/**\n* Replace backslash to slash and remove unneeded leading and trailing slashes\n*\n* @param path - The string to replace\n* @returns The string with replaced backslashes\n*/\nfunction formatSlash(path) {\n\tconst formatted = slash(path);\n\treturn isAbsolutePath(formatted) ? formatted.replace(/\\/+$/g, \"\") : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\n}\n\n//#endregion\nexport { formatSlash, slash };\n//# sourceMappingURL=slash.mjs.map","import { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex.mjs\";\nimport { slash } from \"./slash.mjs\";\n\n//#region src/is-type.ts\n/**\n* Check if the path is an absolute path.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is an absolute path\n*/\nfunction isAbsolutePath(path) {\n\treturn ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n/**\n* Check if the path is an absolute path.\n*\n* @remarks\n* This is an alias for {@link isAbsolutePath}.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is an absolute path\n*/\nfunction isAbsolute(path) {\n\treturn isAbsolutePath(path);\n}\n/**\n* Check if the path is a relative path.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a relative path\n*/\nfunction isRelativePath(path) {\n\treturn !isAbsolutePath(path);\n}\n/**\n* Check if the path is a relative path.\n*\n* @remarks\n* This is an alias for {@link isRelativePath}.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a relative path\n*/\nfunction isRelative(path) {\n\treturn isRelativePath(path);\n}\n/**\n* Check if the path is a npm package path.\n*\n* @remarks\n* This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n*\n* @example\n* ```ts\n* isNpmScopedPackage(\"@stryke/path\"); // returns true\n* isNpmScopedPackage(\"lodash\"); // returns false\n* isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n* ```\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a npm package path\n*/\nfunction isNpmScopedPackagePath(path) {\n\treturn NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n/**\n* Check if the path is a npm package path.\n*\n* @remarks\n* This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n*\n* @example\n* ```ts\n* isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n* isNpmScopedPackagePath(\"lodash\"); // returns false\n* isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n* ```\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a npm package path\n*/\nfunction isNpmScopedPackage(path) {\n\treturn isNpmScopedPackagePath(path);\n}\n\n//#endregion\nexport { isAbsolute, isAbsolutePath, isNpmScopedPackage, isNpmScopedPackagePath, isRelative, isRelativePath };\n//# sourceMappingURL=is-type.mjs.map","import { DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX } from \"./regex.mjs\";\nimport { isAbsolute } from \"./is-type.mjs\";\n\n//#region src/join-paths.ts\nfunction normalizeWindowsPath(input = \"\") {\n\tif (!input) return input;\n\treturn input.replace(/\\\\/g, \"/\").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());\n}\nfunction correctPaths(path) {\n\tif (!path || path.length === 0) return \".\";\n\tpath = normalizeWindowsPath(path);\n\tconst isUNCPath = path.match(UNC_REGEX);\n\tconst isPathAbsolute = isAbsolute(path);\n\tconst trailingSeparator = path[path.length - 1] === \"/\";\n\tpath = normalizeString(path, !isPathAbsolute);\n\tif (path.length === 0) {\n\t\tif (isPathAbsolute) return \"/\";\n\t\treturn trailingSeparator ? \"./\" : \".\";\n\t}\n\tif (trailingSeparator) path += \"/\";\n\tif (DRIVE_LETTER_REGEX.test(path)) path += \"/\";\n\tif (isUNCPath) {\n\t\tif (!isPathAbsolute) return `//./${path}`;\n\t\treturn `//${path}`;\n\t}\n\treturn isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n/**\n* Joins all given path segments together using the platform-specific separator as a delimiter.\n* The resulting path is normalized to remove any redundant or unnecessary segments.\n*\n* @param segments - The path segments to join.\n* @returns The joined and normalized path string.\n*/\nfunction joinPaths(...segments) {\n\tlet path = \"\";\n\tfor (const seg of segments) {\n\t\tif (!seg) continue;\n\t\tif (path.length > 0) {\n\t\t\tconst pathTrailing = path[path.length - 1] === \"/\";\n\t\t\tconst segLeading = seg[0] === \"/\";\n\t\t\tif (pathTrailing && segLeading) path += seg.slice(1);\n\t\t\telse path += pathTrailing || segLeading ? seg : `/${seg}`;\n\t\t} else path += seg;\n\t}\n\treturn correctPaths(path);\n}\nconst join = joinPaths;\n/**\n* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n*\n* @param path - The path to normalize.\n* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n* @returns the normalized path string.\n*/\nfunction normalizeString(path, allowAboveRoot) {\n\tlet res = \"\";\n\tlet lastSegmentLength = 0;\n\tlet lastSlash = -1;\n\tlet dots = 0;\n\tlet char = null;\n\tfor (let index = 0; index <= path.length; ++index) {\n\t\tif (index < path.length) char = path[index];\n\t\telse if (char === \"/\") break;\n\t\telse char = \"/\";\n\t\tif (char === \"/\") {\n\t\t\tif (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {\n\t\t\t\tif (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== \".\" || res[res.length - 2] !== \".\") {\n\t\t\t\t\tif (res.length > 2) {\n\t\t\t\t\t\tconst lastSlashIndex = res.lastIndexOf(\"/\");\n\t\t\t\t\t\tif (lastSlashIndex === -1) {\n\t\t\t\t\t\t\tres = \"\";\n\t\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tres = res.slice(0, lastSlashIndex);\n\t\t\t\t\t\t\tlastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastSlash = index;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (res.length > 0) {\n\t\t\t\t\t\tres = \"\";\n\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\tlastSlash = index;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (allowAboveRoot) {\n\t\t\t\t\tres += res.length > 0 ? \"/..\" : \"..\";\n\t\t\t\t\tlastSegmentLength = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;\n\t\t\t\telse res = path.slice(lastSlash + 1, index);\n\t\t\t\tlastSegmentLength = index - lastSlash - 1;\n\t\t\t}\n\t\t\tlastSlash = index;\n\t\t\tdots = 0;\n\t\t} else if (char === \".\" && dots !== -1) ++dots;\n\t\telse dots = -1;\n\t}\n\treturn res;\n}\n\n//#endregion\nexport { join, joinPaths };\n//# sourceMappingURL=join-paths.mjs.map"],"x_google_ignoreList":[0,1,2,3],"mappings":";AACA,MAAM,2BAA2B;AACjC,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AAClB,MAAM,sBAAsB;;;;;;;;;;ACK5B,SAAS,MAAM,MAAM;AACpB,KAAI,KAAK,WAAW,UAAU,CAAE,QAAO;AACvC,QAAO,KAAK,QAAQ,OAAO,IAAI;;;;;;;;;;;ACDhC,SAAS,eAAe,MAAM;AAC7B,QAAO,oBAAoB,KAAK,MAAM,KAAK,CAAC;;;;;;;;;;;AAW7C,SAAS,WAAW,MAAM;AACzB,QAAO,eAAe,KAAK;;;;;ACnB5B,SAAS,qBAAqB,QAAQ,IAAI;AACzC,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,MAAM,QAAQ,OAAO,IAAI,CAAC,QAAQ,2BAA2B,MAAM,EAAE,aAAa,CAAC;;AAE3F,SAAS,aAAa,MAAM;AAC3B,KAAI,CAAC,QAAQ,KAAK,WAAW,EAAG,QAAO;A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