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

@hua-labs/dot-aot

v0.1.0

Published

Build-time static extraction for @hua-labs/dot — Vite and Babel plugins

Downloads

57

Readme

@hua-labs/dot-aot

Build-time static extraction for @hua-labs/dot. Replaces static dot() calls with pre-computed style objects at build time, eliminating runtime parsing overhead. Provides a Vite plugin and a Babel plugin (Metro, Next.js compatible).

npm version npm downloads license TypeScript

Features

  • Zero-runtime CSS — static dot() calls replaced with inline object literals at build time
  • Vite plugin — enforce: 'pre' transform hook, fast path skips files with no dot calls
  • Babel plugin — AST-accurate CallExpression visitor, works with Metro and Next.js
  • Regex-based extraction engine — skips calls in strings, comments, template literals, and chained methods
  • Static options support — extracts target and dark when literal values; skips breakpoint (dynamic)
  • Cross-platform output — correct serialization for web, native, and flutter targets
  • Graceful fallback — malformed or unresolvable calls silently left as runtime
  • styleToObjectLiteral — handles nested structures (RN transform arrays, Flutter recipe objects)

Installation

pnpm add @hua-labs/dot-aot

Peer dependencies: vite >=5.0.0

Quick Start

// Vite
import dotAot from "@hua-labs/dot-aot/vite";
export default defineConfig({ plugins: [dotAot()] });

// Babel / Metro / Next.js
module.exports = {
  plugins: [["@hua-labs/dot-aot/babel", { target: "native" }]],
};

// Before build:
const style = dot("p-4 flex items-center bg-primary-500");

// After build (inlined by plugin):
const style = {
  padding: "16px",
  display: "flex",
  alignItems: "center",
  backgroundColor: "var(--color-primary-500)",
};

API

| Export | Type | Description | | ------------------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | | extractStaticCalls | function | Scan source string and return all extractable dot() calls sorted last-to-first. Options: { functionNames?: string[], target?: 'web' | 'native' | 'flutter' } | | transformSource | function | Apply all extractions in a single pass. Returns { code, extractions } or null if no changes. Safe for use in any transform pipeline. | | styleToObjectLiteral | function | Serialize a resolved style object to a JS object literal string (with wrapping parentheses). Handles nested arrays and objects for RN/Flutter targets. | | ExtractedCall | type | { start: number; end: number; input: string; options?: DotOptions; result: Record<string, unknown> } | | ExtractOptions | type | { functionNames?: string[]; target?: 'web' | 'native' | 'flutter' } | | @hua-labs/dot-aot/vite subpath | | | | dotAotVite (default) | function | Vite plugin factory. Returns a Vite plugin with enforce: 'pre'. Options: DotAotViteOptions. | | DotAotViteOptions | type | Extends ExtractOptions. { include?: string[]; exclude?: string[] } — file extensions to include/exclude. | | @hua-labs/dot-aot/babel subpath | | | | dotAotBabel (default) | function | Babel plugin factory. Returns a Babel plugin with CallExpression visitor. Options: DotAotBabelOptions. | | DotAotBabelOptions | type | { functionNames?: string[]; target?: DotTarget } |

Related Packages

License

MIT — HUA Labs