@optique/valibot 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
  const valibot = __toESM(require("valibot"));
26
27
 
27
28
  //#region src/index.ts
@@ -219,13 +220,16 @@ function inferChoices(schema) {
219
220
  * );
220
221
  * ```
221
222
  *
223
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
222
224
  * @since 0.7.0
223
225
  */
224
226
  function valibot$1(schema, options = {}) {
225
227
  const choices = inferChoices(schema);
228
+ const metavar = options.metavar ?? inferMetavar(schema);
229
+ (0, __optique_core_nonempty.ensureNonEmptyString)(metavar);
226
230
  const parser = {
227
231
  $mode: "sync",
228
- metavar: options.metavar ?? inferMetavar(schema),
232
+ metavar,
229
233
  ...choices != null && choices.length > 0 ? {
230
234
  choices: Object.freeze(choices),
231
235
  *suggest(prefix) {
package/dist/index.d.cts CHANGED
@@ -106,6 +106,7 @@ interface ValibotParserOptions {
106
106
  * );
107
107
  * ```
108
108
  *
109
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
109
110
  * @since 0.7.0
110
111
  */
111
112
  declare function valibot<T>(schema: v.BaseSchema<unknown, T, v.BaseIssue<unknown>>, options?: ValibotParserOptions): ValueParser<"sync", T>;
package/dist/index.d.ts CHANGED
@@ -106,6 +106,7 @@ interface ValibotParserOptions {
106
106
  * );
107
107
  * ```
108
108
  *
109
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
109
110
  * @since 0.7.0
110
111
  */
111
112
  declare function valibot<T>(schema: v.BaseSchema<unknown, T, v.BaseIssue<unknown>>, options?: ValibotParserOptions): 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
  import { safeParse } from "valibot";
3
4
 
4
5
  //#region src/index.ts
@@ -196,13 +197,16 @@ function inferChoices(schema) {
196
197
  * );
197
198
  * ```
198
199
  *
200
+ * @throws {TypeError} If the resolved `metavar` is an empty string.
199
201
  * @since 0.7.0
200
202
  */
201
203
  function valibot(schema, options = {}) {
202
204
  const choices = inferChoices(schema);
205
+ const metavar = options.metavar ?? inferMetavar(schema);
206
+ ensureNonEmptyString(metavar);
203
207
  const parser = {
204
208
  $mode: "sync",
205
- metavar: options.metavar ?? inferMetavar(schema),
209
+ metavar,
206
210
  ...choices != null && choices.length > 0 ? {
207
211
  choices: Object.freeze(choices),
208
212
  *suggest(prefix) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/valibot",
3
- "version": "1.0.0-dev.1291+36a7f4c9",
3
+ "version": "1.0.0-dev.1303+2bdb4aa1",
4
4
  "description": "Valibot value parsers for Optique",
5
5
  "keywords": [
6
6
  "CLI",
@@ -57,7 +57,7 @@
57
57
  "valibot": "^1.2.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",