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

@tailwind-styled/engine

v5.0.0

Published

Unified build engine for tailwind-styled-v4

Readme

@tailwind-styled/engine

Unified build engine for tailwind-styled-v4 with native-first architecture.

Features

  • Native-First: Uses Rust bindings for optimal performance
  • Incremental Builds: Efficient file change detection and CSS regeneration
  • Watch Mode: Real-time file watching with debounce and batching
  • Plugin System: Extensible hooks for customization
  • Analyzer Integration: Optional semantic analysis (unused classes, conflicts)
  • Zero Runtime Overhead: Generates compile-time CSS

Installation

npm install @tailwind-styled/engine

Quick Start

import { createEngine } from "@tailwind-styled/engine"

async function main() {
  const engine = await createEngine({
    root: "./src",
    compileCss: true,
  })

  // Build once
  const result = await engine.build()
  console.log(result.css) // Generated atomic CSS
  console.log(result.mergedClassList) // All classes found

  // Or watch for changes
  await engine.watch((event) => {
    console.log(event.type, event.result.css)
  })
}

main()

API Reference

createEngine(options?)

Creates an engine instance with the following options:

interface EngineOptions {
  /** Project root directory */
  root?: string
  /** Scanner options */
  scanner?: ScanWorkspaceOptions
  /** Whether to compile CSS (default: true) */
  compileCss?: boolean
  /** Path to tailwind config */
  tailwindConfigPath?: string
  /** Plugin instances */
  plugins?: EnginePlugin[]
  /** Enable analyzer integration (default: false) */
  analyze?: boolean
}

Engine Methods

| Method | Description | |--------|-------------| | scan() | Scan workspace for files and classes | | build() | Run full build (scan + CSS generation) | | watch(onEvent) | Start watch mode with event callback |

BuildResult

interface BuildResult {
  scan: ScanWorkspaceResult
  mergedClassList: string // All unique classes
  css: string // Generated CSS
  analysis?: {
    unusedClasses: string[]
    classConflicts: Array<{ className: string; files: string[] }>
    classUsage: Record<string, number>
  }
}

Plugins

Create custom plugins to extend engine functionality:

const myPlugin: EnginePlugin = {
  name: "my-plugin",
  beforeScan(context) {
    console.log("Starting scan:", context.root)
  },
  afterScan(scan, context) {
    console.log(`Found ${scan.totalFiles} files`)
    return scan
  },
  transformClasses(classes, context) {
    // Add or modify classes
    return classes.map(c => c.includes("btn") ? `${c} font-bold` : c)
  },
  beforeBuild(scan, context) {
    console.log("Building...")
  },
  afterBuild(result, context) {
    console.log(`Generated ${result.css.length} bytes of CSS`)
    return result
  },
  onError(error, context) {
    console.error("Build error:", error.message)
  },
}

Plugin Hooks

| Hook | Description | |------|-------------| | beforeScan | Called before scanning starts | | afterScan | Called after scan completes | | transformClasses | Transform class list before CSS generation | | beforeBuild | Called before CSS build | | afterBuild | Called after CSS build completes | | onError | Called when an error occurs |

Watch Events

engine.watch((event) => {
  switch (event.type) {
    case "initial":
      console.log("Initial build:", event.result.css)
      break
    case "change":
      console.log("File changed:", event.filePath)
      break
    case "unlink":
      console.log("File deleted:", event.filePath)
      break
    case "full-rescan":
      console.log("Full rescan triggered")
      break
    case "error":
      console.error("Error:", event.error)
      break
  }
})

Analyzer Integration

Enable semantic analysis for insights:

const engine = await createEngine({
  root: "./src",
  analyze: true, // Enable analyzer
})

const result = await engine.build()

// Access analysis results
console.log(result.analysis?.unusedClasses)
console.log(result.analysis?.classUsage)

Internal API

For advanced usage, import internal functions:

import { applyIncrementalChange } from "@tailwind-styled/engine/internal"
import { watchWorkspaceNative } from "@tailwind-styled/engine/internal"

Note: Internal APIs may change at any time without notice.

Breaking Changes in v5

| Area | v4 | v5 | |------|----|----| | API Exports | Many functions | Only createEngine + EnginePlugin | | Analyzer | N/A | Optional via analyze: true | | Watch Hooks | N/A | Added beforeWatch/afterWatch |

TypeScript

This package is written in TypeScript and includes type definitions.