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

@csszyx/compiler

v0.3.1

Published

Core compiler and transformation logic for csszyx

Readme

@csszyx/compiler

TypeScript compiler package for CSSzyx - handles JSX transformation, recovery token generation, and manifest creation.

Features

  • JSX Transform: Converts sz prop to Tailwind CSS className strings
  • Recovery Token System: Cryptographic tokens for hydration recovery control
  • Manifest Generation: Build-time manifest for recovery metadata
  • Type Safety: Full TypeScript support with strict types

Installation

pnpm add @csszyx/compiler

Usage

Basic Transform

import { transform } from "@csszyx/compiler";

// Transform sz object to className string
const className = transform({ p: 4, bg: "red-500" });
// Returns: "p-4 bg-red-500"

// With variants
const classNameWithVariants = transform({
  p: 4,
  hover: { bg: "blue-500" },
});
// Returns: "p-4 hover:bg-blue-500"

Recovery Token Generation

import { createRecoveryToken } from "@csszyx/compiler";

const recovery = createRecoveryToken(
  {
    mode: "csr",
    component: "Button",
    filePath: "/app/Button.tsx",
    line: 10,
    column: 5,
  },
  "build-123",
);

console.log(recovery.token); // "a94f1c2e8b3d"

Manifest Builder

import { ManifestBuilder } from "@csszyx/compiler";

const builder = new ManifestBuilder("build-123");

builder.addToken("token1", {
  mode: "csr",
  component: "Button",
  filePath: "/app/Button.tsx",
  line: 10,
  column: 5,
  buildId: "build-123",
});

const manifest = builder.build();
// {
//   buildId: 'build-123',
//   checksum: '...',
//   tokens: { token1: { mode: 'csr', component: 'Button', path: '...' } }
// }

API Reference

Transform

transform(szProp: SzObject, prefix?: string): string

Transforms a CSSzyx sz object into a Tailwind CSS className string.

isValidSzProp(szProp: unknown): boolean

Validates that an sz prop object is valid.

normalizeClassName(className: string): string

Normalizes a className string by removing extra whitespace.

Recovery

generateRecoveryToken(metadata: TokenMetadata): string

Generates a cryptographic token for a recovery declaration.

createRecoveryToken(metadata, buildId): RecoveryToken

Creates a recovery token with full metadata.

isValidRecoveryMode(value: unknown): boolean

Validates if a value is a valid recovery mode ('csr' or 'dev-only').

validateSzRecover(value, componentName): { valid: boolean; error?: string }

Validates szRecover attribute value.

injectRecoveryToken(attributes, token): Record<string, unknown>

Injects recovery token into JSX attributes.

Manifest

class ManifestBuilder

Builder class for creating recovery manifests.

Methods:

  • addToken(token: string, metadata: TokenMetadata): void
  • build(): RecoveryManifest
  • size(): number
  • hasToken(token: string): boolean
  • clear(): void

serializeManifest(manifest, pretty?): string

Serializes a recovery manifest to JSON string.

parseManifest(json: string): RecoveryManifest

Parses a recovery manifest from JSON string.

validateManifest(manifest): { valid: boolean; error?: string }

Validates a recovery manifest structure.

License

MIT