@optique/core 1.0.0-dev.908 → 1.0.0

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 (109) hide show
  1. package/dist/annotation-state.cjs +425 -0
  2. package/dist/annotation-state.d.cts +24 -0
  3. package/dist/annotation-state.d.ts +24 -0
  4. package/dist/annotation-state.js +414 -0
  5. package/dist/annotations.cjs +2 -248
  6. package/dist/annotations.d.cts +2 -137
  7. package/dist/annotations.d.ts +2 -137
  8. package/dist/annotations.js +2 -238
  9. package/dist/completion.cjs +611 -100
  10. package/dist/completion.d.cts +1 -1
  11. package/dist/completion.d.ts +1 -1
  12. package/dist/completion.js +611 -100
  13. package/dist/constructs.cjs +3338 -827
  14. package/dist/constructs.d.cts +48 -7
  15. package/dist/constructs.d.ts +48 -7
  16. package/dist/constructs.js +3338 -827
  17. package/dist/context.cjs +0 -23
  18. package/dist/context.d.cts +119 -53
  19. package/dist/context.d.ts +119 -53
  20. package/dist/context.js +0 -22
  21. package/dist/dependency-metadata.cjs +139 -0
  22. package/dist/dependency-metadata.d.cts +112 -0
  23. package/dist/dependency-metadata.d.ts +112 -0
  24. package/dist/dependency-metadata.js +138 -0
  25. package/dist/dependency-runtime.cjs +698 -0
  26. package/dist/dependency-runtime.d.cts +149 -0
  27. package/dist/dependency-runtime.d.ts +149 -0
  28. package/dist/dependency-runtime.js +687 -0
  29. package/dist/dependency.cjs +7 -928
  30. package/dist/dependency.d.cts +2 -794
  31. package/dist/dependency.d.ts +2 -794
  32. package/dist/dependency.js +2 -899
  33. package/dist/displaywidth.cjs +44 -0
  34. package/dist/displaywidth.js +43 -0
  35. package/dist/doc.cjs +285 -23
  36. package/dist/doc.d.cts +57 -2
  37. package/dist/doc.d.ts +57 -2
  38. package/dist/doc.js +283 -25
  39. package/dist/execution-context.cjs +56 -0
  40. package/dist/execution-context.js +53 -0
  41. package/dist/extension.cjs +87 -0
  42. package/dist/extension.d.cts +97 -0
  43. package/dist/extension.d.ts +97 -0
  44. package/dist/extension.js +76 -0
  45. package/dist/facade.cjs +718 -523
  46. package/dist/facade.d.cts +87 -18
  47. package/dist/facade.d.ts +87 -18
  48. package/dist/facade.js +718 -523
  49. package/dist/index.cjs +14 -29
  50. package/dist/index.d.cts +10 -10
  51. package/dist/index.d.ts +10 -10
  52. package/dist/index.js +7 -7
  53. package/dist/input-trace.cjs +56 -0
  54. package/dist/input-trace.d.cts +77 -0
  55. package/dist/input-trace.d.ts +77 -0
  56. package/dist/input-trace.js +55 -0
  57. package/dist/internal/annotations.cjs +316 -0
  58. package/dist/internal/annotations.d.cts +140 -0
  59. package/dist/internal/annotations.d.ts +140 -0
  60. package/dist/internal/annotations.js +306 -0
  61. package/dist/internal/dependency.cjs +984 -0
  62. package/dist/internal/dependency.d.cts +539 -0
  63. package/dist/internal/dependency.d.ts +539 -0
  64. package/dist/internal/dependency.js +964 -0
  65. package/dist/{mode-dispatch.cjs → internal/mode-dispatch.cjs} +1 -3
  66. package/dist/{mode-dispatch.d.cts → internal/mode-dispatch.d.cts} +3 -7
  67. package/dist/{mode-dispatch.d.ts → internal/mode-dispatch.d.ts} +3 -7
  68. package/dist/{mode-dispatch.js → internal/mode-dispatch.js} +1 -3
  69. package/dist/internal/parser.cjs +728 -0
  70. package/dist/internal/parser.d.cts +947 -0
  71. package/dist/internal/parser.d.ts +947 -0
  72. package/dist/internal/parser.js +711 -0
  73. package/dist/message.cjs +84 -26
  74. package/dist/message.d.cts +49 -9
  75. package/dist/message.d.ts +49 -9
  76. package/dist/message.js +84 -27
  77. package/dist/modifiers.cjs +1023 -240
  78. package/dist/modifiers.d.cts +42 -1
  79. package/dist/modifiers.d.ts +42 -1
  80. package/dist/modifiers.js +1023 -240
  81. package/dist/parser.cjs +11 -463
  82. package/dist/parser.d.cts +3 -537
  83. package/dist/parser.d.ts +3 -537
  84. package/dist/parser.js +2 -433
  85. package/dist/phase2-seed.cjs +59 -0
  86. package/dist/phase2-seed.js +56 -0
  87. package/dist/primitives.cjs +557 -208
  88. package/dist/primitives.d.cts +10 -14
  89. package/dist/primitives.d.ts +10 -14
  90. package/dist/primitives.js +557 -208
  91. package/dist/program.cjs +5 -1
  92. package/dist/program.d.cts +5 -3
  93. package/dist/program.d.ts +5 -3
  94. package/dist/program.js +6 -1
  95. package/dist/suggestion.cjs +22 -8
  96. package/dist/suggestion.js +22 -8
  97. package/dist/usage-internals.cjs +3 -2
  98. package/dist/usage-internals.js +4 -2
  99. package/dist/usage.cjs +195 -40
  100. package/dist/usage.d.cts +92 -11
  101. package/dist/usage.d.ts +92 -11
  102. package/dist/usage.js +194 -41
  103. package/dist/validate.cjs +170 -0
  104. package/dist/validate.js +164 -0
  105. package/dist/valueparser.cjs +1278 -191
  106. package/dist/valueparser.d.cts +330 -20
  107. package/dist/valueparser.d.ts +330 -20
  108. package/dist/valueparser.js +1277 -192
  109. package/package.json +9 -9
@@ -1,137 +1,2 @@
1
- //#region src/annotations.d.ts
2
- /**
3
- * Runtime context extension system for Optique parsers.
4
- *
5
- * This module provides the annotations system that allows external runtime data
6
- * to be passed to parsers during the parsing session. This enables use cases like
7
- * config file fallbacks, environment-based validation, and shared context.
8
- *
9
- * @module
10
- * @since 0.10.0
11
- */
12
- /**
13
- * Annotation key symbol for storing data in parser state.
14
- * @since 0.10.0
15
- */
16
- declare const annotationKey: unique symbol;
17
- /**
18
- * Internal marker attached during the first pass of `runWith()` so wrappers
19
- * with side effects can defer work until dynamic contexts have resolved.
20
- *
21
- * @internal
22
- */
23
- declare const firstPassAnnotationKey: unique symbol;
24
- /**
25
- * Internal key for preserving primitive parser state values when annotations
26
- * are injected into non-object states.
27
- * @internal
28
- */
29
- declare const annotationStateValueKey: unique symbol;
30
- /**
31
- * Internal marker key that indicates annotation wrapping was injected by
32
- * Optique internals for non-object states.
33
- * @internal
34
- */
35
- declare const annotationWrapperKey: unique symbol;
36
- /**
37
- * Annotations that can be passed to parsers during execution.
38
- * Allows external packages to provide additional data that parsers can access
39
- * during complete() or parse() phases.
40
- *
41
- * @example
42
- * ```typescript
43
- * const myDataKey = Symbol.for("@my-package/data");
44
- * const result = parse(parser, args, {
45
- * annotations: {
46
- * [myDataKey]: { foo: "bar" }
47
- * }
48
- * });
49
- * ```
50
- * @since 0.10.0
51
- */
52
- type Annotations = Record<symbol, unknown>;
53
- /**
54
- * Options for parse functions.
55
- * @since 0.10.0
56
- */
57
- interface ParseOptions {
58
- /**
59
- * Annotations to attach to the parsing session.
60
- * Parsers can access these annotations via getAnnotations(state).
61
- */
62
- annotations?: Annotations;
63
- }
64
- /**
65
- * Extracts annotations from parser state.
66
- *
67
- * @param state Parser state that may contain annotations
68
- * @returns Annotations object or undefined if no annotations are present
69
- * @since 0.10.0
70
- *
71
- * @example
72
- * ```typescript
73
- * const annotations = getAnnotations(state);
74
- * const myData = annotations?.[myDataKey];
75
- * ```
76
- */
77
- declare function getAnnotations(state: unknown): Annotations | undefined;
78
- /**
79
- * Reattaches annotations to a freshly created array state.
80
- *
81
- * Array spread copies elements but drops symbol properties, so parsers that
82
- * rebuild array states need to copy annotations back explicitly.
83
- *
84
- * @param source The original state that may carry annotations.
85
- * @param target The freshly created array state.
86
- * @returns The target array, with annotations copied when available.
87
- * @internal
88
- */
89
- declare function annotateFreshArray<T>(source: unknown, target: readonly T[]): readonly T[];
90
- /**
91
- * Propagates annotations from one parser state to another.
92
- *
93
- * This is mainly used by parsers that rebuild array states with spread syntax.
94
- * Array spread copies elements but drops custom symbol properties, so we need
95
- * to reattach annotations explicitly when present.
96
- *
97
- * @param source The original state that may carry annotations.
98
- * @param target The new state to receive annotations.
99
- * @returns The target state, with annotations copied when available.
100
- * @internal
101
- */
102
- declare function inheritAnnotations<T>(source: unknown, target: T): T;
103
- /**
104
- * Injects annotations into parser state while preserving state shape.
105
- *
106
- * - Primitive, null, and undefined states are wrapped with internal metadata.
107
- * - Array states are cloned and annotated without mutating the original.
108
- * - Plain object states are shallow-cloned with annotations attached.
109
- * - Built-in object states (Date/Map/Set/RegExp) are cloned by constructor.
110
- * - Other non-plain object states are cloned via prototype/descriptors.
111
- *
112
- * @param state The parser state to annotate.
113
- * @param annotations The annotations to inject.
114
- * @returns Annotated state.
115
- * @internal
116
- */
117
- declare function injectAnnotations<TState>(state: TState, annotations: Annotations): TState;
118
- /**
119
- * Unwraps a primitive-state annotation wrapper injected by Optique internals.
120
- *
121
- * @param value Value to potentially unwrap.
122
- * @returns The unwrapped primitive value when the input is an injected wrapper;
123
- * otherwise the original value.
124
- * @internal
125
- */
126
- declare function unwrapInjectedAnnotationWrapper<T>(value: T): T;
127
- /**
128
- * Returns whether the given value is an internal primitive-state annotation
129
- * wrapper that was injected by Optique.
130
- *
131
- * @param value Value to check.
132
- * @returns `true` if the value is an injected internal wrapper.
133
- * @internal
134
- */
135
- declare function isInjectedAnnotationWrapper(value: unknown): boolean;
136
- //#endregion
137
- export { Annotations, ParseOptions, annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, firstPassAnnotationKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
1
+ import { Annotations, ParseOptions, getAnnotations } from "./internal/annotations.cjs";
2
+ export { type Annotations, type ParseOptions, getAnnotations };
@@ -1,137 +1,2 @@
1
- //#region src/annotations.d.ts
2
- /**
3
- * Runtime context extension system for Optique parsers.
4
- *
5
- * This module provides the annotations system that allows external runtime data
6
- * to be passed to parsers during the parsing session. This enables use cases like
7
- * config file fallbacks, environment-based validation, and shared context.
8
- *
9
- * @module
10
- * @since 0.10.0
11
- */
12
- /**
13
- * Annotation key symbol for storing data in parser state.
14
- * @since 0.10.0
15
- */
16
- declare const annotationKey: unique symbol;
17
- /**
18
- * Internal marker attached during the first pass of `runWith()` so wrappers
19
- * with side effects can defer work until dynamic contexts have resolved.
20
- *
21
- * @internal
22
- */
23
- declare const firstPassAnnotationKey: unique symbol;
24
- /**
25
- * Internal key for preserving primitive parser state values when annotations
26
- * are injected into non-object states.
27
- * @internal
28
- */
29
- declare const annotationStateValueKey: unique symbol;
30
- /**
31
- * Internal marker key that indicates annotation wrapping was injected by
32
- * Optique internals for non-object states.
33
- * @internal
34
- */
35
- declare const annotationWrapperKey: unique symbol;
36
- /**
37
- * Annotations that can be passed to parsers during execution.
38
- * Allows external packages to provide additional data that parsers can access
39
- * during complete() or parse() phases.
40
- *
41
- * @example
42
- * ```typescript
43
- * const myDataKey = Symbol.for("@my-package/data");
44
- * const result = parse(parser, args, {
45
- * annotations: {
46
- * [myDataKey]: { foo: "bar" }
47
- * }
48
- * });
49
- * ```
50
- * @since 0.10.0
51
- */
52
- type Annotations = Record<symbol, unknown>;
53
- /**
54
- * Options for parse functions.
55
- * @since 0.10.0
56
- */
57
- interface ParseOptions {
58
- /**
59
- * Annotations to attach to the parsing session.
60
- * Parsers can access these annotations via getAnnotations(state).
61
- */
62
- annotations?: Annotations;
63
- }
64
- /**
65
- * Extracts annotations from parser state.
66
- *
67
- * @param state Parser state that may contain annotations
68
- * @returns Annotations object or undefined if no annotations are present
69
- * @since 0.10.0
70
- *
71
- * @example
72
- * ```typescript
73
- * const annotations = getAnnotations(state);
74
- * const myData = annotations?.[myDataKey];
75
- * ```
76
- */
77
- declare function getAnnotations(state: unknown): Annotations | undefined;
78
- /**
79
- * Reattaches annotations to a freshly created array state.
80
- *
81
- * Array spread copies elements but drops symbol properties, so parsers that
82
- * rebuild array states need to copy annotations back explicitly.
83
- *
84
- * @param source The original state that may carry annotations.
85
- * @param target The freshly created array state.
86
- * @returns The target array, with annotations copied when available.
87
- * @internal
88
- */
89
- declare function annotateFreshArray<T>(source: unknown, target: readonly T[]): readonly T[];
90
- /**
91
- * Propagates annotations from one parser state to another.
92
- *
93
- * This is mainly used by parsers that rebuild array states with spread syntax.
94
- * Array spread copies elements but drops custom symbol properties, so we need
95
- * to reattach annotations explicitly when present.
96
- *
97
- * @param source The original state that may carry annotations.
98
- * @param target The new state to receive annotations.
99
- * @returns The target state, with annotations copied when available.
100
- * @internal
101
- */
102
- declare function inheritAnnotations<T>(source: unknown, target: T): T;
103
- /**
104
- * Injects annotations into parser state while preserving state shape.
105
- *
106
- * - Primitive, null, and undefined states are wrapped with internal metadata.
107
- * - Array states are cloned and annotated without mutating the original.
108
- * - Plain object states are shallow-cloned with annotations attached.
109
- * - Built-in object states (Date/Map/Set/RegExp) are cloned by constructor.
110
- * - Other non-plain object states are cloned via prototype/descriptors.
111
- *
112
- * @param state The parser state to annotate.
113
- * @param annotations The annotations to inject.
114
- * @returns Annotated state.
115
- * @internal
116
- */
117
- declare function injectAnnotations<TState>(state: TState, annotations: Annotations): TState;
118
- /**
119
- * Unwraps a primitive-state annotation wrapper injected by Optique internals.
120
- *
121
- * @param value Value to potentially unwrap.
122
- * @returns The unwrapped primitive value when the input is an injected wrapper;
123
- * otherwise the original value.
124
- * @internal
125
- */
126
- declare function unwrapInjectedAnnotationWrapper<T>(value: T): T;
127
- /**
128
- * Returns whether the given value is an internal primitive-state annotation
129
- * wrapper that was injected by Optique.
130
- *
131
- * @param value Value to check.
132
- * @returns `true` if the value is an injected internal wrapper.
133
- * @internal
134
- */
135
- declare function isInjectedAnnotationWrapper(value: unknown): boolean;
136
- //#endregion
137
- export { Annotations, ParseOptions, annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, firstPassAnnotationKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
1
+ import { Annotations, ParseOptions, getAnnotations } from "./internal/annotations.js";
2
+ export { type Annotations, type ParseOptions, getAnnotations };
@@ -1,239 +1,3 @@
1
- //#region src/annotations.ts
2
- /**
3
- * Runtime context extension system for Optique parsers.
4
- *
5
- * This module provides the annotations system that allows external runtime data
6
- * to be passed to parsers during the parsing session. This enables use cases like
7
- * config file fallbacks, environment-based validation, and shared context.
8
- *
9
- * @module
10
- * @since 0.10.0
11
- */
12
- /**
13
- * Annotation key symbol for storing data in parser state.
14
- * @since 0.10.0
15
- */
16
- const annotationKey = Symbol.for("@optique/core/parser/annotation");
17
- /**
18
- * Internal marker attached during the first pass of `runWith()` so wrappers
19
- * with side effects can defer work until dynamic contexts have resolved.
20
- *
21
- * @internal
22
- */
23
- const firstPassAnnotationKey = Symbol.for("@optique/core/parser/firstPass");
24
- /**
25
- * Internal key for preserving primitive parser state values when annotations
26
- * are injected into non-object states.
27
- * @internal
28
- */
29
- const annotationStateValueKey = Symbol.for("@optique/core/parser/annotationStateValue");
30
- /**
31
- * Internal marker key that indicates annotation wrapping was injected by
32
- * Optique internals for non-object states.
33
- * @internal
34
- */
35
- const annotationWrapperKey = Symbol.for("@optique/core/parser/annotationWrapper");
36
- /**
37
- * Internal symbol keys that define Optique's primitive-state annotation
38
- * wrapper shape.
39
- * @internal
40
- */
41
- const annotationWrapperKeys = new Set([
42
- annotationKey,
43
- annotationStateValueKey,
44
- annotationWrapperKey
45
- ]);
46
- const injectedAnnotationWrappers = /* @__PURE__ */ new WeakSet();
47
- /**
48
- * Extracts annotations from parser state.
49
- *
50
- * @param state Parser state that may contain annotations
51
- * @returns Annotations object or undefined if no annotations are present
52
- * @since 0.10.0
53
- *
54
- * @example
55
- * ```typescript
56
- * const annotations = getAnnotations(state);
57
- * const myData = annotations?.[myDataKey];
58
- * ```
59
- */
60
- function getAnnotations(state) {
61
- if (state == null || typeof state !== "object") return void 0;
62
- const stateObj = state;
63
- const annotations = stateObj[annotationKey];
64
- if (annotations != null && typeof annotations === "object") return annotations;
65
- return void 0;
66
- }
67
- /**
68
- * Reattaches annotations to a freshly created array state.
69
- *
70
- * Array spread copies elements but drops symbol properties, so parsers that
71
- * rebuild array states need to copy annotations back explicitly.
72
- *
73
- * @param source The original state that may carry annotations.
74
- * @param target The freshly created array state.
75
- * @returns The target array, with annotations copied when available.
76
- * @internal
77
- */
78
- function annotateFreshArray(source, target) {
79
- const annotations = getAnnotations(source);
80
- if (annotations === void 0) return target;
81
- const annotated = target;
82
- annotated[annotationKey] = annotations;
83
- return annotated;
84
- }
85
- /**
86
- * Propagates annotations from one parser state to another.
87
- *
88
- * This is mainly used by parsers that rebuild array states with spread syntax.
89
- * Array spread copies elements but drops custom symbol properties, so we need
90
- * to reattach annotations explicitly when present.
91
- *
92
- * @param source The original state that may carry annotations.
93
- * @param target The new state to receive annotations.
94
- * @returns The target state, with annotations copied when available.
95
- * @internal
96
- */
97
- function inheritAnnotations(source, target) {
98
- const annotations = getAnnotations(source);
99
- if (annotations === void 0) return target;
100
- if (target == null || typeof target !== "object") return injectAnnotations(target, annotations);
101
- if (isInjectedAnnotationWrapper(target)) return injectAnnotations(target, annotations);
102
- if (Array.isArray(target)) {
103
- const cloned$1 = [...target];
104
- cloned$1[annotationKey] = annotations;
105
- return cloned$1;
106
- }
107
- if (target instanceof Date) {
108
- const cloned$1 = new Date(target.getTime());
109
- cloned$1[annotationKey] = annotations;
110
- return cloned$1;
111
- }
112
- if (target instanceof Map) {
113
- const cloned$1 = new Map(target);
114
- cloned$1[annotationKey] = annotations;
115
- return cloned$1;
116
- }
117
- if (target instanceof Set) {
118
- const cloned$1 = new Set(target);
119
- cloned$1[annotationKey] = annotations;
120
- return cloned$1;
121
- }
122
- if (target instanceof RegExp) {
123
- const cloned$1 = new RegExp(target);
124
- cloned$1[annotationKey] = annotations;
125
- return cloned$1;
126
- }
127
- if (Object.getPrototypeOf(target) !== Object.prototype && Object.getPrototypeOf(target) !== null) return target;
128
- const cloned = Object.create(Object.getPrototypeOf(target), Object.getOwnPropertyDescriptors(target));
129
- cloned[annotationKey] = annotations;
130
- return cloned;
131
- }
132
- /**
133
- * Injects annotations into parser state while preserving state shape.
134
- *
135
- * - Primitive, null, and undefined states are wrapped with internal metadata.
136
- * - Array states are cloned and annotated without mutating the original.
137
- * - Plain object states are shallow-cloned with annotations attached.
138
- * - Built-in object states (Date/Map/Set/RegExp) are cloned by constructor.
139
- * - Other non-plain object states are cloned via prototype/descriptors.
140
- *
141
- * @param state The parser state to annotate.
142
- * @param annotations The annotations to inject.
143
- * @returns Annotated state.
144
- * @internal
145
- */
146
- function injectAnnotations(state, annotations) {
147
- if (state == null || typeof state !== "object") {
148
- const wrapper = {};
149
- Object.defineProperties(wrapper, {
150
- [annotationKey]: {
151
- value: annotations,
152
- enumerable: true,
153
- writable: true,
154
- configurable: true
155
- },
156
- [annotationStateValueKey]: {
157
- value: state,
158
- enumerable: false,
159
- writable: true,
160
- configurable: true
161
- },
162
- [annotationWrapperKey]: {
163
- value: true,
164
- enumerable: false,
165
- writable: true,
166
- configurable: true
167
- }
168
- });
169
- injectedAnnotationWrappers.add(wrapper);
170
- return wrapper;
171
- }
172
- if (Array.isArray(state)) {
173
- const cloned$1 = [...state];
174
- cloned$1[annotationKey] = annotations;
175
- return cloned$1;
176
- }
177
- if (isInjectedAnnotationWrapper(state)) {
178
- state[annotationKey] = annotations;
179
- return state;
180
- }
181
- if (state instanceof Date) {
182
- const cloned$1 = new Date(state.getTime());
183
- cloned$1[annotationKey] = annotations;
184
- return cloned$1;
185
- }
186
- if (state instanceof Map) {
187
- const cloned$1 = new Map(state);
188
- cloned$1[annotationKey] = annotations;
189
- return cloned$1;
190
- }
191
- if (state instanceof Set) {
192
- const cloned$1 = new Set(state);
193
- cloned$1[annotationKey] = annotations;
194
- return cloned$1;
195
- }
196
- if (state instanceof RegExp) {
197
- const cloned$1 = new RegExp(state);
198
- cloned$1[annotationKey] = annotations;
199
- return cloned$1;
200
- }
201
- const proto = Object.getPrototypeOf(state);
202
- if (proto === Object.prototype || proto === null) return {
203
- ...state,
204
- [annotationKey]: annotations
205
- };
206
- const cloned = Object.create(proto, Object.getOwnPropertyDescriptors(state));
207
- cloned[annotationKey] = annotations;
208
- return cloned;
209
- }
210
- /**
211
- * Unwraps a primitive-state annotation wrapper injected by Optique internals.
212
- *
213
- * @param value Value to potentially unwrap.
214
- * @returns The unwrapped primitive value when the input is an injected wrapper;
215
- * otherwise the original value.
216
- * @internal
217
- */
218
- function unwrapInjectedAnnotationWrapper(value) {
219
- if (value == null || typeof value !== "object") return value;
220
- const valueRecord = value;
221
- if (valueRecord[annotationWrapperKey] !== true) return value;
222
- const ownKeys = Reflect.ownKeys(valueRecord);
223
- if (ownKeys.length === 3 && ownKeys.every((key) => annotationWrapperKeys.has(key)) && isInjectedAnnotationWrapper(value)) return valueRecord[annotationStateValueKey];
224
- return value;
225
- }
226
- /**
227
- * Returns whether the given value is an internal primitive-state annotation
228
- * wrapper that was injected by Optique.
229
- *
230
- * @param value Value to check.
231
- * @returns `true` if the value is an injected internal wrapper.
232
- * @internal
233
- */
234
- function isInjectedAnnotationWrapper(value) {
235
- return value != null && typeof value === "object" && injectedAnnotationWrappers.has(value);
236
- }
1
+ import { getAnnotations } from "./internal/annotations.js";
237
2
 
238
- //#endregion
239
- export { annotateFreshArray, annotationKey, annotationStateValueKey, annotationWrapperKey, firstPassAnnotationKey, getAnnotations, inheritAnnotations, injectAnnotations, isInjectedAnnotationWrapper, unwrapInjectedAnnotationWrapper };
3
+ export { getAnnotations };