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

@xyd-js/source-react-runtime

v0.0.0-build-df98432-20260513223339

Published

Build plugin (Vite, Rollup, esbuild) that auto-detects React components and injects runtime type metadata using typia and xyd uniform format

Readme

@xyd-js/source-react-runtime

Build plugin that auto-detects React components and injects runtime type metadata (__xydUniform by default) using typia for TypeScript type resolution and @xyd-js/openapi for JSON Schema → xyd uniform conversion.

No manual annotations needed — just add the plugin to your build config.

Supported bundlers

| Bundler | Import | Build command | |---------|--------|---------------| | Vite | @xyd-js/source-react-runtime | vite build | | Rollup | @xyd-js/source-react-runtime | rollup -c | | esbuild | @xyd-js/source-react-runtime/esbuild | node esbuild.config.mjs | | React Router v7 | @xyd-js/source-react-runtime | react-router build | | TanStack Router | @xyd-js/source-react-runtime | vite build |

Usage

Vite / React Router / TanStack Router

// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import { xydSourceReactRuntime } from "@xyd-js/source-react-runtime";

export default defineConfig({
  plugins: [
    xydSourceReactRuntime(),
    react(),
  ],
});

Rollup

// rollup.config.mjs
import typescript from "@rollup/plugin-typescript";
import { xydSourceReactRuntime } from "@xyd-js/source-react-runtime";

export default {
  input: "src/index.ts",
  plugins: [
    xydSourceReactRuntime(),
    typescript(),
  ],
};

esbuild

// esbuild.config.mjs
import * as esbuild from "esbuild";
import { xydSourceReactRuntimeEsbuild } from "@xyd-js/source-react-runtime/esbuild";

await esbuild.build({
  entryPoints: ["src/index.ts"],
  outfile: "dist/index.js",
  bundle: true,
  format: "esm",
  plugins: [
    xydSourceReactRuntimeEsbuild(),
  ],
});

Options

All options are optional.

| Option | Type | Default | Description | |--------|------|---------|-------------| | tsconfig | string | ./tsconfig.json | Path to tsconfig.json. Configurable for monorepos or custom locations. | | propertyName | string | __xydUniform | Property name for the injected metadata |

xydSourceReactRuntime({
  tsconfig: resolve(__dirname, "tsconfig.json"),
  propertyName: "__docs", // Component.__docs = JSON.parse('...')
});

What it detects

The plugin auto-detects:

  • Exported function componentsexport function MyComponent(props: Props) { ... }
  • Exported arrow componentsexport const MyComponent = (props: Props) => { ... }
  • Re-exported componentsfunction MyComponent(props: Props) { ... } export { MyComponent }
  • Contextsexport const MyContext = createContext<ValueType>(null)

Props with React.* types (e.g. React.ReactNode) are skipped because typia cannot resolve React's internal types.

How it works

  1. Detect — scans all source files from tsconfig.json using the TypeScript compiler AST to find exported components and their props type names
  2. Inject — creates in-memory modified source files with typia.json.schemas<[PropsType]>() calls appended
  3. Transform — runs typia's TypeScript transform on the full program (all files) for cross-file type resolution
  4. Convert — converts the resulting JSON Schema to xyd uniform format using @xyd-js/openapi's schemaObjectToUniformDefinitionProperties
  5. Output — replaces the typia call with Component.{propertyName} = JSON.parse('...')

Output format

Each component gets a static property with the xyd uniform Reference format:

// Build output
function UserCard(props) { /* ... */ }
UserCard.__xydUniform = JSON.parse('{"title":"UserCard","definitions":[{"title":"Props","properties":[{"name":"name","type":"string","meta":[{"name":"required","value":"true"}]},{"name":"email","type":"string","meta":[{"name":"required","value":"true"}]}]}]}');

At runtime, access the metadata:

import { UserCard } from "./components";

console.log(UserCard.__xydUniform);
// { title: "UserCard", definitions: [{ title: "Props", properties: [...] }] }