@optique/config 1.0.0-dev.1499 → 1.0.0-dev.1502

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
@@ -24,7 +24,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
24
24
  const node_fs = __toESM(require("node:fs"));
25
25
  const node_path = __toESM(require("node:path"));
26
26
  const __optique_core_annotations = __toESM(require("@optique/core/annotations"));
27
- const __optique_core_context = __toESM(require("@optique/core/context"));
28
27
  const __optique_core_message = __toESM(require("@optique/core/message"));
29
28
  const __optique_core_mode_dispatch = __toESM(require("@optique/core/mode-dispatch"));
30
29
 
@@ -43,243 +42,9 @@ const activeConfigRegistry = /* @__PURE__ */ new Map();
43
42
  */
44
43
  const activeConfigMetaRegistry = /* @__PURE__ */ new Map();
45
44
  const phase1ConfigAnnotationMarker = Symbol("@optique/config/phase1Annotation");
46
- function isDeferredPromptValue(value) {
47
- return (0, __optique_core_context.isPlaceholderValue)(value);
48
- }
49
45
  function isPhase2UndefinedParsedValue(value) {
50
46
  return value != null && typeof value === "object" && phase2UndefinedParsedValueKey in value;
51
47
  }
52
- function isPlainObject(value) {
53
- const proto = Object.getPrototypeOf(value);
54
- return proto === Object.prototype || proto === null;
55
- }
56
- function shouldSkipCollectionOwnKey(value, key) {
57
- if (Array.isArray(value)) return key === "length" || typeof key === "string" && Number.isInteger(Number(key)) && String(Number(key)) === key;
58
- return false;
59
- }
60
- function containsDeferredPromptValuesInOwnProperties(value, seen) {
61
- for (const key of Reflect.ownKeys(value)) {
62
- if (shouldSkipCollectionOwnKey(value, key)) continue;
63
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
64
- if (descriptor != null && "value" in descriptor && containsDeferredPromptValues(descriptor.value, seen)) return true;
65
- }
66
- return false;
67
- }
68
- function copySanitizedOwnProperties(source, target, seen) {
69
- for (const key of Reflect.ownKeys(source)) {
70
- if (shouldSkipCollectionOwnKey(source, key)) continue;
71
- const descriptor = Object.getOwnPropertyDescriptor(source, key);
72
- if (descriptor == null) continue;
73
- if ("value" in descriptor) descriptor.value = stripDeferredPromptValues(descriptor.value, seen);
74
- Object.defineProperty(target, key, descriptor);
75
- }
76
- }
77
- function containsDeferredPromptValues(value, seen = /* @__PURE__ */ new WeakSet()) {
78
- if (isDeferredPromptValue(value)) return true;
79
- if (value == null || typeof value !== "object") return false;
80
- if (seen.has(value)) return false;
81
- seen.add(value);
82
- if (Array.isArray(value)) {
83
- if (value.some((item) => containsDeferredPromptValues(item, seen))) return true;
84
- return containsDeferredPromptValuesInOwnProperties(value, seen);
85
- }
86
- if (value instanceof Set) {
87
- for (const entryValue of value) if (containsDeferredPromptValues(entryValue, seen)) return true;
88
- return containsDeferredPromptValuesInOwnProperties(value, seen);
89
- }
90
- if (value instanceof Map) {
91
- for (const [key, entryValue] of value) if (containsDeferredPromptValues(key, seen) || containsDeferredPromptValues(entryValue, seen)) return true;
92
- return containsDeferredPromptValuesInOwnProperties(value, seen);
93
- }
94
- return containsDeferredPromptValuesInOwnProperties(value, seen);
95
- }
96
- const SANITIZE_FAILED = Symbol("sanitizeFailed");
97
- const activeSanitizations = /* @__PURE__ */ new WeakMap();
98
- function callWithSanitizedOwnProperties(target, fn, args, strip, seen) {
99
- let active = activeSanitizations.get(target);
100
- if (active != null) active.count++;
101
- else {
102
- const saved = /* @__PURE__ */ new Map();
103
- const sanitizedValues = /* @__PURE__ */ new Map();
104
- for (const key of Reflect.ownKeys(target)) {
105
- const desc = Object.getOwnPropertyDescriptor(target, key);
106
- if (desc != null && "value" in desc) {
107
- let stripped;
108
- try {
109
- stripped = strip(desc.value, seen);
110
- } catch {
111
- for (const [k, d] of saved) try {
112
- Object.defineProperty(target, k, d);
113
- } catch {}
114
- return SANITIZE_FAILED;
115
- }
116
- if (stripped !== desc.value) try {
117
- Object.defineProperty(target, key, {
118
- ...desc,
119
- value: stripped
120
- });
121
- saved.set(key, desc);
122
- sanitizedValues.set(key, stripped);
123
- } catch {
124
- for (const [k, d] of saved) try {
125
- Object.defineProperty(target, k, d);
126
- } catch {}
127
- return SANITIZE_FAILED;
128
- }
129
- }
130
- }
131
- active = {
132
- saved,
133
- sanitizedValues,
134
- count: 1
135
- };
136
- activeSanitizations.set(target, active);
137
- }
138
- function release() {
139
- active.count--;
140
- if (active.count === 0) {
141
- activeSanitizations.delete(target);
142
- for (const [key, desc] of active.saved) try {
143
- const current = Object.getOwnPropertyDescriptor(target, key);
144
- if (current == null) continue;
145
- if ("value" in current && current.value !== active.sanitizedValues.get(key)) continue;
146
- Object.defineProperty(target, key, desc);
147
- } catch {}
148
- }
149
- }
150
- let result;
151
- try {
152
- result = fn.apply(target, args);
153
- } catch (e) {
154
- release();
155
- throw e;
156
- }
157
- if (result instanceof Promise) return result.then((v) => {
158
- release();
159
- return strip(v, seen);
160
- }, (e) => {
161
- release();
162
- throw e;
163
- });
164
- release();
165
- return strip(result, seen);
166
- }
167
- function callMethodOnSanitizedTarget(fn, proxy, target, args, strip, seen) {
168
- const result = callWithSanitizedOwnProperties(target, fn, args, strip, seen);
169
- if (result !== SANITIZE_FAILED) return result;
170
- const fallback = fn.apply(proxy, args);
171
- if (fallback instanceof Promise) return fallback.then((v) => strip(v, seen));
172
- return strip(fallback, seen);
173
- }
174
- function createSanitizedNonPlainView(value, seen) {
175
- const methodCache = /* @__PURE__ */ new Map();
176
- const proxy = new Proxy(value, {
177
- get(target, key, receiver) {
178
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
179
- if (descriptor != null && "value" in descriptor) {
180
- if (!descriptor.configurable && !descriptor.writable) return descriptor.value;
181
- const val = stripDeferredPromptValues(descriptor.value, seen);
182
- if (typeof val === "function") {
183
- if (!descriptor.configurable && !descriptor.writable || /^class[\s{]/.test(Function.prototype.toString.call(val))) return val;
184
- const cached = methodCache.get(key);
185
- if (cached != null && cached.fn === val) return cached.wrapper;
186
- const wrapper = function(...args) {
187
- if (this !== proxy) return stripDeferredPromptValues(val.apply(this, args), seen);
188
- return callMethodOnSanitizedTarget(val, proxy, target, args, stripDeferredPromptValues, seen);
189
- };
190
- methodCache.set(key, {
191
- fn: val,
192
- wrapper
193
- });
194
- return wrapper;
195
- }
196
- return val;
197
- }
198
- let isAccessor = false;
199
- for (let proto = target; proto != null; proto = Object.getPrototypeOf(proto)) {
200
- const d = Object.getOwnPropertyDescriptor(proto, key);
201
- if (d != null) {
202
- isAccessor = "get" in d;
203
- break;
204
- }
205
- }
206
- const result = Reflect.get(target, key, receiver);
207
- if (typeof result === "function") {
208
- if (/^class[\s{]/.test(Function.prototype.toString.call(result))) return result;
209
- if (!isAccessor) {
210
- const cached = methodCache.get(key);
211
- if (cached != null && cached.fn === result) return cached.wrapper;
212
- const wrapper = function(...args) {
213
- if (this !== proxy) return stripDeferredPromptValues(result.apply(this, args), seen);
214
- return callMethodOnSanitizedTarget(result, proxy, target, args, stripDeferredPromptValues, seen);
215
- };
216
- methodCache.set(key, {
217
- fn: result,
218
- wrapper
219
- });
220
- return wrapper;
221
- }
222
- return function(...args) {
223
- if (this !== proxy) return stripDeferredPromptValues(result.apply(this, args), seen);
224
- return callMethodOnSanitizedTarget(result, proxy, target, args, stripDeferredPromptValues, seen);
225
- };
226
- }
227
- return stripDeferredPromptValues(result, seen);
228
- },
229
- getOwnPropertyDescriptor(target, key) {
230
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
231
- if (descriptor == null || !("value" in descriptor)) return descriptor;
232
- if (!descriptor.configurable && !descriptor.writable) return descriptor;
233
- return {
234
- ...descriptor,
235
- value: stripDeferredPromptValues(descriptor.value, seen)
236
- };
237
- }
238
- });
239
- seen.set(value, proxy);
240
- return proxy;
241
- }
242
- function stripDeferredPromptValues(value, seen = /* @__PURE__ */ new WeakMap()) {
243
- if (isDeferredPromptValue(value)) return void 0;
244
- if (value == null || typeof value !== "object") return value;
245
- const cached = seen.get(value);
246
- if (cached !== void 0) return cached;
247
- if (Array.isArray(value)) {
248
- if (!containsDeferredPromptValues(value)) return value;
249
- const clone$1 = new Array(value.length);
250
- seen.set(value, clone$1);
251
- for (let i = 0; i < value.length; i++) clone$1[i] = stripDeferredPromptValues(value[i], seen);
252
- copySanitizedOwnProperties(value, clone$1, seen);
253
- return clone$1;
254
- }
255
- if (value instanceof Set) {
256
- if (!containsDeferredPromptValues(value)) return value;
257
- const clone$1 = /* @__PURE__ */ new Set();
258
- seen.set(value, clone$1);
259
- for (const entryValue of value) clone$1.add(stripDeferredPromptValues(entryValue, seen));
260
- copySanitizedOwnProperties(value, clone$1, seen);
261
- return clone$1;
262
- }
263
- if (value instanceof Map) {
264
- if (!containsDeferredPromptValues(value)) return value;
265
- const clone$1 = /* @__PURE__ */ new Map();
266
- seen.set(value, clone$1);
267
- for (const [key, entryValue] of value) clone$1.set(stripDeferredPromptValues(key, seen), stripDeferredPromptValues(entryValue, seen));
268
- copySanitizedOwnProperties(value, clone$1, seen);
269
- return clone$1;
270
- }
271
- if (!isPlainObject(value)) return containsDeferredPromptValues(value) ? createSanitizedNonPlainView(value, seen) : value;
272
- if (!containsDeferredPromptValues(value)) return value;
273
- const clone = Object.create(Object.getPrototypeOf(value));
274
- seen.set(value, clone);
275
- for (const key of Reflect.ownKeys(value)) {
276
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
277
- if (descriptor == null) continue;
278
- if ("value" in descriptor) descriptor.value = stripDeferredPromptValues(descriptor.value, seen);
279
- Object.defineProperty(clone, key, descriptor);
280
- }
281
- return clone;
282
- }
283
48
  /**
284
49
  * Sets active config data for a context.
285
50
  * @internal
@@ -428,7 +193,7 @@ function createConfigContext(options) {
428
193
  if (!opts || !opts.getConfigPath && !opts.load) throw new TypeError("Either getConfigPath or load must be provided in the runner options when using ConfigContext.");
429
194
  if (opts.load !== void 0 && typeof opts.load !== "function") throw new TypeError(`Expected load to be a function, but got: ${getTypeName(opts.load)}.`);
430
195
  if (!opts.load && opts.getConfigPath !== void 0 && typeof opts.getConfigPath !== "function") throw new TypeError(`Expected getConfigPath to be a function, but got: ${getTypeName(opts.getConfigPath)}.`);
431
- const parsedValue = isPhase2UndefinedParsedValue(parsed) ? void 0 : stripDeferredPromptValues(parsed);
196
+ const parsedValue = isPhase2UndefinedParsedValue(parsed) ? void 0 : parsed;
432
197
  const parsedPlaceholder = parsedValue;
433
198
  const buildAnnotations = (configData, configMeta) => {
434
199
  if (configData === void 0 || configData === null) return {};
@@ -596,6 +361,13 @@ function bindConfig(parser, options) {
596
361
  return parser.getDocFragments(state, defaultValue);
597
362
  }
598
363
  };
364
+ if ("placeholder" in parser) Object.defineProperty(boundParser, "placeholder", {
365
+ get() {
366
+ return parser.placeholder;
367
+ },
368
+ configurable: true,
369
+ enumerable: false
370
+ });
599
371
  return boundParser;
600
372
  }
601
373
  /**
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ParserValuePlaceholder, SourceContext } from "@optique/core/context";
2
1
  import { StandardSchemaV1 } from "@standard-schema/spec";
2
+ import { ParserValuePlaceholder, SourceContext } from "@optique/core/context";
3
3
  import { Parser } from "@optique/core/parser";
4
4
 
5
5
  //#region src/index.d.ts
package/dist/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import { readFileSync } from "node:fs";
2
2
  import { dirname, resolve } from "node:path";
3
3
  import { annotationKey, getAnnotations } from "@optique/core/annotations";
4
- import { isPlaceholderValue } from "@optique/core/context";
5
4
  import { message } from "@optique/core/message";
6
5
  import { mapModeValue, wrapForMode } from "@optique/core/mode-dispatch";
7
6
 
@@ -20,243 +19,9 @@ const activeConfigRegistry = /* @__PURE__ */ new Map();
20
19
  */
21
20
  const activeConfigMetaRegistry = /* @__PURE__ */ new Map();
22
21
  const phase1ConfigAnnotationMarker = Symbol("@optique/config/phase1Annotation");
23
- function isDeferredPromptValue(value) {
24
- return isPlaceholderValue(value);
25
- }
26
22
  function isPhase2UndefinedParsedValue(value) {
27
23
  return value != null && typeof value === "object" && phase2UndefinedParsedValueKey in value;
28
24
  }
29
- function isPlainObject(value) {
30
- const proto = Object.getPrototypeOf(value);
31
- return proto === Object.prototype || proto === null;
32
- }
33
- function shouldSkipCollectionOwnKey(value, key) {
34
- if (Array.isArray(value)) return key === "length" || typeof key === "string" && Number.isInteger(Number(key)) && String(Number(key)) === key;
35
- return false;
36
- }
37
- function containsDeferredPromptValuesInOwnProperties(value, seen) {
38
- for (const key of Reflect.ownKeys(value)) {
39
- if (shouldSkipCollectionOwnKey(value, key)) continue;
40
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
41
- if (descriptor != null && "value" in descriptor && containsDeferredPromptValues(descriptor.value, seen)) return true;
42
- }
43
- return false;
44
- }
45
- function copySanitizedOwnProperties(source, target, seen) {
46
- for (const key of Reflect.ownKeys(source)) {
47
- if (shouldSkipCollectionOwnKey(source, key)) continue;
48
- const descriptor = Object.getOwnPropertyDescriptor(source, key);
49
- if (descriptor == null) continue;
50
- if ("value" in descriptor) descriptor.value = stripDeferredPromptValues(descriptor.value, seen);
51
- Object.defineProperty(target, key, descriptor);
52
- }
53
- }
54
- function containsDeferredPromptValues(value, seen = /* @__PURE__ */ new WeakSet()) {
55
- if (isDeferredPromptValue(value)) return true;
56
- if (value == null || typeof value !== "object") return false;
57
- if (seen.has(value)) return false;
58
- seen.add(value);
59
- if (Array.isArray(value)) {
60
- if (value.some((item) => containsDeferredPromptValues(item, seen))) return true;
61
- return containsDeferredPromptValuesInOwnProperties(value, seen);
62
- }
63
- if (value instanceof Set) {
64
- for (const entryValue of value) if (containsDeferredPromptValues(entryValue, seen)) return true;
65
- return containsDeferredPromptValuesInOwnProperties(value, seen);
66
- }
67
- if (value instanceof Map) {
68
- for (const [key, entryValue] of value) if (containsDeferredPromptValues(key, seen) || containsDeferredPromptValues(entryValue, seen)) return true;
69
- return containsDeferredPromptValuesInOwnProperties(value, seen);
70
- }
71
- return containsDeferredPromptValuesInOwnProperties(value, seen);
72
- }
73
- const SANITIZE_FAILED = Symbol("sanitizeFailed");
74
- const activeSanitizations = /* @__PURE__ */ new WeakMap();
75
- function callWithSanitizedOwnProperties(target, fn, args, strip, seen) {
76
- let active = activeSanitizations.get(target);
77
- if (active != null) active.count++;
78
- else {
79
- const saved = /* @__PURE__ */ new Map();
80
- const sanitizedValues = /* @__PURE__ */ new Map();
81
- for (const key of Reflect.ownKeys(target)) {
82
- const desc = Object.getOwnPropertyDescriptor(target, key);
83
- if (desc != null && "value" in desc) {
84
- let stripped;
85
- try {
86
- stripped = strip(desc.value, seen);
87
- } catch {
88
- for (const [k, d] of saved) try {
89
- Object.defineProperty(target, k, d);
90
- } catch {}
91
- return SANITIZE_FAILED;
92
- }
93
- if (stripped !== desc.value) try {
94
- Object.defineProperty(target, key, {
95
- ...desc,
96
- value: stripped
97
- });
98
- saved.set(key, desc);
99
- sanitizedValues.set(key, stripped);
100
- } catch {
101
- for (const [k, d] of saved) try {
102
- Object.defineProperty(target, k, d);
103
- } catch {}
104
- return SANITIZE_FAILED;
105
- }
106
- }
107
- }
108
- active = {
109
- saved,
110
- sanitizedValues,
111
- count: 1
112
- };
113
- activeSanitizations.set(target, active);
114
- }
115
- function release() {
116
- active.count--;
117
- if (active.count === 0) {
118
- activeSanitizations.delete(target);
119
- for (const [key, desc] of active.saved) try {
120
- const current = Object.getOwnPropertyDescriptor(target, key);
121
- if (current == null) continue;
122
- if ("value" in current && current.value !== active.sanitizedValues.get(key)) continue;
123
- Object.defineProperty(target, key, desc);
124
- } catch {}
125
- }
126
- }
127
- let result;
128
- try {
129
- result = fn.apply(target, args);
130
- } catch (e) {
131
- release();
132
- throw e;
133
- }
134
- if (result instanceof Promise) return result.then((v) => {
135
- release();
136
- return strip(v, seen);
137
- }, (e) => {
138
- release();
139
- throw e;
140
- });
141
- release();
142
- return strip(result, seen);
143
- }
144
- function callMethodOnSanitizedTarget(fn, proxy, target, args, strip, seen) {
145
- const result = callWithSanitizedOwnProperties(target, fn, args, strip, seen);
146
- if (result !== SANITIZE_FAILED) return result;
147
- const fallback = fn.apply(proxy, args);
148
- if (fallback instanceof Promise) return fallback.then((v) => strip(v, seen));
149
- return strip(fallback, seen);
150
- }
151
- function createSanitizedNonPlainView(value, seen) {
152
- const methodCache = /* @__PURE__ */ new Map();
153
- const proxy = new Proxy(value, {
154
- get(target, key, receiver) {
155
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
156
- if (descriptor != null && "value" in descriptor) {
157
- if (!descriptor.configurable && !descriptor.writable) return descriptor.value;
158
- const val = stripDeferredPromptValues(descriptor.value, seen);
159
- if (typeof val === "function") {
160
- if (!descriptor.configurable && !descriptor.writable || /^class[\s{]/.test(Function.prototype.toString.call(val))) return val;
161
- const cached = methodCache.get(key);
162
- if (cached != null && cached.fn === val) return cached.wrapper;
163
- const wrapper = function(...args) {
164
- if (this !== proxy) return stripDeferredPromptValues(val.apply(this, args), seen);
165
- return callMethodOnSanitizedTarget(val, proxy, target, args, stripDeferredPromptValues, seen);
166
- };
167
- methodCache.set(key, {
168
- fn: val,
169
- wrapper
170
- });
171
- return wrapper;
172
- }
173
- return val;
174
- }
175
- let isAccessor = false;
176
- for (let proto = target; proto != null; proto = Object.getPrototypeOf(proto)) {
177
- const d = Object.getOwnPropertyDescriptor(proto, key);
178
- if (d != null) {
179
- isAccessor = "get" in d;
180
- break;
181
- }
182
- }
183
- const result = Reflect.get(target, key, receiver);
184
- if (typeof result === "function") {
185
- if (/^class[\s{]/.test(Function.prototype.toString.call(result))) return result;
186
- if (!isAccessor) {
187
- const cached = methodCache.get(key);
188
- if (cached != null && cached.fn === result) return cached.wrapper;
189
- const wrapper = function(...args) {
190
- if (this !== proxy) return stripDeferredPromptValues(result.apply(this, args), seen);
191
- return callMethodOnSanitizedTarget(result, proxy, target, args, stripDeferredPromptValues, seen);
192
- };
193
- methodCache.set(key, {
194
- fn: result,
195
- wrapper
196
- });
197
- return wrapper;
198
- }
199
- return function(...args) {
200
- if (this !== proxy) return stripDeferredPromptValues(result.apply(this, args), seen);
201
- return callMethodOnSanitizedTarget(result, proxy, target, args, stripDeferredPromptValues, seen);
202
- };
203
- }
204
- return stripDeferredPromptValues(result, seen);
205
- },
206
- getOwnPropertyDescriptor(target, key) {
207
- const descriptor = Object.getOwnPropertyDescriptor(target, key);
208
- if (descriptor == null || !("value" in descriptor)) return descriptor;
209
- if (!descriptor.configurable && !descriptor.writable) return descriptor;
210
- return {
211
- ...descriptor,
212
- value: stripDeferredPromptValues(descriptor.value, seen)
213
- };
214
- }
215
- });
216
- seen.set(value, proxy);
217
- return proxy;
218
- }
219
- function stripDeferredPromptValues(value, seen = /* @__PURE__ */ new WeakMap()) {
220
- if (isDeferredPromptValue(value)) return void 0;
221
- if (value == null || typeof value !== "object") return value;
222
- const cached = seen.get(value);
223
- if (cached !== void 0) return cached;
224
- if (Array.isArray(value)) {
225
- if (!containsDeferredPromptValues(value)) return value;
226
- const clone$1 = new Array(value.length);
227
- seen.set(value, clone$1);
228
- for (let i = 0; i < value.length; i++) clone$1[i] = stripDeferredPromptValues(value[i], seen);
229
- copySanitizedOwnProperties(value, clone$1, seen);
230
- return clone$1;
231
- }
232
- if (value instanceof Set) {
233
- if (!containsDeferredPromptValues(value)) return value;
234
- const clone$1 = /* @__PURE__ */ new Set();
235
- seen.set(value, clone$1);
236
- for (const entryValue of value) clone$1.add(stripDeferredPromptValues(entryValue, seen));
237
- copySanitizedOwnProperties(value, clone$1, seen);
238
- return clone$1;
239
- }
240
- if (value instanceof Map) {
241
- if (!containsDeferredPromptValues(value)) return value;
242
- const clone$1 = /* @__PURE__ */ new Map();
243
- seen.set(value, clone$1);
244
- for (const [key, entryValue] of value) clone$1.set(stripDeferredPromptValues(key, seen), stripDeferredPromptValues(entryValue, seen));
245
- copySanitizedOwnProperties(value, clone$1, seen);
246
- return clone$1;
247
- }
248
- if (!isPlainObject(value)) return containsDeferredPromptValues(value) ? createSanitizedNonPlainView(value, seen) : value;
249
- if (!containsDeferredPromptValues(value)) return value;
250
- const clone = Object.create(Object.getPrototypeOf(value));
251
- seen.set(value, clone);
252
- for (const key of Reflect.ownKeys(value)) {
253
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
254
- if (descriptor == null) continue;
255
- if ("value" in descriptor) descriptor.value = stripDeferredPromptValues(descriptor.value, seen);
256
- Object.defineProperty(clone, key, descriptor);
257
- }
258
- return clone;
259
- }
260
25
  /**
261
26
  * Sets active config data for a context.
262
27
  * @internal
@@ -405,7 +170,7 @@ function createConfigContext(options) {
405
170
  if (!opts || !opts.getConfigPath && !opts.load) throw new TypeError("Either getConfigPath or load must be provided in the runner options when using ConfigContext.");
406
171
  if (opts.load !== void 0 && typeof opts.load !== "function") throw new TypeError(`Expected load to be a function, but got: ${getTypeName(opts.load)}.`);
407
172
  if (!opts.load && opts.getConfigPath !== void 0 && typeof opts.getConfigPath !== "function") throw new TypeError(`Expected getConfigPath to be a function, but got: ${getTypeName(opts.getConfigPath)}.`);
408
- const parsedValue = isPhase2UndefinedParsedValue(parsed) ? void 0 : stripDeferredPromptValues(parsed);
173
+ const parsedValue = isPhase2UndefinedParsedValue(parsed) ? void 0 : parsed;
409
174
  const parsedPlaceholder = parsedValue;
410
175
  const buildAnnotations = (configData, configMeta) => {
411
176
  if (configData === void 0 || configData === null) return {};
@@ -573,6 +338,13 @@ function bindConfig(parser, options) {
573
338
  return parser.getDocFragments(state, defaultValue);
574
339
  }
575
340
  };
341
+ if ("placeholder" in parser) Object.defineProperty(boundParser, "placeholder", {
342
+ get() {
343
+ return parser.placeholder;
344
+ },
345
+ configurable: true,
346
+ enumerable: false
347
+ });
576
348
  return boundParser;
577
349
  }
578
350
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/config",
3
- "version": "1.0.0-dev.1499+1fd447f6",
3
+ "version": "1.0.0-dev.1502+fda779c7",
4
4
  "description": "Configuration file support for Optique with Standard Schema validation",
5
5
  "keywords": [
6
6
  "CLI",
@@ -59,7 +59,7 @@
59
59
  "@standard-schema/spec": "^1.1.0"
60
60
  },
61
61
  "dependencies": {
62
- "@optique/core": "1.0.0-dev.1499+1fd447f6"
62
+ "@optique/core": "1.0.0-dev.1502+fda779c7"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@standard-schema/spec": "^1.1.0",
@@ -67,7 +67,7 @@
67
67
  "tsdown": "^0.13.0",
68
68
  "typescript": "^5.8.3",
69
69
  "zod": "^3.25.0 || ^4.0.0",
70
- "@optique/env": "1.0.0-dev.1499+1fd447f6"
70
+ "@optique/env": "1.0.0-dev.1502+fda779c7"
71
71
  },
72
72
  "scripts": {
73
73
  "build": "tsdown",