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

farm-plugin-comptime-stdlib

v0.2.0

Published

Compile-time standard library for FarmFE — provides built-in functions (range, math, etc.) that expand statically at build time

Readme

farm-plugin-comptime-stdlib

Compile-time standard library for FarmFE — provides built-in functions that expand statically at build time.

Install

npm install farm-plugin-comptime-stdlib

Dependencies: This plugin uses core-ast-ts internally. Installed automatically.

Concept

Like C++ constexpr — this plugin provides utility functions that are expanded at compile time when all arguments are literals. Unlike lodash (a runtime library), these functions disappear from the output entirely when they can be statically evaluated.

When arguments are dynamic (not known at compile time), the call is kept and a minimal runtime polyfill is injected.

Usage

import comptimeStdlib from 'farm-plugin-comptime-stdlib'

export default {
  plugins: [comptimeStdlib()],
}

Provided Functions

Range and Repeat

const indices = $range(0, 5)
// → [0, 1, 2, 3, 4]  (static array literal)

const steps = $range(0, 10, 2)
// → [0, 2, 4, 6, 8]

const zeros = $repeat(3, 0)
// → [0, 0, 0]

Math (Constant Folding)

const area = $times(3.14, 4)
// → 12.56

const total = $add(100, 200)
// → 300

const diff = $sub(500, 200)
// → 300

const ratio = $div(22, 7)
// → 3.142857142857143

const rem = $mod(10, 3)
// → 1

const power = $pow(2, 10)
// → 1024

const lo = $min(1, 5, 3)
// → 1

const hi = $max(1, 5, 3)
// → 5

const val = $clamp(15, 0, 10)
// → 10

String/Number Conversions

const h = $hex(255)
// → "0xff"

const o = $oct(8)
// → "0o10"

const b = $bin(5)
// → "0b101"

const code = $charCode('A')
// → 65

const ch = $fromCharCode(65)
// → "A"

Dynamic Arguments (Runtime Fallback)

// n is a runtime variable — can't fold statically
const indices = $range(0, n)
// → kept as $range(0, n), runtime polyfill injected automatically

The plugin tracks which functions need runtime versions and injects only the necessary polyfills via a virtual module.

How It Works

  1. Scans code for $-prefixed stdlib function calls
  2. If all arguments are literals → evaluate and inline the result as a literal
  3. If any argument is dynamic → keep the call, inject runtime polyfill
  4. Runtime polyfill module is generated on-demand (virtual:farm-plugin-comptime-stdlib/runtime)

License

MIT