@karmaniverous/get-dotenv 7.0.7 → 7.0.9

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 (51) hide show
  1. package/dist/chunks/{createCli-DRgcaM2D.mjs → createCli-CCxTLJ1j.mjs} +57 -10
  2. package/dist/chunks/index-Cay5Gzhu.mjs +111 -0
  3. package/dist/chunks/{index-BzoCat8h.mjs → index-xqvxTkr9.mjs} +6 -6
  4. package/dist/chunks/{loader-V1vbmtyw.mjs → loader-C3DtD6HB.mjs} +4 -2
  5. package/dist/chunks/{readDotenvCascade-Dgx4SC1p.mjs → readDotenvCascade-CfFPgLCp.mjs} +52 -21
  6. package/dist/chunks/{readMergedOptions-x80ltQO_.mjs → readMergedOptions-_hjyCNZ7.mjs} +54 -14
  7. package/dist/chunks/{resolveCliOptions-CR-BEUmS.mjs → resolveCliOptions-Dp7wPY1K.mjs} +1 -1
  8. package/dist/chunks/{spawnEnv-CKgnHGpr.mjs → spawnEnv-DvisqPiU.mjs} +28 -3
  9. package/dist/chunks/{types-poB1VAs_.mjs → types-zXDNhcST.mjs} +1 -1
  10. package/dist/cli.d.ts +9 -5
  11. package/dist/cli.mjs +10 -15
  12. package/dist/cliHost.d.ts +9 -5
  13. package/dist/cliHost.mjs +6 -6
  14. package/dist/config.d.ts +1 -1
  15. package/dist/config.mjs +1 -1
  16. package/dist/env-overlay.d.ts +13 -9
  17. package/dist/env-overlay.mjs +2 -2
  18. package/dist/getdotenv.cli.mjs +10 -15
  19. package/dist/index.d.ts +10 -6
  20. package/dist/index.mjs +30 -23
  21. package/dist/plugins-aws.d.ts +1 -1
  22. package/dist/plugins-aws.mjs +4 -4
  23. package/dist/plugins-batch.d.ts +17 -1
  24. package/dist/plugins-batch.mjs +202 -68
  25. package/dist/plugins-cmd.d.ts +1 -1
  26. package/dist/plugins-cmd.mjs +6 -6
  27. package/dist/plugins-init.d.ts +1 -1
  28. package/dist/plugins-init.mjs +3 -3
  29. package/dist/plugins.d.ts +3 -1
  30. package/dist/plugins.mjs +9 -14
  31. package/package.json +40 -40
  32. package/schema/getdotenv.config.schema.json +207 -0
  33. package/dist/chunks/AwsRestJsonProtocol-BWWvLZiw.mjs +0 -1026
  34. package/dist/chunks/externalDataInterceptor-Bbvq4sdd.mjs +0 -19
  35. package/dist/chunks/getSSOTokenFromFile-ClTzvS3i.mjs +0 -22
  36. package/dist/chunks/index-4kbkrHS9.mjs +0 -12529
  37. package/dist/chunks/index-B5GwHCSX.mjs +0 -669
  38. package/dist/chunks/index-Cl6wXPYD.mjs +0 -82
  39. package/dist/chunks/index-D7Lv-lxm.mjs +0 -349
  40. package/dist/chunks/index-DFNP_Nrx.mjs +0 -188
  41. package/dist/chunks/index-DO68RbZ8.mjs +0 -103
  42. package/dist/chunks/index-Db08BBL5.mjs +0 -519
  43. package/dist/chunks/index-De2jIOhi.mjs +0 -541
  44. package/dist/chunks/index-IOQ1o3w3.mjs +0 -290
  45. package/dist/chunks/index-Tm4WDj9R.mjs +0 -383
  46. package/dist/chunks/index-fNrNPp4e.mjs +0 -946
  47. package/dist/chunks/index-w8gK2SKP.mjs +0 -31
  48. package/dist/chunks/loadSso-Ce3ChPPj.mjs +0 -488
  49. package/dist/chunks/package-DbbYaehr.mjs +0 -5
  50. package/dist/chunks/parseKnownFiles-BCL0L7aP.mjs +0 -23
  51. package/dist/chunks/sdk-stream-mixin-B_ajKWho.mjs +0 -307
@@ -1,307 +0,0 @@
1
- import { Writable, Readable } from 'node:stream';
2
- import { aS as toHex, a5 as fromArrayBuffer } from './index-4kbkrHS9.mjs';
3
-
4
- const isReadableStream = (stream) => typeof ReadableStream === "function" &&
5
- (stream?.constructor?.name === ReadableStream.name || stream instanceof ReadableStream);
6
-
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) => {
100
- if ((typeof Blob === "function" && stream instanceof Blob) || stream.constructor?.name === "Blob") {
101
- if (Blob.prototype.arrayBuffer !== undefined) {
102
- return new Uint8Array(await stream.arrayBuffer());
103
- }
104
- return collectBlob(stream);
105
- }
106
- return collectStream(stream);
107
- };
108
- async function collectBlob(blob) {
109
- const base64 = await readToBase64(blob);
110
- const arrayBuffer = fromBase64(base64);
111
- return new Uint8Array(arrayBuffer);
112
- }
113
- async function collectStream(stream) {
114
- const chunks = [];
115
- const reader = stream.getReader();
116
- let isDone = false;
117
- let length = 0;
118
- while (!isDone) {
119
- const { done, value } = await reader.read();
120
- if (value) {
121
- chunks.push(value);
122
- length += value.length;
123
- }
124
- isDone = done;
125
- }
126
- const collected = new Uint8Array(length);
127
- let offset = 0;
128
- for (const chunk of chunks) {
129
- collected.set(chunk, offset);
130
- offset += chunk.length;
131
- }
132
- return collected;
133
- }
134
- function readToBase64(blob) {
135
- return new Promise((resolve, reject) => {
136
- const reader = new FileReader();
137
- reader.onloadend = () => {
138
- if (reader.readyState !== 2) {
139
- return reject(new Error("Reader aborted too early"));
140
- }
141
- const result = (reader.result ?? "");
142
- const commaIndex = result.indexOf(",");
143
- const dataOffset = commaIndex > -1 ? commaIndex + 1 : result.length;
144
- resolve(result.substring(dataOffset));
145
- };
146
- reader.onabort = () => reject(new Error("Read aborted"));
147
- reader.onerror = () => reject(reader.error);
148
- reader.readAsDataURL(blob);
149
- });
150
- }
151
-
152
- const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1 = "The stream has already been transformed.";
153
- const sdkStreamMixin$1 = (stream) => {
154
- if (!isBlobInstance(stream) && !isReadableStream(stream)) {
155
- const name = stream?.__proto__?.constructor?.name || stream;
156
- throw new Error(`Unexpected stream implementation, expect Blob or ReadableStream, got ${name}`);
157
- }
158
- let transformed = false;
159
- const transformToByteArray = async () => {
160
- if (transformed) {
161
- throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
162
- }
163
- transformed = true;
164
- return await streamCollector$1(stream);
165
- };
166
- const blobToWebStream = (blob) => {
167
- if (typeof blob.stream !== "function") {
168
- throw new Error("Cannot transform payload Blob to web stream. Please make sure the Blob.stream() is polyfilled.\n" +
169
- "If you are using React Native, this API is not yet supported, see: https://react-native.canny.io/feature-requests/p/fetch-streaming-body");
170
- }
171
- return blob.stream();
172
- };
173
- return Object.assign(stream, {
174
- transformToByteArray: transformToByteArray,
175
- transformToString: async (encoding) => {
176
- const buf = await transformToByteArray();
177
- if (encoding === "base64") {
178
- return toBase64(buf);
179
- }
180
- else if (encoding === "hex") {
181
- return toHex(buf);
182
- }
183
- else if (encoding === undefined || encoding === "utf8" || encoding === "utf-8") {
184
- return toUtf8(buf);
185
- }
186
- else if (typeof TextDecoder === "function") {
187
- return new TextDecoder(encoding).decode(buf);
188
- }
189
- else {
190
- throw new Error("TextDecoder is not available, please make sure polyfill is provided.");
191
- }
192
- },
193
- transformToWebStream: () => {
194
- if (transformed) {
195
- throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED$1);
196
- }
197
- transformed = true;
198
- if (isBlobInstance(stream)) {
199
- return blobToWebStream(stream);
200
- }
201
- else if (isReadableStream(stream)) {
202
- return stream;
203
- }
204
- else {
205
- throw new Error(`Cannot transform payload to web stream, got ${stream}`);
206
- }
207
- },
208
- });
209
- };
210
- const isBlobInstance = (stream) => typeof Blob === "function" && stream instanceof Blob;
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
-
260
- const ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED = "The stream has already been transformed.";
261
- const sdkStreamMixin = (stream) => {
262
- if (!(stream instanceof Readable)) {
263
- try {
264
- return sdkStreamMixin$1(stream);
265
- }
266
- catch (e) {
267
- const name = stream?.__proto__?.constructor?.name || stream;
268
- throw new Error(`Unexpected stream implementation, expect Stream.Readable instance, got ${name}`);
269
- }
270
- }
271
- let transformed = false;
272
- const transformToByteArray = async () => {
273
- if (transformed) {
274
- throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
275
- }
276
- transformed = true;
277
- return await streamCollector(stream);
278
- };
279
- return Object.assign(stream, {
280
- transformToByteArray,
281
- transformToString: async (encoding) => {
282
- const buf = await transformToByteArray();
283
- if (encoding === undefined || Buffer.isEncoding(encoding)) {
284
- return fromArrayBuffer(buf.buffer, buf.byteOffset, buf.byteLength).toString(encoding);
285
- }
286
- else {
287
- const decoder = new TextDecoder(encoding);
288
- return decoder.decode(buf);
289
- }
290
- },
291
- transformToWebStream: () => {
292
- if (transformed) {
293
- throw new Error(ERR_MSG_STREAM_HAS_BEEN_TRANSFORMED);
294
- }
295
- if (stream.readableFlowing !== null) {
296
- throw new Error("The stream has been consumed by other callbacks.");
297
- }
298
- if (typeof Readable.toWeb !== "function") {
299
- throw new Error("Readable.toWeb() is not supported. Please ensure a polyfill is available.");
300
- }
301
- transformed = true;
302
- return Readable.toWeb(stream);
303
- },
304
- });
305
- };
306
-
307
- export { sdkStreamMixin as s };