@karmaniverous/get-dotenv 7.0.2 → 7.0.4

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.
Files changed (46) hide show
  1. package/README.md +2 -0
  2. package/dist/chunks/{AwsRestJsonProtocol-Bh3OvjNM.mjs → AwsRestJsonProtocol-4m7HHwvS.mjs} +2 -2
  3. package/dist/chunks/{createCli-wmAcTdWR.mjs → createCli-CVvh-dBp.mjs} +18 -5
  4. package/dist/chunks/{externalDataInterceptor-BBvsYwZE.mjs → externalDataInterceptor-DyDNbv-D.mjs} +2 -2
  5. package/dist/chunks/{getSSOTokenFromFile-BSeYpbLi.mjs → getSSOTokenFromFile-CkYcEieD.mjs} +1 -1
  6. package/dist/chunks/{index-BZrYAvLs.mjs → index-B35hOhgq.mjs} +5 -5
  7. package/dist/chunks/{index-C-9h7h7x.mjs → index-B3fM_U6F.mjs} +8 -8
  8. package/dist/chunks/{index-DLciMnJ6.mjs → index-B_yJRqty.mjs} +5 -5
  9. package/dist/chunks/{index-CGG9e0xu.mjs → index-BuxEK_Z4.mjs} +9 -9
  10. package/dist/chunks/{index-aUz_8rS_.mjs → index-C58EanKv.mjs} +3 -3
  11. package/dist/chunks/{index-GcL_Hrrr.mjs → index-CjWZ4uNg.mjs} +6 -6
  12. package/dist/chunks/{index-CnnI9zSQ.mjs → index-CsI5JuIM.mjs} +4 -4
  13. package/dist/chunks/{index-DmynYewb.mjs → index-D-a5vkZL.mjs} +6 -6
  14. package/dist/chunks/{index-CQoEnkSc.mjs → index-D6iVe1wh.mjs} +3 -3
  15. package/dist/chunks/{index-BhMXFr37.mjs → index-Dd6S1nZ-.mjs} +3 -3
  16. package/dist/chunks/{index-DyRIwYWf.mjs → index-Dl8qC51H.mjs} +3 -3
  17. package/dist/chunks/{index-cIL2r09o.mjs → index-FT37CtcF.mjs} +4 -4
  18. package/dist/chunks/{index-tlD9zcww.mjs → index-QkVZTs6l.mjs} +13 -13
  19. package/dist/chunks/{loadSso-9hx2nl0k.mjs → loadSso-DF7GLUZf.mjs} +5 -5
  20. package/dist/chunks/{loader-CE4HSRN4.mjs → loader-V1vbmtyw.mjs} +2 -0
  21. package/dist/chunks/{parseKnownFiles-CewXrtbo.mjs → parseKnownFiles-BZNrX_JE.mjs} +1 -1
  22. package/dist/chunks/{readMergedOptions-atT1xkoe.mjs → readMergedOptions-CraAnYdB.mjs} +33 -7
  23. package/dist/chunks/{resolveCliOptions-BLSqCGm7.mjs → resolveCliOptions-BMBkWDYJ.mjs} +1 -1
  24. package/dist/chunks/{sdk-stream-mixin-CMdQ7nO8.mjs → sdk-stream-mixin-BL49AxZx.mjs} +1 -1
  25. package/dist/chunks/{types-BdKCfPRW.mjs → types-BthqmnDr.mjs} +1 -1
  26. package/dist/cli.d.ts +8 -0
  27. package/dist/cli.mjs +6 -6
  28. package/dist/cliHost.d.ts +8 -0
  29. package/dist/cliHost.mjs +4 -4
  30. package/dist/config.d.ts +2 -0
  31. package/dist/config.mjs +1 -1
  32. package/dist/env-overlay.d.ts +2 -0
  33. package/dist/getdotenv.cli.mjs +6 -6
  34. package/dist/index.d.ts +10 -0
  35. package/dist/index.mjs +9 -9
  36. package/dist/plugins-aws.d.ts +6 -0
  37. package/dist/plugins-aws.mjs +2 -2
  38. package/dist/plugins-batch.d.ts +6 -0
  39. package/dist/plugins-batch.mjs +2 -2
  40. package/dist/plugins-cmd.d.ts +6 -0
  41. package/dist/plugins-cmd.mjs +4 -4
  42. package/dist/plugins-init.d.ts +6 -0
  43. package/dist/plugins-init.mjs +2 -2
  44. package/dist/plugins.d.ts +6 -0
  45. package/dist/plugins.mjs +5 -5
  46. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { at as loadSharedConfigFiles } from './index-CGG9e0xu.mjs';
1
+ import { at as loadSharedConfigFiles } from './index-BuxEK_Z4.mjs';
2
2
 
3
3
  const mergeConfigFiles = (...files) => {
4
4
  const merged = {};
@@ -10,7 +10,7 @@ import 'node:buffer';
10
10
  import 'crypto';
11
11
  import { fileURLToPath } from 'url';
12
12
  import 'dotenv';
13
- import { g as getDotenvOptionsSchemaResolved, r as resolveGetDotenvConfigSources } from './loader-CE4HSRN4.mjs';
13
+ import { g as getDotenvOptionsSchemaResolved, r as resolveGetDotenvConfigSources } from './loader-V1vbmtyw.mjs';
14
14
  import { packageDirectory } from 'package-directory';
15
15
 
16
16
  /**
@@ -143,6 +143,7 @@ const baseScripts = {
143
143
  * @public
144
144
  */
145
145
  const baseRootOptionDefaults = {
146
+ defaultEnvKey: 'DEFAULT_ENV',
146
147
  dotenvToken: '.env',
147
148
  loadProcess: true,
148
149
  logger: console,
@@ -355,8 +356,29 @@ const computeContext = async (customOptions, plugins, hostMetaUrl) => {
355
356
  const validated = getDotenvOptionsSchemaResolved.parse(optionsResolved);
356
357
  // Discover config sources.
357
358
  const sources = await resolveGetDotenvConfigSources(hostMetaUrl);
359
+ // Pre-pass: read global-only files to resolve defaultEnvKey (skip when env is explicit).
360
+ let fileDefaultEnv;
361
+ if (!validated.env) {
362
+ const defaultEnvKey = validated.defaultEnvKey ?? 'DEFAULT_ENV';
363
+ const prePass = await readDotenvCascadeWithProvenance({
364
+ paths: Array.isArray(validated.paths) ? validated.paths : [],
365
+ ...(typeof validated.dotenvToken === 'string'
366
+ ? { dotenvToken: validated.dotenvToken }
367
+ : {}),
368
+ ...(typeof validated.privateToken === 'string'
369
+ ? { privateToken: validated.privateToken }
370
+ : {}),
371
+ excludeEnv: true,
372
+ });
373
+ fileDefaultEnv = prePass.dotenv[defaultEnvKey];
374
+ }
375
+ // Resolution: env > fileDefaultEnv > defaultEnv
376
+ const envName = validated.env
377
+ ?? (typeof fileDefaultEnv === 'string' && fileDefaultEnv.length > 0
378
+ ? fileDefaultEnv
379
+ : undefined)
380
+ ?? validated.defaultEnv;
358
381
  // Base dotenv from files (with file provenance; no dynamics; no programmatic vars; no side effects).
359
- const envName = validated.env ?? validated.defaultEnv;
360
382
  const fileRes = await readDotenvCascadeWithProvenance({
361
383
  paths: Array.isArray(validated.paths) ? validated.paths : [],
362
384
  ...(typeof validated.dotenvToken === 'string'
@@ -365,10 +387,7 @@ const computeContext = async (customOptions, plugins, hostMetaUrl) => {
365
387
  ...(typeof validated.privateToken === 'string'
366
388
  ? { privateToken: validated.privateToken }
367
389
  : {}),
368
- ...(typeof validated.env === 'string' ? { env: validated.env } : {}),
369
- ...(typeof validated.defaultEnv === 'string'
370
- ? { defaultEnv: validated.defaultEnv }
371
- : {}),
390
+ ...(typeof envName === 'string' ? { env: envName } : {}),
372
391
  ...(validated.excludeEnv === true ? { excludeEnv: true } : {}),
373
392
  ...(validated.excludeGlobal === true ? { excludeGlobal: true } : {}),
374
393
  ...(validated.excludePrivate === true ? { excludePrivate: true } : {}),
@@ -467,6 +486,7 @@ const computeContext = async (customOptions, plugins, hostMetaUrl) => {
467
486
  }
468
487
  }
469
488
  return {
489
+ ...(typeof envName === 'string' ? { env: envName } : {}),
470
490
  optionsResolved: validated,
471
491
  dotenv,
472
492
  dotenvProvenance,
@@ -549,7 +569,7 @@ function definePlugin(spec) {
549
569
  */
550
570
  const attachRootOptions = (program, defaults) => {
551
571
  const GROUP = 'base';
552
- const { defaultEnv, dotenvToken, dynamicPath, env, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
572
+ const { defaultEnv, defaultEnvKey, dotenvToken, dynamicPath, env, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
553
573
  const va = typeof defaults?.varsAssignor === 'string' ? defaults.varsAssignor : '=';
554
574
  const vd = typeof defaults?.varsDelimiter === 'string' ? defaults.varsDelimiter : ' ';
555
575
  // Helper: append (default) tags for ON/OFF toggles
@@ -731,6 +751,12 @@ const attachRootOptions = (program, defaults) => {
731
751
  o1.default(defaultEnv);
732
752
  program.addOption(o1);
733
753
  program.setOptionGroup(o1, GROUP);
754
+ const o1b = new Option('--default-env-key <string>', 'env var name in global dotenv files that specifies the default environment (dotenv-expanded)');
755
+ o1b.argParser(dotenvExpandFromProcessEnv);
756
+ if (defaultEnvKey !== undefined)
757
+ o1b.default(defaultEnvKey);
758
+ program.addOption(o1b);
759
+ program.setOptionGroup(o1b, GROUP);
734
760
  const o2 = new Option('--dotenv-token <string>', 'dotenv-expanded token indicating a dotenv file');
735
761
  o2.argParser(dotenvExpandFromProcessEnv);
736
762
  if (dotenvToken !== undefined)
@@ -1,4 +1,4 @@
1
- import { c as baseRootOptionDefaults, d as defaultsDeep } from './readMergedOptions-atT1xkoe.mjs';
1
+ import { c as baseRootOptionDefaults, d as defaultsDeep } from './readMergedOptions-CraAnYdB.mjs';
2
2
  import 'radash';
3
3
  import 'node:buffer';
4
4
  import 'fs-extra';
@@ -1,5 +1,5 @@
1
1
  import { Writable, Readable } from 'node:stream';
2
- import { aS as toHex, a5 as fromArrayBuffer } from './index-CGG9e0xu.mjs';
2
+ import { aS as toHex, a5 as fromArrayBuffer } from './index-BuxEK_Z4.mjs';
3
3
 
4
4
  const isReadableStream = (stream) => typeof ReadableStream === "function" &&
5
5
  (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
@@ -1,4 +1,4 @@
1
- import { g as definePlugin } from './readMergedOptions-atT1xkoe.mjs';
1
+ import { g as definePlugin } from './readMergedOptions-CraAnYdB.mjs';
2
2
 
3
3
  /**
4
4
  * Create a namespace-only parent plugin (a group command) for composing plugins
package/dist/cli.d.ts CHANGED
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -271,6 +273,8 @@ interface RootOptionsShape {
271
273
  redactPatterns?: string[];
272
274
  /** Default target environment when not specified. */
273
275
  defaultEnv?: string;
276
+ /** Env var name in global dotenv files that specifies the default environment. */
277
+ defaultEnvKey?: string;
274
278
  /** Token indicating a dotenv file (default: ".env"). */
275
279
  dotenvToken?: string;
276
280
  /** Path to dynamic variables module (default: undefined). */
@@ -319,6 +323,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
319
323
  * @public
320
324
  */
321
325
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
326
+ /**
327
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
328
+ */
329
+ env?: string;
322
330
  /**
323
331
  * Fully resolved option bag used to compute this context.
324
332
  */
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { c as createCli } from './chunks/createCli-wmAcTdWR.mjs';
1
+ export { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
2
2
  import 'zod';
3
3
  import 'path';
4
- import './chunks/loader-CE4HSRN4.mjs';
4
+ import './chunks/loader-V1vbmtyw.mjs';
5
5
  import 'fs-extra';
6
6
  import 'package-directory';
7
7
  import 'url';
@@ -13,16 +13,16 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
13
13
  import 'crypto';
14
14
  import '@commander-js/extra-typings';
15
15
  import 'nanoid';
16
- import './chunks/readMergedOptions-atT1xkoe.mjs';
16
+ import './chunks/readMergedOptions-CraAnYdB.mjs';
17
17
  import './chunks/readDotenvCascade-Dgx4SC1p.mjs';
18
18
  import 'dotenv';
19
19
  import 'execa';
20
20
  import './chunks/helpConfig-CGejgwWW.mjs';
21
- import './chunks/resolveCliOptions-BLSqCGm7.mjs';
21
+ import './chunks/resolveCliOptions-BMBkWDYJ.mjs';
22
22
  import './chunks/validate-CDl0rE6k.mjs';
23
23
  import './plugins-aws.mjs';
24
24
  import './chunks/spawnEnv-CKgnHGpr.mjs';
25
- import './chunks/index-CGG9e0xu.mjs';
25
+ import './chunks/index-BuxEK_Z4.mjs';
26
26
  import 'node:os';
27
27
  import 'node:fs/promises';
28
28
  import 'node:stream';
@@ -33,7 +33,7 @@ import 'node:process';
33
33
  import './plugins-batch.mjs';
34
34
  import './chunks/invoke-DuRPU1oC.mjs';
35
35
  import 'globby';
36
- import './chunks/index-BhMXFr37.mjs';
36
+ import './chunks/index-Dd6S1nZ-.mjs';
37
37
  import './plugins-init.mjs';
38
38
  import 'readline/promises';
39
39
  import 'node:url';
package/dist/cliHost.d.ts CHANGED
@@ -145,6 +145,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
145
145
  */
146
146
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
147
147
  defaultEnv: z.ZodOptional<z.ZodString>;
148
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
148
149
  dotenvToken: z.ZodOptional<z.ZodString>;
149
150
  dynamicPath: z.ZodOptional<z.ZodString>;
150
151
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -196,6 +197,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
196
197
  */
197
198
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
198
199
  defaultEnv: z.ZodOptional<z.ZodString>;
200
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
199
201
  dotenvToken: z.ZodOptional<z.ZodString>;
200
202
  dynamicPath: z.ZodOptional<z.ZodString>;
201
203
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -272,6 +274,8 @@ interface RootOptionsShape {
272
274
  redactPatterns?: string[];
273
275
  /** Default target environment when not specified. */
274
276
  defaultEnv?: string;
277
+ /** Env var name in global dotenv files that specifies the default environment. */
278
+ defaultEnvKey?: string;
275
279
  /** Token indicating a dotenv file (default: ".env"). */
276
280
  dotenvToken?: string;
277
281
  /** Path to dynamic variables module (default: undefined). */
@@ -325,6 +329,10 @@ declare const defineScripts: <TShell extends string | boolean>() => <T extends S
325
329
  * @public
326
330
  */
327
331
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
332
+ /**
333
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
334
+ */
335
+ env?: string;
328
336
  /**
329
337
  * Fully resolved option bag used to compute this context.
330
338
  */
package/dist/cliHost.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { G as GetDotenvCli, g as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-atT1xkoe.mjs';
1
+ export { G as GetDotenvCli, g as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-CraAnYdB.mjs';
2
2
  export { b as buildSpawnEnv, r as resolveCommand, a as resolveShell, c as runCommand, d as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-CKgnHGpr.mjs';
3
- export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-BLSqCGm7.mjs';
4
- export { d as defineScripts, g as groupPlugins } from './chunks/types-BdKCfPRW.mjs';
3
+ export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-BMBkWDYJ.mjs';
4
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-BthqmnDr.mjs';
5
5
  export { t as toHelpConfig } from './chunks/helpConfig-CGejgwWW.mjs';
6
6
  export { c as composeNestedEnv, m as maybePreserveNodeEvalArgv, s as stripOne } from './chunks/invoke-DuRPU1oC.mjs';
7
7
  export { z } from 'zod';
@@ -17,7 +17,7 @@ import 'path';
17
17
  import 'url';
18
18
  import 'dotenv';
19
19
  import 'nanoid';
20
- import './chunks/loader-CE4HSRN4.mjs';
20
+ import './chunks/loader-V1vbmtyw.mjs';
21
21
  import 'package-directory';
22
22
  import 'yaml';
23
23
  import 'execa';
package/dist/config.d.ts CHANGED
@@ -56,6 +56,8 @@ interface RootOptionsShape {
56
56
  redactPatterns?: string[];
57
57
  /** Default target environment when not specified. */
58
58
  defaultEnv?: string;
59
+ /** Env var name in global dotenv files that specifies the default environment. */
60
+ defaultEnvKey?: string;
59
61
  /** Token indicating a dotenv file (default: ".env"). */
60
62
  dotenvToken?: string;
61
63
  /** Path to dynamic variables module (default: undefined). */
package/dist/config.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-CE4HSRN4.mjs';
1
+ export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-V1vbmtyw.mjs';
2
2
  export { v as validateEnvAgainstSources } from './chunks/validate-CDl0rE6k.mjs';
3
3
  import 'fs-extra';
4
4
  import 'package-directory';
@@ -56,6 +56,8 @@ interface RootOptionsShape {
56
56
  redactPatterns?: string[];
57
57
  /** Default target environment when not specified. */
58
58
  defaultEnv?: string;
59
+ /** Env var name in global dotenv files that specifies the default environment. */
60
+ defaultEnvKey?: string;
59
61
  /** Token indicating a dotenv file (default: ".env"). */
60
62
  dotenvToken?: string;
61
63
  /** Path to dynamic variables module (default: undefined). */
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { c as createCli } from './chunks/createCli-wmAcTdWR.mjs';
2
+ import { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
3
3
  import 'zod';
4
4
  import 'path';
5
- import './chunks/loader-CE4HSRN4.mjs';
5
+ import './chunks/loader-V1vbmtyw.mjs';
6
6
  import 'fs-extra';
7
7
  import 'package-directory';
8
8
  import 'url';
@@ -14,16 +14,16 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
14
14
  import 'crypto';
15
15
  import '@commander-js/extra-typings';
16
16
  import 'nanoid';
17
- import './chunks/readMergedOptions-atT1xkoe.mjs';
17
+ import './chunks/readMergedOptions-CraAnYdB.mjs';
18
18
  import './chunks/readDotenvCascade-Dgx4SC1p.mjs';
19
19
  import 'dotenv';
20
20
  import 'execa';
21
21
  import './chunks/helpConfig-CGejgwWW.mjs';
22
- import './chunks/resolveCliOptions-BLSqCGm7.mjs';
22
+ import './chunks/resolveCliOptions-BMBkWDYJ.mjs';
23
23
  import './chunks/validate-CDl0rE6k.mjs';
24
24
  import './plugins-aws.mjs';
25
25
  import './chunks/spawnEnv-CKgnHGpr.mjs';
26
- import './chunks/index-CGG9e0xu.mjs';
26
+ import './chunks/index-BuxEK_Z4.mjs';
27
27
  import 'node:os';
28
28
  import 'node:fs/promises';
29
29
  import 'node:stream';
@@ -34,7 +34,7 @@ import 'node:process';
34
34
  import './plugins-batch.mjs';
35
35
  import './chunks/invoke-DuRPU1oC.mjs';
36
36
  import 'globby';
37
- import './chunks/index-BhMXFr37.mjs';
37
+ import './chunks/index-Dd6S1nZ-.mjs';
38
38
  import './plugins-init.mjs';
39
39
  import 'readline/promises';
40
40
  import 'node:url';
package/dist/index.d.ts CHANGED
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -271,6 +273,8 @@ interface RootOptionsShape {
271
273
  redactPatterns?: string[];
272
274
  /** Default target environment when not specified. */
273
275
  defaultEnv?: string;
276
+ /** Env var name in global dotenv files that specifies the default environment. */
277
+ defaultEnvKey?: string;
274
278
  /** Token indicating a dotenv file (default: ".env"). */
275
279
  dotenvToken?: string;
276
280
  /** Path to dynamic variables module (default: undefined). */
@@ -324,6 +328,10 @@ declare const defineScripts: <TShell extends string | boolean>() => <T extends S
324
328
  * @public
325
329
  */
326
330
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
331
+ /**
332
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
333
+ */
334
+ env?: string;
327
335
  /**
328
336
  * Fully resolved option bag used to compute this context.
329
337
  */
@@ -1109,6 +1117,8 @@ interface BaseRootOptionDefaults {
1109
1117
  entropyMinLength: number;
1110
1118
  /** Regex patterns (as strings) to suppress entropy warnings by key. */
1111
1119
  entropyWhitelist: string[];
1120
+ /** Env var name in global dotenv files that specifies the default environment. */
1121
+ defaultEnvKey: string;
1112
1122
  /** Default dotenv search paths (stringly, CLI-compatible). */
1113
1123
  paths: string;
1114
1124
  /** Paths delimiter used for the `--paths` string. */
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- export { c as createCli } from './chunks/createCli-wmAcTdWR.mjs';
2
- import { j as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-atT1xkoe.mjs';
3
- export { G as GetDotenvCli, a as assertLogger, c as baseRootOptionDefaults, d as defaultsDeep, e as defineDynamic, f as defineGetDotenvConfig, g as definePlugin, h as getDotenvCliOptions2Options, i as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-atT1xkoe.mjs';
1
+ export { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
2
+ import { j as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-CraAnYdB.mjs';
3
+ export { G as GetDotenvCli, a as assertLogger, c as baseRootOptionDefaults, d as defaultsDeep, e as defineDynamic, f as defineGetDotenvConfig, g as definePlugin, h as getDotenvCliOptions2Options, i as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-CraAnYdB.mjs';
4
4
  export { b as buildSpawnEnv, s as shouldCapture, t as tokenize } from './chunks/spawnEnv-CKgnHGpr.mjs';
5
- export { d as defineScripts, g as groupPlugins } from './chunks/types-BdKCfPRW.mjs';
5
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-BthqmnDr.mjs';
6
6
  import { omit, pick } from 'radash';
7
7
  import { Buffer } from 'node:buffer';
8
8
  export { l as loadModuleDefault } from './chunks/loadModuleDefault-Dj8B3Stt.mjs';
@@ -10,8 +10,8 @@ import { InvalidArgumentError } from '@commander-js/extra-typings';
10
10
  import 'zod';
11
11
  import { nanoid } from 'nanoid';
12
12
  import path$1 from 'path';
13
- import { a as redactObject, m as maybeWarnEntropy } from './chunks/index-BhMXFr37.mjs';
14
- export { r as redactDisplay, t as traceChildEnv } from './chunks/index-BhMXFr37.mjs';
13
+ import { a as redactObject, m as maybeWarnEntropy } from './chunks/index-Dd6S1nZ-.mjs';
14
+ export { r as redactDisplay, t as traceChildEnv } from './chunks/index-Dd6S1nZ-.mjs';
15
15
  import { r as readDotenv, e as dotenvExpandAll, a as applyDynamicMap, l as loadAndApplyDynamic } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
16
16
  export { d as dotenvExpand, f as dotenvExpandFromProcessEnv } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
17
17
  import fs from 'fs-extra';
@@ -19,15 +19,15 @@ import path from 'node:path';
19
19
  import 'crypto';
20
20
  import 'url';
21
21
  import 'dotenv';
22
- import './chunks/loader-CE4HSRN4.mjs';
22
+ import './chunks/loader-V1vbmtyw.mjs';
23
23
  import 'package-directory';
24
24
  import 'yaml';
25
25
  import 'execa';
26
26
  import './chunks/helpConfig-CGejgwWW.mjs';
27
- import './chunks/resolveCliOptions-BLSqCGm7.mjs';
27
+ import './chunks/resolveCliOptions-BMBkWDYJ.mjs';
28
28
  import './chunks/validate-CDl0rE6k.mjs';
29
29
  import './plugins-aws.mjs';
30
- import './chunks/index-CGG9e0xu.mjs';
30
+ import './chunks/index-BuxEK_Z4.mjs';
31
31
  import 'node:os';
32
32
  import 'node:fs/promises';
33
33
  import 'node:stream';
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -232,6 +234,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
232
234
  * @public
233
235
  */
234
236
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
237
+ /**
238
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
239
+ */
240
+ env?: string;
235
241
  /**
236
242
  * Fully resolved option bag used to compute this context.
237
243
  */
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-atT1xkoe.mjs';
1
+ import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-CraAnYdB.mjs';
2
2
  import 'execa';
3
3
  import { isObject } from 'radash';
4
4
  import 'node:buffer';
@@ -10,7 +10,7 @@ import 'url';
10
10
  import '@commander-js/extra-typings';
11
11
  import 'nanoid';
12
12
  import 'dotenv';
13
- import './chunks/loader-CE4HSRN4.mjs';
13
+ import './chunks/loader-V1vbmtyw.mjs';
14
14
  import 'package-directory';
15
15
  import 'yaml';
16
16
  import { z } from 'zod';
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -232,6 +234,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
232
234
  * @public
233
235
  */
234
236
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
237
+ /**
238
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
239
+ */
240
+ env?: string;
235
241
  /**
236
242
  * Fully resolved option bag used to compute this context.
237
243
  */
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-atT1xkoe.mjs';
1
+ import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-CraAnYdB.mjs';
2
2
  import 'execa';
3
3
  import 'radash';
4
4
  import 'node:buffer';
@@ -10,7 +10,7 @@ import 'url';
10
10
  import { Command } from '@commander-js/extra-typings';
11
11
  import 'nanoid';
12
12
  import 'dotenv';
13
- import './chunks/loader-CE4HSRN4.mjs';
13
+ import './chunks/loader-V1vbmtyw.mjs';
14
14
  import { packageDirectory } from 'package-directory';
15
15
  import 'yaml';
16
16
  import { z } from 'zod';
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -232,6 +234,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
232
234
  * @public
233
235
  */
234
236
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
237
+ /**
238
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
239
+ */
240
+ env?: string;
235
241
  /**
236
242
  * Fully resolved option bag used to compute this context.
237
243
  */
@@ -1,5 +1,5 @@
1
1
  import 'radash';
2
- import './chunks/readMergedOptions-atT1xkoe.mjs';
2
+ import './chunks/readMergedOptions-CraAnYdB.mjs';
3
3
  import 'execa';
4
4
  import 'node:buffer';
5
5
  import 'fs-extra';
@@ -10,13 +10,13 @@ import 'url';
10
10
  import '@commander-js/extra-typings';
11
11
  import 'nanoid';
12
12
  import 'dotenv';
13
- import './chunks/loader-CE4HSRN4.mjs';
13
+ import './chunks/loader-V1vbmtyw.mjs';
14
14
  import 'package-directory';
15
15
  import 'yaml';
16
16
  import 'zod';
17
- export { c as cmdPlugin } from './chunks/index-BhMXFr37.mjs';
17
+ export { c as cmdPlugin } from './chunks/index-Dd6S1nZ-.mjs';
18
18
  import './chunks/readDotenvCascade-Dgx4SC1p.mjs';
19
19
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
20
20
  import './chunks/spawnEnv-CKgnHGpr.mjs';
21
21
  import './chunks/invoke-DuRPU1oC.mjs';
22
- import './chunks/resolveCliOptions-BLSqCGm7.mjs';
22
+ import './chunks/resolveCliOptions-BMBkWDYJ.mjs';
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -232,6 +234,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
232
234
  * @public
233
235
  */
234
236
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
237
+ /**
238
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
239
+ */
240
+ env?: string;
235
241
  /**
236
242
  * Fully resolved option bag used to compute this context.
237
243
  */
@@ -1,4 +1,4 @@
1
- import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-atT1xkoe.mjs';
1
+ import { r as readMergedOptions, g as definePlugin } from './chunks/readMergedOptions-CraAnYdB.mjs';
2
2
  import 'execa';
3
3
  import 'radash';
4
4
  import 'node:buffer';
@@ -10,7 +10,7 @@ import 'url';
10
10
  import '@commander-js/extra-typings';
11
11
  import 'nanoid';
12
12
  import 'dotenv';
13
- import './chunks/loader-CE4HSRN4.mjs';
13
+ import './chunks/loader-V1vbmtyw.mjs';
14
14
  import { packageDirectory } from 'package-directory';
15
15
  import 'yaml';
16
16
  import 'zod';
package/dist/plugins.d.ts CHANGED
@@ -144,6 +144,7 @@ type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
144
144
  */
145
145
  declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
146
146
  defaultEnv: z.ZodOptional<z.ZodString>;
147
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
147
148
  dotenvToken: z.ZodOptional<z.ZodString>;
148
149
  dynamicPath: z.ZodOptional<z.ZodString>;
149
150
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -195,6 +196,7 @@ declare const getDotenvCliOptionsSchemaResolved: z.ZodObject<{
195
196
  */
196
197
  declare const getDotenvOptionsSchemaResolved: z.ZodObject<{
197
198
  defaultEnv: z.ZodOptional<z.ZodString>;
199
+ defaultEnvKey: z.ZodOptional<z.ZodString>;
198
200
  dotenvToken: z.ZodOptional<z.ZodString>;
199
201
  dynamicPath: z.ZodOptional<z.ZodString>;
200
202
  dynamic: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -232,6 +234,10 @@ type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<s
232
234
  * @public
233
235
  */
234
236
  interface GetDotenvCliCtx<TOptions extends GetDotenvOptions = GetDotenvOptions> {
237
+ /**
238
+ * Effective environment name after resolution (explicit -e \> defaultEnvKey \> defaultEnv).
239
+ */
240
+ env?: string;
235
241
  /**
236
242
  * Fully resolved option bag used to compute this context.
237
243
  */
package/dist/plugins.mjs CHANGED
@@ -1,9 +1,9 @@
1
1
  export { awsPlugin, getAwsRegion } from './plugins-aws.mjs';
2
- export { R as awsWhoamiPlugin } from './chunks/index-CGG9e0xu.mjs';
2
+ export { R as awsWhoamiPlugin } from './chunks/index-BuxEK_Z4.mjs';
3
3
  export { batchPlugin } from './plugins-batch.mjs';
4
- export { c as cmdPlugin } from './chunks/index-BhMXFr37.mjs';
4
+ export { c as cmdPlugin } from './chunks/index-Dd6S1nZ-.mjs';
5
5
  export { initPlugin } from './plugins-init.mjs';
6
- import './chunks/readMergedOptions-atT1xkoe.mjs';
6
+ import './chunks/readMergedOptions-CraAnYdB.mjs';
7
7
  import 'zod';
8
8
  import '@commander-js/extra-typings';
9
9
  import './chunks/readDotenvCascade-Dgx4SC1p.mjs';
@@ -17,7 +17,7 @@ import 'path';
17
17
  import 'url';
18
18
  import 'dotenv';
19
19
  import 'nanoid';
20
- import './chunks/loader-CE4HSRN4.mjs';
20
+ import './chunks/loader-V1vbmtyw.mjs';
21
21
  import 'package-directory';
22
22
  import 'yaml';
23
23
  import 'execa';
@@ -31,6 +31,6 @@ import 'node:https';
31
31
  import 'node:process';
32
32
  import './chunks/invoke-DuRPU1oC.mjs';
33
33
  import 'globby';
34
- import './chunks/resolveCliOptions-BLSqCGm7.mjs';
34
+ import './chunks/resolveCliOptions-BMBkWDYJ.mjs';
35
35
  import 'readline/promises';
36
36
  import 'node:url';