@adonisjs/env 6.2.0 → 7.0.0-next.0

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.
@@ -5,12 +5,12 @@ var __export = (target, all) => {
5
5
  };
6
6
 
7
7
  // src/loader.ts
8
- import { fileURLToPath } from "node:url";
9
- import { readFile } from "node:fs/promises";
10
- import { isAbsolute, join } from "node:path";
8
+ import { fileURLToPath } from "url";
9
+ import { readFile } from "fs/promises";
10
+ import { isAbsolute, join } from "path";
11
11
 
12
12
  // src/debug.ts
13
- import { debuglog } from "node:util";
13
+ import { debuglog } from "util";
14
14
  var debug_default = debuglog("adonisjs:env");
15
15
 
16
16
  // src/loader.ts
@@ -93,4 +93,3 @@ export {
93
93
  debug_default,
94
94
  EnvLoader
95
95
  };
96
- //# sourceMappingURL=chunk-VIQ26ZGM.js.map
package/build/index.js CHANGED
@@ -2,7 +2,7 @@ import {
2
2
  EnvLoader,
3
3
  __export,
4
4
  debug_default
5
- } from "./chunk-VIQ26ZGM.js";
5
+ } from "./chunk-EIJZNYI6.js";
6
6
 
7
7
  // src/env.ts
8
8
  import { schema as envSchema } from "@poppinss/validator-lite";
@@ -16,7 +16,7 @@ __export(errors_exports, {
16
16
  E_IDENTIFIER_ALREADY_DEFINED: () => E_IDENTIFIER_ALREADY_DEFINED,
17
17
  E_INVALID_ENV_VARIABLES: () => E_INVALID_ENV_VARIABLES
18
18
  });
19
- import { createError, Exception } from "@poppinss/utils";
19
+ import { createError, Exception } from "@poppinss/utils/exception";
20
20
  var E_INVALID_ENV_VARIABLES = class EnvValidationException extends Exception {
21
21
  static message = "Validation failed for one or more environment variables";
22
22
  static code = "E_INVALID_ENV_VARIABLES";
@@ -343,4 +343,3 @@ export {
343
343
  EnvProcessor,
344
344
  errors_exports as errors
345
345
  };
346
- //# sourceMappingURL=index.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  EnvLoader
3
- } from "../chunk-VIQ26ZGM.js";
3
+ } from "../chunk-EIJZNYI6.js";
4
4
 
5
5
  // src/editor.ts
6
6
  import splitLines from "split-lines";
7
7
  import lodash from "@poppinss/utils/lodash";
8
- import { writeFile } from "node:fs/promises";
8
+ import { writeFile } from "fs/promises";
9
9
  var EnvEditor = class _EnvEditor {
10
10
  #appRoot;
11
11
  #loader;
@@ -71,4 +71,3 @@ var EnvEditor = class _EnvEditor {
71
71
  export {
72
72
  EnvEditor
73
73
  };
74
- //# sourceMappingURL=editor.js.map
@@ -1,4 +1,4 @@
1
- import { Exception } from '@poppinss/utils';
1
+ import { Exception } from '@poppinss/utils/exception';
2
2
  /**
3
3
  * Exception raised when one or more env variables
4
4
  * are invalid
@@ -13,7 +13,7 @@ export declare const E_INVALID_ENV_VARIABLES: {
13
13
  code?: string;
14
14
  status: number;
15
15
  toString(): string;
16
- readonly [Symbol.toStringTag]: string;
16
+ get [Symbol.toStringTag](): string;
17
17
  message: string;
18
18
  stack?: string;
19
19
  cause?: unknown;
@@ -22,8 +22,9 @@ export declare const E_INVALID_ENV_VARIABLES: {
22
22
  code: string;
23
23
  help?: string;
24
24
  status?: number;
25
+ isError(error: unknown): error is Error;
25
26
  captureStackTrace(targetObject: object, constructorOpt?: Function): void;
26
- prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined;
27
+ prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): any;
27
28
  stackTraceLimit: number;
28
29
  };
29
30
  export declare const E_IDENTIFIER_ALREADY_DEFINED: new (args: [string], options?: ErrorOptions) => Exception;
@@ -1,4 +1,4 @@
1
- import { DotenvParseOutput } from 'dotenv';
1
+ import { type DotenvParseOutput } from 'dotenv';
2
2
  /**
3
3
  * Env parser parses the environment variables from a string formatted
4
4
  * as a key-value pair seperated using an `=`. For example:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adonisjs/env",
3
- "version": "6.2.0",
3
+ "version": "7.0.0-next.0",
4
4
  "description": "Environment variable manager for Node.js",
5
5
  "main": "build/index.js",
6
6
  "type": "module",
@@ -15,63 +15,50 @@
15
15
  "./editor": "./build/src/editor.js"
16
16
  },
17
17
  "engines": {
18
- "node": ">=18.16.0"
18
+ "node": ">=24.0.0"
19
19
  },
20
20
  "scripts": {
21
21
  "pretest": "npm run lint",
22
22
  "test": "cross-env NODE_DEBUG=adonisjs:env c8 npm run quick:test",
23
- "clean": "del-cli build",
23
+ "lint": "eslint .",
24
+ "format": "prettier --write .",
24
25
  "typecheck": "tsc --noEmit",
25
26
  "precompile": "npm run lint && npm run clean",
27
+ "clean": "del-cli build",
26
28
  "compile": "tsup-node && tsc --emitDeclarationOnly --declaration",
27
29
  "build": "npm run compile",
28
30
  "release": "release-it",
29
31
  "version": "npm run build",
30
32
  "prepublishOnly": "npm run build",
31
- "lint": "eslint .",
32
- "format": "prettier --write .",
33
- "quick:test": "node --import=ts-node-maintained/register/esm bin/test.ts"
33
+ "quick:test": "node --import=@poppinss/ts-exec --enable-source-maps bin/test.ts"
34
34
  },
35
- "keywords": [
36
- "env",
37
- "adonisjs"
38
- ],
39
- "author": "Harminder Virk <virk@adonisjs.com>",
40
- "contributors": [
41
- "Romain Lanz <romain.lanz@pm.me>",
42
- "Julien Ripouteau <julien@ripouteau.com>"
43
- ],
44
- "license": "MIT",
45
35
  "devDependencies": {
46
- "@adonisjs/eslint-config": "^2.0.0",
47
- "@adonisjs/prettier-config": "^1.4.4",
48
- "@adonisjs/tsconfig": "^1.4.0",
49
- "@commitlint/cli": "^19.8.0",
50
- "@commitlint/config-conventional": "^19.8.0",
51
- "@japa/assert": "^4.0.1",
36
+ "@adonisjs/eslint-config": "^3.0.0-next.0",
37
+ "@adonisjs/prettier-config": "^1.4.5",
38
+ "@adonisjs/tsconfig": "^2.0.0-next.0",
39
+ "@japa/assert": "^4.1.1",
52
40
  "@japa/expect-type": "^2.0.3",
53
41
  "@japa/file-system": "^2.3.2",
54
- "@japa/runner": "^4.2.0",
55
- "@release-it/conventional-changelog": "^10.0.0",
56
- "@swc/core": "1.10.7",
57
- "@types/node": "^22.13.10",
42
+ "@japa/runner": "^4.3.0",
43
+ "@poppinss/ts-exec": "^1.4.0",
44
+ "@release-it/conventional-changelog": "^10.0.1",
45
+ "@types/node": "^24.1.0",
58
46
  "c8": "^10.1.3",
59
- "cross-env": "^7.0.3",
47
+ "cross-env": "^10.0.0",
60
48
  "del-cli": "^6.0.0",
61
- "eslint": "^9.22.0",
62
- "husky": "^9.1.7",
63
- "prettier": "^3.5.3",
64
- "release-it": "^18.1.2",
65
- "ts-node-maintained": "^10.9.5",
66
- "tsup": "^8.4.0",
67
- "typescript": "^5.8.2"
49
+ "eslint": "^9.32.0",
50
+ "prettier": "^3.6.2",
51
+ "release-it": "^19.0.4",
52
+ "tsup": "^8.5.0",
53
+ "typescript": "^5.8.3"
68
54
  },
69
55
  "dependencies": {
70
- "@poppinss/utils": "^6.9.2",
71
- "@poppinss/validator-lite": "^2.1.0",
72
- "dotenv": "^16.4.7",
56
+ "@poppinss/utils": "^7.0.0-next.3",
57
+ "@poppinss/validator-lite": "^2.1.2",
58
+ "dotenv": "^17.2.1",
73
59
  "split-lines": "^3.0.0"
74
60
  },
61
+ "homepage": "https://github.com/adonisjs/env#readme",
75
62
  "repository": {
76
63
  "type": "git",
77
64
  "url": "git+https://github.com/adonisjs/env.git"
@@ -79,15 +66,31 @@
79
66
  "bugs": {
80
67
  "url": "https://github.com/adonisjs/env/issues"
81
68
  },
82
- "homepage": "https://github.com/adonisjs/env#readme",
83
- "commitlint": {
84
- "extends": [
85
- "@commitlint/config-conventional"
86
- ]
87
- },
69
+ "keywords": [
70
+ "env",
71
+ "adonisjs"
72
+ ],
73
+ "author": "Harminder Virk <virk@adonisjs.com>",
74
+ "license": "MIT",
75
+ "contributors": [
76
+ "Romain Lanz <romain.lanz@pm.me>",
77
+ "Julien Ripouteau <julien@ripouteau.com>"
78
+ ],
88
79
  "publishConfig": {
89
80
  "access": "public",
90
- "tag": "latest"
81
+ "provenance": true
82
+ },
83
+ "tsup": {
84
+ "entry": [
85
+ "./index.ts",
86
+ "./src/editor.ts"
87
+ ],
88
+ "outDir": "./build",
89
+ "clean": true,
90
+ "format": "esm",
91
+ "dts": false,
92
+ "sourcemap": false,
93
+ "target": "esnext"
91
94
  },
92
95
  "release-it": {
93
96
  "git": {
@@ -122,20 +125,5 @@
122
125
  "tests/**"
123
126
  ]
124
127
  },
125
- "eslintConfig": {
126
- "extends": "@adonisjs/eslint-config/package"
127
- },
128
- "prettier": "@adonisjs/prettier-config",
129
- "tsup": {
130
- "entry": [
131
- "./index.ts",
132
- "./src/editor.ts"
133
- ],
134
- "outDir": "./build",
135
- "clean": true,
136
- "format": "esm",
137
- "dts": false,
138
- "sourcemap": true,
139
- "target": "esnext"
140
- }
128
+ "prettier": "@adonisjs/prettier-config"
141
129
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/loader.ts","../src/debug.ts"],"sourcesContent":["/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { fileURLToPath } from 'node:url'\nimport { readFile } from 'node:fs/promises'\nimport { isAbsolute, join } from 'node:path'\n\nimport debug from './debug.js'\n\n/**\n * Read the contents of one or more dot-env files. Following is how the files\n * are read.\n *\n * - Load file from the \"ENV_PATH\" environment file.\n * (Raise error if file is missing)\n *\n * - If \"ENV_PATH\" is not defined, then find \".env\" file in the app root.\n * (Ignore if file is missing)\n *\n * - Find \".env.[NODE_ENV]\" file in the app root.\n * (Ignore if file is missing)\n *\n * ```ts\n * const loader = new EnvLoader(new URL('./', import.meta.url))\n *\n * const { envContents, currentEnvContents } = await loader.load()\n *\n * // envContents: Contents of .env or file specified via ENV_PATH\n * // currentEnvContents: Contents of .env.[NODE_ENV] file\n * ```\n */\nexport class EnvLoader {\n #appRoot: string\n #loadExampleFile: boolean\n\n constructor(appRoot: string | URL, loadExampleFile: boolean = false) {\n this.#appRoot = typeof appRoot === 'string' ? appRoot : fileURLToPath(appRoot)\n this.#loadExampleFile = loadExampleFile\n }\n\n /**\n * Optionally read a file from the disk\n */\n async #loadFile(filePath: string | URL): Promise<{ fileExists: boolean; contents: string }> {\n try {\n const contents = await readFile(filePath, 'utf-8')\n return { contents, fileExists: true }\n } catch (error) {\n /* c8 ignore next 3 */\n if (error.code !== 'ENOENT') {\n throw error\n }\n\n return { contents: '', fileExists: false }\n }\n }\n\n /**\n * Load contents of the main dot-env file and the current\n * environment dot-env file\n */\n async load(): Promise<{ contents: string; path: string; fileExists: boolean }[]> {\n const ENV_PATH = process.env.ENV_PATH\n const NODE_ENV = process.env.NODE_ENV\n const envFiles: { path: string; contents: string; fileExists: boolean }[] = []\n\n if (debug.enabled) {\n debug('ENV_PATH variable is %s', ENV_PATH ? 'set' : 'not set')\n debug('NODE_ENV variable is %s', NODE_ENV ? 'set' : 'not set')\n }\n\n /**\n * Base path to load .env files from\n */\n const baseEnvPath = ENV_PATH\n ? isAbsolute(ENV_PATH)\n ? ENV_PATH\n : join(this.#appRoot, ENV_PATH)\n : this.#appRoot\n\n if (debug.enabled) {\n debug('dot-env files base path \"%s\"', baseEnvPath)\n }\n\n /**\n * 1st\n * The top most priority is given to the \".env.[NODE_ENV].local\" file\n */\n if (NODE_ENV) {\n const nodeEnvLocalFile = join(baseEnvPath, `.env.${NODE_ENV}.local`)\n envFiles.push({\n path: nodeEnvLocalFile,\n ...(await this.#loadFile(nodeEnvLocalFile)),\n })\n }\n\n /**\n * 2nd\n * Next, we give priority to the \".env.local\" file\n */\n if (!NODE_ENV || !['test', 'testing'].includes(NODE_ENV)) {\n const envLocalFile = join(baseEnvPath, '.env.local')\n envFiles.push({\n path: envLocalFile,\n ...(await this.#loadFile(envLocalFile)),\n })\n }\n\n /**\n * 3rd\n * Next, we give priority to the \".env.[NODE_ENV]\" file\n */\n if (NODE_ENV) {\n const nodeEnvFile = join(baseEnvPath, `.env.${NODE_ENV}`)\n envFiles.push({\n path: nodeEnvFile,\n ...(await this.#loadFile(nodeEnvFile)),\n })\n }\n\n /**\n * Finally, we push the contents of the \".env\" file.\n */\n const envFile = join(baseEnvPath, '.env')\n envFiles.push({\n path: envFile,\n ...(await this.#loadFile(envFile)),\n })\n\n /**\n * Load example file\n */\n if (this.#loadExampleFile) {\n const envExampleFile = join(baseEnvPath, '.env.example')\n envFiles.push({\n path: envExampleFile,\n ...(await this.#loadFile(envExampleFile)),\n })\n }\n\n return envFiles\n }\n}\n","/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { debuglog } from 'node:util'\nexport default debuglog('adonisjs:env')\n"],"mappings":";;;;;;;AASA,SAAS,qBAAqB;AAC9B,SAAS,gBAAgB;AACzB,SAAS,YAAY,YAAY;;;ACFjC,SAAS,gBAAgB;AACzB,IAAO,gBAAQ,SAAS,cAAc;;;AD2B/B,IAAM,YAAN,MAAgB;AAAA,EACrB;AAAA,EACA;AAAA,EAEA,YAAY,SAAuB,kBAA2B,OAAO;AACnE,SAAK,WAAW,OAAO,YAAY,WAAW,UAAU,cAAc,OAAO;AAC7E,SAAK,mBAAmB;AAAA,EAC1B;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAAU,UAA4E;AAC1F,QAAI;AACF,YAAM,WAAW,MAAM,SAAS,UAAU,OAAO;AACjD,aAAO,EAAE,UAAU,YAAY,KAAK;AAAA,IACtC,SAAS,OAAO;AAEd,UAAI,MAAM,SAAS,UAAU;AAC3B,cAAM;AAAA,MACR;AAEA,aAAO,EAAE,UAAU,IAAI,YAAY,MAAM;AAAA,IAC3C;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAM,OAA2E;AAC/E,UAAM,WAAW,QAAQ,IAAI;AAC7B,UAAM,WAAW,QAAQ,IAAI;AAC7B,UAAM,WAAsE,CAAC;AAE7E,QAAI,cAAM,SAAS;AACjB,oBAAM,2BAA2B,WAAW,QAAQ,SAAS;AAC7D,oBAAM,2BAA2B,WAAW,QAAQ,SAAS;AAAA,IAC/D;AAKA,UAAM,cAAc,WAChB,WAAW,QAAQ,IACjB,WACA,KAAK,KAAK,UAAU,QAAQ,IAC9B,KAAK;AAET,QAAI,cAAM,SAAS;AACjB,oBAAM,gCAAgC,WAAW;AAAA,IACnD;AAMA,QAAI,UAAU;AACZ,YAAM,mBAAmB,KAAK,aAAa,QAAQ,QAAQ,QAAQ;AACnE,eAAS,KAAK;AAAA,QACZ,MAAM;AAAA,QACN,GAAI,MAAM,KAAK,UAAU,gBAAgB;AAAA,MAC3C,CAAC;AAAA,IACH;AAMA,QAAI,CAAC,YAAY,CAAC,CAAC,QAAQ,SAAS,EAAE,SAAS,QAAQ,GAAG;AACxD,YAAM,eAAe,KAAK,aAAa,YAAY;AACnD,eAAS,KAAK;AAAA,QACZ,MAAM;AAAA,QACN,GAAI,MAAM,KAAK,UAAU,YAAY;AAAA,MACvC,CAAC;AAAA,IACH;AAMA,QAAI,UAAU;AACZ,YAAM,cAAc,KAAK,aAAa,QAAQ,QAAQ,EAAE;AACxD,eAAS,KAAK;AAAA,QACZ,MAAM;AAAA,QACN,GAAI,MAAM,KAAK,UAAU,WAAW;AAAA,MACtC,CAAC;AAAA,IACH;AAKA,UAAM,UAAU,KAAK,aAAa,MAAM;AACxC,aAAS,KAAK;AAAA,MACZ,MAAM;AAAA,MACN,GAAI,MAAM,KAAK,UAAU,OAAO;AAAA,IAClC,CAAC;AAKD,QAAI,KAAK,kBAAkB;AACzB,YAAM,iBAAiB,KAAK,aAAa,cAAc;AACvD,eAAS,KAAK;AAAA,QACZ,MAAM;AAAA,QACN,GAAI,MAAM,KAAK,UAAU,cAAc;AAAA,MACzC,CAAC;AAAA,IACH;AAEA,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/env.ts","../src/parser.ts","../src/errors.ts","../src/validator.ts","../src/processor.ts"],"sourcesContent":["/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { schema as envSchema } from '@poppinss/validator-lite'\nimport type { ValidateFn } from '@poppinss/validator-lite/types'\n\nimport { EnvParser } from './parser.js'\nimport { EnvValidator } from './validator.js'\nimport { EnvProcessor } from './processor.js'\n\n/**\n * A wrapper over \"process.env\" with types information.\n *\n * ```ts\n * const validate = Env.rules({\n * PORT: Env.schema.number()\n * })\n *\n * const validatedEnvVars = validate(process.env)\n *\n * const env = new EnvValues(validatedEnvVars)\n * env.get('PORT') // type === number\n * ```\n */\nexport class Env<EnvValues extends Record<string, any>> {\n /**\n * A cache of env values\n */\n #values: EnvValues\n\n constructor(values: EnvValues) {\n this.#values = values\n }\n\n /**\n * Create an instance of the env class by validating the\n * environment variables. Also, the `.env` files are\n * loaded from the appRoot\n */\n static async create<Schema extends { [key: string]: ValidateFn<unknown> }>(\n appRoot: URL,\n schema: Schema\n ): Promise<\n Env<{\n [K in keyof Schema]: ReturnType<Schema[K]>\n }>\n > {\n const values = await new EnvProcessor(appRoot).process()\n const validator = this.rules(schema)\n return new Env(validator.validate(values))\n }\n\n /**\n * Define an identifier for any environment value. The callback is invoked\n * when the value match the identifier to modify its interpolation.\n *\n * @deprecated use `Env.defineIdentifier` instead\n */\n static identifier(name: string, callback: (value: string) => Promise<string> | string): void {\n return EnvParser.defineIdentifier(name, callback)\n }\n\n /**\n * Define an identifier for any environment value. The callback is invoked\n * when the value match the identifier to modify its interpolation.\n */\n static defineIdentifier(\n name: string,\n callback: (value: string) => Promise<string> | string\n ): void {\n EnvParser.defineIdentifier(name, callback)\n }\n\n /**\n * Define an identifier for any environment value, if it's not already defined.\n * The callback is invoked when the value match the identifier to modify its\n * interpolation.\n */\n static defineIdentifierIfMissing(\n name: string,\n callback: (value: string) => Promise<string> | string\n ): void {\n EnvParser.defineIdentifierIfMissing(name, callback)\n }\n\n /**\n * Remove an identifier\n */\n static removeIdentifier(name: string): void {\n EnvParser.removeIdentifier(name)\n }\n\n /**\n * The schema builder for defining validation rules\n */\n static schema: typeof envSchema = envSchema\n\n /**\n * Define the validation rules for validating environment\n * variables. The return value is an instance of the\n * env validator\n */\n static rules<T extends { [key: string]: ValidateFn<unknown> }>(schema: T): EnvValidator<T> {\n const validator = new EnvValidator<T>(schema)\n return validator\n }\n\n /**\n * Get the value of an environment variable by key. The values are\n * looked up inside the validated environment and \"process.env\"\n * is used as a fallback.\n *\n * The second param is the default value, which is returned when\n * the environment variable does not exist.\n *\n * ```ts\n * Env.get('PORT')\n *\n * // With default value\n * Env.get('PORT', 3000)\n * ```\n */\n get<K extends keyof EnvValues>(key: K): EnvValues[K]\n get<K extends keyof EnvValues>(\n key: K,\n defaultValue: Exclude<EnvValues[K], undefined>\n ): Exclude<EnvValues[K], undefined>\n get(key: string): string | undefined\n get(key: string, defaultValue: string): string\n get(key: string, defaultValue?: any): any {\n /**\n * Return cached value\n */\n if (this.#values[key] !== undefined) {\n return this.#values[key]\n }\n\n /**\n * Get value from \"process.env\" and update the cache\n */\n const envValue = process.env[key]\n if (envValue) {\n return envValue\n }\n\n /**\n * Return default value when unable to lookup any other value\n */\n return defaultValue\n }\n\n /**\n * Update/set value of an environment variable.\n *\n * The value is not casted/validated using the validator, so make sure\n * to set the correct data type.\n *\n * ```ts\n * Env.set('PORT', 3000)\n *\n * Env.get('PORT') === 3000 // true\n * process.env.PORT === '3000' // true\n * ```\n */\n set<K extends keyof EnvValues>(key: K, value: EnvValues[K]): void\n set(key: string, value: string): void\n set(key: string | keyof EnvValues, value: any): void {\n this.#values[key] = value\n process.env[key as string] = value\n }\n}\n","/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport dotenv, { DotenvParseOutput } from 'dotenv'\nimport { E_IDENTIFIER_ALREADY_DEFINED } from './errors.js'\n\n/**\n * Env parser parses the environment variables from a string formatted\n * as a key-value pair seperated using an `=`. For example:\n *\n * ```dotenv\n * PORT=3333\n * HOST=127.0.0.1\n * ```\n *\n * The variables can reference other environment variables as well using `$`.\n * For example:\n *\n * ```dotenv\n * PORT=3333\n * REDIS_PORT=$PORT\n * ```\n *\n * The variables using characters other than letters can wrap variable\n * named inside a curly brace.\n *\n * ```dotenv\n * APP-PORT=3333\n * REDIS_PORT=${APP-PORT}\n * ```\n *\n * You can escape the `$` sign with a backtick.\n *\n * ```dotenv\n * REDIS_PASSWORD=foo\\$123\n * ```\n *\n * ## Usage\n *\n * ```ts\n * const parser = new EnvParser(envContents)\n * const output = parser.parse()\n *\n * // The output is a key-value pair\n * ```\n */\nexport class EnvParser {\n #envContents: string\n #preferProcessEnv: boolean = true\n static #identifiers: Record<string, (value: string) => Promise<string> | string> = {}\n\n constructor(envContents: string, options?: { ignoreProcessEnv: boolean }) {\n if (options?.ignoreProcessEnv) {\n this.#preferProcessEnv = false\n }\n\n this.#envContents = envContents\n }\n\n /**\n * Define an identifier for any environment value. The callback is invoked\n * when the value match the identifier to modify its interpolation.\n *\n * @deprecated use `EnvParser.defineIdentifier` instead\n */\n static identifier(name: string, callback: (value: string) => Promise<string> | string): void {\n EnvParser.defineIdentifier(name, callback)\n }\n\n /**\n * Define an identifier for any environment value. The callback is invoked\n * when the value match the identifier to modify its interpolation.\n */\n static defineIdentifier(\n name: string,\n callback: (value: string) => Promise<string> | string\n ): void {\n if (this.#identifiers[name]) {\n throw new E_IDENTIFIER_ALREADY_DEFINED([name])\n }\n\n this.#identifiers[name] = callback\n }\n\n /**\n * Define an identifier for any environment value, if it's not already defined.\n * The callback is invoked when the value match the identifier to modify its\n * interpolation.\n */\n static defineIdentifierIfMissing(\n name: string,\n callback: (value: string) => Promise<string> | string\n ): void {\n if (typeof this.#identifiers[name] === 'undefined') {\n this.#identifiers[name] = callback\n }\n }\n\n /**\n * Remove an identifier\n */\n static removeIdentifier(name: string): void {\n delete this.#identifiers[name]\n }\n\n /**\n * Returns the value from the parsed object\n */\n #getValue(key: string, parsed: DotenvParseOutput): string {\n if (this.#preferProcessEnv && process.env[key]) {\n return process.env[key]!\n }\n\n if (parsed[key]) {\n return this.#interpolate(parsed[key], parsed)\n }\n\n return process.env[key] || ''\n }\n\n /**\n * Interpolating the token wrapped inside the mustache braces.\n */\n #interpolateMustache(token: string, parsed: DotenvParseOutput) {\n /**\n * Finding the closing brace. If closing brace is missing, we\n * consider the block as a normal string\n */\n const closingBrace = token.indexOf('}')\n if (closingBrace === -1) {\n return token\n }\n\n /**\n * Then we pull everything until the closing brace, except\n * the opening brace and trim off all white spaces.\n */\n const varReference = token.slice(1, closingBrace).trim()\n\n /**\n * Getting the value of the reference inside the braces\n */\n return `${this.#getValue(varReference, parsed)}${token.slice(closingBrace + 1)}`\n }\n\n /**\n * Interpolating the variable reference starting with a\n * `$`. We only capture numbers,letter and underscore.\n * For other characters, one can use the mustache\n * braces.\n */\n #interpolateVariable(token: string, parsed: any) {\n return token.replace(/[a-zA-Z0-9_]+/, (key) => {\n return this.#getValue(key, parsed)\n })\n }\n\n /**\n * Interpolates the referenced values\n */\n #interpolate(value: string, parsed: DotenvParseOutput): string {\n const tokens = value.split('$')\n\n let newValue = ''\n let skipNextToken = true\n\n tokens.forEach((token) => {\n /**\n * If the value is an escaped sequence, then we replace it\n * with a `$` and then skip the next token.\n */\n if (token === '\\\\') {\n newValue += '$'\n skipNextToken = true\n return\n }\n\n /**\n * Use the value as it is when \"skipNextToken\" is set to true.\n */\n if (skipNextToken) {\n /**\n * Replace the ending escape sequence with a $\n */\n newValue += token.replace(/\\\\$/, '$')\n /**\n * and then skip the next token if it ends with escape sequence\n */\n if (token.endsWith('\\\\')) {\n return\n }\n } else {\n /**\n * Handle mustache block\n */\n if (token.startsWith('{')) {\n newValue += this.#interpolateMustache(token, parsed)\n return\n }\n\n /**\n * Process all words as variable\n */\n newValue += this.#interpolateVariable(token, parsed)\n }\n\n /**\n * Process next token\n */\n skipNextToken = false\n })\n\n return newValue\n }\n\n /**\n * Parse the env string to an object of environment variables.\n */\n async parse(): Promise<DotenvParseOutput> {\n const envCollection = dotenv.parse(this.#envContents.trim())\n const identifiers = Object.keys(EnvParser.#identifiers)\n let result: DotenvParseOutput = {}\n\n $keyLoop: for (const key in envCollection) {\n const value = this.#getValue(key, envCollection)\n\n if (value.includes(':')) {\n for (const identifier of identifiers) {\n if (value.startsWith(`${identifier}:`)) {\n result[key] = await EnvParser.#identifiers[identifier](\n value.substring(identifier.length + 1)\n )\n\n continue $keyLoop\n }\n\n if (value.startsWith(`${identifier}\\\\:`)) {\n result[key] = identifier + value.substring(identifier.length + 1)\n\n continue $keyLoop\n }\n }\n\n result[key] = value\n } else {\n result[key] = value\n }\n }\n\n return result\n }\n}\n","/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport { createError, Exception } from '@poppinss/utils'\n\n/**\n * Exception raised when one or more env variables\n * are invalid\n */\nexport const E_INVALID_ENV_VARIABLES = class EnvValidationException extends Exception {\n static message = 'Validation failed for one or more environment variables'\n static code = 'E_INVALID_ENV_VARIABLES'\n help: string = ''\n}\n\nexport const E_IDENTIFIER_ALREADY_DEFINED = createError<[string]>(\n 'The identifier \"%s\" is already defined',\n 'E_IDENTIFIER_ALREADY_DEFINED',\n 500\n)\n","/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport type { Exception } from '@poppinss/utils'\nimport type { ValidateFn } from '@poppinss/validator-lite/types'\n\nimport { E_INVALID_ENV_VARIABLES } from './errors.js'\n\n/**\n * Exposes the API to validate environment variables against a\n * pre-defined schema.\n *\n * The class is not exported in the main API and used internally.\n */\nexport class EnvValidator<Schema extends { [key: string]: ValidateFn<unknown> }> {\n #schema: Schema\n #error: Exception\n\n constructor(schema: Schema) {\n this.#schema = schema\n this.#error = new E_INVALID_ENV_VARIABLES()\n }\n\n /**\n * Accepts an object of values to validate against the pre-defined\n * schema.\n *\n * The return value is a merged copy of the original object and the\n * values mutated by the schema validator.\n */\n validate(values: { [K: string]: string | undefined }): {\n [K in keyof Schema]: ReturnType<Schema[K]>\n } {\n const help: string[] = []\n\n const validated = Object.keys(this.#schema).reduce(\n (result, key) => {\n const value = process.env[key] || values[key]\n\n try {\n result[key] = this.#schema[key](key, value) as any\n } catch (error) {\n help.push(`- ${error.message}`)\n }\n return result\n },\n { ...values }\n ) as { [K in keyof Schema]: ReturnType<Schema[K]> }\n\n if (help.length) {\n this.#error.help = help.join('\\n')\n throw this.#error\n }\n\n return validated\n }\n}\n","/*\n * @adonisjs/application\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport debug from './debug.js'\nimport { EnvParser } from './parser.js'\nimport { EnvLoader } from './loader.js'\n\n/**\n * Env processors loads, parses and process environment variables.\n */\nexport class EnvProcessor {\n /**\n * App root is needed to load files\n */\n #appRoot: URL\n\n constructor(appRoot: URL) {\n this.#appRoot = appRoot\n }\n\n /**\n * Parse env variables from raw contents\n */\n async #processContents(envContents: string, store: Record<string, any>) {\n /**\n * Collected env variables\n */\n if (!envContents.trim()) {\n return store\n }\n\n const parser = new EnvParser(envContents)\n const values = await parser.parse()\n\n Object.keys(values).forEach((key) => {\n let value = process.env[key]\n\n if (!value) {\n value = values[key]\n process.env[key] = values[key]\n }\n\n if (!store[key]) {\n store[key] = value\n }\n })\n\n return store\n }\n\n /**\n * Parse env variables by loading dot files.\n */\n async #loadAndProcessDotFiles() {\n const loader = new EnvLoader(this.#appRoot)\n const envFiles = await loader.load()\n\n if (debug.enabled) {\n debug(\n 'processing .env files (priority from top to bottom) %O',\n envFiles.map((file) => file.path)\n )\n }\n\n /**\n * Collected env variables\n */\n const envValues: Record<string, any> = {}\n await Promise.all(envFiles.map(({ contents }) => this.#processContents(contents, envValues)))\n return envValues\n }\n\n /**\n * Process env variables\n */\n async process() {\n return this.#loadAndProcessDotFiles()\n }\n}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AI;AACpB,YAAQ,IAAI,GAAa,IAAI;AAAA,EAC/B;AACF;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/editor.ts"],"sourcesContent":["/*\n * @adonisjs/env\n *\n * (c) AdonisJS\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nimport splitLines from 'split-lines'\nimport lodash from '@poppinss/utils/lodash'\nimport { writeFile } from 'node:fs/promises'\n\nimport { EnvLoader } from './loader.js'\n\nexport class EnvEditor {\n #appRoot: URL\n #loader: EnvLoader\n #files: { contents: string[]; path: string }[] = []\n\n /**\n * Creates an instance of env editor and loads .env files\n * contents.\n */\n static async create(appRoot: URL) {\n const editor = new EnvEditor(appRoot)\n await editor.load()\n\n return editor\n }\n\n constructor(appRoot: URL) {\n this.#appRoot = appRoot\n this.#loader = new EnvLoader(this.#appRoot, true)\n }\n\n /**\n * Loads .env files for editing. Only \".env\" and \".env.example\"\n * files are picked for editing.\n */\n async load() {\n const envFiles = await this.#loader.load()\n\n this.#files = envFiles\n .filter(\n (envFile) =>\n envFile.fileExists &&\n (envFile.path.endsWith('.env') || envFile.path.endsWith('.env.example'))\n )\n .map((envFile) => {\n return {\n contents: splitLines(envFile.contents.trim()),\n path: envFile.path,\n }\n })\n }\n\n /**\n * Add key-value pair to the dot-env files.\n * If `withEmptyExampleValue` is true then the key will be added with an empty value\n * to the `.env.example` file.\n */\n add(key: string, value: string | number | boolean, withEmptyExampleValue = false) {\n this.#files.forEach((file) => {\n let entryIndex = file.contents.findIndex((line) => line.startsWith(`${key}=`))\n\n entryIndex = entryIndex === -1 ? file.contents.length : entryIndex\n\n if (withEmptyExampleValue && file.path.endsWith('.env.example')) {\n lodash.set(file.contents, entryIndex, `${key}=`)\n } else {\n lodash.set(file.contents, entryIndex, `${key}=${value}`)\n }\n })\n }\n\n toJSON() {\n return this.#files\n }\n\n /**\n * Save changes to the disk\n */\n async save() {\n await Promise.all(\n this.#files.map((file) => {\n return writeFile(file.path,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