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

@json-render/yaml

v0.15.0

Published

YAML wire format for @json-render/core. Progressive rendering and surgical edits via streaming YAML.

Readme

@json-render/yaml

YAML wire format for @json-render/core. Progressive rendering and surgical edits via streaming YAML.

Installation

npm install @json-render/yaml @json-render/core yaml

Key Concepts

  • YAML wire format: Uses yaml-spec, yaml-edit, yaml-patch, and diff code fences instead of JSONL
  • Streaming parser: Incrementally parses YAML as it arrives, emitting JSON Patch operations
  • Edit modes: Supports patch (RFC 6902), merge (RFC 7396), and unified diff for surgical edits
  • AI SDK transform: Drop-in TransformStream that converts YAML fences into json-render patch data parts

Quick Start

Generate a YAML System Prompt

import { yamlPrompt } from "@json-render/yaml";
import { catalog } from "./catalog";

const systemPrompt = yamlPrompt(catalog, {
  mode: "standalone",
  editModes: ["merge"],
});

Stream YAML Specs (AI SDK)

import { pipeYamlRender } from "@json-render/yaml";
import { createUIMessageStream, createUIMessageStreamResponse } from "ai";

const stream = createUIMessageStream({
  execute: async ({ writer }) => {
    writer.merge(pipeYamlRender(result.toUIMessageStream()));
  },
});
return createUIMessageStreamResponse({ stream });

Streaming Parser (Low-Level)

import { createYamlStreamCompiler } from "@json-render/yaml";

const compiler = createYamlStreamCompiler<Spec>();

// Feed chunks as they arrive
const { result, newPatches } = compiler.push("root: main\n");
compiler.push("elements:\n  main:\n    type: Card\n");

// Flush remaining data
const { result: final } = compiler.flush();

API Reference

yamlPrompt(catalog, options?)

Generate a YAML-format system prompt from any json-render catalog.

| Option | Type | Default | Description | |--------|------|---------|-------------| | system | string | "You are a UI generator that outputs YAML." | Custom system message intro | | mode | "standalone" \| "inline" | "standalone" | Output mode | | customRules | string[] | [] | Additional rules | | editModes | EditMode[] | ["merge"] | Edit modes to document |

createYamlTransform(options?)

Creates a TransformStream that converts YAML spec/edit fences in AI SDK stream chunks into json-render patch data parts.

| Option | Type | Description | |--------|------|-------------| | previousSpec | Spec | Seed with a previous spec for multi-turn edit support |

pipeYamlRender(stream, options?)

Convenience wrapper that pipes an AI SDK stream through the YAML transform. Drop-in replacement for pipeJsonRender from @json-render/core.

createYamlStreamCompiler(initial?)

Create a streaming YAML compiler that incrementally parses YAML text and emits JSON Patch operations.

Returns YamlStreamCompiler<T> with methods:

| Method | Description | |--------|-------------| | push(chunk) | Push a chunk of text. Returns { result, newPatches } | | flush() | Flush remaining buffer and return final result | | getResult() | Get the current compiled result | | getPatches() | Get all patches applied so far | | reset(initial?) | Reset to initial state |

Fence Constants

Exported constants for fence detection:

  • YAML_SPEC_FENCE```yaml-spec
  • YAML_EDIT_FENCE```yaml-edit
  • YAML_PATCH_FENCE```yaml-patch
  • DIFF_FENCE```diff
  • FENCE_CLOSE```

Re-exports from @json-render/core

  • diffToPatches(oldObj, newObj) — Generate RFC 6902 JSON Patch from object diff
  • deepMergeSpec(base, patch) — RFC 7396 JSON Merge Patch