@dotenvx/dotenvx 1.26.0 → 1.26.1

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/CHANGELOG.md CHANGED
@@ -2,7 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.26.0...main)
5
+ [Unreleased](https://github.com/dotenvx/dotenvx/compare/v1.26.1...main)
6
+
7
+ ## [1.26.1](https://github.com/dotenvx/dotenvx/compare/v1.26.0...v1.26.1)
8
+
9
+ ### Added
10
+
11
+ * add typescript type definitions for `main.parse` method ([#475](https://github.com/dotenvx/dotenvx/pull/475))
6
12
 
7
13
  ## [1.26.0](https://github.com/dotenvx/dotenvx/compare/v1.25.2...v1.26.0)
8
14
 
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "1.26.0",
2
+ "version": "1.26.1",
3
3
  "name": "@dotenvx/dotenvx",
4
4
  "description": "a better dotenv–from the creator of `dotenv`",
5
5
  "author": "@motdotla",
package/src/lib/main.d.ts CHANGED
@@ -1,5 +1,37 @@
1
1
  import type { URL } from 'url';
2
2
 
3
+ export interface DotenvParseOptions {
4
+ /**
5
+ * Override any environment variables that have already been set on your machine with values from your .env file.
6
+ * @default false
7
+ * @example require('@dotenvx/dotenvx').config({ overload: true })
8
+ * @alias overload
9
+ */
10
+ overload?: boolean;
11
+
12
+ /**
13
+ * @default false
14
+ * @alias override
15
+ */
16
+ override?: boolean;
17
+
18
+ /**
19
+ * Specify an object to read existing environment variables from. Defaults to process.env environment variables.
20
+ *
21
+ * @default process.env
22
+ * @example const processEnv = {}; require('@dotenvx/dotenvx').parse('HELLO=World', { processEnv: processEnv })
23
+ */
24
+ processEnv?: DotenvPopulateInput;
25
+
26
+ /**
27
+ * Specify a privateKey to decrypt any encrypted contents with.
28
+ *
29
+ * @default undefined
30
+ * @example require('@dotenvx/dotenvx').parse('HELLO="encrypted:BE9Y7LKANx77X1pv1HnEoil93fPa5c9rpL/1ps48uaRT9zM8VR6mHx9yM+HktKdsPGIZELuZ7rr2mn1gScsmWitppAgE/1lVprNYBCqiYeaTcKXjDUXU5LfsEsflnAsDhT/kWG1l"', { privateKey: 'a4547dcd9d3429615a3649bb79e87edb62ee6a74b007075e9141ae44f5fb412c' })
31
+ */
32
+ privateKey?: string;
33
+ }
34
+
3
35
  export interface DotenvParseOutput {
4
36
  [name: string]: string;
5
37
  }
@@ -9,14 +41,16 @@ export interface DotenvParseOutput {
9
41
  *
10
42
  * @see https://dotenvx.com/docs
11
43
  * @param src - contents to be parsed. example: `'DB_HOST=localhost'`
44
+ * @param options - additional options. example: `{ prcoessEnv: {}, privateKey: '<privateKey>', overload: false }`
12
45
  * @returns an object with keys and values based on `src`. example: `{ DB_HOST : 'localhost' }`
13
46
  */
14
47
  export function parse<T extends DotenvParseOutput = DotenvParseOutput>(
15
- src: string | Buffer
48
+ src: string | Buffer,
49
+ options?: DotenvParseOptions
16
50
  ): T;
17
51
 
18
52
  export interface DotenvConfigOptions {
19
- /** *
53
+ /**
20
54
  * Specify a custom path if your file containing environment variables is located elsewhere.
21
55
  * Can also be an array of strings, specifying multiple paths.
22
56
  *
@@ -37,16 +71,16 @@ export interface DotenvConfigOptions {
37
71
  /**
38
72
  * Override any environment variables that have already been set on your machine with values from your .env file.
39
73
  * @default false
40
- * @example require('@dotenvx/dotenvx').config({ override: true })
74
+ * @example require('@dotenvx/dotenvx').config({ overload: true })
41
75
  * @alias overload
42
76
  */
43
- override?: boolean;
77
+ overload?: boolean;
44
78
 
45
79
  /**
46
80
  * @default false
47
81
  * @alias override
48
82
  */
49
- overload?: boolean;
83
+ override?: boolean;
50
84
 
51
85
  /**
52
86
  * Specify an object to write your secrets to. Defaults to process.env environment variables.
@@ -118,7 +152,7 @@ export interface DotenvPopulateInput {
118
152
  *
119
153
  * @see https://dotenvx.com/docs
120
154
  *
121
- * @param options - additional options. example: `{ path: './custom/path', encoding: 'latin1', debug: true, override: false }`
155
+ * @param options - additional options. example: `{ path: './custom/path', encoding: 'latin1', debug: true, overload: false }`
122
156
  * @returns an object with a `parsed` key if successful or `error` key if an error occurred. example: { parsed: { KEY: 'value' } }
123
157
  *
124
158
  */