@karmaniverous/get-dotenv 4.2.1 → 4.2.3

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/index.d.cts CHANGED
@@ -4,18 +4,10 @@ import { Command } from '@commander-js/extra-typings';
4
4
  * Options passed programmatically to `getDotenvCli`.
5
5
  */
6
6
  interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
7
- /**
8
- * CLI alias. Should align with the `bin` property in `package.json`.
9
- */
10
- alias?: string;
11
7
  /**
12
8
  * Logs CLI internals when true.
13
9
  */
14
10
  debug?: boolean;
15
- /**
16
- * Cli description (appears in CLI help).
17
- */
18
- description?: string;
19
11
  /**
20
12
  * A delimited string of paths to dotenv files.
21
13
  */
@@ -30,6 +22,10 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
30
22
  * `pathsDelimiter`.
31
23
  */
32
24
  pathsDelimiterPattern?: string;
25
+ /**
26
+ * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
27
+ */
28
+ shellScripts?: Record<string, string>;
33
29
  /**
34
30
  * A delimited string of key-value pairs declaratively specifying variables &
35
31
  * values to be loaded in addition to any dotenv files.
@@ -62,13 +58,9 @@ type GetDotenvDynamicFunction = (vars: ProcessEnv) => string | undefined;
62
58
  type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<GetDotenvDynamicFunction>>;
63
59
  type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
64
60
  /**
65
- * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
61
+ * Options passed programmatically to `getDotenv`.
66
62
  */
67
63
  interface GetDotenvOptions {
68
- /**
69
- * log internals to logger
70
- */
71
- debug?: boolean;
72
64
  /**
73
65
  * default target environment (used if `env` is not provided)
74
66
  */
@@ -76,7 +68,7 @@ interface GetDotenvOptions {
76
68
  /**
77
69
  * token indicating a dotenv file
78
70
  */
79
- dotenvToken?: string;
71
+ dotenvToken: string;
80
72
  /**
81
73
  * path to JS module default-exporting an object keyed to dynamic variable functions
82
74
  */
@@ -129,10 +121,6 @@ interface GetDotenvOptions {
129
121
  * filename token indicating private variables
130
122
  */
131
123
  privateToken?: string;
132
- /**
133
- * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
134
- */
135
- shellScripts?: Record<string, string>;
136
124
  /**
137
125
  * explicit variables to include
138
126
  */
@@ -190,11 +178,23 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
190
178
  * sets defaults that can be overridden by local `getdotenv.config.json` in
191
179
  * projects that import the CLI.
192
180
  */
193
- interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
181
+ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
182
+ /**
183
+ * CLI alias. Should align with the `bin` property in `package.json`.
184
+ */
185
+ alias: string;
186
+ /**
187
+ * Cli description (appears in CLI help).
188
+ */
189
+ description: string;
190
+ /**
191
+ * The `import.meta.url` of the module generating the CLI.
192
+ */
193
+ importMetaUrl: string;
194
194
  /**
195
195
  * Logger object (defaults to console)
196
196
  */
197
- logger?: Logger;
197
+ logger: Logger;
198
198
  /**
199
199
  * Mutates inbound options & executes side effects within the `getDotenv`
200
200
  * context before executing CLI commands.
@@ -210,7 +210,7 @@ interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
210
210
  /**
211
211
  * Generate a Commander CLI Command for get-dotenv.
212
212
  */
213
- declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsCustom }?: GetDotenvCliGenerateOptions) => Command;
213
+ declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, 'importMetaUrl'> & Partial<Omit<GetDotenvCliGenerateOptions, 'importMetaUrl'>>) => Promise<Command>;
214
214
 
215
215
  /**
216
216
  * Asynchronously process dotenv files of the form `.env[.<ENV>][.<PRIVATE_TOKEN>]`
@@ -218,6 +218,6 @@ declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsC
218
218
  * @param options - `GetDotenvOptions` object
219
219
  * @returns The combined parsed dotenv object.
220
220
  */
221
- declare const getDotenv: (options?: GetDotenvOptions) => Promise<ProcessEnv>;
221
+ declare const getDotenv: (options?: Partial<GetDotenvOptions>) => Promise<ProcessEnv>;
222
222
 
223
223
  export { type GetDotenvDynamic, type GetDotenvOptions, type ProcessEnv, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, generateGetDotenvCli, getDotenv };
package/dist/index.d.mts CHANGED
@@ -4,18 +4,10 @@ import { Command } from '@commander-js/extra-typings';
4
4
  * Options passed programmatically to `getDotenvCli`.
5
5
  */
6
6
  interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
7
- /**
8
- * CLI alias. Should align with the `bin` property in `package.json`.
9
- */
10
- alias?: string;
11
7
  /**
12
8
  * Logs CLI internals when true.
13
9
  */
14
10
  debug?: boolean;
15
- /**
16
- * Cli description (appears in CLI help).
17
- */
18
- description?: string;
19
11
  /**
20
12
  * A delimited string of paths to dotenv files.
21
13
  */
@@ -30,6 +22,10 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
30
22
  * `pathsDelimiter`.
31
23
  */
32
24
  pathsDelimiterPattern?: string;
25
+ /**
26
+ * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
27
+ */
28
+ shellScripts?: Record<string, string>;
33
29
  /**
34
30
  * A delimited string of key-value pairs declaratively specifying variables &
35
31
  * values to be loaded in addition to any dotenv files.
@@ -62,13 +58,9 @@ type GetDotenvDynamicFunction = (vars: ProcessEnv) => string | undefined;
62
58
  type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<GetDotenvDynamicFunction>>;
63
59
  type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
64
60
  /**
65
- * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
61
+ * Options passed programmatically to `getDotenv`.
66
62
  */
67
63
  interface GetDotenvOptions {
68
- /**
69
- * log internals to logger
70
- */
71
- debug?: boolean;
72
64
  /**
73
65
  * default target environment (used if `env` is not provided)
74
66
  */
@@ -76,7 +68,7 @@ interface GetDotenvOptions {
76
68
  /**
77
69
  * token indicating a dotenv file
78
70
  */
79
- dotenvToken?: string;
71
+ dotenvToken: string;
80
72
  /**
81
73
  * path to JS module default-exporting an object keyed to dynamic variable functions
82
74
  */
@@ -129,10 +121,6 @@ interface GetDotenvOptions {
129
121
  * filename token indicating private variables
130
122
  */
131
123
  privateToken?: string;
132
- /**
133
- * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
134
- */
135
- shellScripts?: Record<string, string>;
136
124
  /**
137
125
  * explicit variables to include
138
126
  */
@@ -190,11 +178,23 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
190
178
  * sets defaults that can be overridden by local `getdotenv.config.json` in
191
179
  * projects that import the CLI.
192
180
  */
193
- interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
181
+ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
182
+ /**
183
+ * CLI alias. Should align with the `bin` property in `package.json`.
184
+ */
185
+ alias: string;
186
+ /**
187
+ * Cli description (appears in CLI help).
188
+ */
189
+ description: string;
190
+ /**
191
+ * The `import.meta.url` of the module generating the CLI.
192
+ */
193
+ importMetaUrl: string;
194
194
  /**
195
195
  * Logger object (defaults to console)
196
196
  */
197
- logger?: Logger;
197
+ logger: Logger;
198
198
  /**
199
199
  * Mutates inbound options & executes side effects within the `getDotenv`
200
200
  * context before executing CLI commands.
@@ -210,7 +210,7 @@ interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
210
210
  /**
211
211
  * Generate a Commander CLI Command for get-dotenv.
212
212
  */
213
- declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsCustom }?: GetDotenvCliGenerateOptions) => Command;
213
+ declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, 'importMetaUrl'> & Partial<Omit<GetDotenvCliGenerateOptions, 'importMetaUrl'>>) => Promise<Command>;
214
214
 
215
215
  /**
216
216
  * Asynchronously process dotenv files of the form `.env[.<ENV>][.<PRIVATE_TOKEN>]`
@@ -218,6 +218,6 @@ declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsC
218
218
  * @param options - `GetDotenvOptions` object
219
219
  * @returns The combined parsed dotenv object.
220
220
  */
221
- declare const getDotenv: (options?: GetDotenvOptions) => Promise<ProcessEnv>;
221
+ declare const getDotenv: (options?: Partial<GetDotenvOptions>) => Promise<ProcessEnv>;
222
222
 
223
223
  export { type GetDotenvDynamic, type GetDotenvOptions, type ProcessEnv, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, generateGetDotenvCli, getDotenv };
package/dist/index.d.ts CHANGED
@@ -4,18 +4,10 @@ import { Command } from '@commander-js/extra-typings';
4
4
  * Options passed programmatically to `getDotenvCli`.
5
5
  */
6
6
  interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
7
- /**
8
- * CLI alias. Should align with the `bin` property in `package.json`.
9
- */
10
- alias?: string;
11
7
  /**
12
8
  * Logs CLI internals when true.
13
9
  */
14
10
  debug?: boolean;
15
- /**
16
- * Cli description (appears in CLI help).
17
- */
18
- description?: string;
19
11
  /**
20
12
  * A delimited string of paths to dotenv files.
21
13
  */
@@ -30,6 +22,10 @@ interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
30
22
  * `pathsDelimiter`.
31
23
  */
32
24
  pathsDelimiterPattern?: string;
25
+ /**
26
+ * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
27
+ */
28
+ shellScripts?: Record<string, string>;
33
29
  /**
34
30
  * A delimited string of key-value pairs declaratively specifying variables &
35
31
  * values to be loaded in addition to any dotenv files.
@@ -62,13 +58,9 @@ type GetDotenvDynamicFunction = (vars: ProcessEnv) => string | undefined;
62
58
  type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<GetDotenvDynamicFunction>>;
63
59
  type Logger = Record<string, (...args: unknown[]) => void> | typeof console;
64
60
  /**
65
- * Options passed programmatically to `getDotenv` and `getDotEnvSync`.
61
+ * Options passed programmatically to `getDotenv`.
66
62
  */
67
63
  interface GetDotenvOptions {
68
- /**
69
- * log internals to logger
70
- */
71
- debug?: boolean;
72
64
  /**
73
65
  * default target environment (used if `env` is not provided)
74
66
  */
@@ -76,7 +68,7 @@ interface GetDotenvOptions {
76
68
  /**
77
69
  * token indicating a dotenv file
78
70
  */
79
- dotenvToken?: string;
71
+ dotenvToken: string;
80
72
  /**
81
73
  * path to JS module default-exporting an object keyed to dynamic variable functions
82
74
  */
@@ -129,10 +121,6 @@ interface GetDotenvOptions {
129
121
  * filename token indicating private variables
130
122
  */
131
123
  privateToken?: string;
132
- /**
133
- * Shell scripts that can be executed from the CLI, either individually or via the batch subcommand.
134
- */
135
- shellScripts?: Record<string, string>;
136
124
  /**
137
125
  * explicit variables to include
138
126
  */
@@ -190,11 +178,23 @@ type GetDotenvCliPostHookCallback = (dotenv: ProcessEnv) => Promise<void>;
190
178
  * sets defaults that can be overridden by local `getdotenv.config.json` in
191
179
  * projects that import the CLI.
192
180
  */
193
- interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
181
+ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
182
+ /**
183
+ * CLI alias. Should align with the `bin` property in `package.json`.
184
+ */
185
+ alias: string;
186
+ /**
187
+ * Cli description (appears in CLI help).
188
+ */
189
+ description: string;
190
+ /**
191
+ * The `import.meta.url` of the module generating the CLI.
192
+ */
193
+ importMetaUrl: string;
194
194
  /**
195
195
  * Logger object (defaults to console)
196
196
  */
197
- logger?: Logger;
197
+ logger: Logger;
198
198
  /**
199
199
  * Mutates inbound options & executes side effects within the `getDotenv`
200
200
  * context before executing CLI commands.
@@ -210,7 +210,7 @@ interface GetDotenvCliGenerateOptions extends Omit<GetDotenvCliOptions, 'env'> {
210
210
  /**
211
211
  * Generate a Commander CLI Command for get-dotenv.
212
212
  */
213
- declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsCustom }?: GetDotenvCliGenerateOptions) => Command;
213
+ declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, 'importMetaUrl'> & Partial<Omit<GetDotenvCliGenerateOptions, 'importMetaUrl'>>) => Promise<Command>;
214
214
 
215
215
  /**
216
216
  * Asynchronously process dotenv files of the form `.env[.<ENV>][.<PRIVATE_TOKEN>]`
@@ -218,6 +218,6 @@ declare const generateGetDotenvCli: ({ logger, preHook, postHook, ...cliOptionsC
218
218
  * @param options - `GetDotenvOptions` object
219
219
  * @returns The combined parsed dotenv object.
220
220
  */
221
- declare const getDotenv: (options?: GetDotenvOptions) => Promise<ProcessEnv>;
221
+ declare const getDotenv: (options?: Partial<GetDotenvOptions>) => Promise<ProcessEnv>;
222
222
 
223
223
  export { type GetDotenvDynamic, type GetDotenvOptions, type ProcessEnv, dotenvExpand, dotenvExpandAll, dotenvExpandFromProcessEnv, generateGetDotenvCli, getDotenv };