@karmaniverous/get-dotenv 7.0.1 → 7.0.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.
Files changed (50) hide show
  1. package/dist/chunks/{AwsRestJsonProtocol-DeiE3wkO.mjs → AwsRestJsonProtocol-fgUvbh0C.mjs} +158 -81
  2. package/dist/chunks/{createCli-B9-MIwWj.mjs → createCli-B9De0dbB.mjs} +5 -5
  3. package/dist/chunks/{externalDataInterceptor-gi2RH4ez.mjs → externalDataInterceptor-m2kSL8CB.mjs} +2 -2
  4. package/dist/chunks/{getSSOTokenFromFile-BfAhZf_d.mjs → getSSOTokenFromFile-Vx7XHoYM.mjs} +4 -4
  5. package/dist/chunks/{index-CMSCF_uw.mjs → index-BdwUJ997.mjs} +494 -255
  6. package/dist/chunks/{index-mPj0Vhpw.mjs → index-BupFFAuS.mjs} +14 -16
  7. package/dist/chunks/{index-xRi3oKvY.mjs → index-C2z1IV4R.mjs} +11 -13
  8. package/dist/chunks/{index-CAtxK29A.mjs → index-CcxIt23B.mjs} +12 -9
  9. package/dist/chunks/{index-DfvhftMN.mjs → index-D1FUmkpH.mjs} +30 -29
  10. package/dist/chunks/{index-C21RHLO4.mjs → index-D8mqch7I.mjs} +34 -19
  11. package/dist/chunks/{index-D8S1lJ24.mjs → index-DavD95qI.mjs} +272 -182
  12. package/dist/chunks/{index-AssUn9IY.mjs → index-DbDfog26.mjs} +11158 -8060
  13. package/dist/chunks/index-DmR_hk_x.mjs +31 -0
  14. package/dist/chunks/{index-DY7wYcXW.mjs → index-R829pajs.mjs} +15 -18
  15. package/dist/chunks/{index-98yxYe1W.mjs → index-ScWmGA41.mjs} +282 -206
  16. package/dist/chunks/{index-B6r8O7PJ.mjs → index-UolIX-qt.mjs} +15 -18
  17. package/dist/chunks/{index-Ccay5Db0.mjs → index-WAaC3U5P.mjs} +17 -20
  18. package/dist/chunks/{loadSso-C-y9gQEz.mjs → loadSso-BZQzknAq.mjs} +243 -181
  19. package/dist/chunks/{loader-CE4HSRN4.mjs → loader-V1vbmtyw.mjs} +2 -0
  20. package/dist/chunks/{package-DiDNabNr.mjs → package-DbbYaehr.mjs} +1 -1
  21. package/dist/chunks/{parseKnownFiles-KczcjlE0.mjs → parseKnownFiles-CCiikesE.mjs} +1 -1
  22. package/dist/chunks/{readDotenvCascade-HLU7FsEQ.mjs → readDotenvCascade-Dgx4SC1p.mjs} +3 -7
  23. package/dist/chunks/{readMergedOptions-D6niy_Ep.mjs → readMergedOptions-BRLqvCpt.mjs} +37 -10
  24. package/dist/chunks/{resolveCliOptions-PWF1aEM9.mjs → resolveCliOptions-Bbv0tNSF.mjs} +1 -1
  25. package/dist/chunks/{sdk-stream-mixin-blFikF4G.mjs → sdk-stream-mixin-pKJE9QhL.mjs} +145 -5
  26. package/dist/chunks/{spawnEnv-5kdIVv0x.mjs → spawnEnv-CKgnHGpr.mjs} +5 -5
  27. package/dist/chunks/{types-Bp3u5-IH.mjs → types-BfKw9R-k.mjs} +1 -1
  28. package/dist/cli.d.ts +4 -0
  29. package/dist/cli.mjs +13 -15
  30. package/dist/cliHost.d.ts +4 -0
  31. package/dist/cliHost.mjs +6 -6
  32. package/dist/config.d.ts +2 -0
  33. package/dist/config.mjs +1 -1
  34. package/dist/env-overlay.d.ts +2 -0
  35. package/dist/env-overlay.mjs +2 -2
  36. package/dist/getdotenv.cli.mjs +13 -15
  37. package/dist/index.d.ts +6 -0
  38. package/dist/index.mjs +17 -19
  39. package/dist/plugins-aws.d.ts +2 -0
  40. package/dist/plugins-aws.mjs +4 -4
  41. package/dist/plugins-batch.d.ts +2 -0
  42. package/dist/plugins-batch.mjs +4 -4
  43. package/dist/plugins-cmd.d.ts +2 -0
  44. package/dist/plugins-cmd.mjs +6 -6
  45. package/dist/plugins-init.d.ts +2 -0
  46. package/dist/plugins-init.mjs +5 -5
  47. package/dist/plugins.d.ts +2 -0
  48. package/dist/plugins.mjs +12 -14
  49. package/package.json +1 -1
  50. package/dist/chunks/index-DtdHVcXz.mjs +0 -27
@@ -1,6 +1,6 @@
1
1
  import { z } from 'zod';
2
2
  import { Option, Command } from '@commander-js/extra-typings';
3
- import { h as dotenvExpand, r as readDotenvCascadeWithProvenance, o as overlayEnvWithProvenance, b as applyDynamicMapWithProvenance, l as loadDynamicModuleDefault, f as dotenvExpandFromProcessEnv } from './readDotenvCascade-HLU7FsEQ.mjs';
3
+ import { d as dotenvExpand, h as readDotenvCascadeWithProvenance, o as overlayEnvWithProvenance, b as applyDynamicMapWithProvenance, g as loadDynamicModuleDefault, f as dotenvExpandFromProcessEnv } from './readDotenvCascade-Dgx4SC1p.mjs';
4
4
  import fs from 'fs-extra';
5
5
  import 'node:path';
6
6
  import 'nanoid';
@@ -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 } : {}),
@@ -549,7 +568,7 @@ function definePlugin(spec) {
549
568
  */
550
569
  const attachRootOptions = (program, defaults) => {
551
570
  const GROUP = 'base';
552
- const { defaultEnv, dotenvToken, dynamicPath, env, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
571
+ const { defaultEnv, defaultEnvKey, dotenvToken, dynamicPath, env, outputPath, paths, pathsDelimiter, pathsDelimiterPattern, privateToken, varsAssignor, varsAssignorPattern, varsDelimiter, varsDelimiterPattern, } = defaults ?? {};
553
572
  const va = typeof defaults?.varsAssignor === 'string' ? defaults.varsAssignor : '=';
554
573
  const vd = typeof defaults?.varsDelimiter === 'string' ? defaults.varsDelimiter : ' ';
555
574
  // Helper: append (default) tags for ON/OFF toggles
@@ -731,6 +750,12 @@ const attachRootOptions = (program, defaults) => {
731
750
  o1.default(defaultEnv);
732
751
  program.addOption(o1);
733
752
  program.setOptionGroup(o1, GROUP);
753
+ const o1b = new Option('--default-env-key <string>', 'env var name in global dotenv files that specifies the default environment (dotenv-expanded)');
754
+ o1b.argParser(dotenvExpandFromProcessEnv);
755
+ if (defaultEnvKey !== undefined)
756
+ o1b.default(defaultEnvKey);
757
+ program.addOption(o1b);
758
+ program.setOptionGroup(o1b, GROUP);
734
759
  const o2 = new Option('--dotenv-token <string>', 'dotenv-expanded token indicating a dotenv file');
735
760
  o2.argParser(dotenvExpandFromProcessEnv);
736
761
  if (dotenvToken !== undefined)
@@ -1264,7 +1289,9 @@ class GetDotenvCli extends Command {
1264
1289
  }
1265
1290
  /** Internal: climb to the true root (host) command. */
1266
1291
  _root() {
1267
- let node = this;
1292
+ let node = this.parent;
1293
+ if (!node)
1294
+ return this;
1268
1295
  while (node.parent) {
1269
1296
  node = node.parent;
1270
1297
  }
@@ -1436,4 +1463,4 @@ const readMergedOptions = (cmd) => {
1436
1463
  return bag;
1437
1464
  };
1438
1465
 
1439
- export { GetDotenvCli as G, defaultsDeep as a, baseRootOptionDefaults as b, attachRootOptions as c, definePlugin as d, resolveGetDotenvOptions as e, assertLogger as f, getDotenvCliOptions2Options as g, defineDynamic as h, defineGetDotenvConfig as i, interpolateDeep as j, readMergedOptions as r, writeDotenvFile as w };
1466
+ export { GetDotenvCli as G, assertLogger as a, attachRootOptions as b, baseRootOptionDefaults as c, defaultsDeep as d, defineDynamic as e, defineGetDotenvConfig as f, definePlugin as g, getDotenvCliOptions2Options as h, interpolateDeep as i, resolveGetDotenvOptions as j, readMergedOptions as r, writeDotenvFile as w };
@@ -1,4 +1,4 @@
1
- import { b as baseRootOptionDefaults, a as defaultsDeep } from './readMergedOptions-D6niy_Ep.mjs';
1
+ import { c as baseRootOptionDefaults, d as defaultsDeep } from './readMergedOptions-BRLqvCpt.mjs';
2
2
  import 'radash';
3
3
  import 'node:buffer';
4
4
  import 'fs-extra';
@@ -1,10 +1,102 @@
1
- import { m as fromBase64, n as toBase64, o as toHex, t as toUtf8, q as fromArrayBuffer, r as streamCollector$1 } from './index-AssUn9IY.mjs';
2
- import { Readable } from 'stream';
1
+ import { Writable, Readable } from 'node:stream';
2
+ import { aS as toHex, a5 as fromArrayBuffer } from './index-DbDfog26.mjs';
3
3
 
4
4
  const isReadableStream = (stream) => typeof ReadableStream === "function" &&
5
5
  (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
6
6
 
7
- const streamCollector = async (stream) => {
7
+ const fromUtf8 = (input) => new TextEncoder().encode(input);
8
+
9
+ const chars = `ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`;
10
+ const alphabetByEncoding = Object.entries(chars).reduce((acc, [i, c]) => {
11
+ acc[c] = Number(i);
12
+ return acc;
13
+ }, {});
14
+ const alphabetByValue = chars.split("");
15
+ const bitsPerLetter = 6;
16
+ const bitsPerByte = 8;
17
+ const maxLetterValue = 0b111111;
18
+
19
+ function toBase64(_input) {
20
+ let input;
21
+ if (typeof _input === "string") {
22
+ input = fromUtf8(_input);
23
+ }
24
+ else {
25
+ input = _input;
26
+ }
27
+ const isArrayLike = typeof input === "object" && typeof input.length === "number";
28
+ const isUint8Array = typeof input === "object" &&
29
+ typeof input.byteOffset === "number" &&
30
+ typeof input.byteLength === "number";
31
+ if (!isArrayLike && !isUint8Array) {
32
+ throw new Error("@smithy/util-base64: toBase64 encoder function only accepts string | Uint8Array.");
33
+ }
34
+ let str = "";
35
+ for (let i = 0; i < input.length; i += 3) {
36
+ let bits = 0;
37
+ let bitLength = 0;
38
+ for (let j = i, limit = Math.min(i + 3, input.length); j < limit; j++) {
39
+ bits |= input[j] << ((limit - j - 1) * bitsPerByte);
40
+ bitLength += bitsPerByte;
41
+ }
42
+ const bitClusterCount = Math.ceil(bitLength / bitsPerLetter);
43
+ bits <<= bitClusterCount * bitsPerLetter - bitLength;
44
+ for (let k = 1; k <= bitClusterCount; k++) {
45
+ const offset = (bitClusterCount - k) * bitsPerLetter;
46
+ str += alphabetByValue[(bits & (maxLetterValue << offset)) >> offset];
47
+ }
48
+ str += "==".slice(0, 4 - bitClusterCount);
49
+ }
50
+ return str;
51
+ }
52
+
53
+ const toUtf8 = (input) => {
54
+ if (typeof input === "string") {
55
+ return input;
56
+ }
57
+ if (typeof input !== "object" || typeof input.byteOffset !== "number" || typeof input.byteLength !== "number") {
58
+ throw new Error("@smithy/util-utf8: toUtf8 encoder function only accepts string | Uint8Array.");
59
+ }
60
+ return new TextDecoder("utf-8").decode(input);
61
+ };
62
+
63
+ const fromBase64 = (input) => {
64
+ let totalByteLength = (input.length / 4) * 3;
65
+ if (input.slice(-2) === "==") {
66
+ totalByteLength -= 2;
67
+ }
68
+ else if (input.slice(-1) === "=") {
69
+ totalByteLength--;
70
+ }
71
+ const out = new ArrayBuffer(totalByteLength);
72
+ const dataView = new DataView(out);
73
+ for (let i = 0; i < input.length; i += 4) {
74
+ let bits = 0;
75
+ let bitLength = 0;
76
+ for (let j = i, limit = i + 3; j <= limit; j++) {
77
+ if (input[j] !== "=") {
78
+ if (!(input[j] in alphabetByEncoding)) {
79
+ throw new TypeError(`Invalid character ${input[j]} in base64 string.`);
80
+ }
81
+ bits |= alphabetByEncoding[input[j]] << ((limit - j) * bitsPerLetter);
82
+ bitLength += bitsPerLetter;
83
+ }
84
+ else {
85
+ bits >>= bitsPerLetter;
86
+ }
87
+ }
88
+ const chunkOffset = (i / 4) * 3;
89
+ bits >>= bitLength % bitsPerByte;
90
+ const byteLength = Math.floor(bitLength / bitsPerByte);
91
+ for (let k = 0; k < byteLength; k++) {
92
+ const offset = (byteLength - k - 1) * bitsPerByte;
93
+ dataView.setUint8(chunkOffset + k, (bits & (255 << offset)) >> offset);
94
+ }
95
+ }
96
+ return new Uint8Array(out);
97
+ };
98
+
99
+ const streamCollector$1 = async (stream) => {
8
100
  if ((typeof Blob === "function" && stream instanceof Blob) || stream.constructor?.name === "Blob") {
9
101
  if (Blob.prototype.arrayBuffer !== undefined) {
10
102
  return new Uint8Array(await stream.arrayBuffer());
@@ -69,7 +161,7 @@ const sdkStreamMixin$1 = (stream) => {
69
161
  throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
70
162
  }
71
163
  transformed = true;
72
- return await streamCollector(stream);
164
+ return await streamCollector$1(stream);
73
165
  };
74
166
  const blobToWebStream = (blob) => {
75
167
  if (typeof blob.stream !== "function") {
@@ -117,6 +209,54 @@ const sdkStreamMixin$1 = (stream) => {
117
209
  };
118
210
  const isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
119
211
 
212
+ class Collector extends Writable {
213
+ bufferedBytes = [];
214
+ _write(chunk, encoding, callback) {
215
+ this.bufferedBytes.push(chunk);
216
+ callback();
217
+ }
218
+ }
219
+ const isReadableStreamInstance = (stream) => typeof ReadableStream === "function" && stream instanceof ReadableStream;
220
+ async function collectReadableStream(stream) {
221
+ const chunks = [];
222
+ const reader = stream.getReader();
223
+ let isDone = false;
224
+ let length = 0;
225
+ while (!isDone) {
226
+ const { done, value } = await reader.read();
227
+ if (value) {
228
+ chunks.push(value);
229
+ length += value.length;
230
+ }
231
+ isDone = done;
232
+ }
233
+ const collected = new Uint8Array(length);
234
+ let offset = 0;
235
+ for (const chunk of chunks) {
236
+ collected.set(chunk, offset);
237
+ offset += chunk.length;
238
+ }
239
+ return collected;
240
+ }
241
+ const streamCollector = (stream) => {
242
+ if (isReadableStreamInstance(stream)) {
243
+ return collectReadableStream(stream);
244
+ }
245
+ return new Promise((resolve, reject) => {
246
+ const collector = new Collector();
247
+ stream.pipe(collector);
248
+ stream.on("error", (err) => {
249
+ collector.end();
250
+ reject(err);
251
+ });
252
+ collector.on("error", reject);
253
+ collector.on("finish", function () {
254
+ const bytes = new Uint8Array(Buffer.concat(this.bufferedBytes));
255
+ resolve(bytes);
256
+ });
257
+ });
258
+ };
259
+
120
260
  const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
121
261
  const sdkStreamMixin = (stream) => {
122
262
  if (!(stream instanceof Readable)) {
@@ -134,7 +274,7 @@ const sdkStreamMixin = (stream) => {
134
274
  throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
135
275
  }
136
276
  transformed = true;
137
- return await streamCollector$1(stream);
277
+ return await streamCollector(stream);
138
278
  };
139
279
  return Object.assign(stream, {
140
280
  transformToByteArray,
@@ -143,12 +143,12 @@ async function _execNormalized(command, shell, opts = {}) {
143
143
  return { exitCode: 0, stdout: '', stderr: '' };
144
144
  dbg('exec (plain)', { file, args, stdio });
145
145
  try {
146
- const ok = pickResult((await execa(file, args, {
146
+ const ok = pickResult(await execa(file, args, {
147
147
  ...(opts.cwd !== undefined ? { cwd: opts.cwd } : {}),
148
148
  ...(envSan !== undefined ? { env: envSan } : {}),
149
149
  stdio,
150
150
  ...timeoutBits,
151
- })));
151
+ }));
152
152
  dbg('exit (plain)', { exitCode: ok.exitCode });
153
153
  return ok;
154
154
  }
@@ -166,13 +166,13 @@ async function _execNormalized(command, shell, opts = {}) {
166
166
  stdio,
167
167
  });
168
168
  try {
169
- const ok = pickResult((await execaCommand(commandStr, {
169
+ const ok = pickResult(await execaCommand(commandStr, {
170
170
  shell,
171
171
  ...(opts.cwd !== undefined ? { cwd: opts.cwd } : {}),
172
172
  ...(envSan !== undefined ? { env: envSan } : {}),
173
173
  stdio,
174
174
  ...timeoutBits,
175
- })));
175
+ }));
176
176
  dbg('exit (shell)', { exitCode: ok.exitCode });
177
177
  return ok;
178
178
  }
@@ -307,4 +307,4 @@ const buildSpawnEnv = (base, overlay) => {
307
307
  return out;
308
308
  };
309
309
 
310
- export { runCommandResult as a, resolveCommand as b, resolveShell as c, buildSpawnEnv as d, runCommand as r, shouldCapture as s, tokenize as t };
310
+ export { resolveShell as a, buildSpawnEnv as b, runCommand as c, runCommandResult as d, resolveCommand as r, shouldCapture as s, tokenize as t };
@@ -1,4 +1,4 @@
1
- import { d as definePlugin } from './readMergedOptions-D6niy_Ep.mjs';
1
+ import { g as definePlugin } from './readMergedOptions-BRLqvCpt.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). */
package/dist/cli.mjs CHANGED
@@ -1,7 +1,7 @@
1
- export { c as createCli } from './chunks/createCli-B9-MIwWj.mjs';
1
+ export { c as createCli } from './chunks/createCli-B9De0dbB.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,29 +13,27 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
13
13
  import 'crypto';
14
14
  import '@commander-js/extra-typings';
15
15
  import 'nanoid';
16
- import './chunks/readMergedOptions-D6niy_Ep.mjs';
17
- import './chunks/readDotenvCascade-HLU7FsEQ.mjs';
16
+ import './chunks/readMergedOptions-BRLqvCpt.mjs';
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-PWF1aEM9.mjs';
21
+ import './chunks/resolveCliOptions-Bbv0tNSF.mjs';
22
22
  import './chunks/validate-CDl0rE6k.mjs';
23
23
  import './plugins-aws.mjs';
24
- import './chunks/spawnEnv-5kdIVv0x.mjs';
25
- import './chunks/index-AssUn9IY.mjs';
26
- import 'buffer';
27
- import 'os';
24
+ import './chunks/spawnEnv-CKgnHGpr.mjs';
25
+ import './chunks/index-DbDfog26.mjs';
26
+ import 'node:os';
28
27
  import 'node:fs/promises';
29
- import 'http';
30
- import 'https';
31
- import 'stream';
32
- import 'process';
28
+ import 'node:stream';
29
+ import 'node:crypto';
33
30
  import 'node:fs';
31
+ import 'node:https';
32
+ import 'node:process';
34
33
  import './plugins-batch.mjs';
35
34
  import './chunks/invoke-DuRPU1oC.mjs';
36
35
  import 'globby';
37
- import './chunks/index-CAtxK29A.mjs';
36
+ import './chunks/index-CcxIt23B.mjs';
38
37
  import './plugins-init.mjs';
39
- import 'node:process';
40
38
  import 'readline/promises';
41
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). */
package/dist/cliHost.mjs CHANGED
@@ -1,12 +1,12 @@
1
- export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-D6niy_Ep.mjs';
2
- export { d as buildSpawnEnv, b as resolveCommand, c as resolveShell, r as runCommand, a as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-5kdIVv0x.mjs';
3
- export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-PWF1aEM9.mjs';
4
- export { d as defineScripts, g as groupPlugins } from './chunks/types-Bp3u5-IH.mjs';
1
+ export { G as GetDotenvCli, g as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-BRLqvCpt.mjs';
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-Bbv0tNSF.mjs';
4
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-BfKw9R-k.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';
8
8
  import '@commander-js/extra-typings';
9
- import './chunks/readDotenvCascade-HLU7FsEQ.mjs';
9
+ import './chunks/readDotenvCascade-Dgx4SC1p.mjs';
10
10
  import 'fs-extra';
11
11
  import 'radash';
12
12
  import 'node:buffer';
@@ -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,5 +1,5 @@
1
- import { d as dotenvExpandAll } from './chunks/readDotenvCascade-HLU7FsEQ.mjs';
2
- export { a as applyDynamicMap, b as applyDynamicMapWithProvenance, e as createDotenvProvenance, c as loadAndApplyDynamic, l as loadDynamicModuleDefault, o as overlayEnvWithProvenance, p as pushDotenvProvenance, r as readDotenvCascadeWithProvenance } from './chunks/readDotenvCascade-HLU7FsEQ.mjs';
1
+ import { e as dotenvExpandAll } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
2
+ export { a as applyDynamicMap, b as applyDynamicMapWithProvenance, c as createDotenvProvenance, l as loadAndApplyDynamic, g as loadDynamicModuleDefault, o as overlayEnvWithProvenance, p as pushDotenvProvenance, h as readDotenvCascadeWithProvenance } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
3
3
  import 'fs-extra';
4
4
  import 'node:path';
5
5
  import 'radash';
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { c as createCli } from './chunks/createCli-B9-MIwWj.mjs';
2
+ import { c as createCli } from './chunks/createCli-B9De0dbB.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,30 +14,28 @@ import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
14
14
  import 'crypto';
15
15
  import '@commander-js/extra-typings';
16
16
  import 'nanoid';
17
- import './chunks/readMergedOptions-D6niy_Ep.mjs';
18
- import './chunks/readDotenvCascade-HLU7FsEQ.mjs';
17
+ import './chunks/readMergedOptions-BRLqvCpt.mjs';
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-PWF1aEM9.mjs';
22
+ import './chunks/resolveCliOptions-Bbv0tNSF.mjs';
23
23
  import './chunks/validate-CDl0rE6k.mjs';
24
24
  import './plugins-aws.mjs';
25
- import './chunks/spawnEnv-5kdIVv0x.mjs';
26
- import './chunks/index-AssUn9IY.mjs';
27
- import 'buffer';
28
- import 'os';
25
+ import './chunks/spawnEnv-CKgnHGpr.mjs';
26
+ import './chunks/index-DbDfog26.mjs';
27
+ import 'node:os';
29
28
  import 'node:fs/promises';
30
- import 'http';
31
- import 'https';
32
- import 'stream';
33
- import 'process';
29
+ import 'node:stream';
30
+ import 'node:crypto';
34
31
  import 'node:fs';
32
+ import 'node:https';
33
+ import 'node:process';
35
34
  import './plugins-batch.mjs';
36
35
  import './chunks/invoke-DuRPU1oC.mjs';
37
36
  import 'globby';
38
- import './chunks/index-CAtxK29A.mjs';
37
+ import './chunks/index-CcxIt23B.mjs';
39
38
  import './plugins-init.mjs';
40
- import 'node:process';
41
39
  import 'readline/promises';
42
40
  import 'node:url';
43
41
 
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). */
@@ -1109,6 +1113,8 @@ interface BaseRootOptionDefaults {
1109
1113
  entropyMinLength: number;
1110
1114
  /** Regex patterns (as strings) to suppress entropy warnings by key. */
1111
1115
  entropyWhitelist: string[];
1116
+ /** Env var name in global dotenv files that specifies the default environment. */
1117
+ defaultEnvKey: string;
1112
1118
  /** Default dotenv search paths (stringly, CLI-compatible). */
1113
1119
  paths: string;
1114
1120
  /** Paths delimiter used for the `--paths` string. */
package/dist/index.mjs CHANGED
@@ -1,8 +1,8 @@
1
- export { c as createCli } from './chunks/createCli-B9-MIwWj.mjs';
2
- import { e as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-D6niy_Ep.mjs';
3
- export { G as GetDotenvCli, f as assertLogger, b as baseRootOptionDefaults, a as defaultsDeep, h as defineDynamic, i as defineGetDotenvConfig, d as definePlugin, g as getDotenvCliOptions2Options, j as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-D6niy_Ep.mjs';
4
- export { d as buildSpawnEnv, s as shouldCapture, t as tokenize } from './chunks/spawnEnv-5kdIVv0x.mjs';
5
- export { d as defineScripts, g as groupPlugins } from './chunks/types-Bp3u5-IH.mjs';
1
+ export { c as createCli } from './chunks/createCli-B9De0dbB.mjs';
2
+ import { j as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-BRLqvCpt.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-BRLqvCpt.mjs';
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-BfKw9R-k.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,37 +10,35 @@ 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 { r as redactObject, m as maybeWarnEntropy } from './chunks/index-CAtxK29A.mjs';
14
- export { a as redactDisplay, t as traceChildEnv } from './chunks/index-CAtxK29A.mjs';
15
- import { g as readDotenv, d as dotenvExpandAll, a as applyDynamicMap, c as loadAndApplyDynamic } from './chunks/readDotenvCascade-HLU7FsEQ.mjs';
16
- export { h as dotenvExpand, f as dotenvExpandFromProcessEnv } from './chunks/readDotenvCascade-HLU7FsEQ.mjs';
13
+ import { a as redactObject, m as maybeWarnEntropy } from './chunks/index-CcxIt23B.mjs';
14
+ export { r as redactDisplay, t as traceChildEnv } from './chunks/index-CcxIt23B.mjs';
15
+ import { r as readDotenv, e as dotenvExpandAll, a as applyDynamicMap, l as loadAndApplyDynamic } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
16
+ export { d as dotenvExpand, f as dotenvExpandFromProcessEnv } from './chunks/readDotenvCascade-Dgx4SC1p.mjs';
17
17
  import fs from 'fs-extra';
18
18
  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-PWF1aEM9.mjs';
27
+ import './chunks/resolveCliOptions-Bbv0tNSF.mjs';
28
28
  import './chunks/validate-CDl0rE6k.mjs';
29
29
  import './plugins-aws.mjs';
30
- import './chunks/index-AssUn9IY.mjs';
31
- import 'buffer';
32
- import 'os';
30
+ import './chunks/index-DbDfog26.mjs';
31
+ import 'node:os';
33
32
  import 'node:fs/promises';
34
- import 'http';
35
- import 'https';
36
- import 'stream';
37
- import 'process';
33
+ import 'node:stream';
34
+ import 'node:crypto';
38
35
  import 'node:fs';
36
+ import 'node:https';
37
+ import 'node:process';
39
38
  import './plugins-batch.mjs';
40
39
  import './chunks/invoke-DuRPU1oC.mjs';
41
40
  import 'globby';
42
41
  import './plugins-init.mjs';
43
- import 'node:process';
44
42
  import 'readline/promises';
45
43
  import 'node:url';
46
44