@optique/core 1.3.0-dev.2418 → 1.3.0-dev.2422

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.
@@ -536,6 +536,15 @@ function getNodeRawInput(node) {
536
536
  return node.rawInput ?? extractRawInputFromState(node.state);
537
537
  }
538
538
  /**
539
+ * Memoizes {@link hasInactiveCompletion} per runtime node. Extraction is
540
+ * pure over the node's state and nodes are freshly built for each
541
+ * completion pass, so a result keyed by node identity stays valid for as
542
+ * long as the node is reachable, while ordering, demand propagation,
543
+ * metadata registration, and failure propagation within one pass share a
544
+ * single evaluation.
545
+ */
546
+ const inactiveCompletionCache = /* @__PURE__ */ new WeakMap();
547
+ /**
539
548
  * Whether a node's completion dependencies are inactive because this
540
549
  * occurrence's own state already extracts a value: a field satisfied by
541
550
  * the command line or a binding never runs its configuration resolver,
@@ -546,6 +555,13 @@ function getNodeRawInput(node) {
546
555
  * active because it cannot be decided synchronously.
547
556
  */
548
557
  function hasInactiveCompletion(node) {
558
+ const cached = inactiveCompletionCache.get(node);
559
+ if (cached != null) return cached;
560
+ const inactive = computeInactiveCompletion(node);
561
+ inactiveCompletionCache.set(node, inactive);
562
+ return inactive;
563
+ }
564
+ function computeInactiveCompletion(node) {
549
565
  const metadata = node.parser.dependencyMetadata;
550
566
  if (metadata?.completion == null || metadata.source == null) return false;
551
567
  const extracted = metadata.source.extractSourceValue?.(node.state);
@@ -536,6 +536,15 @@ function getNodeRawInput(node) {
536
536
  return node.rawInput ?? extractRawInputFromState(node.state);
537
537
  }
538
538
  /**
539
+ * Memoizes {@link hasInactiveCompletion} per runtime node. Extraction is
540
+ * pure over the node's state and nodes are freshly built for each
541
+ * completion pass, so a result keyed by node identity stays valid for as
542
+ * long as the node is reachable, while ordering, demand propagation,
543
+ * metadata registration, and failure propagation within one pass share a
544
+ * single evaluation.
545
+ */
546
+ const inactiveCompletionCache = /* @__PURE__ */ new WeakMap();
547
+ /**
539
548
  * Whether a node's completion dependencies are inactive because this
540
549
  * occurrence's own state already extracts a value: a field satisfied by
541
550
  * the command line or a binding never runs its configuration resolver,
@@ -546,6 +555,13 @@ function getNodeRawInput(node) {
546
555
  * active because it cannot be decided synchronously.
547
556
  */
548
557
  function hasInactiveCompletion(node) {
558
+ const cached = inactiveCompletionCache.get(node);
559
+ if (cached != null) return cached;
560
+ const inactive = computeInactiveCompletion(node);
561
+ inactiveCompletionCache.set(node, inactive);
562
+ return inactive;
563
+ }
564
+ function computeInactiveCompletion(node) {
549
565
  const metadata = node.parser.dependencyMetadata;
550
566
  if (metadata?.completion == null || metadata.source == null) return false;
551
567
  const extracted = metadata.source.extractSourceValue?.(node.state);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.3.0-dev.2418",
3
+ "version": "1.3.0-dev.2422",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -221,7 +221,7 @@
221
221
  },
222
222
  "sideEffects": false,
223
223
  "devDependencies": {
224
- "@optique/env": "1.3.0-dev.2418+afa5cda1",
224
+ "@optique/env": "1.3.0-dev.2422+fbfebd21",
225
225
  "@types/node": "^24.0.0",
226
226
  "fast-check": "^4.7.0",
227
227
  "tsdown": "^0.13.0",