lukeed

lukeed / comptime

Public

A Zig-inspired build-time evaluation primitive, exposed as Vite and Rolldown plugins

50
0
100% credibility
Found May 08, 2026 at 50 stars -- GitGems finds repos before they trend. Get early access to the next one.
Sign Up Free
AI Analysis
TypeScript
AI Summary

Comptime is a plugin for Vite and Rolldown that evaluates pure functions at build time and replaces the calls with their serialized results for optimization.

How It Works

1
🕵️ Discover comptime

You hear about a handy tool that pre-calculates heavy math or logic in your web project so everything runs faster for visitors.

2
📦 Add the helper

Simply include this speed tool in your project's setup files with a quick addition.

3
Mark calculations

In your code, use a special note to tell the tool exactly what numbers or results to figure out ahead of time.

4
🔨 Build your project

Run your usual build process, and the tool quietly computes and swaps in the final values.

5
See the magic

Open the built files and watch as your complex calculations turn into simple, ready numbers.

🚀 Faster website

Your app now loads and works super quickly, delighting users with instant results.

Sign up to see the full architecture

4 more

Sign Up Free

Star Growth

See how this repo grew from 50 to 50 stars Sign Up Free
Repurpose This Repo

Repurpose is a Pro feature

Generate ready-to-use prompts for X threads, LinkedIn posts, blog posts, YouTube scripts, and more -- with full repo context baked in.

Unlock Repurpose
AI-Generated Review

What is comptime?

Comptime brings Zig-inspired build-time evaluation to TypeScript as simple Vite and Rolldown plugins. Write `comptime(() => expensivePureWork())` and it computes the result during builds—like turning `fibonacci(10)` into `55`—replacing the call with a static literal. Without the plugin, it throws at runtime to catch misses, mimicking comptime meaning from Zig or comptime rust.

Why is it gaining traction?

It handles real-world complexity: async bodies, dynamic imports, top-level refs, JSX in TSX, and even process.env reads (with configurable policies). Custom serializers let you bake in URLs or assets, and dev servers hot-reload changes. Unlike basic const gen tools, this primitive feels like native comptime ts or comptime zig orm—pure functions become comptime_int literals without runtime cost.

Who should use this?

Vite or Rolldown users generating build-time values: TS devs precomputing math tables, config objects, or static site data. Ideal for frontend teams wanting comptime zig-style optimizations in apps, or library authors exposing serialized primitives without bundler hacks.

Verdict

Grab it for Vite/Rolldown projects needing build-time eval—docs and tests are solid despite 30 stars and 1.0% credibility score. Early maturity means watch for edge cases, but it's a smart zig-inspired win for pure computation.

(187 words)

Sign up to read the full AI review Sign Up Free

Similar repos coming soon.