@optique/core 1.2.0-dev.2312 → 1.2.0-dev.2316

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.
@@ -325,9 +325,9 @@ function transform(parser, mapping) {
325
325
  };
326
326
  Object.defineProperty(transformed, "placeholder", {
327
327
  get() {
328
- if (parser.placeholder === void 0) return void 0;
329
328
  try {
330
- return mapping.map(parser.placeholder);
329
+ const placeholder = parser.placeholder;
330
+ return placeholder === void 0 ? void 0 : mapping.map(placeholder);
331
331
  } catch {
332
332
  return void 0;
333
333
  }
@@ -362,9 +362,28 @@ function transform(parser, mapping) {
362
362
  const syncParser = parser;
363
363
  Object.defineProperty(transformed, "validate", {
364
364
  value(value) {
365
+ let unmapped;
366
+ try {
367
+ unmapped = mapping.unmap(value);
368
+ } catch {
369
+ return {
370
+ success: true,
371
+ value
372
+ };
373
+ }
374
+ let formatted;
375
+ try {
376
+ formatted = syncParser.format(unmapped);
377
+ } catch {
378
+ if (unmapped === void 0) return transformMappingFailure();
379
+ return {
380
+ success: true,
381
+ value
382
+ };
383
+ }
365
384
  let result;
366
385
  try {
367
- result = syncParser.parse(syncParser.format(mapping.unmap(value)));
386
+ result = syncParser.parse(formatted);
368
387
  } catch {
369
388
  return transformMappingFailure();
370
389
  }
@@ -325,9 +325,9 @@ function transform(parser, mapping) {
325
325
  };
326
326
  Object.defineProperty(transformed, "placeholder", {
327
327
  get() {
328
- if (parser.placeholder === void 0) return void 0;
329
328
  try {
330
- return mapping.map(parser.placeholder);
329
+ const placeholder = parser.placeholder;
330
+ return placeholder === void 0 ? void 0 : mapping.map(placeholder);
331
331
  } catch {
332
332
  return void 0;
333
333
  }
@@ -362,9 +362,28 @@ function transform(parser, mapping) {
362
362
  const syncParser = parser;
363
363
  Object.defineProperty(transformed, "validate", {
364
364
  value(value) {
365
+ let unmapped;
366
+ try {
367
+ unmapped = mapping.unmap(value);
368
+ } catch {
369
+ return {
370
+ success: true,
371
+ value
372
+ };
373
+ }
374
+ let formatted;
375
+ try {
376
+ formatted = syncParser.format(unmapped);
377
+ } catch {
378
+ if (unmapped === void 0) return transformMappingFailure();
379
+ return {
380
+ success: true,
381
+ value
382
+ };
383
+ }
365
384
  let result;
366
385
  try {
367
- result = syncParser.parse(syncParser.format(mapping.unmap(value)));
386
+ result = syncParser.parse(formatted);
368
387
  } catch {
369
388
  return transformMappingFailure();
370
389
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.2.0-dev.2312",
3
+ "version": "1.2.0-dev.2316",
4
4
  "description": "Type-safe combinatorial command-line interface parser",
5
5
  "keywords": [
6
6
  "CLI",
@@ -225,7 +225,7 @@
225
225
  "fast-check": "^4.7.0",
226
226
  "tsdown": "^0.13.0",
227
227
  "typescript": "^5.8.3",
228
- "@optique/env": "1.2.0-dev.2312+03f76ba1"
228
+ "@optique/env": "1.2.0-dev.2316+7a578ce1"
229
229
  },
230
230
  "scripts": {
231
231
  "build": "tsdown",