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

@lumencast/compiler

v0.15.0

Published

LSML 1.0 / 1.1 → flat RenderBundle compiler. Lets authors write idiomatic LSML and feed it to @lumencast/runtime.

Readme

@lumencast/compiler

LSML 1.0 / 1.1 → flat RenderBundle compiler. Authors write idiomatic LSML, the runtime gets the shape it expects.

Why this exists

@lumencast/runtime consumes a flat compiled form (RenderBundle with a bindings map per node, primitive-specific prop names like text.size, repeat with template-as-only-child). The canonical authoring format (LSML 1.0, see spec/LSML-1.md) is more ergonomic — inline bind: { value: "path" }, CSS-style style.fontSize, repeat.template. This compiler bridges the two.

It also computes the canonical sha256 scene_version per LSML §3 so authors can content-address their bundles deterministically.

Install

pnpm add @lumencast/compiler

Surface

import {
  compileBundle,
  hashBundle,
  validatePathData,
  type LSMLBundle,
  type CompileOptions,
  type CompileDiagnostic,
} from "@lumencast/compiler";

const lsml: LSMLBundle = {
  lsml: "1.1",
  scene_id: "scoreboard",
  scene_version: "sha256:0".repeat(64), // placeholder — replace via hashBundle
  layout: {
    kind: "stack",
    direction: "vertical",
    gap: 16,
    children: [
      { kind: "text", style: { fontSize: 48, color: "#fff" }, bind: { value: "show.title" } },
      {
        kind: "repeat",
        scope: "p",
        bind: { items: "players" },
        template: {
          kind: "text",
          bind: { value: "{p}.name" },
        },
      },
    ],
  },
};

// 1. Stamp a deterministic scene_version
const hashed = await hashBundle(lsml);

// 2. Compile to the runtime's flat form
const opts: CompileOptions = {
  strict: false, // true → throw on any warn (CI/authoring tools)
  onWarn: (msg, diag: CompileDiagnostic) => {
    // diag.nodeId, diag.field, diag.reason — never the offending value (R9)
    console.warn(msg);
  },
};
const bundle = compileBundle(hashed, opts);

The output bundle is what you serve at GET /lsdp/v1/scenes/<id>/bundle?v=<scene_version>.

What this covers (LSML 1.0 + 1.1, ADR 001 phases A+B)

  • 9 primitives: stack, grid, frame, text, image, shape, media, repeat, instance
  • bind: { value | src | items }bindings map; bindStyle → bindings on style props
  • LSML CSS-style names → runtime primitive vocab (fontSize → size, color → colour, etc.)
  • Layout vocabulary mapping (align: "start" → "flex-start", etc.)
  • repeat.templatechildren: [template]
  • animate.transition (tween / spring with mass) → transitions map; animate.from.filter lowered and clamped
  • bindAnimate §6.3 → animateBindings map; keys validated against animatable props (throw on invalid key)
  • fills[], strokes[] per LSML 1.1
  • paths[] / pathData — validated via validatePathData() (strict SVG d allowlist, 8 KiB/subpath cap, command cap)
  • clipsContent forwarded on frames
  • keyframes + stagger_ms lowered to runtime keyframe shape
  • scale: [sx, sy] per-axis
  • cornerRadiusradius mismatch corrected
  • filter values clamped at lowering (blur ≤ 100 px, brightness ≤ 4, negatives rejected — R8)
  • profiles[] forwarded into the RenderBundle (authoring profiles treated as advisory per §17.5.1)
  • Anti-silent-drop: every spec'd-but-unsupported field calls onWarn with { nodeId, field, reason } (never the value); strict: true throws
  • Canonical hashing per LSML §3 via hashBundle()

validatePathData(d, nodeId, field)

Standalone validator for SVG d strings. Allowlists commands MmLlHhVvCcSsQqTtAaZz + numbers; rejects url(, data:, <, &; enforces the byte and command caps. Throws on invalid input. Available independently for tooling that validates paths outside compileBundle.

What this doesn't cover

  • Full schema validation (use lumen validate — forthcoming CLI)
  • i18n table → runtime resolution (LSML §12)
  • Asset host allowlist enforcement
  • A11y schema rules (LSML §13)
  • Phase C fields (effects[], blendMode, per-corner cornerRadius, strokes[] advanced, angular-gradient/diamond-gradient, mask) — gated on RFC LSML 1.2

License

Apache 2.0 — see the repo root.