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

forma-dsl

v0.4.12

Published

A declarative DSL for 3D modeling and scene composition, reusable components, and live previews.

Downloads

3,753

Readme

forma-dsl

Release npm

A declarative DSL for 3D modeling and scene composition, with reusable components and live previews.

Models are written as text - blocks, attributes and expressions in an HCL-like syntax - parsed and solved by the Manifold CSG kernel compiled to WebAssembly. It runs unchanged in Node and in the browser.

npm install forma-dsl
import { render, toBinarySTL, EvaluationContext } from 'forma-dsl';
import { writeFile } from 'node:fs/promises';

const source = `
  param height { type = number  default = 20  min = 8  max = 40 }
  model "riser" {
    extrude {
      height = var.height
      rounded_rect { size = [40, 20]  radius = 4  center = true }
    }
  }
`;

// One context, reused: the digest cache is what makes the second render of a changed
// document cheap, and a fresh context starts empty every time.
const context = await EvaluationContext.create();

for (const height of [10, 20, 30]) {
  const result = await render(source, { params: { height }, context });
  await writeFile(`part-${height}.stl`, toBinarySTL(result.parts[0].concrete));
  // Free what this tree can no longer reach, so a long run stays bounded.
  context.collect(result.parts.map((part) => part.node));
}

context.dispose();

The language in one screen

param height { type = number  default = 20  min = 8  max = 40 }

local sizes = [1.5, 2, 2.5, 3, 4, 5, 6]

model "hex_key_holder" {
  part "body" {
    color = "#6f7d8c"

    difference {
      align {
        x = "center"  y = "center"
        extrude {
          height = var.height
          rounded_rect { size = [62, 13]  radius = 6.5  center = true }
        }
      }

      for i, size in sizes {
        translate {
          offset = [(i - (len(sizes) - 1) / 2) * 8, 0, 2.5]
          extrude {
            height = var.height
            regular_polygon { sides = 6  width_across_flats = size + 0.3 }
          }
        }
      }
    }
  }
}

Geometry is composed by nesting blocks: a block's children are its operands, and several children in a row are implicitly union. Angles are in degrees, everywhere.

API

| Export | What it does | | --- | --- | | render(source, options?) | Compile a document and evaluate one model into renderable parts | | describeParameters(source) | Read a document's declared inputs, without rendering | | EvaluationContext | The digest cache, and the owner of every WASM object | | GeometryNode | The immutable, content-addressed geometry IR | | toRenderMesh · toBinarySTL | Buffers for a renderer, or a file for a slicer | | Vector · Angle · Transform | The value types the evaluator works in | | loadKernel · setQuality | Loading and tuning the Manifold module | | Program · Evaluator · parse · tokenize | The compiler stages, for tools | | BLOCKS · FUNCTIONS · CONSTANTS | The registries, so an editor need not restate them |

Hand-written TypeScript declarations ship with it, so the API is typed from either language.

Documentation

The full reference - every declaration, block, function and error, each with usage and troubleshooting. The editor runs the whole thing in the browser: type, and the solid updates. The site has a demo that types a document out and solves it as it goes.

How it works

source ──▶ lexer ──▶ parser ──▶ evaluator ──▶ geometry nodes ──▶ Manifold (WASM) ──▶ mesh
                                    │                │
                                params          digest cache

The evaluator does not call the kernel. It produces a tree of immutable geometry nodes, each carrying a 128-bit digest of its own content and its children's digests. Identity is digest identity, so a component used twenty times is one node, evaluated once. Nodes are the only thing that reaches the kernel, and every result is memoized by digest - which is what makes an edit cheap, since only the subtrees whose content actually changed are re-evaluated.

WebAssembly objects are not garbage-collected, so an EvaluationContext owns everything it produced. collect(roots) frees what the current tree can no longer reach; dispose() frees the lot.

One runtime dependency, manifold-3d.

License

MIT - see LICENSE.