@optique/zod 1.0.0-dev.1291 → 1.0.0-dev.1303

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 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: options.metavar ?? inferMetavar(schema),
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
@@ -97,6 +97,7 @@ interface ZodParserOptions {
97
97
  * }));
98
98
  * ```
99
99
  *
100
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
100
101
  * @since 0.7.0
101
102
  */
102
103
  declare function zod<T>(schema: z.Schema<T>, options?: ZodParserOptions): ValueParser<"sync", T>;
package/dist/index.d.ts CHANGED
@@ -97,6 +97,7 @@ interface ZodParserOptions {
97
97
  * }));
98
98
  * ```
99
99
  *
100
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
100
101
  * @since 0.7.0
101
102
  */
102
103
  declare function zod<T>(schema: z.Schema<T>, options?: ZodParserOptions): ValueParser<"sync", T>;
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: options.metavar ?? inferMetavar(schema),
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.1291+36a7f4c9",
3
+ "version": "1.0.0-dev.1303+2bdb4aa1",
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.1291+36a7f4c9"
60
+ "@optique/core": "1.0.0-dev.1303+2bdb4aa1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@types/node": "^20.19.9",