@optique/core 1.2.0-dev.2314 → 1.2.0-dev.2318

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.
@@ -339,9 +339,18 @@ function transform(parser, mapping) {
339
339
  const validate = parser.validate.bind(parser);
340
340
  Object.defineProperty(transformed, "validate", {
341
341
  value(value) {
342
+ let unmapped;
343
+ try {
344
+ unmapped = mapping.unmap(value);
345
+ } catch {
346
+ return {
347
+ success: true,
348
+ value
349
+ };
350
+ }
342
351
  let result;
343
352
  try {
344
- result = validate(mapping.unmap(value));
353
+ result = validate(unmapped);
345
354
  } catch {
346
355
  return transformMappingFailure();
347
356
  }
@@ -362,9 +371,28 @@ function transform(parser, mapping) {
362
371
  const syncParser = parser;
363
372
  Object.defineProperty(transformed, "validate", {
364
373
  value(value) {
374
+ let unmapped;
375
+ try {
376
+ unmapped = mapping.unmap(value);
377
+ } catch {
378
+ return {
379
+ success: true,
380
+ value
381
+ };
382
+ }
383
+ let formatted;
384
+ try {
385
+ formatted = syncParser.format(unmapped);
386
+ } catch {
387
+ if (unmapped === void 0) return transformMappingFailure();
388
+ return {
389
+ success: true,
390
+ value
391
+ };
392
+ }
365
393
  let result;
366
394
  try {
367
- result = syncParser.parse(syncParser.format(mapping.unmap(value)));
395
+ result = syncParser.parse(formatted);
368
396
  } catch {
369
397
  return transformMappingFailure();
370
398
  }
@@ -339,9 +339,18 @@ function transform(parser, mapping) {
339
339
  const validate = parser.validate.bind(parser);
340
340
  Object.defineProperty(transformed, "validate", {
341
341
  value(value) {
342
+ let unmapped;
343
+ try {
344
+ unmapped = mapping.unmap(value);
345
+ } catch {
346
+ return {
347
+ success: true,
348
+ value
349
+ };
350
+ }
342
351
  let result;
343
352
  try {
344
- result = validate(mapping.unmap(value));
353
+ result = validate(unmapped);
345
354
  } catch {
346
355
  return transformMappingFailure();
347
356
  }
@@ -362,9 +371,28 @@ function transform(parser, mapping) {
362
371
  const syncParser = parser;
363
372
  Object.defineProperty(transformed, "validate", {
364
373
  value(value) {
374
+ let unmapped;
375
+ try {
376
+ unmapped = mapping.unmap(value);
377
+ } catch {
378
+ return {
379
+ success: true,
380
+ value
381
+ };
382
+ }
383
+ let formatted;
384
+ try {
385
+ formatted = syncParser.format(unmapped);
386
+ } catch {
387
+ if (unmapped === void 0) return transformMappingFailure();
388
+ return {
389
+ success: true,
390
+ value
391
+ };
392
+ }
365
393
  let result;
366
394
  try {
367
- result = syncParser.parse(syncParser.format(mapping.unmap(value)));
395
+ result = syncParser.parse(formatted);
368
396
  } catch {
369
397
  return transformMappingFailure();
370
398
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/core",
3
- "version": "1.2.0-dev.2314",
3
+ "version": "1.2.0-dev.2318",
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.2314+a847eac5"
228
+ "@optique/env": "1.2.0-dev.2318+be3862ce"
229
229
  },
230
230
  "scripts": {
231
231
  "build": "tsdown",