@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,12 +1,12 @@
1
- import { exec } from 'child_process';
2
- import { promisify } from 'util';
3
- import { s as setCredentialFeature, C as CredentialsProviderError, k as getProfileName } from './index-AssUn9IY.mjs';
4
- import { e as externalDataInterceptor } from './externalDataInterceptor-gi2RH4ez.mjs';
5
- import { p as parseKnownFiles } from './parseKnownFiles-KczcjlE0.mjs';
6
- import './readMergedOptions-D6niy_Ep.mjs';
1
+ import { exec } from 'node:child_process';
2
+ import { promisify } from 'node:util';
3
+ import { aO as setCredentialFeature, e as CredentialsProviderError, al as getProfileName } from './index-DbDfog26.mjs';
4
+ import { e as externalDataInterceptor } from './externalDataInterceptor-m2kSL8CB.mjs';
5
+ import { p as parseKnownFiles } from './parseKnownFiles-CCiikesE.mjs';
6
+ import './readMergedOptions-BRLqvCpt.mjs';
7
7
  import 'zod';
8
8
  import '@commander-js/extra-typings';
9
- import './readDotenvCascade-HLU7FsEQ.mjs';
9
+ import './readDotenvCascade-Dgx4SC1p.mjs';
10
10
  import 'fs-extra';
11
11
  import 'radash';
12
12
  import 'node:buffer';
@@ -17,20 +17,18 @@ import 'path';
17
17
  import 'url';
18
18
  import 'dotenv';
19
19
  import 'nanoid';
20
- import './loader-CE4HSRN4.mjs';
20
+ import './loader-V1vbmtyw.mjs';
21
21
  import 'package-directory';
22
22
  import 'yaml';
23
23
  import 'execa';
24
- import 'buffer';
25
- import 'os';
24
+ import 'node:os';
26
25
  import 'node:fs/promises';
27
- import 'http';
28
- import 'https';
29
- import 'stream';
30
- import 'process';
26
+ import 'node:stream';
27
+ import 'node:crypto';
31
28
  import 'node:fs';
32
- import './getSSOTokenFromFile-BfAhZf_d.mjs';
33
- import 'fs/promises';
29
+ import 'node:https';
30
+ import 'node:process';
31
+ import './getSSOTokenFromFile-Vx7XHoYM.mjs';
34
32
 
35
33
  const getValidatedProcessCredentials = (profileName, data, profiles) => {
36
34
  if (data.Version !== 1) {
@@ -1,10 +1,10 @@
1
- import fs from 'fs/promises';
2
- import { C as CredentialsProviderError, H as HttpRequest, p as parseRfc3339DateTime, N as NodeHttpHandler, s as setCredentialFeature } from './index-AssUn9IY.mjs';
3
- import { s as sdkStreamMixin } from './sdk-stream-mixin-blFikF4G.mjs';
4
- import './readMergedOptions-D6niy_Ep.mjs';
1
+ import fs from 'node:fs/promises';
2
+ import { e as CredentialsProviderError, n as HttpRequest, ax as parseRfc3339DateTime, y as NodeHttpHandler, aO as setCredentialFeature } from './index-DbDfog26.mjs';
3
+ import { s as sdkStreamMixin } from './sdk-stream-mixin-pKJE9QhL.mjs';
4
+ import './readMergedOptions-BRLqvCpt.mjs';
5
5
  import 'zod';
6
6
  import '@commander-js/extra-typings';
7
- import './readDotenvCascade-HLU7FsEQ.mjs';
7
+ import './readDotenvCascade-Dgx4SC1p.mjs';
8
8
  import 'fs-extra';
9
9
  import 'radash';
10
10
  import 'node:buffer';
@@ -15,18 +15,16 @@ import 'path';
15
15
  import 'url';
16
16
  import 'dotenv';
17
17
  import 'nanoid';
18
- import './loader-CE4HSRN4.mjs';
18
+ import './loader-V1vbmtyw.mjs';
19
19
  import 'package-directory';
20
20
  import 'yaml';
21
21
  import 'execa';
22
- import 'buffer';
23
- import 'os';
24
- import 'node:fs/promises';
25
- import 'http';
26
- import 'https';
27
- import 'stream';
28
- import 'process';
22
+ import 'node:os';
23
+ import 'node:stream';
24
+ import 'node:crypto';
29
25
  import 'node:fs';
26
+ import 'node:https';
27
+ import 'node:process';
30
28
 
31
29
  const ECS_CONTAINER_HOST = "169.254.170.2";
32
30
  const EKS_CONTAINER_HOST_IPv4 = "169.254.170.23";
@@ -1,5 +1,5 @@
1
1
  import { camel } from 'radash';
2
- import { r as readMergedOptions, g as getDotenvCliOptions2Options, d as definePlugin } from './readMergedOptions-D6niy_Ep.mjs';
2
+ import { r as readMergedOptions, d as defaultsDeep, h as getDotenvCliOptions2Options, g as definePlugin } from './readMergedOptions-BRLqvCpt.mjs';
3
3
  import 'execa';
4
4
  import 'node:buffer';
5
5
  import 'fs-extra';
@@ -10,14 +10,14 @@ import 'url';
10
10
  import '@commander-js/extra-typings';
11
11
  import 'nanoid';
12
12
  import 'dotenv';
13
- import './loader-CE4HSRN4.mjs';
13
+ import { r as resolveGetDotenvConfigSources } from './loader-V1vbmtyw.mjs';
14
14
  import 'package-directory';
15
15
  import 'yaml';
16
16
  import { z } from 'zod';
17
- import { b as resolveCommand, c as resolveShell, t as tokenize, s as shouldCapture, r as runCommand, d as buildSpawnEnv } from './spawnEnv-5kdIVv0x.mjs';
17
+ import { r as resolveCommand, a as resolveShell, t as tokenize, s as shouldCapture, c as runCommand, b as buildSpawnEnv } from './spawnEnv-CKgnHGpr.mjs';
18
18
  import { m as maybePreserveNodeEvalArgv, c as composeNestedEnv, s as stripOne } from './invoke-DuRPU1oC.mjs';
19
- import { f as dotenvExpandFromProcessEnv } from './readDotenvCascade-HLU7FsEQ.mjs';
20
- import { r as resolveCliOptions, b as baseGetDotenvCliOptions } from './resolveCliOptions-PWF1aEM9.mjs';
19
+ import { f as dotenvExpandFromProcessEnv } from './readDotenvCascade-Dgx4SC1p.mjs';
20
+ import { b as baseGetDotenvCliOptions, r as resolveCliOptions } from './resolveCliOptions-Bbv0tNSF.mjs';
21
21
 
22
22
  /** src/diagnostics/entropy.ts
23
23
  * Entropy diagnostics (presentation-only).
@@ -350,8 +350,7 @@ const attachCmdParentInvoker = (cli, options, plugin) => {
350
350
  };
351
351
  const aliasKey = deriveKey(aliasSpec.flags);
352
352
  // Expose the option on the parent (root) command.
353
- const parentCmd = cli.parent ??
354
- cli;
353
+ const parentCmd = cli.parent ?? cli;
355
354
  const desc = aliasSpec.description ??
356
355
  'alias of cmd subcommand; provide command tokens (variadic)';
357
356
  parentCmd.option(aliasSpec.flags, desc);
@@ -400,7 +399,11 @@ const attachCmdParentInvoker = (cli, options, plugin) => {
400
399
  return; // do not run alias when an explicit subcommand is present
401
400
  aliasState.handled = true;
402
401
  // Merge CLI options and resolve dotenv context for this invocation.
403
- const { merged } = resolveCliOptions(raw, baseGetDotenvCliOptions, process.env.getDotenvCliOptions);
402
+ // Use config-enriched defaults (not bare baseGetDotenvCliOptions) so
403
+ // project rootOptionDefaults (paths, defaultEnv, etc.) are respected.
404
+ const sources = await resolveGetDotenvConfigSources(import.meta.url);
405
+ const enrichedDefaults = defaultsDeep(baseGetDotenvCliOptions, sources.packaged?.rootOptionDefaults, sources.project?.public?.rootOptionDefaults, sources.project?.local?.rootOptionDefaults);
406
+ const { merged } = resolveCliOptions(raw, enrichedDefaults, process.env.getDotenvCliOptions);
404
407
  const serviceOptions = getDotenvCliOptions2Options(merged);
405
408
  await cli.resolveAndLoad(serviceOptions);
406
409
  // Build input string and apply optional expansion (by config default).
@@ -477,4 +480,4 @@ const cmdPlugin = (options = {}) => {
477
480
  return plugin;
478
481
  };
479
482
 
480
- export { redactDisplay as a, cmdPlugin as c, maybeWarnEntropy as m, redactObject as r, traceChildEnv as t };
483
+ export { redactObject as a, cmdPlugin as c, maybeWarnEntropy as m, redactDisplay as r, traceChildEnv as t };
@@ -1,11 +1,10 @@
1
- import { parse } from 'url';
2
- import { Buffer } from 'buffer';
3
- import { request } from 'http';
4
- import { aq as ProviderError, C as CredentialsProviderError, F as parseUrl, O as loadConfig } from './index-AssUn9IY.mjs';
5
- import './readMergedOptions-D6niy_Ep.mjs';
1
+ import { parse } from 'node:url';
2
+ import { request } from 'node:http';
3
+ import { J as ProviderError, e as CredentialsProviderError, aA as parseUrl, ar as loadConfig } from './index-DbDfog26.mjs';
4
+ import './readMergedOptions-BRLqvCpt.mjs';
6
5
  import 'zod';
7
6
  import '@commander-js/extra-typings';
8
- import './readDotenvCascade-HLU7FsEQ.mjs';
7
+ import './readDotenvCascade-Dgx4SC1p.mjs';
9
8
  import 'fs-extra';
10
9
  import 'radash';
11
10
  import 'node:buffer';
@@ -13,18 +12,38 @@ import 'node:path';
13
12
  import './loadModuleDefault-Dj8B3Stt.mjs';
14
13
  import 'crypto';
15
14
  import 'path';
15
+ import 'url';
16
16
  import 'dotenv';
17
17
  import 'nanoid';
18
- import './loader-CE4HSRN4.mjs';
18
+ import './loader-V1vbmtyw.mjs';
19
19
  import 'package-directory';
20
20
  import 'yaml';
21
21
  import 'execa';
22
- import 'os';
22
+ import 'node:os';
23
23
  import 'node:fs/promises';
24
- import 'https';
25
- import 'stream';
26
- import 'process';
24
+ import 'node:stream';
25
+ import 'node:crypto';
27
26
  import 'node:fs';
27
+ import 'node:https';
28
+ import 'node:process';
29
+
30
+ const isImdsCredentials = (arg) => Boolean(arg) &&
31
+ typeof arg === "object" &&
32
+ typeof arg.AccessKeyId === "string" &&
33
+ typeof arg.SecretAccessKey === "string" &&
34
+ typeof arg.Token === "string" &&
35
+ typeof arg.Expiration === "string";
36
+ const fromImdsCredentials = (creds) => ({
37
+ accessKeyId: creds.AccessKeyId,
38
+ secretAccessKey: creds.SecretAccessKey,
39
+ sessionToken: creds.Token,
40
+ expiration: new Date(creds.Expiration),
41
+ ...(creds.AccountId && { accountId: creds.AccountId }),
42
+ });
43
+
44
+ const DEFAULT_TIMEOUT = 1000;
45
+ const DEFAULT_MAX_RETRIES = 0;
46
+ const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });
28
47
 
29
48
  function httpRequest(options) {
30
49
  return new Promise((resolve, reject) => {
@@ -60,24 +79,6 @@ function httpRequest(options) {
60
79
  });
61
80
  }
62
81
 
63
- const isImdsCredentials = (arg) => Boolean(arg) &&
64
- typeof arg === "object" &&
65
- typeof arg.AccessKeyId === "string" &&
66
- typeof arg.SecretAccessKey === "string" &&
67
- typeof arg.Token === "string" &&
68
- typeof arg.Expiration === "string";
69
- const fromImdsCredentials = (creds) => ({
70
- accessKeyId: creds.AccessKeyId,
71
- secretAccessKey: creds.SecretAccessKey,
72
- sessionToken: creds.Token,
73
- expiration: new Date(creds.Expiration),
74
- ...(creds.AccountId && { accountId: creds.AccountId }),
75
- });
76
-
77
- const DEFAULT_TIMEOUT = 1000;
78
- const DEFAULT_MAX_RETRIES = 0;
79
- const providerConfigFromInit = ({ maxRetries = DEFAULT_MAX_RETRIES, timeout = DEFAULT_TIMEOUT, }) => ({ maxRetries, timeout });
80
-
81
82
  const retry = (toRetry, maxRetries) => {
82
83
  let promise = toRetry();
83
84
  for (let i = 0; i < maxRetries; i++) {
@@ -1,8 +1,9 @@
1
- import { t as toUtf8, i as fromUtf8 } from './index-AssUn9IY.mjs';
2
- import './readMergedOptions-D6niy_Ep.mjs';
1
+ import 'node:crypto';
2
+ import { aT as toUtf8, a8 as fromUtf8 } from './index-DbDfog26.mjs';
3
+ import './readMergedOptions-BRLqvCpt.mjs';
3
4
  import 'zod';
4
5
  import '@commander-js/extra-typings';
5
- import './readDotenvCascade-HLU7FsEQ.mjs';
6
+ import './readDotenvCascade-Dgx4SC1p.mjs';
6
7
  import 'fs-extra';
7
8
  import 'radash';
8
9
  import 'node:buffer';
@@ -13,18 +14,16 @@ import 'path';
13
14
  import 'url';
14
15
  import 'dotenv';
15
16
  import 'nanoid';
16
- import './loader-CE4HSRN4.mjs';
17
+ import './loader-V1vbmtyw.mjs';
17
18
  import 'package-directory';
18
19
  import 'yaml';
19
20
  import 'execa';
20
- import 'buffer';
21
- import 'os';
21
+ import 'node:os';
22
22
  import 'node:fs/promises';
23
- import 'http';
24
- import 'https';
25
- import 'stream';
26
- import 'process';
23
+ import 'node:stream';
27
24
  import 'node:fs';
25
+ import 'node:https';
26
+ import 'node:process';
28
27
 
29
28
  class EventStreamSerde {
30
29
  marshaller;
@@ -74,9 +73,13 @@ class EventStreamSerde {
74
73
  body: event.body,
75
74
  };
76
75
  }
77
- const unionMember = Object.keys(event).find((key) => {
78
- return key !== "__type";
79
- }) ?? "";
76
+ let unionMember = "";
77
+ for (const key in event) {
78
+ if (key !== "__type") {
79
+ unionMember = key;
80
+ break;
81
+ }
82
+ }
80
83
  const { additionalHeaders, body, eventType, explicitPayloadContentType } = this.writeEventBody(unionMember, unionSchema, event);
81
84
  const headers = {
82
85
  ":event-type": { type: "string", value: eventType },
@@ -97,9 +100,13 @@ class EventStreamSerde {
97
100
  const memberSchemas = unionSchema.getMemberSchemas();
98
101
  const initialResponseMarker = Symbol("initialResponseMarker");
99
102
  const asyncIterable = marshaller.deserialize(response.body, async (event) => {
100
- const unionMember = Object.keys(event).find((key) => {
101
- return key !== "__type";
102
- }) ?? "";
103
+ let unionMember = "";
104
+ for (const key in event) {
105
+ if (key !== "__type") {
106
+ unionMember = key;
107
+ break;
108
+ }
109
+ }
103
110
  const body = event[unionMember].body;
104
111
  if (unionMember === "initial-response") {
105
112
  const dataObject = await this.deserializer.read(responseSchema, body);
@@ -150,6 +157,11 @@ class EventStreamSerde {
150
157
  [unionMember]: out,
151
158
  };
152
159
  }
160
+ if (body.byteLength === 0) {
161
+ return {
162
+ [unionMember]: {},
163
+ };
164
+ }
153
165
  }
154
166
  return {
155
167
  [unionMember]: await this.deserializer.read(eventStreamSchema, body),
@@ -170,8 +182,8 @@ class EventStreamSerde {
170
182
  if (!responseSchema) {
171
183
  throw new Error("@smithy::core/protocols - initial-response event encountered in event stream but no response schema given.");
172
184
  }
173
- for (const [key, value] of Object.entries(firstEvent.value)) {
174
- initialResponseContainer[key] = value;
185
+ for (const key in firstEvent.value) {
186
+ initialResponseContainer[key] = firstEvent.value[key];
175
187
  }
176
188
  }
177
189
  return {
@@ -255,11 +267,14 @@ class EventStreamSerde {
255
267
  serializer.write(eventSchema, event[unionMember]);
256
268
  }
257
269
  }
270
+ else if (eventSchema.isUnitSchema()) {
271
+ serializer.write(eventSchema, {});
272
+ }
258
273
  else {
259
274
  throw new Error("@smithy/core/event-streams - non-struct member not supported in event stream union.");
260
275
  }
261
276
  }
262
- const messageSerialization = serializer.flush();
277
+ const messageSerialization = serializer.flush() ?? new Uint8Array();
263
278
  const body = typeof messageSerialization === "string"
264
279
  ? (this.serdeContext?.utf8Decoder ?? fromUtf8)(messageSerialization)
265
280
  : messageSerialization;