@karmaniverous/get-dotenv 6.2.4 → 6.4.0
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 +1 -0
- package/dist/chunks/{AwsRestJsonProtocol-Bq1HE-Ln.mjs → AwsRestJsonProtocol-fYZqn-kW.mjs} +2 -2
- package/dist/chunks/{createCli-BY6_cfZr.mjs → createCli-BnRdfRRL.mjs} +7 -6
- package/dist/chunks/{externalDataInterceptor-CbsdEYa-.mjs → externalDataInterceptor-CILOLqbB.mjs} +2 -2
- package/dist/chunks/{getSSOTokenFromFile-hUSpR7Wf.mjs → getSSOTokenFromFile-BwMkZ_yT.mjs} +1 -1
- package/dist/chunks/{index-C_wqbTwI.mjs → index-0-nP97ri.mjs} +7 -6
- package/dist/chunks/{index-CeCufHlm.mjs → index-70Dm0f1N.mjs} +11 -10
- package/dist/chunks/{index-BPYF6K_G.mjs → index-BhVOypA1.mjs} +9 -8
- package/dist/chunks/{index-cIunyiUQ.mjs → index-CcwT4HJK.mjs} +6 -5
- package/dist/chunks/{index-BpCF5UKx.mjs → index-D8UL3w94.mjs} +6 -5
- package/dist/chunks/{index-Cu7rdyqN.mjs → index-DLNhHC15.mjs} +9 -8
- package/dist/chunks/{index-Dp1Ip6Ra.mjs → index-DWqbxY8Y.mjs} +11 -10
- package/dist/chunks/{index-c7zKtEuy.mjs → index-Du51s-Z0.mjs} +8 -7
- package/dist/chunks/{index-B5JKTBOL.mjs → index-DuSz0ul6.mjs} +8 -7
- package/dist/chunks/{index-DWAtHEA-.mjs → index-OeNCYa8T.mjs} +6 -5
- package/dist/chunks/{index-DyU5pKKi.mjs → index-_FP0whjC.mjs} +6 -5
- package/dist/chunks/{index-BEJFiHMX.mjs → index-o5zJ9PWL.mjs} +15 -15
- package/dist/chunks/{index-Bc3h0a95.mjs → index-r0Me7-sT.mjs} +112 -6
- package/dist/chunks/{loadSso-w1eTVg0O.mjs → loadSso-CLR1fKci.mjs} +8 -7
- package/dist/chunks/{loader-DnhPeGfq.mjs → loader-CePOf74i.mjs} +1 -0
- package/dist/chunks/{parseKnownFiles-B9cDK21V.mjs → parseKnownFiles-BQvmJ0HK.mjs} +1 -1
- package/dist/chunks/readDotenvCascade-DfFkWMjs.mjs +546 -0
- package/dist/chunks/{readMergedOptions-Nt0TR7dX.mjs → readMergedOptions-B7VdLROn.mjs} +62 -272
- package/dist/chunks/{resolveCliOptions-TFRzhB2c.mjs → resolveCliOptions-pgUXHJtj.mjs} +2 -1
- package/dist/chunks/{sdk-stream-mixin-BZoJ5jy9.mjs → sdk-stream-mixin-ecbbBR0l.mjs} +1 -1
- package/dist/chunks/{spawnEnv-CN8a7cNR.mjs → spawnEnv-CQwFu7ZJ.mjs} +2 -1
- package/dist/chunks/{types-DJ-BGABd.mjs → types-CVDR-Sjk.mjs} +1 -1
- package/dist/cli.d.ts +218 -84
- package/dist/cli.mjs +10 -10
- package/dist/cliHost.d.ts +218 -84
- package/dist/cliHost.mjs +8 -7
- package/dist/config.mjs +2 -1
- package/dist/env-overlay.d.ts +304 -2
- package/dist/env-overlay.mjs +38 -1
- package/dist/getdotenv.cli.mjs +10 -10
- package/dist/index.d.ts +703 -86
- package/dist/index.mjs +862 -13
- package/dist/plugins-aws.d.ts +153 -19
- package/dist/plugins-aws.mjs +5 -4
- package/dist/plugins-batch.d.ts +153 -19
- package/dist/plugins-batch.mjs +5 -4
- package/dist/plugins-cmd.d.ts +153 -19
- package/dist/plugins-cmd.mjs +7 -6
- package/dist/plugins-init.d.ts +153 -19
- package/dist/plugins-init.mjs +4 -4
- package/dist/plugins.d.ts +153 -19
- package/dist/plugins.mjs +9 -9
- package/package.json +1 -1
- package/dist/chunks/overlayEnv-Bs2kVayG.mjs +0 -234
package/dist/cliHost.mjs
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-
|
|
2
|
-
export {
|
|
3
|
-
export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-
|
|
4
|
-
export { d as defineScripts, g as groupPlugins } from './chunks/types-
|
|
1
|
+
export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-B7VdLROn.mjs';
|
|
2
|
+
export { d as buildSpawnEnv, b as resolveCommand, c as resolveShell, r as runCommand, a as runCommandResult, s as shouldCapture } from './chunks/spawnEnv-CQwFu7ZJ.mjs';
|
|
3
|
+
export { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './chunks/resolveCliOptions-pgUXHJtj.mjs';
|
|
4
|
+
export { d as defineScripts, g as groupPlugins } from './chunks/types-CVDR-Sjk.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/
|
|
9
|
+
import './chunks/readDotenvCascade-DfFkWMjs.mjs';
|
|
10
10
|
import 'fs-extra';
|
|
11
|
+
import 'node:path';
|
|
11
12
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
12
13
|
import 'crypto';
|
|
13
14
|
import 'path';
|
|
14
15
|
import 'url';
|
|
15
|
-
import 'nanoid';
|
|
16
16
|
import 'dotenv';
|
|
17
|
-
import '
|
|
17
|
+
import 'nanoid';
|
|
18
|
+
import './chunks/loader-CePOf74i.mjs';
|
|
18
19
|
import 'package-directory';
|
|
19
20
|
import 'yaml';
|
|
20
21
|
import 'execa';
|
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-
|
|
1
|
+
export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-CePOf74i.mjs';
|
|
2
2
|
export { v as validateEnvAgainstSources } from './chunks/validate-CDl0rE6k.mjs';
|
|
3
3
|
import 'fs-extra';
|
|
4
4
|
import 'package-directory';
|
|
@@ -6,5 +6,6 @@ import 'path';
|
|
|
6
6
|
import 'url';
|
|
7
7
|
import 'yaml';
|
|
8
8
|
import 'zod';
|
|
9
|
+
import 'node:path';
|
|
9
10
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
10
11
|
import 'crypto';
|
package/dist/env-overlay.d.ts
CHANGED
|
@@ -180,6 +180,150 @@ type GetDotenvDynamicFunction = (vars: ProcessEnv, env: string | undefined) => s
|
|
|
180
180
|
*/
|
|
181
181
|
type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<GetDotenvDynamicFunction>>;
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* Dotenv provenance model (descriptor-only).
|
|
185
|
+
*
|
|
186
|
+
* Requirements addressed:
|
|
187
|
+
* - Host ctx carries a dotenv provenance mapping describing per-key origin and override history.
|
|
188
|
+
* - Provenance is descriptor-only (no value payloads).
|
|
189
|
+
* - Provenance is an ordered stack per key in ascending precedence; the last entry is effective.
|
|
190
|
+
* - Explicit unsets are represented as `op: 'unset'` without requiring deletion of keys from the env map.
|
|
191
|
+
*/
|
|
192
|
+
/**
|
|
193
|
+
* Provenance kind for an entry in {@link DotenvProvenance}.
|
|
194
|
+
*
|
|
195
|
+
* @public
|
|
196
|
+
*/
|
|
197
|
+
type DotenvProvenanceKind = 'file' | 'config' | 'vars' | 'dynamic';
|
|
198
|
+
/**
|
|
199
|
+
* Operation represented by a provenance entry.
|
|
200
|
+
*
|
|
201
|
+
* @public
|
|
202
|
+
*/
|
|
203
|
+
type DotenvProvenanceOp = 'set' | 'unset';
|
|
204
|
+
/**
|
|
205
|
+
* Base shape for all provenance entries.
|
|
206
|
+
*
|
|
207
|
+
* @public
|
|
208
|
+
*/
|
|
209
|
+
interface DotenvProvenanceEntryBase {
|
|
210
|
+
/**
|
|
211
|
+
* The kind of provenance entry.
|
|
212
|
+
*/
|
|
213
|
+
kind: DotenvProvenanceKind;
|
|
214
|
+
/**
|
|
215
|
+
* The operation applied at this layer.
|
|
216
|
+
*/
|
|
217
|
+
op: DotenvProvenanceOp;
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Provenance entry representing a value sourced from a dotenv file in the cascade.
|
|
221
|
+
*
|
|
222
|
+
* @public
|
|
223
|
+
*/
|
|
224
|
+
interface DotenvFileProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
225
|
+
/** Discriminator. */
|
|
226
|
+
kind: 'file';
|
|
227
|
+
/** Global vs env-scoped file. */
|
|
228
|
+
scope: 'global' | 'env';
|
|
229
|
+
/** Public vs private file. */
|
|
230
|
+
privacy: 'public' | 'private';
|
|
231
|
+
/** Environment name (required when scope is `env`). */
|
|
232
|
+
env?: string;
|
|
233
|
+
/**
|
|
234
|
+
* The corresponding `paths[]` entry as provided by the caller/CLI.
|
|
235
|
+
* This is not an absolute path by policy.
|
|
236
|
+
*/
|
|
237
|
+
path: string;
|
|
238
|
+
/**
|
|
239
|
+
* The computed dotenv filename token (e.g., `.env`, `.env.dev`, `.env.local`, `.env.dev.local`).
|
|
240
|
+
*/
|
|
241
|
+
file: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Provenance entry representing a value sourced from config overlays (`vars` / `envVars`).
|
|
245
|
+
*
|
|
246
|
+
* @public
|
|
247
|
+
*/
|
|
248
|
+
interface DotenvConfigProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
249
|
+
/** Discriminator. */
|
|
250
|
+
kind: 'config';
|
|
251
|
+
/** Global vs env-scoped config slice. */
|
|
252
|
+
scope: 'global' | 'env';
|
|
253
|
+
/** Public vs private on the privacy axis (`local` config maps to `private`). */
|
|
254
|
+
privacy: 'public' | 'private';
|
|
255
|
+
/** Environment name (required when scope is `env`). */
|
|
256
|
+
env?: string;
|
|
257
|
+
/** Packaged vs project config origin. */
|
|
258
|
+
configScope: 'packaged' | 'project';
|
|
259
|
+
/** Public vs local config file. */
|
|
260
|
+
configPrivacy: 'public' | 'local';
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Provenance entry representing explicit variables overrides.
|
|
264
|
+
*
|
|
265
|
+
* Notes:
|
|
266
|
+
* - This kind represents values injected via `vars` (CLI/programmatic), not dotenv files.
|
|
267
|
+
*
|
|
268
|
+
* @public
|
|
269
|
+
*/
|
|
270
|
+
interface DotenvVarsProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
271
|
+
/** Discriminator. */
|
|
272
|
+
kind: 'vars';
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Source tier for dynamic variables.
|
|
276
|
+
*
|
|
277
|
+
* @public
|
|
278
|
+
*/
|
|
279
|
+
type DotenvDynamicSource = 'config' | 'programmatic' | 'dynamicPath';
|
|
280
|
+
/**
|
|
281
|
+
* Provenance entry representing dynamic variables.
|
|
282
|
+
*
|
|
283
|
+
* @public
|
|
284
|
+
*/
|
|
285
|
+
interface DotenvDynamicProvenanceEntry extends DotenvProvenanceEntryBase {
|
|
286
|
+
/** Discriminator. */
|
|
287
|
+
kind: 'dynamic';
|
|
288
|
+
/** Dynamic source tier. */
|
|
289
|
+
dynamicSource: DotenvDynamicSource;
|
|
290
|
+
/**
|
|
291
|
+
* The `dynamicPath` value as provided by the caller/CLI when `dynamicSource` is `dynamicPath`.
|
|
292
|
+
* This is not resolved to an absolute path by provenance policy.
|
|
293
|
+
*/
|
|
294
|
+
dynamicPath?: string;
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Union of all supported provenance entry shapes.
|
|
298
|
+
*
|
|
299
|
+
* @public
|
|
300
|
+
*/
|
|
301
|
+
type DotenvProvenanceEntry = DotenvFileProvenanceEntry | DotenvConfigProvenanceEntry | DotenvVarsProvenanceEntry | DotenvDynamicProvenanceEntry;
|
|
302
|
+
/**
|
|
303
|
+
* Per-key provenance history.
|
|
304
|
+
*
|
|
305
|
+
* Each key maps to an array of entries ordered in ascending precedence (lower to higher).
|
|
306
|
+
*
|
|
307
|
+
* @public
|
|
308
|
+
*/
|
|
309
|
+
type DotenvProvenance = Record<string, DotenvProvenanceEntry[]>;
|
|
310
|
+
/**
|
|
311
|
+
* Create an empty provenance map.
|
|
312
|
+
*
|
|
313
|
+
* @public
|
|
314
|
+
*/
|
|
315
|
+
declare function createDotenvProvenance(): DotenvProvenance;
|
|
316
|
+
/**
|
|
317
|
+
* Append a provenance entry for a key.
|
|
318
|
+
*
|
|
319
|
+
* @param prov - Provenance map to mutate.
|
|
320
|
+
* @param key - Variable name.
|
|
321
|
+
* @param entry - Descriptor-only provenance entry.
|
|
322
|
+
*
|
|
323
|
+
* @public
|
|
324
|
+
*/
|
|
325
|
+
declare function pushDotenvProvenance(prov: DotenvProvenance, key: string, entry: DotenvProvenanceEntry): void;
|
|
326
|
+
|
|
183
327
|
/**
|
|
184
328
|
* Apply a dynamic map to the target progressively.
|
|
185
329
|
* - Functions receive (target, env) and may return string | undefined.
|
|
@@ -191,6 +335,42 @@ type GetDotenvDynamic = Record<string, GetDotenvDynamicFunction | ReturnType<Get
|
|
|
191
335
|
* @returns Nothing.
|
|
192
336
|
*/
|
|
193
337
|
declare function applyDynamicMap(target: ProcessEnv, map?: GetDotenvDynamic, env?: string): void;
|
|
338
|
+
/**
|
|
339
|
+
* Load a default-export dynamic map from a JS/TS file (without applying it).
|
|
340
|
+
*
|
|
341
|
+
* Uses util/loadModuleDefault for robust TS handling (direct import, esbuild,
|
|
342
|
+
* typescript.transpile fallback).
|
|
343
|
+
*
|
|
344
|
+
* Error behavior:
|
|
345
|
+
* - On failure to load/compile/evaluate the module, throws a unified message:
|
|
346
|
+
* "Unable to load dynamic TypeScript file: <absPath>. Install 'esbuild'..."
|
|
347
|
+
*
|
|
348
|
+
* @param absPath - Absolute path to the dynamic module file.
|
|
349
|
+
* @param cacheDirName - Cache subdirectory under `.tsbuild/` for compiled artifacts.
|
|
350
|
+
* @returns A `Promise\<GetDotenvDynamic | undefined\>` resolving to the module default export (if present).
|
|
351
|
+
*
|
|
352
|
+
* @public
|
|
353
|
+
*/
|
|
354
|
+
declare function loadDynamicModuleDefault(absPath: string, cacheDirName: string): Promise<GetDotenvDynamic | undefined>;
|
|
355
|
+
/**
|
|
356
|
+
* Apply a dynamic map and append provenance entries per key.
|
|
357
|
+
*
|
|
358
|
+
* Requirements addressed:
|
|
359
|
+
* - Dynamic provenance entries record `dynamicSource` and optional `dynamicPath` (as provided).
|
|
360
|
+
* - Record `op: 'unset'` when the dynamic evaluation yields `undefined`.
|
|
361
|
+
*
|
|
362
|
+
* @param target - Mutable env map to assign into.
|
|
363
|
+
* @param map - Dynamic map (functions and/or literals).
|
|
364
|
+
* @param env - Selected environment name (if any).
|
|
365
|
+
* @param prov - Provenance map to append into.
|
|
366
|
+
* @param meta - Dynamic provenance metadata (source tier and optional dynamicPath).
|
|
367
|
+
*
|
|
368
|
+
* @public
|
|
369
|
+
*/
|
|
370
|
+
declare function applyDynamicMapWithProvenance(target: ProcessEnv, map: GetDotenvDynamic | undefined, env: string | undefined, prov: DotenvProvenance, meta: {
|
|
371
|
+
dynamicSource: DotenvDynamicSource;
|
|
372
|
+
dynamicPath?: string;
|
|
373
|
+
}): void;
|
|
194
374
|
/**
|
|
195
375
|
* Load a default-export dynamic map from a JS/TS file and apply it.
|
|
196
376
|
* Uses util/loadModuleDefault for robust TS handling (direct import, esbuild,
|
|
@@ -273,5 +453,127 @@ declare function overlayEnv<B extends ProcessEnv | Readonly<Record<string, strin
|
|
|
273
453
|
programmaticVars: P;
|
|
274
454
|
}): B & P;
|
|
275
455
|
|
|
276
|
-
|
|
277
|
-
|
|
456
|
+
/**
|
|
457
|
+
* Overlay config-provided values onto a base env while recording provenance.
|
|
458
|
+
*
|
|
459
|
+
* Requirements addressed:
|
|
460
|
+
* - Provenance entries for `kind: 'config'` include scope/privacy/env/configScope/configPrivacy.
|
|
461
|
+
* - Provenance entries for `kind: 'vars'` represent explicit vars overlays.
|
|
462
|
+
* - Provenance is recorded as layers are applied (no post-hoc reconstruction).
|
|
463
|
+
* - Record `op: 'unset'` when a layer writes an undefined result (e.g., expansion yields empty).
|
|
464
|
+
*/
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Input options for {@link overlayEnvWithProvenance}.
|
|
468
|
+
*
|
|
469
|
+
* @public
|
|
470
|
+
*/
|
|
471
|
+
interface OverlayEnvWithProvenanceArgs {
|
|
472
|
+
/**
|
|
473
|
+
* Base environment variables.
|
|
474
|
+
*/
|
|
475
|
+
base: ProcessEnv | Readonly<Record<string, string | undefined>>;
|
|
476
|
+
/**
|
|
477
|
+
* Target environment name.
|
|
478
|
+
*/
|
|
479
|
+
env: string | undefined;
|
|
480
|
+
/**
|
|
481
|
+
* Configuration sources to overlay.
|
|
482
|
+
*/
|
|
483
|
+
configs: OverlayConfigSources;
|
|
484
|
+
/**
|
|
485
|
+
* Explicit vars overlays applied at the highest static precedence tier.
|
|
486
|
+
*/
|
|
487
|
+
programmaticVars?: ProcessEnv | Readonly<Record<string, string | undefined>>;
|
|
488
|
+
/**
|
|
489
|
+
* Existing provenance map to append into. When omitted, a new map is created.
|
|
490
|
+
*/
|
|
491
|
+
provenance?: DotenvProvenance;
|
|
492
|
+
}
|
|
493
|
+
/**
|
|
494
|
+
* Output of {@link overlayEnvWithProvenance}.
|
|
495
|
+
*
|
|
496
|
+
* @public
|
|
497
|
+
*/
|
|
498
|
+
interface OverlayEnvWithProvenanceResult {
|
|
499
|
+
/**
|
|
500
|
+
* The overlaid environment.
|
|
501
|
+
*/
|
|
502
|
+
env: ProcessEnv;
|
|
503
|
+
/**
|
|
504
|
+
* Provenance history for keys affected by overlays.
|
|
505
|
+
*/
|
|
506
|
+
provenance: DotenvProvenance;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Overlay config-provided values onto a base ProcessEnv using precedence axes:
|
|
510
|
+
* - kind: env \> global
|
|
511
|
+
* - privacy: local \> public
|
|
512
|
+
* - source: project \> packaged \> base
|
|
513
|
+
*
|
|
514
|
+
* Programmatic explicit vars override all config slices.
|
|
515
|
+
*
|
|
516
|
+
* @param args - Overlay inputs.
|
|
517
|
+
* @returns The overlaid env and the updated provenance mapping.
|
|
518
|
+
*
|
|
519
|
+
* @public
|
|
520
|
+
*/
|
|
521
|
+
declare function overlayEnvWithProvenance(args: OverlayEnvWithProvenanceArgs): OverlayEnvWithProvenanceResult;
|
|
522
|
+
|
|
523
|
+
/**
|
|
524
|
+
* Read dotenv files from the deterministic cascade and record provenance.
|
|
525
|
+
*
|
|
526
|
+
* Requirements addressed:
|
|
527
|
+
* - Provenance entries for `kind: 'file'` include scope/privacy/env/path/file (descriptor-only).
|
|
528
|
+
* - Provenance is ordered in ascending precedence as layers are applied.
|
|
529
|
+
* - Uses the same file naming convention as get-dotenv (public/private × global/env).
|
|
530
|
+
*/
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Inputs for reading the dotenv cascade with provenance.
|
|
534
|
+
*
|
|
535
|
+
* @public
|
|
536
|
+
*/
|
|
537
|
+
interface ReadDotenvCascadeArgs {
|
|
538
|
+
/** Base dotenv filename token (default `.env`). */
|
|
539
|
+
dotenvToken?: string;
|
|
540
|
+
/** Private token suffix (default `local`). */
|
|
541
|
+
privateToken?: string;
|
|
542
|
+
/** Ordered search paths (directories). */
|
|
543
|
+
paths: string[];
|
|
544
|
+
/** Selected env name (used for env-scoped files). */
|
|
545
|
+
env?: string;
|
|
546
|
+
/** Default env name (used when `env` is not provided). */
|
|
547
|
+
defaultEnv?: string;
|
|
548
|
+
/** Exclude env-scoped files. */
|
|
549
|
+
excludeEnv?: boolean;
|
|
550
|
+
/** Exclude global files. */
|
|
551
|
+
excludeGlobal?: boolean;
|
|
552
|
+
/** Exclude private files. */
|
|
553
|
+
excludePrivate?: boolean;
|
|
554
|
+
/** Exclude public files. */
|
|
555
|
+
excludePublic?: boolean;
|
|
556
|
+
}
|
|
557
|
+
/**
|
|
558
|
+
* Result of reading the dotenv cascade with provenance.
|
|
559
|
+
*
|
|
560
|
+
* @public
|
|
561
|
+
*/
|
|
562
|
+
interface ReadDotenvCascadeResult {
|
|
563
|
+
/** Expanded dotenv map composed from file sources only. */
|
|
564
|
+
dotenv: ProcessEnv;
|
|
565
|
+
/** File-only provenance history for keys in {@link ReadDotenvCascadeResult.dotenv}. */
|
|
566
|
+
provenance: DotenvProvenance;
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Read and expand dotenv vars from the deterministic file cascade, recording file provenance.
|
|
570
|
+
*
|
|
571
|
+
* @param args - Cascade selector options (tokens/paths/excludes/env).
|
|
572
|
+
* @returns Expanded dotenv and provenance.
|
|
573
|
+
*
|
|
574
|
+
* @public
|
|
575
|
+
*/
|
|
576
|
+
declare function readDotenvCascadeWithProvenance(args: ReadDotenvCascadeArgs): Promise<ReadDotenvCascadeResult>;
|
|
577
|
+
|
|
578
|
+
export { applyDynamicMap, applyDynamicMapWithProvenance, createDotenvProvenance, loadAndApplyDynamic, loadDynamicModuleDefault, overlayEnv, overlayEnvWithProvenance, pushDotenvProvenance, readDotenvCascadeWithProvenance };
|
|
579
|
+
export type { DotenvConfigProvenanceEntry, DotenvDynamicProvenanceEntry, DotenvDynamicSource, DotenvFileProvenanceEntry, DotenvProvenance, DotenvProvenanceEntry, DotenvProvenanceEntryBase, DotenvProvenanceKind, DotenvProvenanceOp, DotenvVarsProvenanceEntry, OverlayConfigSources, OverlayEnvOptionsBase, OverlayEnvOptionsWithProgrammatic, OverlayEnvWithProvenanceArgs, OverlayEnvWithProvenanceResult, ReadDotenvCascadeArgs, ReadDotenvCascadeResult };
|
package/dist/env-overlay.mjs
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
import { d as dotenvExpandAll } from './chunks/readDotenvCascade-DfFkWMjs.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-DfFkWMjs.mjs';
|
|
2
3
|
import 'fs-extra';
|
|
4
|
+
import 'node:path';
|
|
3
5
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
4
6
|
import 'crypto';
|
|
5
7
|
import 'path';
|
|
6
8
|
import 'url';
|
|
9
|
+
import 'dotenv';
|
|
10
|
+
|
|
11
|
+
const applyKv = (current, kv) => {
|
|
12
|
+
if (!kv || Object.keys(kv).length === 0)
|
|
13
|
+
return current;
|
|
14
|
+
const expanded = dotenvExpandAll(kv, { ref: current, progressive: true });
|
|
15
|
+
return { ...current, ...expanded };
|
|
16
|
+
};
|
|
17
|
+
const applyConfigSlice = (current, cfg, env) => {
|
|
18
|
+
if (!cfg)
|
|
19
|
+
return current;
|
|
20
|
+
// kind axis: global then env (env overrides global)
|
|
21
|
+
const afterGlobal = applyKv(current, cfg.vars);
|
|
22
|
+
const envKv = env && cfg.envVars ? cfg.envVars[env] : undefined;
|
|
23
|
+
return applyKv(afterGlobal, envKv);
|
|
24
|
+
};
|
|
25
|
+
function overlayEnv(args) {
|
|
26
|
+
const { base, env, configs } = args;
|
|
27
|
+
let current = { ...base };
|
|
28
|
+
// Source: packaged (public -> local)
|
|
29
|
+
current = applyConfigSlice(current, configs.packaged, env);
|
|
30
|
+
// Packaged "local" is not expected by policy; if present, honor it.
|
|
31
|
+
// We do not have a separate object for packaged.local in sources, keep as-is.
|
|
32
|
+
// Source: project (public -> local)
|
|
33
|
+
current = applyConfigSlice(current, configs.project?.public, env);
|
|
34
|
+
current = applyConfigSlice(current, configs.project?.local, env);
|
|
35
|
+
// Programmatic explicit vars (top of static tier)
|
|
36
|
+
if ('programmaticVars' in args) {
|
|
37
|
+
const toApply = Object.fromEntries(Object.entries(args.programmaticVars).filter(([_k, v]) => typeof v === 'string'));
|
|
38
|
+
current = applyKv(current, toApply);
|
|
39
|
+
}
|
|
40
|
+
return current;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export { overlayEnv };
|
package/dist/getdotenv.cli.mjs
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { c as createCli } from './chunks/createCli-
|
|
2
|
+
import { c as createCli } from './chunks/createCli-BnRdfRRL.mjs';
|
|
3
3
|
import 'zod';
|
|
4
4
|
import 'path';
|
|
5
|
-
import './chunks/loader-
|
|
5
|
+
import './chunks/loader-CePOf74i.mjs';
|
|
6
6
|
import 'fs-extra';
|
|
7
7
|
import 'package-directory';
|
|
8
8
|
import 'url';
|
|
9
9
|
import 'yaml';
|
|
10
|
+
import 'node:path';
|
|
10
11
|
import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
|
|
11
12
|
import 'crypto';
|
|
12
|
-
import './chunks/readMergedOptions-Nt0TR7dX.mjs';
|
|
13
|
-
import '@commander-js/extra-typings';
|
|
14
|
-
import './chunks/overlayEnv-Bs2kVayG.mjs';
|
|
15
13
|
import 'nanoid';
|
|
14
|
+
import './chunks/readMergedOptions-B7VdLROn.mjs';
|
|
15
|
+
import '@commander-js/extra-typings';
|
|
16
|
+
import './chunks/readDotenvCascade-DfFkWMjs.mjs';
|
|
16
17
|
import 'dotenv';
|
|
17
18
|
import 'execa';
|
|
18
19
|
import './chunks/helpConfig-CGejgwWW.mjs';
|
|
19
|
-
import './chunks/resolveCliOptions-
|
|
20
|
+
import './chunks/resolveCliOptions-pgUXHJtj.mjs';
|
|
20
21
|
import './chunks/validate-CDl0rE6k.mjs';
|
|
21
22
|
import './plugins-aws.mjs';
|
|
22
|
-
import './chunks/spawnEnv-
|
|
23
|
-
import './chunks/index-
|
|
23
|
+
import './chunks/spawnEnv-CQwFu7ZJ.mjs';
|
|
24
|
+
import './chunks/index-70Dm0f1N.mjs';
|
|
24
25
|
import 'buffer';
|
|
25
26
|
import 'os';
|
|
26
27
|
import 'node:fs/promises';
|
|
@@ -32,11 +33,10 @@ import 'node:fs';
|
|
|
32
33
|
import './plugins-batch.mjs';
|
|
33
34
|
import './chunks/invoke-DuRPU1oC.mjs';
|
|
34
35
|
import 'globby';
|
|
35
|
-
import './chunks/index-
|
|
36
|
+
import './chunks/index-r0Me7-sT.mjs';
|
|
36
37
|
import './plugins-init.mjs';
|
|
37
38
|
import 'node:process';
|
|
38
39
|
import 'readline/promises';
|
|
39
|
-
import 'node:path';
|
|
40
40
|
import 'node:url';
|
|
41
41
|
|
|
42
42
|
// Delegate to the canonical host factory.
|