@optique/run 1.0.0-dev.788 → 1.0.0-dev.885
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 +2 -0
- package/dist/valueparser.d.ts +2 -0
- package/dist/valueparser.js +3 -0
- package/package.json +2 -2
package/dist/valueparser.cjs
CHANGED
|
@@ -14,6 +14,8 @@ const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
|
|
|
14
14
|
*
|
|
15
15
|
* @param options Configuration options for path validation.
|
|
16
16
|
* @returns A ValueParser that validates and returns string paths.
|
|
17
|
+
* @throws {TypeError} If {@link PathOptionsBase.type} is not one of
|
|
18
|
+
* `"file"`, `"directory"`, or `"either"`.
|
|
17
19
|
* @throws {TypeError} If any entry in {@link PathOptionsBase.extensions} does
|
|
18
20
|
* not start with a dot (e.g., `"json"` instead of `".json"`).
|
|
19
21
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
@@ -47,6 +49,7 @@ const node_fs = require_rolldown_runtime.__toESM(require("node:fs"));
|
|
|
47
49
|
function path(options = {}) {
|
|
48
50
|
const { metavar = "PATH", type = "either", allowCreate = false, extensions } = options;
|
|
49
51
|
(0, __optique_core_nonempty.ensureNonEmptyString)(metavar);
|
|
52
|
+
if (type !== "file" && type !== "directory" && type !== "either") throw new TypeError(`Unsupported path type: ${JSON.stringify(type)}. Expected "file", "directory", or "either".`);
|
|
50
53
|
if (extensions) {
|
|
51
54
|
for (const ext of extensions) if (!ext.startsWith(".")) throw new TypeError(`Each extension must start with a dot, got: ${JSON.stringify(ext)}`);
|
|
52
55
|
}
|
package/dist/valueparser.d.cts
CHANGED
|
@@ -149,6 +149,8 @@ type PathOptions = PathOptionsMustExist | PathOptionsMustNotExist | PathOptionsN
|
|
|
149
149
|
*
|
|
150
150
|
* @param options Configuration options for path validation.
|
|
151
151
|
* @returns A ValueParser that validates and returns string paths.
|
|
152
|
+
* @throws {TypeError} If {@link PathOptionsBase.type} is not one of
|
|
153
|
+
* `"file"`, `"directory"`, or `"either"`.
|
|
152
154
|
* @throws {TypeError} If any entry in {@link PathOptionsBase.extensions} does
|
|
153
155
|
* not start with a dot (e.g., `"json"` instead of `".json"`).
|
|
154
156
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
package/dist/valueparser.d.ts
CHANGED
|
@@ -149,6 +149,8 @@ type PathOptions = PathOptionsMustExist | PathOptionsMustNotExist | PathOptionsN
|
|
|
149
149
|
*
|
|
150
150
|
* @param options Configuration options for path validation.
|
|
151
151
|
* @returns A ValueParser that validates and returns string paths.
|
|
152
|
+
* @throws {TypeError} If {@link PathOptionsBase.type} is not one of
|
|
153
|
+
* `"file"`, `"directory"`, or `"either"`.
|
|
152
154
|
* @throws {TypeError} If any entry in {@link PathOptionsBase.extensions} does
|
|
153
155
|
* not start with a dot (e.g., `"json"` instead of `".json"`).
|
|
154
156
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
package/dist/valueparser.js
CHANGED
|
@@ -13,6 +13,8 @@ import { existsSync, statSync } from "node:fs";
|
|
|
13
13
|
*
|
|
14
14
|
* @param options Configuration options for path validation.
|
|
15
15
|
* @returns A ValueParser that validates and returns string paths.
|
|
16
|
+
* @throws {TypeError} If {@link PathOptionsBase.type} is not one of
|
|
17
|
+
* `"file"`, `"directory"`, or `"either"`.
|
|
16
18
|
* @throws {TypeError} If any entry in {@link PathOptionsBase.extensions} does
|
|
17
19
|
* not start with a dot (e.g., `"json"` instead of `".json"`).
|
|
18
20
|
* @throws {TypeError} If both {@link PathOptionsMustExist.mustExist} and
|
|
@@ -46,6 +48,7 @@ import { existsSync, statSync } from "node:fs";
|
|
|
46
48
|
function path(options = {}) {
|
|
47
49
|
const { metavar = "PATH", type = "either", allowCreate = false, extensions } = options;
|
|
48
50
|
ensureNonEmptyString(metavar);
|
|
51
|
+
if (type !== "file" && type !== "directory" && type !== "either") throw new TypeError(`Unsupported path type: ${JSON.stringify(type)}. Expected "file", "directory", or "either".`);
|
|
49
52
|
if (extensions) {
|
|
50
53
|
for (const ext of extensions) if (!ext.startsWith(".")) throw new TypeError(`Each extension must start with a dot, got: ${JSON.stringify(ext)}`);
|
|
51
54
|
}
|
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.885+3300ebe1",
|
|
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.885+3300ebe1"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@types/node": "^20.19.9",
|