@optique/core 1.0.0-dev.1598 → 1.0.0-dev.1602

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/parser.d.ts CHANGED
@@ -4,6 +4,8 @@ import { Usage } from "./usage.js";
4
4
  import { DocFragments, DocPage } from "./doc.js";
5
5
  import { DependencyRegistryLike } from "./registry-types.js";
6
6
  import { DeferredMap, ValueParserResult } from "./valueparser.js";
7
+ import { ParserDependencyMetadata } from "./dependency-metadata.js";
8
+ import { DependencyRuntimeContext } from "./dependency-runtime.js";
7
9
  import { ConditionalErrorOptions, ConditionalOptions, DuplicateOptionError, GroupOptions, LongestMatchErrorOptions, LongestMatchOptions, MergeOptions, NoMatchContext, ObjectErrorOptions, ObjectOptions, OrErrorOptions, OrOptions, TupleOptions, concat, conditional, group, longestMatch, merge, object, or, tuple } from "./constructs.js";
8
10
  import { MultipleErrorOptions, MultipleOptions, WithDefaultError, WithDefaultOptions, map, multiple, nonEmpty, optional, withDefault } from "./modifiers.js";
9
11
  import { ArgumentErrorOptions, ArgumentOptions, CommandErrorOptions, CommandOptions, FlagErrorOptions, FlagOptions, OptionErrorOptions, OptionOptions, OptionState, PassThroughFormat, PassThroughOptions, argument, command, constant, fail, flag, option, passThrough } from "./primitives.js";
@@ -251,6 +253,14 @@ interface Parser<M extends Mode = "sync", TValue = unknown, TState = unknown> {
251
253
  * @since 1.0.0
252
254
  */
253
255
  normalizeValue?(value: TValue): TValue;
256
+ /**
257
+ * Internal dependency metadata describing this parser's dependency
258
+ * capabilities. Used by the dependency runtime to resolve dependencies
259
+ * without relying on state-shape protocols.
260
+ * @internal
261
+ * @since 1.0.0
262
+ */
263
+ readonly dependencyMetadata?: ParserDependencyMetadata;
254
264
  }
255
265
  /**
256
266
  * Parser-local frame data containing the input buffer and parser state.
@@ -308,6 +318,13 @@ interface ExecutionContext {
308
318
  * @since 0.10.0
309
319
  */
310
320
  readonly dependencyRegistry?: DependencyRegistryLike;
321
+ /**
322
+ * The dependency runtime context for dependency resolution.
323
+ * Coexists with `dependencyRegistry` during the transition period.
324
+ * @internal
325
+ * @since 1.0.0
326
+ */
327
+ readonly dependencyRuntime?: DependencyRuntimeContext;
311
328
  }
312
329
  /**
313
330
  * The context of the parser, which includes the input buffer and the state.
@@ -6,6 +6,7 @@ const require_validate = require('./validate.cjs');
6
6
  const require_usage = require('./usage.cjs');
7
7
  const require_suggestion = require('./suggestion.cjs');
8
8
  const require_usage_internals = require('./usage-internals.cjs');
9
+ const require_dependency_metadata = require('./dependency-metadata.cjs');
9
10
  const require_valueparser = require('./valueparser.cjs');
10
11
 
11
12
  //#region src/primitives.ts
@@ -598,6 +599,10 @@ function option(...args) {
598
599
  enumerable: false,
599
600
  writable: false
600
601
  });
602
+ if (valueParser != null) {
603
+ const depMeta = require_dependency_metadata.extractDependencyMetadata(valueParser);
604
+ if (depMeta != null) result.dependencyMetadata = depMeta;
605
+ }
601
606
  return result;
602
607
  }
603
608
  /**
@@ -963,6 +968,8 @@ function argument(valueParser, options = {}) {
963
968
  configurable: true,
964
969
  enumerable: false
965
970
  });
971
+ const depMeta = require_dependency_metadata.extractDependencyMetadata(valueParser);
972
+ if (depMeta != null) result.dependencyMetadata = depMeta;
966
973
  return result;
967
974
  }
968
975
  function* suggestCommandSync(context, prefix, name, parser, options) {
@@ -6,6 +6,7 @@ import { validateCommandNames, validateOptionNames } from "./validate.js";
6
6
  import { extractOptionNames, isDocHidden, isSuggestionHidden } from "./usage.js";
7
7
  import { DEFAULT_FIND_SIMILAR_OPTIONS, createErrorWithSuggestions, createSuggestionMessage, findSimilar } from "./suggestion.js";
8
8
  import { extractLeadingCommandNames } from "./usage-internals.js";
9
+ import { extractDependencyMetadata } from "./dependency-metadata.js";
9
10
  import { isValueParser } from "./valueparser.js";
10
11
 
11
12
  //#region src/primitives.ts
@@ -598,6 +599,10 @@ function option(...args) {
598
599
  enumerable: false,
599
600
  writable: false
600
601
  });
602
+ if (valueParser != null) {
603
+ const depMeta = extractDependencyMetadata(valueParser);
604
+ if (depMeta != null) result.dependencyMetadata = depMeta;
605
+ }
601
606
  return result;
602
607
  }
603
608
  /**
@@ -963,6 +968,8 @@ function argument(valueParser, options = {}) {
963
968
  configurable: true,
964
969
  enumerable: false
965
970
  });
971
+ const depMeta = extractDependencyMetadata(valueParser);
972
+ if (depMeta != null) result.dependencyMetadata = depMeta;
966
973
  return result;
967
974
  }
968
975
  function* suggestCommandSync(context, prefix, name, parser, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.0.0-dev.1598+6650da3a",
3
+ "version": "1.0.0-dev.1602+d81eb3b1",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",