@optique/run 1.0.0-dev.1499 → 1.0.0-dev.1500
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/valueparser.cjs +3 -0
- package/dist/valueparser.d.cts +9 -0
- package/dist/valueparser.d.ts +9 -0
- package/dist/valueparser.js +3 -0
- package/package.json +2 -2
package/dist/valueparser.cjs
CHANGED
|
@@ -25,6 +25,7 @@ const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
|
|
|
25
25
|
* @throws {TypeError} If {@link PathOptionsBase.allowCreate} is not a boolean.
|
|
26
26
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
27
27
|
* {@link PathOptionsMustNotExist.mustNotExist} are `true`.
|
|
28
|
+
* @throws {TypeError} If `placeholder` is not a string.
|
|
28
29
|
*
|
|
29
30
|
* @example
|
|
30
31
|
* ```typescript
|
|
@@ -62,12 +63,14 @@ function path(options = {}) {
|
|
|
62
63
|
const rawOptions = options;
|
|
63
64
|
if ("mustExist" in options && rawOptions.mustExist !== void 0 && typeof rawOptions.mustExist !== "boolean") throw new TypeError(`Expected mustExist to be a boolean, but got ${typeof rawOptions.mustExist}: ${String(rawOptions.mustExist)}.`);
|
|
64
65
|
if ("mustNotExist" in options && rawOptions.mustNotExist !== void 0 && typeof rawOptions.mustNotExist !== "boolean") throw new TypeError(`Expected mustNotExist to be a boolean, but got ${typeof rawOptions.mustNotExist}: ${String(rawOptions.mustNotExist)}.`);
|
|
66
|
+
if (options.placeholder !== void 0 && typeof options.placeholder !== "string") throw new TypeError(`Expected placeholder to be a string, but got ${typeof options.placeholder}: ${String(options.placeholder)}.`);
|
|
65
67
|
const mustExist = "mustExist" in options ? options.mustExist : false;
|
|
66
68
|
const mustNotExist = "mustNotExist" in options ? options.mustNotExist : false;
|
|
67
69
|
if (mustExist && mustNotExist) throw new TypeError("Options mustExist and mustNotExist are mutually exclusive.");
|
|
68
70
|
return {
|
|
69
71
|
$mode: "sync",
|
|
70
72
|
metavar,
|
|
73
|
+
placeholder: options.placeholder ?? ".",
|
|
71
74
|
parse(input) {
|
|
72
75
|
if (input.trim() === "") return {
|
|
73
76
|
success: false,
|
package/dist/valueparser.d.cts
CHANGED
|
@@ -82,6 +82,14 @@ interface PathOptionsBase {
|
|
|
82
82
|
* start with a dot (e.g. `".json"`, `".yaml"`).
|
|
83
83
|
*/
|
|
84
84
|
readonly extensions?: readonly string[];
|
|
85
|
+
/**
|
|
86
|
+
* A custom placeholder value used during deferred prompt resolution.
|
|
87
|
+
* Override the default `"."` when downstream `map()` transforms or
|
|
88
|
+
* path constraints require a specific path shape.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
*/
|
|
92
|
+
readonly placeholder?: string;
|
|
85
93
|
/**
|
|
86
94
|
* Custom error messages for path validation failures.
|
|
87
95
|
* @since 0.5.0
|
|
@@ -160,6 +168,7 @@ type PathOptions = PathOptionsMustExist | PathOptionsMustNotExist | PathOptionsN
|
|
|
160
168
|
* @throws {TypeError} If {@link PathOptionsBase.allowCreate} is not a boolean.
|
|
161
169
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
162
170
|
* {@link PathOptionsMustNotExist.mustNotExist} are `true`.
|
|
171
|
+
* @throws {TypeError} If `placeholder` is not a string.
|
|
163
172
|
*
|
|
164
173
|
* @example
|
|
165
174
|
* ```typescript
|
package/dist/valueparser.d.ts
CHANGED
|
@@ -82,6 +82,14 @@ interface PathOptionsBase {
|
|
|
82
82
|
* start with a dot (e.g. `".json"`, `".yaml"`).
|
|
83
83
|
*/
|
|
84
84
|
readonly extensions?: readonly string[];
|
|
85
|
+
/**
|
|
86
|
+
* A custom placeholder value used during deferred prompt resolution.
|
|
87
|
+
* Override the default `"."` when downstream `map()` transforms or
|
|
88
|
+
* path constraints require a specific path shape.
|
|
89
|
+
*
|
|
90
|
+
* @since 1.0.0
|
|
91
|
+
*/
|
|
92
|
+
readonly placeholder?: string;
|
|
85
93
|
/**
|
|
86
94
|
* Custom error messages for path validation failures.
|
|
87
95
|
* @since 0.5.0
|
|
@@ -160,6 +168,7 @@ type PathOptions = PathOptionsMustExist | PathOptionsMustNotExist | PathOptionsN
|
|
|
160
168
|
* @throws {TypeError} If {@link PathOptionsBase.allowCreate} is not a boolean.
|
|
161
169
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
162
170
|
* {@link PathOptionsMustNotExist.mustNotExist} are `true`.
|
|
171
|
+
* @throws {TypeError} If `placeholder` is not a string.
|
|
163
172
|
*
|
|
164
173
|
* @example
|
|
165
174
|
* ```typescript
|
package/dist/valueparser.js
CHANGED
|
@@ -24,6 +24,7 @@ import { existsSync, statSync } from "node:fs";
|
|
|
24
24
|
* @throws {TypeError} If {@link PathOptionsBase.allowCreate} is not a boolean.
|
|
25
25
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
26
26
|
* {@link PathOptionsMustNotExist.mustNotExist} are `true`.
|
|
27
|
+
* @throws {TypeError} If `placeholder` is not a string.
|
|
27
28
|
*
|
|
28
29
|
* @example
|
|
29
30
|
* ```typescript
|
|
@@ -61,12 +62,14 @@ function path(options = {}) {
|
|
|
61
62
|
const rawOptions = options;
|
|
62
63
|
if ("mustExist" in options && rawOptions.mustExist !== void 0 && typeof rawOptions.mustExist !== "boolean") throw new TypeError(`Expected mustExist to be a boolean, but got ${typeof rawOptions.mustExist}: ${String(rawOptions.mustExist)}.`);
|
|
63
64
|
if ("mustNotExist" in options && rawOptions.mustNotExist !== void 0 && typeof rawOptions.mustNotExist !== "boolean") throw new TypeError(`Expected mustNotExist to be a boolean, but got ${typeof rawOptions.mustNotExist}: ${String(rawOptions.mustNotExist)}.`);
|
|
65
|
+
if (options.placeholder !== void 0 && typeof options.placeholder !== "string") throw new TypeError(`Expected placeholder to be a string, but got ${typeof options.placeholder}: ${String(options.placeholder)}.`);
|
|
64
66
|
const mustExist = "mustExist" in options ? options.mustExist : false;
|
|
65
67
|
const mustNotExist = "mustNotExist" in options ? options.mustNotExist : false;
|
|
66
68
|
if (mustExist && mustNotExist) throw new TypeError("Options mustExist and mustNotExist are mutually exclusive.");
|
|
67
69
|
return {
|
|
68
70
|
$mode: "sync",
|
|
69
71
|
metavar,
|
|
72
|
+
placeholder: options.placeholder ?? ".",
|
|
70
73
|
parse(input) {
|
|
71
74
|
if (input.trim() === "") return {
|
|
72
75
|
success: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/run",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1500+dc0650e5",
|
|
4
4
|
"description": "Type-safe combinatorial command-line interface parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
},
|
|
71
71
|
"sideEffects": false,
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@optique/core": "1.0.0-dev.
|
|
73
|
+
"@optique/core": "1.0.0-dev.1500+dc0650e5"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|