npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@optique/standard-schema

v1.3.0

Published

Standard Schema value parsers for Optique

Readme

@optique/standard-schema

Standard Schema value parsers for Optique. This package lets you use any Standard Schema-compatible validator as an @optique/core value parser.

Installation

deno add jsr:@optique/standard-schema jsr:@optique/run jsr:@optique/core npm:@standard-schema/spec npm:arktype
npm  add     @optique/standard-schema     @optique/run     @optique/core     @standard-schema/spec arktype
pnpm add     @optique/standard-schema     @optique/run     @optique/core     @standard-schema/spec arktype
yarn add     @optique/standard-schema     @optique/run     @optique/core     @standard-schema/spec arktype
bun  add     @optique/standard-schema     @optique/run     @optique/core     @standard-schema/spec arktype

Replace arktype with any Standard Schema-compatible library you want to use.

Quick example

The following example validates an email address with an ArkType schema through the generic standardSchema() adapter.

import { object } from "@optique/core/constructs";
import { option } from "@optique/core/primitives";
import { run } from "@optique/run";
import { standardSchema } from "@optique/standard-schema";
import { type } from "arktype";

const cli = run(
  object({
    email: option("--email",
      standardSchema(type("string.email"), {
        placeholder: "",
        metavar: "EMAIL",
      }),
    ),
  }),
);

console.log(`Welcome, ${cli.email}!`);

Async schemas

Use standardSchemaAsync() when the validator may perform async work:

import { option } from "@optique/core/primitives";
import { runAsync } from "@optique/run";
import { standardSchemaAsync } from "@optique/standard-schema";
import type { StandardSchemaV1 } from "@standard-schema/spec";

const apiKeySchema: StandardSchemaV1<unknown, string> = {
  "~standard": {
    version: 1,
    vendor: "example",
    async validate(value) {
      if (typeof value === "string" && value.startsWith("live_")) {
        return { value };
      }
      return { issues: [{ message: "Unknown API key." }] };
    },
  },
};

const apiKey = option("--api-key",
  standardSchemaAsync(apiKeySchema, {
    placeholder: "",
    metavar: "API_KEY",
  }),
);

const key = await runAsync(apiKey);

The synchronous standardSchema() helper rejects async validation results and asks you to use standardSchemaAsync() instead.

Dedicated adapters

Standard Schema intentionally exposes validation results, not library-specific metadata. This package therefore stays conservative: it does not infer choices, completion suggestions, Boolean CLI literals, or specialized metavars from the underlying schema.

Use @optique/zod or @optique/valibot when you want richer behavior for those libraries. Use @optique/standard-schema when portability matters, or when your schema library does not have a dedicated Optique adapter.