@optique/core 1.0.0-dev.1901 → 1.0.0-dev.1970

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.
Files changed (77) hide show
  1. package/dist/annotation-state.cjs +115 -60
  2. package/dist/annotation-state.d.cts +24 -0
  3. package/dist/annotation-state.d.ts +24 -0
  4. package/dist/annotation-state.js +114 -60
  5. package/dist/annotations.cjs +2 -267
  6. package/dist/annotations.d.cts +2 -152
  7. package/dist/annotations.d.ts +2 -152
  8. package/dist/annotations.js +2 -256
  9. package/dist/completion.d.cts +1 -1
  10. package/dist/completion.d.ts +1 -1
  11. package/dist/constructs.cjs +206 -238
  12. package/dist/constructs.d.cts +1 -1
  13. package/dist/constructs.d.ts +1 -1
  14. package/dist/constructs.js +96 -128
  15. package/dist/context.d.cts +1 -1
  16. package/dist/context.d.ts +1 -1
  17. package/dist/dependency-metadata.cjs +1 -1
  18. package/dist/dependency-metadata.d.cts +1 -1
  19. package/dist/dependency-metadata.d.ts +1 -1
  20. package/dist/dependency-metadata.js +1 -1
  21. package/dist/dependency-runtime.cjs +2 -2
  22. package/dist/dependency-runtime.js +2 -2
  23. package/dist/dependency.cjs +7 -1111
  24. package/dist/dependency.d.cts +2 -838
  25. package/dist/dependency.d.ts +2 -838
  26. package/dist/dependency.js +2 -1078
  27. package/dist/execution-context.cjs +56 -0
  28. package/dist/execution-context.js +53 -0
  29. package/dist/extension.cjs +87 -0
  30. package/dist/extension.d.cts +97 -0
  31. package/dist/extension.d.ts +97 -0
  32. package/dist/extension.js +76 -0
  33. package/dist/facade.cjs +19 -19
  34. package/dist/facade.d.cts +1 -1
  35. package/dist/facade.d.ts +1 -1
  36. package/dist/facade.js +19 -19
  37. package/dist/index.cjs +4 -41
  38. package/dist/index.d.cts +7 -7
  39. package/dist/index.d.ts +7 -7
  40. package/dist/index.js +5 -5
  41. package/dist/internal/annotations.cjs +316 -0
  42. package/dist/internal/annotations.d.cts +140 -0
  43. package/dist/internal/annotations.d.ts +140 -0
  44. package/dist/internal/annotations.js +306 -0
  45. package/dist/internal/dependency.cjs +984 -0
  46. package/dist/internal/dependency.d.cts +539 -0
  47. package/dist/internal/dependency.d.ts +539 -0
  48. package/dist/internal/dependency.js +964 -0
  49. package/dist/{mode-dispatch.cjs → internal/mode-dispatch.cjs} +1 -3
  50. package/dist/{mode-dispatch.d.cts → internal/mode-dispatch.d.cts} +3 -7
  51. package/dist/{mode-dispatch.d.ts → internal/mode-dispatch.d.ts} +3 -7
  52. package/dist/{mode-dispatch.js → internal/mode-dispatch.js} +1 -3
  53. package/dist/internal/parser.cjs +728 -0
  54. package/dist/internal/parser.d.cts +947 -0
  55. package/dist/internal/parser.d.ts +947 -0
  56. package/dist/internal/parser.js +711 -0
  57. package/dist/modifiers.cjs +108 -125
  58. package/dist/modifiers.d.cts +1 -1
  59. package/dist/modifiers.d.ts +1 -1
  60. package/dist/modifiers.js +92 -109
  61. package/dist/parser.cjs +11 -743
  62. package/dist/parser.d.cts +3 -991
  63. package/dist/parser.d.ts +3 -991
  64. package/dist/parser.js +2 -704
  65. package/dist/phase2-seed.cjs +4 -4
  66. package/dist/phase2-seed.js +4 -4
  67. package/dist/primitives.cjs +39 -74
  68. package/dist/primitives.d.cts +1 -1
  69. package/dist/primitives.d.ts +1 -1
  70. package/dist/primitives.js +26 -61
  71. package/dist/program.d.cts +1 -1
  72. package/dist/program.d.ts +1 -1
  73. package/dist/valueparser.cjs +23 -23
  74. package/dist/valueparser.d.cts +3 -3
  75. package/dist/valueparser.d.ts +3 -3
  76. package/dist/valueparser.js +23 -23
  77. package/package.json +9 -9
@@ -1,5 +1,5 @@
1
- const require_annotations = require('./annotations.cjs');
2
- const require_parser = require('./parser.cjs');
1
+ const require_annotations = require('./internal/annotations.cjs');
2
+ const require_parser = require('./internal/parser.cjs');
3
3
 
4
4
  //#region src/annotation-state.ts
5
5
  /**
@@ -11,6 +11,7 @@ const require_parser = require('./parser.cjs');
11
11
  * @internal
12
12
  */
13
13
  const annotationViewTargets = /* @__PURE__ */ new WeakMap();
14
+ const delegatedAnnotationCloneTargets = /* @__PURE__ */ new WeakMap();
14
15
  /**
15
16
  * Unwraps an annotation-view proxy to its original target object.
16
17
  *
@@ -23,14 +24,18 @@ function unwrapAnnotationView(value) {
23
24
  if (value == null || typeof value !== "object") return value;
24
25
  return annotationViewTargets.get(value) ?? value;
25
26
  }
27
+ function unwrapDelegatedAnnotationClone(value) {
28
+ if (value == null || typeof value !== "object") return value;
29
+ return delegatedAnnotationCloneTargets.get(value) ?? value;
30
+ }
26
31
  /**
27
- * Creates a proxy that exposes annotations without changing the target shape.
32
+ * Creates an annotation-aware proxy without changing the target shape.
28
33
  *
29
34
  * @param state The object state to expose through an annotation-aware view.
30
35
  * @param annotations The annotations to surface through the proxy.
31
36
  * @returns A proxy over the unwrapped target object that reports the supplied
32
37
  * annotations while preserving the target's structural behavior.
33
- * @internal
38
+ * @since 1.0.0
34
39
  */
35
40
  function withAnnotationView(state, annotations) {
36
41
  const target = unwrapAnnotationView(state);
@@ -59,61 +64,90 @@ function normalizeInjectedAnnotationState(state) {
59
64
  return require_annotations.unwrapInjectedAnnotationWrapper(state);
60
65
  }
61
66
  function isNonPlainDelegatedObject(state) {
62
- if (Array.isArray(state) || state instanceof Date || state instanceof Map || state instanceof Set || state instanceof RegExp) return false;
63
67
  const proto = Object.getPrototypeOf(state);
68
+ if (proto === Array.prototype || proto === Date.prototype || proto === Map.prototype || proto === Set.prototype || proto === RegExp.prototype) return false;
64
69
  return proto !== Object.prototype && proto !== null;
65
70
  }
71
+ function inheritDelegatedAnnotations(parentState, childState) {
72
+ const target = normalizeDelegatedAnnotationState(childState);
73
+ const delegatedState = require_annotations.inheritAnnotations(parentState, target);
74
+ if (delegatedState !== target) delegatedAnnotationCloneTargets.set(delegatedState, target);
75
+ return delegatedState;
76
+ }
66
77
  /**
67
78
  * Removes Optique's internal annotation carriers from a delegated state.
68
79
  *
69
- * This unwraps both primitive-state annotation wrappers and annotation-view
70
- * proxies used for non-plain object states.
80
+ * This unwraps primitive-state annotation wrappers, tracked delegated clones,
81
+ * and annotation-view proxies used for object states.
71
82
  *
72
83
  * @param state The delegated state to normalize.
73
84
  * @returns The original underlying state value.
74
85
  * @internal
75
86
  */
76
87
  function normalizeDelegatedAnnotationState(state) {
77
- return normalizeInjectedAnnotationState(unwrapAnnotationView(state));
88
+ return normalizeInjectedAnnotationState(unwrapDelegatedAnnotationClone(unwrapAnnotationView(state)));
78
89
  }
79
90
  /**
80
91
  * Returns whether the given state uses an internal delegated annotation carrier.
81
92
  *
82
93
  * @param state The candidate state to inspect.
83
- * @returns `true` when the state is an injected primitive wrapper or an
84
- * annotation-view proxy.
94
+ * @returns `true` when the state is an injected primitive wrapper, a tracked
95
+ * delegated clone, or an annotation-view proxy.
85
96
  * @internal
86
97
  */
87
98
  function hasDelegatedAnnotationCarrier(state) {
88
- return state != null && typeof state === "object" && (require_annotations.isInjectedAnnotationWrapper(state) || annotationViewTargets.has(state));
99
+ return state != null && typeof state === "object" && (require_annotations.isInjectedAnnotationWrapper(state) || delegatedAnnotationCloneTargets.has(state) || annotationViewTargets.has(state));
100
+ }
101
+ function getOrCreateNestedNormalizationClone(entry) {
102
+ entry.clone ??= entry.createClone();
103
+ return entry.clone;
89
104
  }
90
- function isPendingNestedNormalizationAlias(originalValue, normalizedValue, seen) {
91
- if (originalValue == null || typeof originalValue !== "object") return false;
105
+ function getPendingNestedNormalizationEntry(originalValue, normalizedValue, seen) {
106
+ if (originalValue == null || typeof originalValue !== "object") return void 0;
92
107
  const entry = seen.get(originalValue);
93
- return entry != null && !entry.finalized && entry.clone === normalizedValue;
108
+ return entry != null && entry.clone != null && entry.clone === normalizedValue && (!entry.finalized || entry.preferCloneOnRead) ? entry : void 0;
94
109
  }
95
110
  function createPendingNestedNormalizationClone(source) {
96
- return Array.isArray(source) ? [] : Object.create(Object.getPrototypeOf(source));
111
+ if (!Array.isArray(source)) return Object.create(Object.getPrototypeOf(source));
112
+ if (Object.getPrototypeOf(source) === Array.prototype) return [];
113
+ try {
114
+ return source.slice(0, 0);
115
+ } catch {
116
+ return [];
117
+ }
118
+ }
119
+ function createPendingNestedNormalizationCollectionClone(source) {
120
+ const proto = Object.getPrototypeOf(source);
121
+ if (source instanceof Map && proto === Map.prototype) return /* @__PURE__ */ new Map();
122
+ if (source instanceof Set && proto === Set.prototype) return /* @__PURE__ */ new Set();
123
+ const Constructor = source.constructor;
124
+ if (typeof Constructor === "function") try {
125
+ return new Constructor();
126
+ } catch {}
127
+ return source instanceof Map ? /* @__PURE__ */ new Map() : /* @__PURE__ */ new Set();
97
128
  }
98
- function normalizeNestedDelegatedStructuredState(source, seen) {
99
- const clone = createPendingNestedNormalizationClone(source);
129
+ function normalizeNestedDelegatedStructuredState(source, seen, preferPendingClone) {
100
130
  const entry = {
101
- clone,
131
+ clone: void 0,
132
+ createClone: () => createPendingNestedNormalizationClone(source),
102
133
  finalized: false,
103
- result: clone
134
+ result: source,
135
+ preferCloneOnRead: false
104
136
  };
105
137
  seen.set(source, entry);
106
138
  const overrides = /* @__PURE__ */ new Map();
107
139
  let changed = false;
140
+ let hasPendingAliasOverride = false;
108
141
  for (const key of Reflect.ownKeys(source)) {
109
142
  const descriptor = Object.getOwnPropertyDescriptor(source, key);
110
143
  if (descriptor == null || !("value" in descriptor)) continue;
111
- const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen);
144
+ const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen, true);
112
145
  if (nextValue === descriptor.value) continue;
113
146
  overrides.set(key, nextValue);
114
- if (!isPendingNestedNormalizationAlias(descriptor.value, nextValue, seen)) changed = true;
147
+ if (getPendingNestedNormalizationEntry(descriptor.value, nextValue, seen) == null) changed = true;
148
+ else hasPendingAliasOverride = true;
115
149
  }
116
- if (!changed) {
150
+ if (!changed && !hasPendingAliasOverride) {
117
151
  entry.finalized = true;
118
152
  entry.result = source;
119
153
  return source;
@@ -127,41 +161,50 @@ function normalizeNestedDelegatedStructuredState(source, seen) {
127
161
  value: nextValue
128
162
  };
129
163
  }
164
+ const clone = getOrCreateNestedNormalizationClone(entry);
130
165
  Object.defineProperties(clone, descriptors);
131
166
  entry.finalized = true;
132
- entry.result = clone;
133
- return clone;
167
+ entry.preferCloneOnRead = !changed && hasPendingAliasOverride;
168
+ entry.result = changed ? clone : source;
169
+ return changed || preferPendingClone ? clone : source;
134
170
  }
135
- function normalizeNestedDelegatedMapState(source, seen) {
136
- const clone = /* @__PURE__ */ new Map();
171
+ function normalizeNestedDelegatedMapState(source, seen, preferPendingClone) {
137
172
  const entry = {
138
- clone,
173
+ clone: void 0,
174
+ createClone: () => createPendingNestedNormalizationCollectionClone(source),
139
175
  finalized: false,
140
- result: clone
176
+ result: source,
177
+ preferCloneOnRead: false
141
178
  };
142
179
  seen.set(source, entry);
143
180
  const normalizedEntries = [];
144
181
  const overrides = /* @__PURE__ */ new Map();
145
182
  let changed = false;
183
+ let hasPendingAliasOverride = false;
146
184
  for (const [key, value] of source) {
147
- const nextKey = normalizeNestedDelegatedAnnotationState(key, seen);
148
- const nextValue = normalizeNestedDelegatedAnnotationState(value, seen);
185
+ const nextKey = normalizeNestedDelegatedAnnotationState(key, seen, true);
186
+ const nextValue = normalizeNestedDelegatedAnnotationState(value, seen, true);
149
187
  normalizedEntries.push([nextKey, nextValue]);
150
- if (!isPendingNestedNormalizationAlias(key, nextKey, seen) && nextKey !== key || !isPendingNestedNormalizationAlias(value, nextValue, seen) && nextValue !== value) changed = true;
188
+ if (nextKey !== key) if (getPendingNestedNormalizationEntry(key, nextKey, seen) == null) changed = true;
189
+ else hasPendingAliasOverride = true;
190
+ if (nextValue !== value) if (getPendingNestedNormalizationEntry(value, nextValue, seen) == null) changed = true;
191
+ else hasPendingAliasOverride = true;
151
192
  }
152
193
  for (const key of Reflect.ownKeys(source)) {
153
194
  const descriptor = Object.getOwnPropertyDescriptor(source, key);
154
195
  if (descriptor == null || !("value" in descriptor)) continue;
155
- const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen);
196
+ const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen, true);
156
197
  if (nextValue === descriptor.value) continue;
157
198
  overrides.set(key, nextValue);
158
- if (!isPendingNestedNormalizationAlias(descriptor.value, nextValue, seen)) changed = true;
199
+ if (getPendingNestedNormalizationEntry(descriptor.value, nextValue, seen) == null) changed = true;
200
+ else hasPendingAliasOverride = true;
159
201
  }
160
- if (!changed) {
202
+ if (!changed && !hasPendingAliasOverride) {
161
203
  entry.finalized = true;
162
204
  entry.result = source;
163
205
  return source;
164
206
  }
207
+ const clone = getOrCreateNestedNormalizationClone(entry);
165
208
  for (const [key, value] of normalizedEntries) clone.set(key, value);
166
209
  const descriptors = Object.getOwnPropertyDescriptors(source);
167
210
  for (const [key, nextValue] of overrides) {
@@ -174,38 +217,45 @@ function normalizeNestedDelegatedMapState(source, seen) {
174
217
  }
175
218
  Object.defineProperties(clone, descriptors);
176
219
  entry.finalized = true;
177
- entry.result = clone;
178
- return clone;
220
+ entry.preferCloneOnRead = !changed && hasPendingAliasOverride;
221
+ entry.result = changed ? clone : source;
222
+ return changed || preferPendingClone ? clone : source;
179
223
  }
180
- function normalizeNestedDelegatedSetState(source, seen) {
181
- const clone = /* @__PURE__ */ new Set();
224
+ function normalizeNestedDelegatedSetState(source, seen, preferPendingClone) {
182
225
  const entry = {
183
- clone,
226
+ clone: void 0,
227
+ createClone: () => createPendingNestedNormalizationCollectionClone(source),
184
228
  finalized: false,
185
- result: clone
229
+ result: source,
230
+ preferCloneOnRead: false
186
231
  };
187
232
  seen.set(source, entry);
188
233
  const normalizedValues = [];
189
234
  const overrides = /* @__PURE__ */ new Map();
190
235
  let changed = false;
236
+ let hasPendingAliasOverride = false;
191
237
  for (const value of source) {
192
- const nextValue = normalizeNestedDelegatedAnnotationState(value, seen);
238
+ const nextValue = normalizeNestedDelegatedAnnotationState(value, seen, true);
193
239
  normalizedValues.push(nextValue);
194
- if (nextValue !== value && !isPendingNestedNormalizationAlias(value, nextValue, seen)) changed = true;
240
+ if (nextValue === value) continue;
241
+ if (getPendingNestedNormalizationEntry(value, nextValue, seen) == null) changed = true;
242
+ else hasPendingAliasOverride = true;
195
243
  }
196
244
  for (const key of Reflect.ownKeys(source)) {
197
245
  const descriptor = Object.getOwnPropertyDescriptor(source, key);
198
246
  if (descriptor == null || !("value" in descriptor)) continue;
199
- const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen);
247
+ const nextValue = normalizeNestedDelegatedAnnotationState(descriptor.value, seen, true);
200
248
  if (nextValue === descriptor.value) continue;
201
249
  overrides.set(key, nextValue);
202
- if (!isPendingNestedNormalizationAlias(descriptor.value, nextValue, seen)) changed = true;
250
+ if (getPendingNestedNormalizationEntry(descriptor.value, nextValue, seen) == null) changed = true;
251
+ else hasPendingAliasOverride = true;
203
252
  }
204
- if (!changed) {
253
+ if (!changed && !hasPendingAliasOverride) {
205
254
  entry.finalized = true;
206
255
  entry.result = source;
207
256
  return source;
208
257
  }
258
+ const clone = getOrCreateNestedNormalizationClone(entry);
209
259
  for (const value of normalizedValues) clone.add(value);
210
260
  const descriptors = Object.getOwnPropertyDescriptors(source);
211
261
  for (const [key, nextValue] of overrides) {
@@ -218,8 +268,9 @@ function normalizeNestedDelegatedSetState(source, seen) {
218
268
  }
219
269
  Object.defineProperties(clone, descriptors);
220
270
  entry.finalized = true;
221
- entry.result = clone;
222
- return clone;
271
+ entry.preferCloneOnRead = !changed && hasPendingAliasOverride;
272
+ entry.result = changed ? clone : source;
273
+ return changed || preferPendingClone ? clone : source;
223
274
  }
224
275
  /**
225
276
  * Recursively removes delegated annotation carriers from plain-object, array,
@@ -237,27 +288,30 @@ function normalizeNestedDelegatedSetState(source, seen) {
237
288
  * normalized clone with delegated carriers removed.
238
289
  * @internal
239
290
  */
240
- function normalizeNestedDelegatedAnnotationState(value, seen = /* @__PURE__ */ new WeakMap()) {
291
+ function normalizeNestedDelegatedAnnotationState(value, seen = /* @__PURE__ */ new WeakMap(), preferPendingClone = false) {
241
292
  const normalized = normalizeDelegatedAnnotationState(value);
242
293
  if (normalized == null || typeof normalized !== "object") return normalized;
243
294
  const source = normalized;
244
295
  const existing = seen.get(source);
245
- if (existing != null) return existing.finalized ? existing.result : existing.clone;
246
- if (Array.isArray(source)) return normalizeNestedDelegatedStructuredState(source, seen);
247
- if (source instanceof Map) return normalizeNestedDelegatedMapState(source, seen);
248
- if (source instanceof Set) return normalizeNestedDelegatedSetState(source, seen);
296
+ if (existing != null) {
297
+ if (!existing.finalized) return getOrCreateNestedNormalizationClone(existing);
298
+ return preferPendingClone && existing.preferCloneOnRead ? getOrCreateNestedNormalizationClone(existing) : existing.result;
299
+ }
300
+ if (Array.isArray(source)) return normalizeNestedDelegatedStructuredState(source, seen, preferPendingClone);
301
+ if (source instanceof Map) return normalizeNestedDelegatedMapState(source, seen, preferPendingClone);
302
+ if (source instanceof Set) return normalizeNestedDelegatedSetState(source, seen, preferPendingClone);
249
303
  const proto = Object.getPrototypeOf(source);
250
304
  if (proto !== Object.prototype && proto !== null) return normalized;
251
- return normalizeNestedDelegatedStructuredState(source, seen);
305
+ return normalizeNestedDelegatedStructuredState(source, seen, preferPendingClone);
252
306
  }
253
307
  /**
254
308
  * Creates a short-lived delegated state that exposes the parent's annotations
255
309
  * regardless of the child state's runtime shape.
256
310
  *
257
- * Primitive and nullish states use `injectAnnotations()`, plain objects and
258
- * built-ins use `inheritAnnotations()`, and non-plain objects use an
259
- * annotation-view proxy so class invariants such as private fields remain
260
- * intact.
311
+ * Primitive and nullish states use `injectAnnotations()`, clone-based object
312
+ * delegation is tracked so it can be normalized back out later, and non-plain
313
+ * objects use an annotation-view proxy so class invariants such as private
314
+ * fields remain intact.
261
315
  *
262
316
  * @param parentState The state carrying the annotations to delegate.
263
317
  * @param childState The child state that should observe those annotations.
@@ -268,10 +322,10 @@ function getDelegatedAnnotationState(parentState, childState) {
268
322
  const annotations = require_annotations.getAnnotations(parentState);
269
323
  if (annotations === void 0) return childState;
270
324
  if (require_annotations.isInjectedAnnotationWrapper(childState)) return require_annotations.injectAnnotations(normalizeInjectedAnnotationState(childState), annotations);
271
- if (require_annotations.getAnnotations(childState) === annotations) return childState;
272
325
  if (childState == null || typeof childState !== "object") return require_annotations.injectAnnotations(childState, annotations);
326
+ if (require_annotations.getAnnotations(childState) === annotations && (delegatedAnnotationCloneTargets.has(childState) || annotationViewTargets.has(childState))) return childState;
273
327
  if (isNonPlainDelegatedObject(childState)) return withAnnotationView(childState, annotations);
274
- return require_annotations.inheritAnnotations(parentState, childState);
328
+ return inheritDelegatedAnnotations(parentState, childState);
275
329
  }
276
330
  /**
277
331
  * Returns whether a state is still at the initial sentinel after normalizing
@@ -367,4 +421,5 @@ exports.normalizeDelegatedAnnotationState = normalizeDelegatedAnnotationState;
367
421
  exports.normalizeInjectedAnnotationState = normalizeInjectedAnnotationState;
368
422
  exports.normalizeNestedDelegatedAnnotationState = normalizeNestedDelegatedAnnotationState;
369
423
  exports.reconcileObjectChildState = reconcileObjectChildState;
370
- exports.unwrapAnnotationView = unwrapAnnotationView;
424
+ exports.unwrapAnnotationView = unwrapAnnotationView;
425
+ exports.withAnnotationView = withAnnotationView;
@@ -0,0 +1,24 @@
1
+ import { Annotations } from "./internal/annotations.cjs";
2
+
3
+ //#region src/annotation-state.d.ts
4
+
5
+ /**
6
+ * Creates an annotation-aware proxy without changing the target shape.
7
+ *
8
+ * @param state The object state to expose through an annotation-aware view.
9
+ * @param annotations The annotations to surface through the proxy.
10
+ * @returns A proxy over the unwrapped target object that reports the supplied
11
+ * annotations while preserving the target's structural behavior.
12
+ * @since 1.0.0
13
+ */
14
+ declare function withAnnotationView<T extends object>(state: T, annotations: Annotations): T;
15
+ /**
16
+ * Removes Optique's internal primitive-state annotation wrapper when present.
17
+ *
18
+ * @param state The parser state to normalize.
19
+ * @returns The wrapped primitive sentinel when the input is an injected
20
+ * annotation wrapper; otherwise the original input unchanged.
21
+ * @internal
22
+ */
23
+ //#endregion
24
+ export { withAnnotationView };
@@ -0,0 +1,24 @@
1
+ import { Annotations } from "./internal/annotations.js";
2
+
3
+ //#region src/annotation-state.d.ts
4
+
5
+ /**
6
+ * Creates an annotation-aware proxy without changing the target shape.
7
+ *
8
+ * @param state The object state to expose through an annotation-aware view.
9
+ * @param annotations The annotations to surface through the proxy.
10
+ * @returns A proxy over the unwrapped target object that reports the supplied
11
+ * annotations while preserving the target's structural behavior.
12
+ * @since 1.0.0
13
+ */
14
+ declare function withAnnotationView<T extends object>(state: T, annotations: Annotations): T;
15
+ /**
16
+ * Removes Optique's internal primitive-state annotation wrapper when present.
17
+ *
18
+ * @param state The parser state to normalize.
19
+ * @returns The wrapped primitive sentinel when the input is an injected
20
+ * annotation wrapper; otherwise the original input unchanged.
21
+ * @internal
22
+ */
23
+ //#endregion
24
+ export { withAnnotationView };