@karmaniverous/get-dotenv 6.4.0 → 6.5.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.
Files changed (50) hide show
  1. package/README.md +1 -1
  2. package/dist/chunks/{AwsRestJsonProtocol-fYZqn-kW.mjs → AwsRestJsonProtocol-D_GDWyaH.mjs} +2 -2
  3. package/dist/chunks/{createCli-BnRdfRRL.mjs → createCli-Ct22WCEC.mjs} +8 -5
  4. package/dist/chunks/{externalDataInterceptor-CILOLqbB.mjs → externalDataInterceptor-BRIxrVUl.mjs} +2 -2
  5. package/dist/chunks/{getSSOTokenFromFile-BwMkZ_yT.mjs → getSSOTokenFromFile-TYPZln9_.mjs} +1 -1
  6. package/dist/chunks/{index-DWqbxY8Y.mjs → index-5AyAFomx.mjs} +11 -9
  7. package/dist/chunks/{index-Du51s-Z0.mjs → index-5NxTUVel.mjs} +8 -6
  8. package/dist/chunks/{index-70Dm0f1N.mjs → index-BCVlyd0W.mjs} +12 -10
  9. package/dist/chunks/{index-DLNhHC15.mjs → index-BMb3Lxzl.mjs} +9 -7
  10. package/dist/chunks/{index-0-nP97ri.mjs → index-BNWgREzT.mjs} +7 -5
  11. package/dist/chunks/{index-o5zJ9PWL.mjs → index-BSO6unyj.mjs} +16 -14
  12. package/dist/chunks/{index-BhVOypA1.mjs → index-Be7QY_7N.mjs} +9 -7
  13. package/dist/chunks/{index-r0Me7-sT.mjs → index-BzOeGJbq.mjs} +9 -9
  14. package/dist/chunks/{index-D8UL3w94.mjs → index-CR4cJOVz.mjs} +6 -4
  15. package/dist/chunks/{index-CcwT4HJK.mjs → index-Dz-kRqKN.mjs} +6 -4
  16. package/dist/chunks/{index-DuSz0ul6.mjs → index-G-U0Dimh.mjs} +8 -6
  17. package/dist/chunks/{index-_FP0whjC.mjs → index-LKToAIhZ.mjs} +6 -4
  18. package/dist/chunks/{index-OeNCYa8T.mjs → index-jLjEQoIi.mjs} +6 -4
  19. package/dist/chunks/{loadSso-CLR1fKci.mjs → loadSso-BnjVSVhE.mjs} +8 -6
  20. package/dist/chunks/{loader-CePOf74i.mjs → loader-CE4HSRN4.mjs} +3 -0
  21. package/dist/chunks/{parseKnownFiles-BQvmJ0HK.mjs → parseKnownFiles-CejYPe7q.mjs} +1 -1
  22. package/dist/chunks/{readDotenvCascade-DfFkWMjs.mjs → readDotenvCascade-Bymjvyit.mjs} +4 -1
  23. package/dist/chunks/{readMergedOptions-B7VdLROn.mjs → readMergedOptions-DLRFU2qO.mjs} +40 -38
  24. package/dist/chunks/{resolveCliOptions-pgUXHJtj.mjs → resolveCliOptions-C6oeNl9S.mjs} +4 -1
  25. package/dist/chunks/{sdk-stream-mixin-ecbbBR0l.mjs → sdk-stream-mixin-BDitDomf.mjs} +1 -1
  26. package/dist/chunks/{spawnEnv-CQwFu7ZJ.mjs → spawnEnv-5kdIVv0x.mjs} +5 -2
  27. package/dist/chunks/{types-CVDR-Sjk.mjs → types-BC96rfQj.mjs} +1 -1
  28. package/dist/cli.d.ts +0 -10
  29. package/dist/cli.mjs +11 -9
  30. package/dist/cliHost.d.ts +40 -13
  31. package/dist/cliHost.mjs +54 -7
  32. package/dist/config.d.ts +0 -10
  33. package/dist/config.mjs +4 -1
  34. package/dist/env-overlay.d.ts +6 -16
  35. package/dist/env-overlay.mjs +5 -2
  36. package/dist/getdotenv.cli.mjs +11 -9
  37. package/dist/index.d.ts +25 -31
  38. package/dist/index.mjs +35 -14
  39. package/dist/plugins-aws.d.ts +12 -11
  40. package/dist/plugins-aws.mjs +27 -6
  41. package/dist/plugins-batch.d.ts +1 -11
  42. package/dist/plugins-batch.mjs +6 -4
  43. package/dist/plugins-cmd.d.ts +0 -10
  44. package/dist/plugins-cmd.mjs +8 -6
  45. package/dist/plugins-init.d.ts +0 -10
  46. package/dist/plugins-init.mjs +5 -3
  47. package/dist/plugins.d.ts +12 -11
  48. package/dist/plugins.mjs +10 -8
  49. package/package.json +2 -1
  50. package/templates/config/ts/getdotenv.config.ts +5 -3
@@ -1,19 +1,21 @@
1
1
  import { parse } from 'url';
2
2
  import { Buffer } from 'buffer';
3
3
  import { request } from 'http';
4
- import { aq as ProviderError, C as CredentialsProviderError, F as parseUrl, O as loadConfig } from './index-70Dm0f1N.mjs';
5
- import './readMergedOptions-B7VdLROn.mjs';
4
+ import { aq as ProviderError, C as CredentialsProviderError, F as parseUrl, O as loadConfig } from './index-BCVlyd0W.mjs';
5
+ import './readMergedOptions-DLRFU2qO.mjs';
6
6
  import 'zod';
7
7
  import '@commander-js/extra-typings';
8
- import './readDotenvCascade-DfFkWMjs.mjs';
8
+ import './readDotenvCascade-Bymjvyit.mjs';
9
9
  import 'fs-extra';
10
+ import 'radash';
11
+ import 'node:buffer';
10
12
  import 'node:path';
11
13
  import './loadModuleDefault-Dj8B3Stt.mjs';
12
14
  import 'crypto';
13
15
  import 'path';
14
16
  import 'dotenv';
15
17
  import 'nanoid';
16
- import './loader-CePOf74i.mjs';
18
+ import './loader-CE4HSRN4.mjs';
17
19
  import 'package-directory';
18
20
  import 'yaml';
19
21
  import 'execa';
@@ -1,10 +1,12 @@
1
- import { w as resolveAwsSdkSigV4Config, x as normalizeProvider, y as getSmithyContext, z as EndpointCache, A as resolveEndpoint, B as awsEndpointFunctions, D as customEndpointFunctions, t as toUtf8, i as fromUtf8, F as parseUrl, G as NoOpLogger, I as AwsSdkSigV4Signer, J as NoAuthSigner, n as toBase64, m as fromBase64, K as emitWarningIfUnsupportedVersion, L as resolveDefaultsModeConfig, M as emitWarningIfUnsupportedVersion$1, O as loadConfig, r as streamCollector, P as Hash, N as NodeHttpHandler, Q as createDefaultUserAgentProvider, R as calculateBodyLength, S as NODE_APP_ID_CONFIG_OPTIONS, T as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as DEFAULT_RETRY_MODE, X as NODE_REGION_CONFIG_FILE_OPTIONS, Y as NODE_REGION_CONFIG_OPTIONS, Z as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a0 as getAwsRegionExtensionConfiguration, a1 as getDefaultExtensionConfiguration, a2 as getHttpHandlerExtensionConfiguration, a3 as resolveAwsRegionExtensionConfiguration, a4 as resolveDefaultRuntimeConfig, a5 as resolveHttpHandlerRuntimeConfig, a6 as Client, a7 as resolveUserAgentConfig, a8 as resolveRetryConfig, a9 as resolveRegionConfig, aa as resolveEndpointConfig, ab as resolveHostHeaderConfig, ac as getSchemaSerdePlugin, ad as getUserAgentPlugin, ae as getRetryPlugin, af as getContentLengthPlugin, ag as getHostHeaderPlugin, ah as getLoggerPlugin, ai as getRecursionDetectionPlugin, aj as getHttpAuthSchemeEndpointRuleSetPlugin, ak as DefaultIdentityProviderConfig, al as getHttpSigningPlugin, am as ServiceException, an as TypeRegistry, ao as Command, ap as getEndpointPlugin } from './index-70Dm0f1N.mjs';
2
- import { A as AwsRestJsonProtocol } from './AwsRestJsonProtocol-fYZqn-kW.mjs';
3
- import './readMergedOptions-B7VdLROn.mjs';
1
+ import { w as resolveAwsSdkSigV4Config, x as normalizeProvider, y as getSmithyContext, z as EndpointCache, A as resolveEndpoint, B as awsEndpointFunctions, D as customEndpointFunctions, t as toUtf8, i as fromUtf8, F as parseUrl, G as NoOpLogger, I as AwsSdkSigV4Signer, J as NoAuthSigner, n as toBase64, m as fromBase64, K as emitWarningIfUnsupportedVersion, L as resolveDefaultsModeConfig, M as emitWarningIfUnsupportedVersion$1, O as loadConfig, r as streamCollector, P as Hash, N as NodeHttpHandler, Q as createDefaultUserAgentProvider, R as calculateBodyLength, S as NODE_APP_ID_CONFIG_OPTIONS, T as NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS, U as NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS, V as NODE_RETRY_MODE_CONFIG_OPTIONS, W as DEFAULT_RETRY_MODE, X as NODE_REGION_CONFIG_FILE_OPTIONS, Y as NODE_REGION_CONFIG_OPTIONS, Z as NODE_MAX_ATTEMPT_CONFIG_OPTIONS, _ as NODE_AUTH_SCHEME_PREFERENCE_OPTIONS, $ as loadConfigsForDefaultMode, a0 as getAwsRegionExtensionConfiguration, a1 as getDefaultExtensionConfiguration, a2 as getHttpHandlerExtensionConfiguration, a3 as resolveAwsRegionExtensionConfiguration, a4 as resolveDefaultRuntimeConfig, a5 as resolveHttpHandlerRuntimeConfig, a6 as Client, a7 as resolveUserAgentConfig, a8 as resolveRetryConfig, a9 as resolveRegionConfig, aa as resolveEndpointConfig, ab as resolveHostHeaderConfig, ac as getSchemaSerdePlugin, ad as getUserAgentPlugin, ae as getRetryPlugin, af as getContentLengthPlugin, ag as getHostHeaderPlugin, ah as getLoggerPlugin, ai as getRecursionDetectionPlugin, aj as getHttpAuthSchemeEndpointRuleSetPlugin, ak as DefaultIdentityProviderConfig, al as getHttpSigningPlugin, am as ServiceException, an as TypeRegistry, ao as Command, ap as getEndpointPlugin } from './index-BCVlyd0W.mjs';
2
+ import { A as AwsRestJsonProtocol } from './AwsRestJsonProtocol-D_GDWyaH.mjs';
3
+ import './readMergedOptions-DLRFU2qO.mjs';
4
4
  import 'zod';
5
5
  import '@commander-js/extra-typings';
6
- import './readDotenvCascade-DfFkWMjs.mjs';
6
+ import './readDotenvCascade-Bymjvyit.mjs';
7
7
  import 'fs-extra';
8
+ import 'radash';
9
+ import 'node:buffer';
8
10
  import 'node:path';
9
11
  import './loadModuleDefault-Dj8B3Stt.mjs';
10
12
  import 'crypto';
@@ -12,7 +14,7 @@ import 'path';
12
14
  import 'url';
13
15
  import 'dotenv';
14
16
  import 'nanoid';
15
- import './loader-CePOf74i.mjs';
17
+ import './loader-CE4HSRN4.mjs';
16
18
  import 'package-directory';
17
19
  import 'yaml';
18
20
  import 'execa';
@@ -24,7 +26,7 @@ import 'https';
24
26
  import 'stream';
25
27
  import 'process';
26
28
  import 'node:fs';
27
- import './sdk-stream-mixin-ecbbBR0l.mjs';
29
+ import './sdk-stream-mixin-BDitDomf.mjs';
28
30
 
29
31
  const defaultSSOHttpAuthSchemeParametersProvider = async (config, context, input) => {
30
32
  return {
@@ -4,8 +4,11 @@ import path, { join, extname } from 'path';
4
4
  import { fileURLToPath, pathToFileURL } from 'url';
5
5
  import YAML from 'yaml';
6
6
  import { z } from 'zod';
7
+ import 'radash';
8
+ import 'node:buffer';
7
9
  import 'node:path';
8
10
  import { l as loadModuleDefault } from './loadModuleDefault-Dj8B3Stt.mjs';
11
+ import '@commander-js/extra-typings';
9
12
 
10
13
  /**
11
14
  * Zod schemas for programmatic GetDotenv options.
@@ -1,4 +1,4 @@
1
- import { l as loadSharedConfigFiles } from './index-70Dm0f1N.mjs';
1
+ import { l as loadSharedConfigFiles } from './index-BCVlyd0W.mjs';
2
2
 
3
3
  const mergeConfigFiles = (...files) => {
4
4
  const merged = {};
@@ -1,6 +1,9 @@
1
1
  import fs from 'fs-extra';
2
+ import 'radash';
3
+ import 'node:buffer';
2
4
  import path from 'node:path';
3
5
  import { l as loadModuleDefault } from './loadModuleDefault-Dj8B3Stt.mjs';
6
+ import '@commander-js/extra-typings';
4
7
  import { parse } from 'dotenv';
5
8
  import 'crypto';
6
9
  import 'path';
@@ -118,7 +121,7 @@ const dotenvExpand = (value, ref = process.env) => {
118
121
  * subsequent expansions in the same object (left-to-right by object key order).
119
122
  */
120
123
  function dotenvExpandAll(values, options = {}) {
121
- const { ref = process.env, progressive = false, } = options;
124
+ const { ref = process.env, progressive = false } = options;
122
125
  const out = Object.keys(values).reduce((acc, key) => {
123
126
  acc[key] = dotenvExpand(values[key], {
124
127
  ...ref,
@@ -1,20 +1,30 @@
1
1
  import { z } from 'zod';
2
2
  import { Option, Command } from '@commander-js/extra-typings';
3
- import { g as dotenvExpand, r as readDotenvCascadeWithProvenance, o as overlayEnvWithProvenance, b as applyDynamicMapWithProvenance, l as loadDynamicModuleDefault, h as dotenvExpandFromProcessEnv } from './readDotenvCascade-DfFkWMjs.mjs';
3
+ import { g as dotenvExpand, r as readDotenvCascadeWithProvenance, o as overlayEnvWithProvenance, b as applyDynamicMapWithProvenance, l as loadDynamicModuleDefault, h as dotenvExpandFromProcessEnv } from './readDotenvCascade-Bymjvyit.mjs';
4
4
  import fs from 'fs-extra';
5
5
  import 'node:path';
6
6
  import 'nanoid';
7
7
  import path from 'path';
8
+ import { isObject, shake } from 'radash';
9
+ import 'node:buffer';
8
10
  import 'crypto';
9
11
  import { fileURLToPath } from 'url';
10
12
  import 'dotenv';
11
- import { g as getDotenvOptionsSchemaResolved, r as resolveGetDotenvConfigSources } from './loader-CePOf74i.mjs';
13
+ import { g as getDotenvOptionsSchemaResolved, r as resolveGetDotenvConfigSources } from './loader-CE4HSRN4.mjs';
12
14
  import { packageDirectory } from 'package-directory';
13
15
 
16
+ /**
17
+ * Plain-object deep merge with "later overrides earlier" semantics.
18
+ * - Only merges plain objects (prototype === Object.prototype).
19
+ * - Arrays and non-objects are replaced, not concatenated or merged.
20
+ * - Undefined values are ignored (do not overwrite).
21
+ *
22
+ * Merge order: defaultsDeep(base, override1, override2) → override2 wins.
23
+ */
14
24
  /** @internal */
15
- const isPlainObject$1 = (value) => value !== null &&
16
- typeof value === 'object' &&
17
- Object.getPrototypeOf(value) === Object.prototype;
25
+ const isPlainObject$1 = (value) => {
26
+ return isObject(value) && !Array.isArray(value);
27
+ };
18
28
  const mergeInto = (target, source) => {
19
29
  for (const [key, sVal] of Object.entries(source)) {
20
30
  if (sVal === undefined)
@@ -57,11 +67,20 @@ async function writeDotenvFile(filename, data) {
57
67
  await fs.writeFile(filename, body, { encoding: 'utf-8' });
58
68
  }
59
69
 
70
+ /**
71
+ * Deep interpolation utility for string leaves.
72
+ * - Expands string values using dotenv-style expansion against the provided envRef.
73
+ * - Preserves non-strings as-is.
74
+ * - Does not recurse into arrays (arrays are returned unchanged).
75
+ *
76
+ * Intended for:
77
+ * - Phase C option/config interpolation after composing ctx.dotenv.
78
+ * - Per-plugin config slice interpolation before afterResolve.
79
+ */
60
80
  /** @internal */
61
- const isPlainObject = (v) => v !== null &&
62
- typeof v === 'object' &&
63
- !Array.isArray(v) &&
64
- Object.getPrototypeOf(v) === Object.prototype;
81
+ const isPlainObject = (v) => {
82
+ return isObject(v) && !Array.isArray(v);
83
+ };
65
84
  /**
66
85
  * Deeply interpolate string leaves against envRef.
67
86
  * Arrays are not recursed into; they are returned unchanged.
@@ -103,33 +122,6 @@ const interpolateDeep = (value, envRef) => {
103
122
  return value;
104
123
  };
105
124
 
106
- /** src/util/omitUndefined.ts
107
- * Helpers to drop undefined-valued properties in a typed-friendly way.
108
- */
109
- /**
110
- * Omit keys whose runtime value is undefined from a shallow object.
111
- * Returns a Partial with non-undefined value types preserved.
112
- *
113
- * @typeParam T - Input object shape.
114
- * @param obj - Object to filter.
115
- * @returns A shallow copy of `obj` without keys whose value is `undefined`.
116
- */
117
- /**
118
- * Specialized helper for env-like maps: drop undefined and return string-only.
119
- *
120
- * @typeParam V - Value type for present entries (must extend `string`).
121
- * @param obj - Env-like record containing `string | undefined` values.
122
- * @returns A new record containing only the keys with defined values.
123
- */
124
- function omitUndefinedRecord(obj) {
125
- const out = {};
126
- for (const [k, v] of Object.entries(obj)) {
127
- if (v !== undefined)
128
- out[k] = v;
129
- }
130
- return out;
131
- }
132
-
133
125
  /**
134
126
  * Base root CLI defaults (shared; kept untyped here to avoid cross-layer deps).
135
127
  * Used as the bottom layer for CLI option resolution.
@@ -171,6 +163,16 @@ const baseRootOptionDefaults = {
171
163
  // (debug/log/exclude* resolved via flag utils)
172
164
  };
173
165
 
166
+ // src/GetDotenvOptions.ts
167
+ /**
168
+ * Canonical programmatic options and helpers for get-dotenv.
169
+ *
170
+ * Requirements addressed:
171
+ * - GetDotenvOptions derives from the Zod schema output (single source of truth).
172
+ * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
173
+ * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
174
+ * - Preserve existing behavior for defaults resolution and compat converters.
175
+ */
174
176
  function defineDynamic(d) {
175
177
  return d;
176
178
  }
@@ -230,7 +232,7 @@ debug: _debug, scripts: _scripts, ...rest }) => {
230
232
  // Drop undefined-valued entries at the converter stage to match ProcessEnv
231
233
  // expectations and the compat test assertions.
232
234
  if (parsedVars) {
233
- parsedVars = omitUndefinedRecord(parsedVars);
235
+ parsedVars = shake(parsedVars, (v) => v === undefined);
234
236
  }
235
237
  // Tolerate paths as either a delimited string or string[]
236
238
  const pathsOut = Array.isArray(paths)
@@ -266,7 +268,7 @@ const resolveGetDotenvOptions = (customOptions) => {
266
268
  const result = defaultsDeep(defaultsFromCli, customOptions);
267
269
  return Promise.resolve({
268
270
  ...result, // Keep explicit empty strings/zeros; drop only undefined
269
- vars: omitUndefinedRecord(result.vars ?? {}),
271
+ vars: shake(result.vars ?? {}, (v) => v === undefined),
270
272
  });
271
273
  };
272
274
 
@@ -1,9 +1,12 @@
1
- import { b as baseRootOptionDefaults, a as defaultsDeep } from './readMergedOptions-B7VdLROn.mjs';
1
+ import { b as baseRootOptionDefaults, a as defaultsDeep } from './readMergedOptions-DLRFU2qO.mjs';
2
+ import 'radash';
3
+ import 'node:buffer';
2
4
  import 'fs-extra';
3
5
  import 'node:path';
4
6
  import 'crypto';
5
7
  import 'path';
6
8
  import 'url';
9
+ import '@commander-js/extra-typings';
7
10
 
8
11
  /**
9
12
  * Base CLI options derived from the shared root option defaults.
@@ -1,4 +1,4 @@
1
- import { m as fromBase64, n as toBase64, o as toHex, t as toUtf8, q as fromArrayBuffer, r as streamCollector$1 } from './index-70Dm0f1N.mjs';
1
+ import { m as fromBase64, n as toBase64, o as toHex, t as toUtf8, q as fromArrayBuffer, r as streamCollector$1 } from './index-BCVlyd0W.mjs';
2
2
  import { Readable } from 'stream';
3
3
 
4
4
  const isReadableStream = (stream) => typeof ReadableStream === "function" &&
@@ -1,9 +1,12 @@
1
1
  import { execa, execaCommand } from 'execa';
2
+ import { shake } from 'radash';
3
+ import 'node:buffer';
2
4
  import 'fs-extra';
3
5
  import 'node:path';
4
6
  import 'crypto';
5
7
  import 'path';
6
8
  import 'url';
9
+ import '@commander-js/extra-typings';
7
10
 
8
11
  /**
9
12
  * Minimal tokenizer for shell-off execution.
@@ -255,7 +258,6 @@ const resolveShell = (scripts, command, shell) => scripts && typeof scripts[comm
255
258
  ? (scripts[command].shell ?? false)
256
259
  : (shell ?? false);
257
260
 
258
- const dropUndefined = (bag) => Object.fromEntries(Object.entries(bag).filter((e) => typeof e[1] === 'string'));
259
261
  /**
260
262
  * Build a sanitized environment object for spawning child processes.
261
263
  * Merges `base` and `overlay`, drops undefined values, and handles platform-specific
@@ -270,7 +272,8 @@ const buildSpawnEnv = (base, overlay) => {
270
272
  ...(overlay ?? {}),
271
273
  };
272
274
  // Drop undefined first
273
- const entries = Object.entries(dropUndefined(raw));
275
+ const clean = shake(raw, (v) => v === undefined);
276
+ const entries = Object.entries(clean);
274
277
  if (process.platform === 'win32') {
275
278
  // Windows: keys are case-insensitive; collapse duplicates
276
279
  const byLower = new Map();
@@ -1,4 +1,4 @@
1
- import { d as definePlugin } from './readMergedOptions-B7VdLROn.mjs';
1
+ import { d as definePlugin } from './readMergedOptions-DLRFU2qO.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
@@ -360,16 +360,6 @@ interface BrandOptions {
360
360
  helpHeader?: string;
361
361
  }
362
362
 
363
- /**
364
- * Canonical programmatic options and helpers for get-dotenv.
365
- *
366
- * Requirements addressed:
367
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
368
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
369
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
370
- * - Preserve existing behavior for defaults resolution and compat converters.
371
- */
372
-
373
363
  /**
374
364
  * A minimal representation of an environment key/value mapping.
375
365
  * Values may be `undefined` to represent "unset".
package/dist/cli.mjs CHANGED
@@ -1,26 +1,28 @@
1
- export { c as createCli } from './chunks/createCli-BnRdfRRL.mjs';
1
+ export { c as createCli } from './chunks/createCli-Ct22WCEC.mjs';
2
2
  import 'zod';
3
3
  import 'path';
4
- import './chunks/loader-CePOf74i.mjs';
4
+ import './chunks/loader-CE4HSRN4.mjs';
5
5
  import 'fs-extra';
6
6
  import 'package-directory';
7
7
  import 'url';
8
8
  import 'yaml';
9
+ import 'radash';
10
+ import 'node:buffer';
9
11
  import 'node:path';
10
12
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
11
13
  import 'crypto';
12
- import 'nanoid';
13
- import './chunks/readMergedOptions-B7VdLROn.mjs';
14
14
  import '@commander-js/extra-typings';
15
- import './chunks/readDotenvCascade-DfFkWMjs.mjs';
15
+ import 'nanoid';
16
+ import './chunks/readMergedOptions-DLRFU2qO.mjs';
17
+ import './chunks/readDotenvCascade-Bymjvyit.mjs';
16
18
  import 'dotenv';
17
19
  import 'execa';
18
20
  import './chunks/helpConfig-CGejgwWW.mjs';
19
- import './chunks/resolveCliOptions-pgUXHJtj.mjs';
21
+ import './chunks/resolveCliOptions-C6oeNl9S.mjs';
20
22
  import './chunks/validate-CDl0rE6k.mjs';
21
23
  import './plugins-aws.mjs';
22
- import './chunks/spawnEnv-CQwFu7ZJ.mjs';
23
- import './chunks/index-70Dm0f1N.mjs';
24
+ import './chunks/spawnEnv-5kdIVv0x.mjs';
25
+ import './chunks/index-BCVlyd0W.mjs';
24
26
  import 'buffer';
25
27
  import 'os';
26
28
  import 'node:fs/promises';
@@ -32,7 +34,7 @@ import 'node:fs';
32
34
  import './plugins-batch.mjs';
33
35
  import './chunks/invoke-DuRPU1oC.mjs';
34
36
  import 'globby';
35
- import './chunks/index-r0Me7-sT.mjs';
37
+ import './chunks/index-BzOeGJbq.mjs';
36
38
  import './plugins-init.mjs';
37
39
  import 'node:process';
38
40
  import 'readline/promises';
package/dist/cliHost.d.ts CHANGED
@@ -366,16 +366,6 @@ interface BrandOptions {
366
366
  helpHeader?: string;
367
367
  }
368
368
 
369
- /**
370
- * Canonical programmatic options and helpers for get-dotenv.
371
- *
372
- * Requirements addressed:
373
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
374
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
375
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
376
- * - Preserve existing behavior for defaults resolution and compat converters.
377
- */
378
-
379
369
  /**
380
370
  * A minimal representation of an environment key/value mapping.
381
371
  * Values may be `undefined` to represent "unset".
@@ -654,6 +644,16 @@ declare function definePlugin<TOptions extends GetDotenvOptions, Schema extends
654
644
  }): PluginWithInstanceHelpers<TOptions, z.output<Schema>>;
655
645
  declare function definePlugin<TOptions extends GetDotenvOptions>(spec: DefineSpec<TOptions>): PluginWithInstanceHelpers<TOptions, {}>;
656
646
 
647
+ /**
648
+ * Non-interactive confirm guard for destructive ops.
649
+ * Returns true when force is provided; otherwise warns and sets exitCode.
650
+ *
651
+ * @param force - The force flag value (truthy allows proceed).
652
+ * @param op - Operation name for the warning message.
653
+ * @param flag - The flag name to suggest in the warning message (default: '--force').
654
+ */
655
+ declare function ensureForce(force: unknown, op: string, flag?: string): boolean;
656
+
657
657
  /**
658
658
  * Helper to decide whether to capture child stdio.
659
659
  * Checks GETDOTENV_STDIO env var or the provided bag capture flag.
@@ -959,6 +959,33 @@ interface GroupPluginsOptions<TOptions extends GetDotenvOptions = GetDotenvOptio
959
959
  */
960
960
  declare function groupPlugins<TOptions extends GetDotenvOptions = GetDotenvOptions>(options: GroupPluginsOptions<TOptions>): PluginWithInstanceHelpers<TOptions, {}>;
961
961
 
962
+ /**
963
+ * Return type for {@link describeConfigKeyListDefaults}.
964
+ *
965
+ * @public
966
+ */
967
+ interface DescribeConfigKeyListDefaultsResult {
968
+ /** Description for the include list default. */
969
+ includeDefault: string;
970
+ /** Description for the exclude list default. */
971
+ excludeDefault: string;
972
+ }
973
+ /**
974
+ * Describe a default value for help text.
975
+ * Handles arrays (joins with space) and strings; returns 'none' if empty/undefined.
976
+ */
977
+ declare const describeDefault: (v: unknown) => string;
978
+ /**
979
+ * Describe default values for a pair of include/exclude list options.
980
+ * Returns an object with `includeDefault` and `excludeDefault` strings.
981
+ *
982
+ * If both lists are populated, returns an invalid marker for both.
983
+ */
984
+ declare const describeConfigKeyListDefaults: ({ cfgInclude, cfgExclude, }: {
985
+ cfgInclude?: string[];
986
+ cfgExclude?: string[];
987
+ }) => DescribeConfigKeyListDefaultsResult;
988
+
962
989
  /** src/cliHost/invoke.ts
963
990
  * Shared helpers for composing child env overlays and preserving argv for Node -e.
964
991
  */
@@ -971,7 +998,7 @@ declare function groupPlugins<TOptions extends GetDotenvOptions = GetDotenvOptio
971
998
  * @param dotenv - Composed dotenv variables for the current invocation.
972
999
  * @returns A string-only env overlay suitable for child process spawning.
973
1000
  */
974
- declare function composeNestedEnv(merged: GetDotenvCliOptions | Record<string, unknown>, dotenv: Record<string, string | undefined>): Record<string, string>;
1001
+ declare function composeNestedEnv(merged: GetDotenvCliOptions | Record<string, unknown>, dotenv: ProcessEnv): Record<string, string>;
975
1002
  /**
976
1003
  * Strip one layer of symmetric outer quotes (single or double) from a string.
977
1004
  *
@@ -1086,7 +1113,7 @@ declare const resolveCliOptions: <T extends ResolveCliOptionsShape>(rawCliOption
1086
1113
  * @param base - Base environment (usually `process.env`).
1087
1114
  * @param overlay - Environment variables to overlay.
1088
1115
  */
1089
- declare const buildSpawnEnv: (base?: NodeJS.ProcessEnv, overlay?: Record<string, string | undefined>) => NodeJS.ProcessEnv;
1116
+ declare const buildSpawnEnv: (base?: NodeJS.ProcessEnv, overlay?: ProcessEnv) => NodeJS.ProcessEnv;
1090
1117
 
1091
- export { GetDotenvCli, baseGetDotenvCliOptions, buildSpawnEnv, composeNestedEnv, definePlugin, defineScripts, getRootCommand, groupPlugins, maybePreserveNodeEvalArgv, readMergedOptions, resolveCliOptions, resolveCommand, resolveShell, runCommand, runCommandResult, shouldCapture, stripOne, toHelpConfig };
1118
+ export { GetDotenvCli, baseGetDotenvCliOptions, buildSpawnEnv, composeNestedEnv, definePlugin, defineScripts, describeConfigKeyListDefaults, describeDefault, ensureForce, getRootCommand, groupPlugins, maybePreserveNodeEvalArgv, readMergedOptions, resolveCliOptions, resolveCommand, resolveShell, runCommand, runCommandResult, shouldCapture, stripOne, toHelpConfig };
1092
1119
  export type { BrandOptions, DefineSpec, GetDotenvCliCtx, GetDotenvCliOptions, GetDotenvCliPlugin, GetDotenvCliPublic, GroupPluginsOptions, InferPluginConfig, PluginChildEntry, PluginFlattenedEntry, PluginNamespaceOverride, PluginWithInstanceHelpers, ResolveAndLoadOptions, ResolveCliOptionsResult, ResolvedHelpConfig, RootOptionsShape, RunCommandOptions, RunCommandResultOptions, ScriptDef, Scripts, ScriptsTable };
package/dist/cliHost.mjs CHANGED
@@ -1,13 +1,15 @@
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';
1
+ export { G as GetDotenvCli, d as definePlugin, r as readMergedOptions } from './chunks/readMergedOptions-DLRFU2qO.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-C6oeNl9S.mjs';
4
+ export { d as defineScripts, g as groupPlugins } from './chunks/types-BC96rfQj.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-DfFkWMjs.mjs';
9
+ import './chunks/readDotenvCascade-Bymjvyit.mjs';
10
10
  import 'fs-extra';
11
+ import 'radash';
12
+ import 'node:buffer';
11
13
  import 'node:path';
12
14
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
13
15
  import 'crypto';
@@ -15,11 +17,27 @@ import 'path';
15
17
  import 'url';
16
18
  import 'dotenv';
17
19
  import 'nanoid';
18
- import './chunks/loader-CePOf74i.mjs';
20
+ import './chunks/loader-CE4HSRN4.mjs';
19
21
  import 'package-directory';
20
22
  import 'yaml';
21
23
  import 'execa';
22
24
 
25
+ /**
26
+ * Non-interactive confirm guard for destructive ops.
27
+ * Returns true when force is provided; otherwise warns and sets exitCode.
28
+ *
29
+ * @param force - The force flag value (truthy allows proceed).
30
+ * @param op - Operation name for the warning message.
31
+ * @param flag - The flag name to suggest in the warning message (default: '--force').
32
+ */
33
+ function ensureForce(force, op, flag = '--force') {
34
+ if (force)
35
+ return true;
36
+ console.warn(`${op} requires confirmation. Re-run with ${flag} to proceed.`);
37
+ process.exitCode = 2;
38
+ return false;
39
+ }
40
+
23
41
  /**
24
42
  * Return the top-level root command for a given mount or action's thisCommand.
25
43
  *
@@ -33,4 +51,33 @@ const getRootCommand = (cmd) => {
33
51
  return node;
34
52
  };
35
53
 
36
- export { getRootCommand };
54
+ /**
55
+ * Describe a default value for help text.
56
+ * Handles arrays (joins with space) and strings; returns 'none' if empty/undefined.
57
+ */
58
+ const describeDefault = (v) => {
59
+ if (Array.isArray(v))
60
+ return v.length ? v.join(' ') : 'none';
61
+ if (typeof v === 'string' && v.trim())
62
+ return v;
63
+ return 'none';
64
+ };
65
+ /**
66
+ * Describe default values for a pair of include/exclude list options.
67
+ * Returns an object with `includeDefault` and `excludeDefault` strings.
68
+ *
69
+ * If both lists are populated, returns an invalid marker for both.
70
+ */
71
+ const describeConfigKeyListDefaults = ({ cfgInclude, cfgExclude, }) => {
72
+ // Avoid throwing in help rendering: show an explicit invalid marker.
73
+ if (cfgInclude?.length && cfgExclude?.length) {
74
+ const msg = '(invalid: both set in config)';
75
+ return { includeDefault: msg, excludeDefault: msg };
76
+ }
77
+ return {
78
+ includeDefault: describeDefault(cfgExclude?.length ? undefined : cfgInclude),
79
+ excludeDefault: describeDefault(cfgInclude?.length ? undefined : cfgExclude),
80
+ };
81
+ };
82
+
83
+ export { describeConfigKeyListDefaults, describeDefault, ensureForce, getRootCommand };
package/dist/config.d.ts CHANGED
@@ -99,16 +99,6 @@ interface ScriptDef<TShell extends string | boolean = string | boolean> {
99
99
  */
100
100
  type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | ScriptDef<TShell>>;
101
101
 
102
- /**
103
- * Canonical programmatic options and helpers for get-dotenv.
104
- *
105
- * Requirements addressed:
106
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
107
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
108
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
109
- * - Preserve existing behavior for defaults resolution and compat converters.
110
- */
111
-
112
102
  /**
113
103
  * A minimal representation of an environment key/value mapping.
114
104
  * Values may be `undefined` to represent "unset".
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-CePOf74i.mjs';
1
+ export { d as discoverConfigFiles, l as loadConfigFile, r as resolveGetDotenvConfigSources, t as toFileUrl } from './chunks/loader-CE4HSRN4.mjs';
2
2
  export { v as validateEnvAgainstSources } from './chunks/validate-CDl0rE6k.mjs';
3
3
  import 'fs-extra';
4
4
  import 'package-directory';
@@ -6,6 +6,9 @@ import 'path';
6
6
  import 'url';
7
7
  import 'yaml';
8
8
  import 'zod';
9
+ import 'radash';
10
+ import 'node:buffer';
9
11
  import 'node:path';
10
12
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
11
13
  import 'crypto';
14
+ import '@commander-js/extra-typings';
@@ -153,16 +153,6 @@ type GetDotenvConfigResolved = {
153
153
  plugins?: Record<string, unknown>;
154
154
  };
155
155
 
156
- /**
157
- * Canonical programmatic options and helpers for get-dotenv.
158
- *
159
- * Requirements addressed:
160
- * - GetDotenvOptions derives from the Zod schema output (single source of truth).
161
- * - Removed deprecated/compat flags from the public shape (e.g., useConfigLoader).
162
- * - Provide Vars-aware defineDynamic and a typed config builder defineGetDotenvConfig\<Vars, Env\>().
163
- * - Preserve existing behavior for defaults resolution and compat converters.
164
- */
165
-
166
156
  /**
167
157
  * A minimal representation of an environment key/value mapping.
168
158
  * Values may be `undefined` to represent "unset".
@@ -411,7 +401,7 @@ type OverlayConfigSources = {
411
401
  * @typeParam B - base env shape
412
402
  * @public
413
403
  */
414
- interface OverlayEnvOptionsBase<B extends Record<string, string | undefined> | Readonly<Record<string, string | undefined>>> {
404
+ interface OverlayEnvOptionsBase<B extends ProcessEnv | Readonly<ProcessEnv>> {
415
405
  /** Base environment variables. */
416
406
  base: B;
417
407
  /** Target environment name. */
@@ -426,7 +416,7 @@ interface OverlayEnvOptionsBase<B extends Record<string, string | undefined> | R
426
416
  * @typeParam P - programmatic vars shape
427
417
  * @public
428
418
  */
429
- interface OverlayEnvOptionsWithProgrammatic<B extends Record<string, string | undefined> | Readonly<Record<string, string | undefined>>, P extends Record<string, string | undefined> | Readonly<Record<string, string | undefined>>> extends OverlayEnvOptionsBase<B> {
419
+ interface OverlayEnvOptionsWithProgrammatic<B extends ProcessEnv | Readonly<ProcessEnv>, P extends ProcessEnv | Readonly<ProcessEnv>> extends OverlayEnvOptionsBase<B> {
430
420
  /**
431
421
  * Explicit programmatic variables applied at the highest precedence tier.
432
422
  */
@@ -441,12 +431,12 @@ interface OverlayEnvOptionsWithProgrammatic<B extends Record<string, string | un
441
431
  * Programmatic explicit vars (if provided) override all config slices.
442
432
  * Progressive expansion is applied within each slice.
443
433
  */
444
- declare function overlayEnv<B extends ProcessEnv | Readonly<Record<string, string | undefined>>>(args: {
434
+ declare function overlayEnv<B extends ProcessEnv | Readonly<ProcessEnv>>(args: {
445
435
  base: B;
446
436
  env: string | undefined;
447
437
  configs: OverlayConfigSources;
448
438
  }): B;
449
- declare function overlayEnv<B extends ProcessEnv | Readonly<Record<string, string | undefined>>, P extends ProcessEnv | Readonly<Record<string, string | undefined>>>(args: {
439
+ declare function overlayEnv<B extends ProcessEnv | Readonly<ProcessEnv>, P extends ProcessEnv | Readonly<ProcessEnv>>(args: {
450
440
  base: B;
451
441
  env: string | undefined;
452
442
  configs: OverlayConfigSources;
@@ -472,7 +462,7 @@ interface OverlayEnvWithProvenanceArgs {
472
462
  /**
473
463
  * Base environment variables.
474
464
  */
475
- base: ProcessEnv | Readonly<Record<string, string | undefined>>;
465
+ base: ProcessEnv | Readonly<ProcessEnv>;
476
466
  /**
477
467
  * Target environment name.
478
468
  */
@@ -484,7 +474,7 @@ interface OverlayEnvWithProvenanceArgs {
484
474
  /**
485
475
  * Explicit vars overlays applied at the highest static precedence tier.
486
476
  */
487
- programmaticVars?: ProcessEnv | Readonly<Record<string, string | undefined>>;
477
+ programmaticVars?: ProcessEnv | Readonly<ProcessEnv>;
488
478
  /**
489
479
  * Existing provenance map to append into. When omitted, a new map is created.
490
480
  */
@@ -1,11 +1,14 @@
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';
1
+ import { d as dotenvExpandAll } from './chunks/readDotenvCascade-Bymjvyit.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-Bymjvyit.mjs';
3
3
  import 'fs-extra';
4
4
  import 'node:path';
5
+ import 'radash';
6
+ import 'node:buffer';
5
7
  import './chunks/loadModuleDefault-Dj8B3Stt.mjs';
6
8
  import 'crypto';
7
9
  import 'path';
8
10
  import 'url';
11
+ import '@commander-js/extra-typings';
9
12
  import 'dotenv';
10
13
 
11
14
  const applyKv = (current, kv) => {