@karmaniverous/get-dotenv 7.0.5 → 7.0.6

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.
@@ -131,33 +131,35 @@ function installRootHooks(program, defaults) {
131
131
  if (!program.hasCtx()) {
132
132
  const serviceOptions = getDotenvCliOptions2Options(merged);
133
133
  await program.resolveAndLoad(serviceOptions);
134
- propagateResolvedEnv(merged);
135
- try {
136
- const ctx = program.getCtx();
137
- const helpCfg = toHelpConfig(merged, ctx.pluginConfigs);
138
- program.evaluateDynamicOptions(helpCfg);
139
- }
140
- catch {
141
- /* tolerate */
142
- }
143
- try {
144
- const ctx = program.getCtx();
145
- const dotenv = ctx.dotenv;
146
- const sources2 = await resolveGetDotenvConfigSources(import.meta.url);
147
- const issues = validateEnvAgainstSources(dotenv, sources2);
148
- if (Array.isArray(issues) && issues.length > 0) {
149
- const logger = merged.logger;
150
- issues.forEach((m) => {
151
- logger.error(m);
152
- });
153
- if (merged.strict)
154
- process.exit(1);
155
- }
156
- }
157
- catch {
158
- /* tolerate non-strict flows */
134
+ }
135
+ // Always propagate resolved env into the merged bag — even when
136
+ // preSubcommand already set the context. preAction unconditionally
137
+ // builds a fresh `merged` and overwrites the options bag, so the env
138
+ // propagated by preSubcommand is lost without this call.
139
+ propagateResolvedEnv(merged);
140
+ try {
141
+ const ctx = program.getCtx();
142
+ const helpCfg = toHelpConfig(merged, ctx.pluginConfigs);
143
+ program.evaluateDynamicOptions(helpCfg);
144
+ }
145
+ catch {
146
+ /* tolerate */
147
+ }
148
+ try {
149
+ const ctx = program.getCtx();
150
+ const issues = validateEnvAgainstSources(ctx.dotenv, sources);
151
+ if (Array.isArray(issues) && issues.length > 0) {
152
+ const logger = merged.logger;
153
+ issues.forEach((m) => {
154
+ logger.error(m);
155
+ });
156
+ if (merged.strict)
157
+ process.exit(1);
159
158
  }
160
159
  }
160
+ catch {
161
+ /* tolerate non-strict flows */
162
+ }
161
163
  });
162
164
  return program;
163
165
  }
package/dist/cli.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
1
+ export { c as createCli } from './chunks/createCli-BkHLeYXL.mjs';
2
2
  import 'zod';
3
3
  import 'path';
4
4
  import './chunks/loader-V1vbmtyw.mjs';
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
2
+ import { c as createCli } from './chunks/createCli-BkHLeYXL.mjs';
3
3
  import 'zod';
4
4
  import 'path';
5
5
  import './chunks/loader-V1vbmtyw.mjs';
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { c as createCli } from './chunks/createCli-CVvh-dBp.mjs';
1
+ export { c as createCli } from './chunks/createCli-BkHLeYXL.mjs';
2
2
  import { j as resolveGetDotenvOptions, w as writeDotenvFile } from './chunks/readMergedOptions-CraAnYdB.mjs';
3
3
  export { G as GetDotenvCli, a as assertLogger, c as baseRootOptionDefaults, d as defaultsDeep, e as defineDynamic, f as defineGetDotenvConfig, g as definePlugin, h as getDotenvCliOptions2Options, i as interpolateDeep, r as readMergedOptions } from './chunks/readMergedOptions-CraAnYdB.mjs';
4
4
  export { b as buildSpawnEnv, s as shouldCapture, t as tokenize } from './chunks/spawnEnv-CKgnHGpr.mjs';
package/package.json CHANGED
@@ -221,5 +221,5 @@
221
221
  },
222
222
  "type": "module",
223
223
  "types": "dist/index.d.ts",
224
- "version": "7.0.5"
224
+ "version": "7.0.6"
225
225
  }