@optique/env 1.3.0-dev.2577 → 1.3.0-dev.2581

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/dist/index.cjs CHANGED
@@ -387,14 +387,16 @@ function bindEnv(parser, options) {
387
387
  },
388
388
  parse: (context) => {
389
389
  const annotations = (0, __optique_core_annotations.getAnnotations)(context.state);
390
- const innerState = isEnvBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
390
+ const hadCliValue = isEnvBindState(context.state) && context.state.hasCliValue;
391
+ const innerState = isEnvBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : (0, __optique_core_extension.inheritAnnotations)(context.state, parser.initialState) : context.state;
391
392
  const innerContext = innerState !== context.state ? {
392
393
  ...context,
393
394
  state: innerState
394
395
  } : context;
395
396
  const processResult = (result) => {
396
397
  if (result.success) {
397
- const cliConsumed = result.consumed.length > 0;
398
+ const terminatorOnly = result.consumed.length === 1 && result.consumed[0] === "--" && !context.optionsTerminated && result.next.optionsTerminated;
399
+ const cliConsumed = hadCliValue || result.consumed.length > 0 && !terminatorOnly;
398
400
  const nextState$1 = (0, __optique_core_extension.injectAnnotations)({
399
401
  [envBindStateKey]: true,
400
402
  hasCliValue: cliConsumed,
@@ -411,6 +413,11 @@ function bindEnv(parser, options) {
411
413
  };
412
414
  }
413
415
  if (result.consumed > 0) return result;
416
+ if (hadCliValue) return {
417
+ success: true,
418
+ next: context,
419
+ consumed: []
420
+ };
414
421
  const nextState = (0, __optique_core_extension.injectAnnotations)({
415
422
  [envBindStateKey]: true,
416
423
  hasCliValue: false
package/dist/index.js CHANGED
@@ -364,14 +364,16 @@ function bindEnv(parser, options) {
364
364
  },
365
365
  parse: (context) => {
366
366
  const annotations = getAnnotations(context.state);
367
- const innerState = isEnvBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : parser.initialState : context.state;
367
+ const hadCliValue = isEnvBindState(context.state) && context.state.hasCliValue;
368
+ const innerState = isEnvBindState(context.state) ? context.state.hasCliValue ? context.state.cliState : inheritAnnotations(context.state, parser.initialState) : context.state;
368
369
  const innerContext = innerState !== context.state ? {
369
370
  ...context,
370
371
  state: innerState
371
372
  } : context;
372
373
  const processResult = (result) => {
373
374
  if (result.success) {
374
- const cliConsumed = result.consumed.length > 0;
375
+ const terminatorOnly = result.consumed.length === 1 && result.consumed[0] === "--" && !context.optionsTerminated && result.next.optionsTerminated;
376
+ const cliConsumed = hadCliValue || result.consumed.length > 0 && !terminatorOnly;
375
377
  const nextState$1 = injectAnnotations({
376
378
  [envBindStateKey]: true,
377
379
  hasCliValue: cliConsumed,
@@ -388,6 +390,11 @@ function bindEnv(parser, options) {
388
390
  };
389
391
  }
390
392
  if (result.consumed > 0) return result;
393
+ if (hadCliValue) return {
394
+ success: true,
395
+ next: context,
396
+ consumed: []
397
+ };
391
398
  const nextState = injectAnnotations({
392
399
  [envBindStateKey]: true,
393
400
  hasCliValue: false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/env",
3
- "version": "1.3.0-dev.2577",
3
+ "version": "1.3.0-dev.2581",
4
4
  "description": "Environment variable support for Optique",
5
5
  "keywords": [
6
6
  "CLI",
@@ -60,10 +60,10 @@
60
60
  },
61
61
  "sideEffects": false,
62
62
  "dependencies": {
63
- "@optique/core": "1.3.0-dev.2577+99a69475"
63
+ "@optique/core": "1.3.0-dev.2581+50dd484c"
64
64
  },
65
65
  "devDependencies": {
66
- "@optique/config": "1.3.0-dev.2577+99a69475",
66
+ "@optique/config": "1.3.0-dev.2581+50dd484c",
67
67
  "@types/node": "^24.0.0",
68
68
  "fast-check": "^4.7.0",
69
69
  "tsdown": "^0.13.0",