@optique/zod 1.0.0-dev.1291 → 1.0.0-dev.1300
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 +5 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +5 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -22,6 +22,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
24
|
const __optique_core_message = __toESM(require("@optique/core/message"));
|
|
25
|
+
const __optique_core_nonempty = __toESM(require("@optique/core/nonempty"));
|
|
25
26
|
|
|
26
27
|
//#region src/index.ts
|
|
27
28
|
/**
|
|
@@ -229,13 +230,16 @@ function inferChoices(schema) {
|
|
|
229
230
|
* }));
|
|
230
231
|
* ```
|
|
231
232
|
*
|
|
233
|
+
* @throws {TypeError} If the resolved `metavar` is an empty string.
|
|
232
234
|
* @since 0.7.0
|
|
233
235
|
*/
|
|
234
236
|
function zod(schema, options = {}) {
|
|
235
237
|
const choices = inferChoices(schema);
|
|
238
|
+
const metavar = options.metavar ?? inferMetavar(schema);
|
|
239
|
+
(0, __optique_core_nonempty.ensureNonEmptyString)(metavar);
|
|
236
240
|
const parser = {
|
|
237
241
|
$mode: "sync",
|
|
238
|
-
metavar
|
|
242
|
+
metavar,
|
|
239
243
|
...choices != null && choices.length > 0 ? {
|
|
240
244
|
choices: Object.freeze(choices),
|
|
241
245
|
*suggest(prefix) {
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { message } from "@optique/core/message";
|
|
2
|
+
import { ensureNonEmptyString } from "@optique/core/nonempty";
|
|
2
3
|
|
|
3
4
|
//#region src/index.ts
|
|
4
5
|
/**
|
|
@@ -206,13 +207,16 @@ function inferChoices(schema) {
|
|
|
206
207
|
* }));
|
|
207
208
|
* ```
|
|
208
209
|
*
|
|
210
|
+
* @throws {TypeError} If the resolved `metavar` is an empty string.
|
|
209
211
|
* @since 0.7.0
|
|
210
212
|
*/
|
|
211
213
|
function zod(schema, options = {}) {
|
|
212
214
|
const choices = inferChoices(schema);
|
|
215
|
+
const metavar = options.metavar ?? inferMetavar(schema);
|
|
216
|
+
ensureNonEmptyString(metavar);
|
|
213
217
|
const parser = {
|
|
214
218
|
$mode: "sync",
|
|
215
|
-
metavar
|
|
219
|
+
metavar,
|
|
216
220
|
...choices != null && choices.length > 0 ? {
|
|
217
221
|
choices: Object.freeze(choices),
|
|
218
222
|
*suggest(prefix) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/zod",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1300+12293782",
|
|
4
4
|
"description": "Zod value parsers for Optique",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"zod": "^3.25.0 || ^4.0.0"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@optique/core": "1.0.0-dev.
|
|
60
|
+
"@optique/core": "1.0.0-dev.1300+12293782"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@types/node": "^20.19.9",
|