@karmaniverous/get-dotenv 4.6.0-0 → 5.0.0-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/README.md +130 -23
- package/dist/cliHost.cjs +1089 -0
- package/dist/cliHost.d.cts +191 -0
- package/dist/cliHost.d.mts +191 -0
- package/dist/cliHost.d.ts +191 -0
- package/dist/cliHost.mjs +1085 -0
- package/dist/config.cjs +247 -0
- package/dist/config.d.cts +53 -0
- package/dist/config.d.mts +53 -0
- package/dist/config.d.ts +53 -0
- package/dist/config.mjs +242 -0
- package/dist/env-overlay.cjs +163 -0
- package/dist/env-overlay.d.cts +48 -0
- package/dist/env-overlay.d.mts +48 -0
- package/dist/env-overlay.d.ts +48 -0
- package/dist/env-overlay.mjs +161 -0
- package/dist/getdotenv.cli.mjs +2788 -734
- package/dist/index.cjs +902 -280
- package/dist/index.d.cts +122 -64
- package/dist/index.d.mts +122 -64
- package/dist/index.d.ts +122 -64
- package/dist/index.mjs +904 -283
- package/dist/plugins-aws.cjs +618 -0
- package/dist/plugins-aws.d.cts +176 -0
- package/dist/plugins-aws.d.mts +176 -0
- package/dist/plugins-aws.d.ts +176 -0
- package/dist/plugins-aws.mjs +616 -0
- package/dist/plugins-batch.cjs +569 -0
- package/dist/plugins-batch.d.cts +198 -0
- package/dist/plugins-batch.d.mts +198 -0
- package/dist/plugins-batch.d.ts +198 -0
- package/dist/plugins-batch.mjs +567 -0
- package/dist/plugins-init.cjs +282 -0
- package/dist/plugins-init.d.cts +180 -0
- package/dist/plugins-init.d.mts +180 -0
- package/dist/plugins-init.d.ts +180 -0
- package/dist/plugins-init.mjs +280 -0
- package/getdotenv.config.json +19 -0
- package/package.json +88 -17
- package/templates/cli/ts/index.ts +9 -0
- package/templates/cli/ts/plugins/hello.ts +17 -0
- package/templates/config/js/getdotenv.config.js +15 -0
- package/templates/config/json/local/getdotenv.config.local.json +7 -0
- package/templates/config/json/public/getdotenv.config.json +12 -0
- package/templates/config/public/getdotenv.config.json +13 -0
- package/templates/config/ts/getdotenv.config.ts +16 -0
- package/templates/config/yaml/local/getdotenv.config.local.yaml +7 -0
- package/templates/config/yaml/public/getdotenv.config.yaml +10 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,75 +1,54 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
|
|
3
|
-
type Scripts = Record<string, string | {
|
|
4
|
-
cmd: string;
|
|
5
|
-
shell?: string | boolean;
|
|
6
|
-
}>;
|
|
7
3
|
/**
|
|
8
|
-
*
|
|
4
|
+
* Minimal root options shape shared by CLI and generator layers.
|
|
5
|
+
* Keep keys optional to respect exactOptionalPropertyTypes semantics.
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
type RootOptionsShape = {
|
|
8
|
+
env?: string;
|
|
9
|
+
vars?: string;
|
|
10
|
+
command?: string;
|
|
11
|
+
outputPath?: string;
|
|
12
|
+
shell?: string | boolean;
|
|
13
|
+
loadProcess?: boolean;
|
|
14
|
+
excludeAll?: boolean;
|
|
15
|
+
excludeDynamic?: boolean;
|
|
16
|
+
excludeEnv?: boolean;
|
|
17
|
+
excludeGlobal?: boolean;
|
|
18
|
+
excludePrivate?: boolean;
|
|
19
|
+
excludePublic?: boolean;
|
|
20
|
+
log?: boolean;
|
|
14
21
|
debug?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
capture?: boolean;
|
|
23
|
+
defaultEnv?: string;
|
|
24
|
+
dotenvToken?: string;
|
|
25
|
+
dynamicPath?: string;
|
|
26
|
+
trace?: boolean | string[];
|
|
18
27
|
paths?: string;
|
|
19
|
-
/**
|
|
20
|
-
* A delimiter string with which to split `paths`. Only used if
|
|
21
|
-
* `pathsDelimiterPattern` is not provided.
|
|
22
|
-
*/
|
|
23
28
|
pathsDelimiter?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A regular expression pattern with which to split `paths`. Supersedes
|
|
26
|
-
* `pathsDelimiter`.
|
|
27
|
-
*/
|
|
28
29
|
pathsDelimiterPattern?: string;
|
|
29
|
-
|
|
30
|
-
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
31
|
-
*/
|
|
32
|
-
scripts?: Scripts;
|
|
33
|
-
/**
|
|
34
|
-
* Determines how commands and scripts are executed. If `false` or
|
|
35
|
-
* `undefined`, commands are executed as plain Javascript using the default
|
|
36
|
-
* execa parser. If `true`, commands are executed using the default OS shell
|
|
37
|
-
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
38
|
-
* `/bin/bash`)
|
|
39
|
-
*/
|
|
40
|
-
shell?: string | boolean;
|
|
41
|
-
/**
|
|
42
|
-
* A delimited string of key-value pairs declaratively specifying variables &
|
|
43
|
-
* values to be loaded in addition to any dotenv files.
|
|
44
|
-
*/
|
|
45
|
-
vars?: string;
|
|
46
|
-
/**
|
|
47
|
-
* A string with which to split keys from values in `vars`. Only used if
|
|
48
|
-
* `varsDelimiterPattern` is not provided.
|
|
49
|
-
*/
|
|
50
|
-
varsAssignor?: string;
|
|
51
|
-
/**
|
|
52
|
-
* A regular expression pattern with which to split variable names from values
|
|
53
|
-
* in `vars`. Supersedes `varsAssignor`.
|
|
54
|
-
*/
|
|
55
|
-
varsAssignorPattern?: string;
|
|
56
|
-
/**
|
|
57
|
-
* A string with which to split `vars` into key-value pairs. Only used if
|
|
58
|
-
* `varsDelimiterPattern` is not provided.
|
|
59
|
-
*/
|
|
30
|
+
privateToken?: string;
|
|
60
31
|
varsDelimiter?: string;
|
|
61
|
-
/**
|
|
62
|
-
* A regular expression pattern with which to split `vars` into key-value
|
|
63
|
-
* pairs. Supersedes `varsDelimiter`.
|
|
64
|
-
*/
|
|
65
32
|
varsDelimiterPattern?: string;
|
|
66
|
-
|
|
33
|
+
varsAssignor?: string;
|
|
34
|
+
varsAssignorPattern?: string;
|
|
35
|
+
scripts?: ScriptsTable;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Scripts table shape (configurable shell type).
|
|
39
|
+
*/
|
|
40
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
41
|
+
cmd: string;
|
|
42
|
+
shell?: TShell;
|
|
43
|
+
}>;
|
|
67
44
|
|
|
45
|
+
type RootOptionsShapeCompat = Omit<RootOptionsShape, 'vars' | 'paths'> & {
|
|
46
|
+
vars?: string | Record<string, string | undefined>;
|
|
47
|
+
paths?: string | string[];
|
|
48
|
+
};
|
|
68
49
|
/**
|
|
69
50
|
* A minimal representation of an environment key/value mapping.
|
|
70
|
-
* Values may be `undefined` to represent "unset".
|
|
71
|
-
*/
|
|
72
|
-
type ProcessEnv = Record<string, string | undefined>;
|
|
51
|
+
* Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
|
|
73
52
|
/**
|
|
74
53
|
* Dynamic variable function signature. Receives the current expanded variables
|
|
75
54
|
* and the selected environment (if any), and returns either a string to set
|
|
@@ -158,15 +137,22 @@ interface GetDotenvOptions {
|
|
|
158
137
|
* explicit variables to include
|
|
159
138
|
*/
|
|
160
139
|
vars?: ProcessEnv;
|
|
140
|
+
/**
|
|
141
|
+
* Reserved: config loader flag (no-op).
|
|
142
|
+
* The plugin-first host and generator paths already use the config
|
|
143
|
+
* loader/overlay pipeline unconditionally (no-op when no config files
|
|
144
|
+
* are present). This flag is accepted for forward compatibility but
|
|
145
|
+
* currently has no effect.
|
|
146
|
+
*/
|
|
147
|
+
useConfigLoader?: boolean;
|
|
161
148
|
}
|
|
162
149
|
/**
|
|
163
|
-
* Converts programmatic CLI options to `getDotenv` options.
|
|
164
|
-
*
|
|
150
|
+
* Converts programmatic CLI options to `getDotenv` options. *
|
|
165
151
|
* @param cliOptions - CLI options. Defaults to `{}`.
|
|
166
152
|
*
|
|
167
153
|
* @returns `getDotenv` options.
|
|
168
154
|
*/
|
|
169
|
-
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }:
|
|
155
|
+
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }: RootOptionsShapeCompat) => GetDotenvOptions;
|
|
170
156
|
|
|
171
157
|
/**
|
|
172
158
|
* Recursively expands environment variables in a string. Variables may be
|
|
@@ -236,8 +222,79 @@ declare const dotenvExpandAll: (values?: ProcessEnv, options?: {
|
|
|
236
222
|
*/
|
|
237
223
|
declare const dotenvExpandFromProcessEnv: (value: string | undefined) => string | undefined;
|
|
238
224
|
|
|
225
|
+
type Scripts = Record<string, string | {
|
|
226
|
+
cmd: string;
|
|
227
|
+
shell?: string | boolean;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
231
|
+
*/
|
|
232
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
233
|
+
/**
|
|
234
|
+
* Logs CLI internals when true.
|
|
235
|
+
*/
|
|
236
|
+
debug?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
239
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
240
|
+
*/
|
|
241
|
+
capture?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* A delimited string of paths to dotenv files.
|
|
244
|
+
*/
|
|
245
|
+
paths?: string;
|
|
246
|
+
/**
|
|
247
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
248
|
+
* `pathsDelimiterPattern` is not provided.
|
|
249
|
+
*/
|
|
250
|
+
pathsDelimiter?: string;
|
|
251
|
+
/**
|
|
252
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
253
|
+
* `pathsDelimiter`.
|
|
254
|
+
*/
|
|
255
|
+
pathsDelimiterPattern?: string;
|
|
256
|
+
/**
|
|
257
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
258
|
+
*/
|
|
259
|
+
scripts?: Scripts;
|
|
260
|
+
/**
|
|
261
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
262
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
263
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
264
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
265
|
+
* `/bin/bash`)
|
|
266
|
+
*/
|
|
267
|
+
shell?: string | boolean;
|
|
268
|
+
/**
|
|
269
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
270
|
+
* values to be loaded in addition to any dotenv files.
|
|
271
|
+
*/
|
|
272
|
+
vars?: string;
|
|
273
|
+
/**
|
|
274
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
275
|
+
* `varsDelimiterPattern` is not provided.
|
|
276
|
+
*/
|
|
277
|
+
varsAssignor?: string;
|
|
278
|
+
/**
|
|
279
|
+
* A regular expression pattern with which to split variable names from values
|
|
280
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
281
|
+
*/
|
|
282
|
+
varsAssignorPattern?: string;
|
|
283
|
+
/**
|
|
284
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
285
|
+
* `varsDelimiterPattern` is not provided.
|
|
286
|
+
*/
|
|
287
|
+
varsDelimiter?: string;
|
|
288
|
+
/**
|
|
289
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
290
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
291
|
+
*/
|
|
292
|
+
varsDelimiterPattern?: string;
|
|
293
|
+
}
|
|
294
|
+
|
|
239
295
|
/**
|
|
240
|
-
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
296
|
+
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
297
|
+
* executes side effects within the `getDotenv` context.
|
|
241
298
|
*/
|
|
242
299
|
type GetDotenvCliPreHookCallback = (options: GetDotenvCliOptions) => Promise<void>;
|
|
243
300
|
/**
|
|
@@ -280,7 +337,8 @@ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
|
|
|
280
337
|
}
|
|
281
338
|
|
|
282
339
|
/**
|
|
283
|
-
* Generate a Commander CLI Command for get-dotenv.
|
|
340
|
+
* Generate a Commander CLI Command for get-dotenv.
|
|
341
|
+
* Orchestration only: delegates building and lifecycle hooks.
|
|
284
342
|
*/
|
|
285
343
|
declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, "importMetaUrl"> & Partial<Omit<GetDotenvCliGenerateOptions, "importMetaUrl">>) => Promise<Command>;
|
|
286
344
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,75 +1,54 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
|
|
3
|
-
type Scripts = Record<string, string | {
|
|
4
|
-
cmd: string;
|
|
5
|
-
shell?: string | boolean;
|
|
6
|
-
}>;
|
|
7
3
|
/**
|
|
8
|
-
*
|
|
4
|
+
* Minimal root options shape shared by CLI and generator layers.
|
|
5
|
+
* Keep keys optional to respect exactOptionalPropertyTypes semantics.
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
type RootOptionsShape = {
|
|
8
|
+
env?: string;
|
|
9
|
+
vars?: string;
|
|
10
|
+
command?: string;
|
|
11
|
+
outputPath?: string;
|
|
12
|
+
shell?: string | boolean;
|
|
13
|
+
loadProcess?: boolean;
|
|
14
|
+
excludeAll?: boolean;
|
|
15
|
+
excludeDynamic?: boolean;
|
|
16
|
+
excludeEnv?: boolean;
|
|
17
|
+
excludeGlobal?: boolean;
|
|
18
|
+
excludePrivate?: boolean;
|
|
19
|
+
excludePublic?: boolean;
|
|
20
|
+
log?: boolean;
|
|
14
21
|
debug?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
capture?: boolean;
|
|
23
|
+
defaultEnv?: string;
|
|
24
|
+
dotenvToken?: string;
|
|
25
|
+
dynamicPath?: string;
|
|
26
|
+
trace?: boolean | string[];
|
|
18
27
|
paths?: string;
|
|
19
|
-
/**
|
|
20
|
-
* A delimiter string with which to split `paths`. Only used if
|
|
21
|
-
* `pathsDelimiterPattern` is not provided.
|
|
22
|
-
*/
|
|
23
28
|
pathsDelimiter?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A regular expression pattern with which to split `paths`. Supersedes
|
|
26
|
-
* `pathsDelimiter`.
|
|
27
|
-
*/
|
|
28
29
|
pathsDelimiterPattern?: string;
|
|
29
|
-
|
|
30
|
-
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
31
|
-
*/
|
|
32
|
-
scripts?: Scripts;
|
|
33
|
-
/**
|
|
34
|
-
* Determines how commands and scripts are executed. If `false` or
|
|
35
|
-
* `undefined`, commands are executed as plain Javascript using the default
|
|
36
|
-
* execa parser. If `true`, commands are executed using the default OS shell
|
|
37
|
-
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
38
|
-
* `/bin/bash`)
|
|
39
|
-
*/
|
|
40
|
-
shell?: string | boolean;
|
|
41
|
-
/**
|
|
42
|
-
* A delimited string of key-value pairs declaratively specifying variables &
|
|
43
|
-
* values to be loaded in addition to any dotenv files.
|
|
44
|
-
*/
|
|
45
|
-
vars?: string;
|
|
46
|
-
/**
|
|
47
|
-
* A string with which to split keys from values in `vars`. Only used if
|
|
48
|
-
* `varsDelimiterPattern` is not provided.
|
|
49
|
-
*/
|
|
50
|
-
varsAssignor?: string;
|
|
51
|
-
/**
|
|
52
|
-
* A regular expression pattern with which to split variable names from values
|
|
53
|
-
* in `vars`. Supersedes `varsAssignor`.
|
|
54
|
-
*/
|
|
55
|
-
varsAssignorPattern?: string;
|
|
56
|
-
/**
|
|
57
|
-
* A string with which to split `vars` into key-value pairs. Only used if
|
|
58
|
-
* `varsDelimiterPattern` is not provided.
|
|
59
|
-
*/
|
|
30
|
+
privateToken?: string;
|
|
60
31
|
varsDelimiter?: string;
|
|
61
|
-
/**
|
|
62
|
-
* A regular expression pattern with which to split `vars` into key-value
|
|
63
|
-
* pairs. Supersedes `varsDelimiter`.
|
|
64
|
-
*/
|
|
65
32
|
varsDelimiterPattern?: string;
|
|
66
|
-
|
|
33
|
+
varsAssignor?: string;
|
|
34
|
+
varsAssignorPattern?: string;
|
|
35
|
+
scripts?: ScriptsTable;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Scripts table shape (configurable shell type).
|
|
39
|
+
*/
|
|
40
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
41
|
+
cmd: string;
|
|
42
|
+
shell?: TShell;
|
|
43
|
+
}>;
|
|
67
44
|
|
|
45
|
+
type RootOptionsShapeCompat = Omit<RootOptionsShape, 'vars' | 'paths'> & {
|
|
46
|
+
vars?: string | Record<string, string | undefined>;
|
|
47
|
+
paths?: string | string[];
|
|
48
|
+
};
|
|
68
49
|
/**
|
|
69
50
|
* A minimal representation of an environment key/value mapping.
|
|
70
|
-
* Values may be `undefined` to represent "unset".
|
|
71
|
-
*/
|
|
72
|
-
type ProcessEnv = Record<string, string | undefined>;
|
|
51
|
+
* Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
|
|
73
52
|
/**
|
|
74
53
|
* Dynamic variable function signature. Receives the current expanded variables
|
|
75
54
|
* and the selected environment (if any), and returns either a string to set
|
|
@@ -158,15 +137,22 @@ interface GetDotenvOptions {
|
|
|
158
137
|
* explicit variables to include
|
|
159
138
|
*/
|
|
160
139
|
vars?: ProcessEnv;
|
|
140
|
+
/**
|
|
141
|
+
* Reserved: config loader flag (no-op).
|
|
142
|
+
* The plugin-first host and generator paths already use the config
|
|
143
|
+
* loader/overlay pipeline unconditionally (no-op when no config files
|
|
144
|
+
* are present). This flag is accepted for forward compatibility but
|
|
145
|
+
* currently has no effect.
|
|
146
|
+
*/
|
|
147
|
+
useConfigLoader?: boolean;
|
|
161
148
|
}
|
|
162
149
|
/**
|
|
163
|
-
* Converts programmatic CLI options to `getDotenv` options.
|
|
164
|
-
*
|
|
150
|
+
* Converts programmatic CLI options to `getDotenv` options. *
|
|
165
151
|
* @param cliOptions - CLI options. Defaults to `{}`.
|
|
166
152
|
*
|
|
167
153
|
* @returns `getDotenv` options.
|
|
168
154
|
*/
|
|
169
|
-
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }:
|
|
155
|
+
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }: RootOptionsShapeCompat) => GetDotenvOptions;
|
|
170
156
|
|
|
171
157
|
/**
|
|
172
158
|
* Recursively expands environment variables in a string. Variables may be
|
|
@@ -236,8 +222,79 @@ declare const dotenvExpandAll: (values?: ProcessEnv, options?: {
|
|
|
236
222
|
*/
|
|
237
223
|
declare const dotenvExpandFromProcessEnv: (value: string | undefined) => string | undefined;
|
|
238
224
|
|
|
225
|
+
type Scripts = Record<string, string | {
|
|
226
|
+
cmd: string;
|
|
227
|
+
shell?: string | boolean;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
231
|
+
*/
|
|
232
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
233
|
+
/**
|
|
234
|
+
* Logs CLI internals when true.
|
|
235
|
+
*/
|
|
236
|
+
debug?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
239
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
240
|
+
*/
|
|
241
|
+
capture?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* A delimited string of paths to dotenv files.
|
|
244
|
+
*/
|
|
245
|
+
paths?: string;
|
|
246
|
+
/**
|
|
247
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
248
|
+
* `pathsDelimiterPattern` is not provided.
|
|
249
|
+
*/
|
|
250
|
+
pathsDelimiter?: string;
|
|
251
|
+
/**
|
|
252
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
253
|
+
* `pathsDelimiter`.
|
|
254
|
+
*/
|
|
255
|
+
pathsDelimiterPattern?: string;
|
|
256
|
+
/**
|
|
257
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
258
|
+
*/
|
|
259
|
+
scripts?: Scripts;
|
|
260
|
+
/**
|
|
261
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
262
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
263
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
264
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
265
|
+
* `/bin/bash`)
|
|
266
|
+
*/
|
|
267
|
+
shell?: string | boolean;
|
|
268
|
+
/**
|
|
269
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
270
|
+
* values to be loaded in addition to any dotenv files.
|
|
271
|
+
*/
|
|
272
|
+
vars?: string;
|
|
273
|
+
/**
|
|
274
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
275
|
+
* `varsDelimiterPattern` is not provided.
|
|
276
|
+
*/
|
|
277
|
+
varsAssignor?: string;
|
|
278
|
+
/**
|
|
279
|
+
* A regular expression pattern with which to split variable names from values
|
|
280
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
281
|
+
*/
|
|
282
|
+
varsAssignorPattern?: string;
|
|
283
|
+
/**
|
|
284
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
285
|
+
* `varsDelimiterPattern` is not provided.
|
|
286
|
+
*/
|
|
287
|
+
varsDelimiter?: string;
|
|
288
|
+
/**
|
|
289
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
290
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
291
|
+
*/
|
|
292
|
+
varsDelimiterPattern?: string;
|
|
293
|
+
}
|
|
294
|
+
|
|
239
295
|
/**
|
|
240
|
-
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
296
|
+
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
297
|
+
* executes side effects within the `getDotenv` context.
|
|
241
298
|
*/
|
|
242
299
|
type GetDotenvCliPreHookCallback = (options: GetDotenvCliOptions) => Promise<void>;
|
|
243
300
|
/**
|
|
@@ -280,7 +337,8 @@ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
|
|
|
280
337
|
}
|
|
281
338
|
|
|
282
339
|
/**
|
|
283
|
-
* Generate a Commander CLI Command for get-dotenv.
|
|
340
|
+
* Generate a Commander CLI Command for get-dotenv.
|
|
341
|
+
* Orchestration only: delegates building and lifecycle hooks.
|
|
284
342
|
*/
|
|
285
343
|
declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, "importMetaUrl"> & Partial<Omit<GetDotenvCliGenerateOptions, "importMetaUrl">>) => Promise<Command>;
|
|
286
344
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,75 +1,54 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
|
|
3
|
-
type Scripts = Record<string, string | {
|
|
4
|
-
cmd: string;
|
|
5
|
-
shell?: string | boolean;
|
|
6
|
-
}>;
|
|
7
3
|
/**
|
|
8
|
-
*
|
|
4
|
+
* Minimal root options shape shared by CLI and generator layers.
|
|
5
|
+
* Keep keys optional to respect exactOptionalPropertyTypes semantics.
|
|
9
6
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
type RootOptionsShape = {
|
|
8
|
+
env?: string;
|
|
9
|
+
vars?: string;
|
|
10
|
+
command?: string;
|
|
11
|
+
outputPath?: string;
|
|
12
|
+
shell?: string | boolean;
|
|
13
|
+
loadProcess?: boolean;
|
|
14
|
+
excludeAll?: boolean;
|
|
15
|
+
excludeDynamic?: boolean;
|
|
16
|
+
excludeEnv?: boolean;
|
|
17
|
+
excludeGlobal?: boolean;
|
|
18
|
+
excludePrivate?: boolean;
|
|
19
|
+
excludePublic?: boolean;
|
|
20
|
+
log?: boolean;
|
|
14
21
|
debug?: boolean;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
capture?: boolean;
|
|
23
|
+
defaultEnv?: string;
|
|
24
|
+
dotenvToken?: string;
|
|
25
|
+
dynamicPath?: string;
|
|
26
|
+
trace?: boolean | string[];
|
|
18
27
|
paths?: string;
|
|
19
|
-
/**
|
|
20
|
-
* A delimiter string with which to split `paths`. Only used if
|
|
21
|
-
* `pathsDelimiterPattern` is not provided.
|
|
22
|
-
*/
|
|
23
28
|
pathsDelimiter?: string;
|
|
24
|
-
/**
|
|
25
|
-
* A regular expression pattern with which to split `paths`. Supersedes
|
|
26
|
-
* `pathsDelimiter`.
|
|
27
|
-
*/
|
|
28
29
|
pathsDelimiterPattern?: string;
|
|
29
|
-
|
|
30
|
-
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
31
|
-
*/
|
|
32
|
-
scripts?: Scripts;
|
|
33
|
-
/**
|
|
34
|
-
* Determines how commands and scripts are executed. If `false` or
|
|
35
|
-
* `undefined`, commands are executed as plain Javascript using the default
|
|
36
|
-
* execa parser. If `true`, commands are executed using the default OS shell
|
|
37
|
-
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
38
|
-
* `/bin/bash`)
|
|
39
|
-
*/
|
|
40
|
-
shell?: string | boolean;
|
|
41
|
-
/**
|
|
42
|
-
* A delimited string of key-value pairs declaratively specifying variables &
|
|
43
|
-
* values to be loaded in addition to any dotenv files.
|
|
44
|
-
*/
|
|
45
|
-
vars?: string;
|
|
46
|
-
/**
|
|
47
|
-
* A string with which to split keys from values in `vars`. Only used if
|
|
48
|
-
* `varsDelimiterPattern` is not provided.
|
|
49
|
-
*/
|
|
50
|
-
varsAssignor?: string;
|
|
51
|
-
/**
|
|
52
|
-
* A regular expression pattern with which to split variable names from values
|
|
53
|
-
* in `vars`. Supersedes `varsAssignor`.
|
|
54
|
-
*/
|
|
55
|
-
varsAssignorPattern?: string;
|
|
56
|
-
/**
|
|
57
|
-
* A string with which to split `vars` into key-value pairs. Only used if
|
|
58
|
-
* `varsDelimiterPattern` is not provided.
|
|
59
|
-
*/
|
|
30
|
+
privateToken?: string;
|
|
60
31
|
varsDelimiter?: string;
|
|
61
|
-
/**
|
|
62
|
-
* A regular expression pattern with which to split `vars` into key-value
|
|
63
|
-
* pairs. Supersedes `varsDelimiter`.
|
|
64
|
-
*/
|
|
65
32
|
varsDelimiterPattern?: string;
|
|
66
|
-
|
|
33
|
+
varsAssignor?: string;
|
|
34
|
+
varsAssignorPattern?: string;
|
|
35
|
+
scripts?: ScriptsTable;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Scripts table shape (configurable shell type).
|
|
39
|
+
*/
|
|
40
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
41
|
+
cmd: string;
|
|
42
|
+
shell?: TShell;
|
|
43
|
+
}>;
|
|
67
44
|
|
|
45
|
+
type RootOptionsShapeCompat = Omit<RootOptionsShape, 'vars' | 'paths'> & {
|
|
46
|
+
vars?: string | Record<string, string | undefined>;
|
|
47
|
+
paths?: string | string[];
|
|
48
|
+
};
|
|
68
49
|
/**
|
|
69
50
|
* A minimal representation of an environment key/value mapping.
|
|
70
|
-
* Values may be `undefined` to represent "unset".
|
|
71
|
-
*/
|
|
72
|
-
type ProcessEnv = Record<string, string | undefined>;
|
|
51
|
+
* Values may be `undefined` to represent "unset". */ type ProcessEnv = Record<string, string | undefined>;
|
|
73
52
|
/**
|
|
74
53
|
* Dynamic variable function signature. Receives the current expanded variables
|
|
75
54
|
* and the selected environment (if any), and returns either a string to set
|
|
@@ -158,15 +137,22 @@ interface GetDotenvOptions {
|
|
|
158
137
|
* explicit variables to include
|
|
159
138
|
*/
|
|
160
139
|
vars?: ProcessEnv;
|
|
140
|
+
/**
|
|
141
|
+
* Reserved: config loader flag (no-op).
|
|
142
|
+
* The plugin-first host and generator paths already use the config
|
|
143
|
+
* loader/overlay pipeline unconditionally (no-op when no config files
|
|
144
|
+
* are present). This flag is accepted for forward compatibility but
|
|
145
|
+
* currently has no effect.
|
|
146
|
+
*/
|
|
147
|
+
useConfigLoader?: boolean;
|
|
161
148
|
}
|
|
162
149
|
/**
|
|
163
|
-
* Converts programmatic CLI options to `getDotenv` options.
|
|
164
|
-
*
|
|
150
|
+
* Converts programmatic CLI options to `getDotenv` options. *
|
|
165
151
|
* @param cliOptions - CLI options. Defaults to `{}`.
|
|
166
152
|
*
|
|
167
153
|
* @returns `getDotenv` options.
|
|
168
154
|
*/
|
|
169
|
-
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }:
|
|
155
|
+
declare const getDotenvCliOptions2Options: ({ paths, pathsDelimiter, pathsDelimiterPattern, vars, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, ...rest }: RootOptionsShapeCompat) => GetDotenvOptions;
|
|
170
156
|
|
|
171
157
|
/**
|
|
172
158
|
* Recursively expands environment variables in a string. Variables may be
|
|
@@ -236,8 +222,79 @@ declare const dotenvExpandAll: (values?: ProcessEnv, options?: {
|
|
|
236
222
|
*/
|
|
237
223
|
declare const dotenvExpandFromProcessEnv: (value: string | undefined) => string | undefined;
|
|
238
224
|
|
|
225
|
+
type Scripts = Record<string, string | {
|
|
226
|
+
cmd: string;
|
|
227
|
+
shell?: string | boolean;
|
|
228
|
+
}>;
|
|
229
|
+
/**
|
|
230
|
+
* Options passed programmatically to `getDotenvCli`.
|
|
231
|
+
*/
|
|
232
|
+
interface GetDotenvCliOptions extends Omit<GetDotenvOptions, 'paths' | 'vars'> {
|
|
233
|
+
/**
|
|
234
|
+
* Logs CLI internals when true.
|
|
235
|
+
*/
|
|
236
|
+
debug?: boolean;
|
|
237
|
+
/**
|
|
238
|
+
* When true, capture child stdout/stderr and re-emit after completion.
|
|
239
|
+
* Useful for tests/CI. Default behavior is streaming via stdio: 'inherit'.
|
|
240
|
+
*/
|
|
241
|
+
capture?: boolean;
|
|
242
|
+
/**
|
|
243
|
+
* A delimited string of paths to dotenv files.
|
|
244
|
+
*/
|
|
245
|
+
paths?: string;
|
|
246
|
+
/**
|
|
247
|
+
* A delimiter string with which to split `paths`. Only used if
|
|
248
|
+
* `pathsDelimiterPattern` is not provided.
|
|
249
|
+
*/
|
|
250
|
+
pathsDelimiter?: string;
|
|
251
|
+
/**
|
|
252
|
+
* A regular expression pattern with which to split `paths`. Supersedes
|
|
253
|
+
* `pathsDelimiter`.
|
|
254
|
+
*/
|
|
255
|
+
pathsDelimiterPattern?: string;
|
|
256
|
+
/**
|
|
257
|
+
* Scripts that can be executed from the CLI, either individually or via the batch subcommand.
|
|
258
|
+
*/
|
|
259
|
+
scripts?: Scripts;
|
|
260
|
+
/**
|
|
261
|
+
* Determines how commands and scripts are executed. If `false` or
|
|
262
|
+
* `undefined`, commands are executed as plain Javascript using the default
|
|
263
|
+
* execa parser. If `true`, commands are executed using the default OS shell
|
|
264
|
+
* parser. Otherwise the user may provide a specific shell string (e.g.
|
|
265
|
+
* `/bin/bash`)
|
|
266
|
+
*/
|
|
267
|
+
shell?: string | boolean;
|
|
268
|
+
/**
|
|
269
|
+
* A delimited string of key-value pairs declaratively specifying variables &
|
|
270
|
+
* values to be loaded in addition to any dotenv files.
|
|
271
|
+
*/
|
|
272
|
+
vars?: string;
|
|
273
|
+
/**
|
|
274
|
+
* A string with which to split keys from values in `vars`. Only used if
|
|
275
|
+
* `varsDelimiterPattern` is not provided.
|
|
276
|
+
*/
|
|
277
|
+
varsAssignor?: string;
|
|
278
|
+
/**
|
|
279
|
+
* A regular expression pattern with which to split variable names from values
|
|
280
|
+
* in `vars`. Supersedes `varsAssignor`.
|
|
281
|
+
*/
|
|
282
|
+
varsAssignorPattern?: string;
|
|
283
|
+
/**
|
|
284
|
+
* A string with which to split `vars` into key-value pairs. Only used if
|
|
285
|
+
* `varsDelimiterPattern` is not provided.
|
|
286
|
+
*/
|
|
287
|
+
varsDelimiter?: string;
|
|
288
|
+
/**
|
|
289
|
+
* A regular expression pattern with which to split `vars` into key-value
|
|
290
|
+
* pairs. Supersedes `varsDelimiter`.
|
|
291
|
+
*/
|
|
292
|
+
varsDelimiterPattern?: string;
|
|
293
|
+
}
|
|
294
|
+
|
|
239
295
|
/**
|
|
240
|
-
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
296
|
+
* GetDotenv CLI Pre-hook Callback function type. Mutates inbound options &
|
|
297
|
+
* executes side effects within the `getDotenv` context.
|
|
241
298
|
*/
|
|
242
299
|
type GetDotenvCliPreHookCallback = (options: GetDotenvCliOptions) => Promise<void>;
|
|
243
300
|
/**
|
|
@@ -280,7 +337,8 @@ interface GetDotenvCliGenerateOptions extends GetDotenvCliOptions {
|
|
|
280
337
|
}
|
|
281
338
|
|
|
282
339
|
/**
|
|
283
|
-
* Generate a Commander CLI Command for get-dotenv.
|
|
340
|
+
* Generate a Commander CLI Command for get-dotenv.
|
|
341
|
+
* Orchestration only: delegates building and lifecycle hooks.
|
|
284
342
|
*/
|
|
285
343
|
declare const generateGetDotenvCli: (customOptions: Pick<GetDotenvCliGenerateOptions, "importMetaUrl"> & Partial<Omit<GetDotenvCliGenerateOptions, "importMetaUrl">>) => Promise<Command>;
|
|
286
344
|
|