@karmaniverous/get-dotenv 5.2.6 → 6.0.0-1
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 +106 -70
- package/dist/cliHost.d.ts +232 -226
- package/dist/cliHost.mjs +777 -545
- package/dist/config.d.ts +7 -2
- package/dist/env-overlay.d.ts +21 -9
- package/dist/env-overlay.mjs +14 -19
- package/dist/getdotenv.cli.mjs +1366 -1163
- package/dist/index.d.ts +415 -242
- package/dist/index.mjs +1364 -1414
- package/dist/plugins-aws.d.ts +149 -94
- package/dist/plugins-aws.mjs +307 -195
- package/dist/plugins-batch.d.ts +153 -99
- package/dist/plugins-batch.mjs +277 -95
- package/dist/plugins-cmd.d.ts +140 -94
- package/dist/plugins-cmd.mjs +636 -502
- package/dist/plugins-demo.d.ts +140 -94
- package/dist/plugins-demo.mjs +237 -46
- package/dist/plugins-init.d.ts +140 -94
- package/dist/plugins-init.mjs +129 -12
- package/dist/plugins.d.ts +166 -103
- package/dist/plugins.mjs +977 -840
- package/package.json +15 -53
- package/templates/cli/ts/plugins/hello.ts +27 -6
- package/templates/config/js/getdotenv.config.js +1 -1
- package/templates/config/ts/getdotenv.config.ts +9 -2
- package/dist/cliHost.cjs +0 -1875
- package/dist/cliHost.d.cts +0 -409
- package/dist/cliHost.d.mts +0 -409
- package/dist/config.cjs +0 -252
- package/dist/config.d.cts +0 -55
- package/dist/config.d.mts +0 -55
- package/dist/env-overlay.cjs +0 -163
- package/dist/env-overlay.d.cts +0 -50
- package/dist/env-overlay.d.mts +0 -50
- package/dist/index.cjs +0 -4140
- package/dist/index.d.cts +0 -457
- package/dist/index.d.mts +0 -457
- package/dist/plugins-aws.cjs +0 -667
- package/dist/plugins-aws.d.cts +0 -158
- package/dist/plugins-aws.d.mts +0 -158
- package/dist/plugins-batch.cjs +0 -616
- package/dist/plugins-batch.d.cts +0 -180
- package/dist/plugins-batch.d.mts +0 -180
- package/dist/plugins-cmd.cjs +0 -1113
- package/dist/plugins-cmd.d.cts +0 -178
- package/dist/plugins-cmd.d.mts +0 -178
- package/dist/plugins-demo.cjs +0 -307
- package/dist/plugins-demo.d.cts +0 -158
- package/dist/plugins-demo.d.mts +0 -158
- package/dist/plugins-init.cjs +0 -289
- package/dist/plugins-init.d.cts +0 -162
- package/dist/plugins-init.d.mts +0 -162
- package/dist/plugins.cjs +0 -2283
- package/dist/plugins.d.cts +0 -210
- package/dist/plugins.d.mts +0 -210
package/dist/config.d.ts
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Scripts table shape (configurable shell type).
|
|
3
|
+
*/
|
|
4
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
2
5
|
cmd: string;
|
|
3
|
-
shell?:
|
|
6
|
+
shell?: TShell | undefined;
|
|
4
7
|
}>;
|
|
5
8
|
|
|
9
|
+
type Scripts = ScriptsTable;
|
|
10
|
+
|
|
6
11
|
type GetDotenvConfigResolved = {
|
|
7
12
|
dotenvToken?: string;
|
|
8
13
|
privateToken?: string;
|
package/dist/env-overlay.d.ts
CHANGED
|
@@ -1,12 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Scripts = Record<string, string | {
|
|
2
|
+
* Scripts table shape (configurable shell type).
|
|
3
|
+
*/
|
|
4
|
+
type ScriptsTable<TShell extends string | boolean = string | boolean> = Record<string, string | {
|
|
6
5
|
cmd: string;
|
|
7
|
-
shell?:
|
|
6
|
+
shell?: TShell | undefined;
|
|
8
7
|
}>;
|
|
9
8
|
|
|
9
|
+
type Scripts = ScriptsTable;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A minimal representation of an environment key/value mapping.
|
|
13
|
+
* Values may be `undefined` to represent "unset".
|
|
14
|
+
*/
|
|
15
|
+
type ProcessEnv = Record<string, string | undefined>;
|
|
16
|
+
|
|
10
17
|
type GetDotenvConfigResolved = {
|
|
11
18
|
dotenvToken?: string;
|
|
12
19
|
privateToken?: string;
|
|
@@ -39,12 +46,17 @@ type OverlayConfigSources = {
|
|
|
39
46
|
* Programmatic explicit vars (if provided) override all config slices.
|
|
40
47
|
* Progressive expansion is applied within each slice.
|
|
41
48
|
*/
|
|
42
|
-
declare
|
|
43
|
-
base:
|
|
49
|
+
declare function overlayEnv<B extends ProcessEnv | Readonly<Record<string, string | undefined>>>(args: {
|
|
50
|
+
base: B;
|
|
51
|
+
env: string | undefined;
|
|
52
|
+
configs: OverlayConfigSources;
|
|
53
|
+
}): B;
|
|
54
|
+
declare function overlayEnv<B extends ProcessEnv | Readonly<Record<string, string | undefined>>, P extends ProcessEnv | Readonly<Record<string, string | undefined>>>(args: {
|
|
55
|
+
base: B;
|
|
44
56
|
env: string | undefined;
|
|
45
57
|
configs: OverlayConfigSources;
|
|
46
|
-
programmaticVars
|
|
47
|
-
})
|
|
58
|
+
programmaticVars: P;
|
|
59
|
+
}): B & P;
|
|
48
60
|
|
|
49
61
|
export { overlayEnv };
|
|
50
62
|
export type { OverlayConfigSources };
|
package/dist/env-overlay.mjs
CHANGED
|
@@ -109,14 +109,18 @@ const dotenvExpand = (value, ref = process.env) => {
|
|
|
109
109
|
* When `progressive` is true, each expanded key becomes available for
|
|
110
110
|
* subsequent expansions in the same object (left-to-right by object key order).
|
|
111
111
|
*/
|
|
112
|
-
|
|
113
|
-
const { ref = process.env, progressive = false } = options;
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
112
|
+
function dotenvExpandAll(values, options = {}) {
|
|
113
|
+
const { ref = process.env, progressive = false, } = options;
|
|
114
|
+
const out = Object.keys(values).reduce((acc, key) => {
|
|
115
|
+
acc[key] = dotenvExpand(values[key], {
|
|
116
|
+
...ref,
|
|
117
|
+
...(progressive ? acc : {}),
|
|
118
|
+
});
|
|
119
|
+
return acc;
|
|
120
|
+
}, {});
|
|
121
|
+
// Key-preserving return with a permissive index signature to allow later additions.
|
|
122
|
+
return out;
|
|
123
|
+
}
|
|
120
124
|
|
|
121
125
|
const applyKv = (current, kv) => {
|
|
122
126
|
if (!kv || Object.keys(kv).length === 0)
|
|
@@ -132,16 +136,7 @@ const applyConfigSlice = (current, cfg, env) => {
|
|
|
132
136
|
const envKv = env && cfg.envVars ? cfg.envVars[env] : undefined;
|
|
133
137
|
return applyKv(afterGlobal, envKv);
|
|
134
138
|
};
|
|
135
|
-
|
|
136
|
-
* Overlay config-provided values onto a base ProcessEnv using precedence axes:
|
|
137
|
-
* - kind: env \> global
|
|
138
|
-
* - privacy: local \> public
|
|
139
|
-
* - source: project \> packaged \> base
|
|
140
|
-
*
|
|
141
|
-
* Programmatic explicit vars (if provided) override all config slices.
|
|
142
|
-
* Progressive expansion is applied within each slice.
|
|
143
|
-
*/
|
|
144
|
-
const overlayEnv = ({ base, env, configs, programmaticVars, }) => {
|
|
139
|
+
function overlayEnv({ base, env, configs, programmaticVars, }) {
|
|
145
140
|
let current = { ...base };
|
|
146
141
|
// Source: packaged (public -> local)
|
|
147
142
|
current = applyConfigSlice(current, configs.packaged, env);
|
|
@@ -156,6 +151,6 @@ const overlayEnv = ({ base, env, configs, programmaticVars, }) => {
|
|
|
156
151
|
current = applyKv(current, toApply);
|
|
157
152
|
}
|
|
158
153
|
return current;
|
|
159
|
-
}
|
|
154
|
+
}
|
|
160
155
|
|
|
161
156
|
export { overlayEnv };
|