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

@blazefw/compiler

v0.1.5

Published

BlazeFW Rust/WASM compiler — server/client slicer and accessibility scanner

Readme

@blazefw/compiler

BlazeFW Rust compiler — SWC-based AST analyser that classifies every declaration in a .blazefw.tsx file as ServerOnly, ClientOnly, Shared, BoundaryCrossing, or Mixed, then produces two JS bundles automatically. Also compiles to WASM for browser-side use.

Not published to npm. This is an internal package. Consumers use @blazefw/vite-plugin which calls the blazefw-compiler binary automatically. Direct use is only needed when building custom tooling.

Prerequisites

  • Rust toolchain (rustup + cargo) — install
  • wasm-pack for WASM builds — cargo install wasm-pack

Windows: cargo is not on Git Bash's PATH by default. Either run Rust commands in Windows CMD, or add to ~/.bashrc:

export PATH="/c/Users/$USER/.cargo/bin:$PATH"

Building

cd packages/compiler

# Build the CLI binary (used by @blazefw/vite-plugin)
cargo build --release
# Output: target/release/blazefw-compiler

# Build the WASM module (used by browser-side tooling)
wasm-pack build --target web --out-dir pkg

# Run all tests (39 tests)
cargo test

CLI usage

The blazefw-compiler binary reads a source file from stdin and writes a JSON result to stdout:

echo 'export function foo() { return window.x; }' | ./target/release/blazefw-compiler

Input: raw TypeScript/TSX source on stdin

Output: JSON on stdout:

{
  "server_js": "// server bundle — empty (no server declarations)",
  "client_js": "export function foo() { return window.x; }",
  "violations": []
}

Module structure

src/
├── lib.rs                  — declares all modules; WASM entry point
├── main.rs                 — CLI binary (stdin → stdout JSON)
├── triggers.rs             — CLIENT_TRIGGERS / SERVER_TRIGGERS constants
├── scanner.rs              — CapabilityScanner: detects browser globals
├── secret_scanner.rs       — SecretScanner: detects process.env + DB imports
├── accessibility_scanner.rs — AccessibilityScanner: 6 WCAG 2.1 AA rules
└── slicer/
    ├── mod.rs              — re-exports Classifier, Transformer, SliceResult
    ├── classifier.rs       — two-pass AST classifier (5 DeclKinds)
    └── transformer.rs      — produces server/client JS + RPC stubs

Classification system

The Classifier runs two passes over every declaration:

| DeclKind | Trigger | Output | |---|---|---| | ServerOnly | process.env, DB imports, node:* | Server bundle only | | ClientOnly | window, document, localStorage | Client bundle only | | Shared | No triggers (pure logic) | Both bundles | | BoundaryCrossing | Server fn called from client code | RPC stub in client bundle | | Mixed | Both server + client triggers in same fn | Error — flagged in violations |

Server triggers (SecretScanner)

  • process.env.*
  • DB imports: prisma, drizzle, mongoose, pg, mysql2, better-sqlite3, sequelize
  • Node.js protocol: node:fs, node:crypto, node:path, etc.
  • CommonJS require() with the above

Client triggers (CapabilityScanner)

  • window, document, navigator, location
  • localStorage, sessionStorage
  • addEventListener, removeEventListener

Accessibility rules (AccessibilityScanner)

Six WCAG 2.1 AA rules checked at AST level:

| Rule ID | Criterion | Severity | |---|---|---| | missing-alt | 1.1.1 — <img> without alt | Error | | unlabeled-action | 4.1.2 — <Action> without label | Error | | heading-order | 1.3.1 — heading level skips (h1→h3) | Warning | | missing-input-label | 1.3.1 — <input> without label or id | Error | | empty-link | 2.4.4 — <a> with no text or aria-label | Error | | positive-tabindex | 2.4.3 — tabIndex > 0 | Warning |

RPC stub shape

BoundaryCrossing functions get this stub in the client bundle:

// Auto-generated — never written by hand
export async function getUser(id: string) {
  return __blazefw_rpc('/api/__blazefw/getUser', { id });
}

Key swc_core notes (v59.x)

  • Str.value is Wtf8Atom — use .to_string_lossy() to convert to &str
  • Ident::new(sym, span, ctxt) takes 3 args (not 2)
  • BlockStmt has ctxt: SyntaxContext field — use Default::default()
  • JSXAttrValue::Lit removed — string attrs use JSXAttrValue::Str(Str)
  • Do not add swc_ecma_parser or swc_ecma_visit as separate deps — they conflict with swc_core's internal versions