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

lineadraw

v0.5.0

Published

Type definitions and marketplace tooling for Linea blocks and commands

Readme

lineadraw

Type definitions and marketplace tooling for Linea blocks and commands — the one devDependency a block/command repository needs. Zero runtime: your modules import types from "lineadraw", and the Linea editor provides the real implementation when it runs them.

  • Typings — lineadraw.d.ts makes import { defineBlock } from "lineadraw" and import { … } from "lineadraw/helpers" type-check in any editor/CI, with parameter types inferred into your draw function.
  • CLI — lineadraw manifest | check | init turns any repository into a Linea marketplace: a git repo the editor can browse and install blocks/commands from.

Quick start

Scaffold a fresh marketplace repository:

npm create lineadraw my-blocks

Or add the structure to an existing project:

npm i -D lineadraw
npx lineadraw init

Either way you get blocks/ and commands/ folders, a tsconfig.json wired to the typings, a sample block, a CI workflow, and a generated catalog (.lineadraw/marketplace.json) — the repo is addable in the editor from the first push.

Writing a block

A block is one module with a single defineBlock default export: typed parameters in, geometry out.

// blocks/surface.block.ts
import { defineBlock } from "lineadraw";

export default defineBlock({
  // The id is the block's identity everywhere: @<collection>/<slug>.
  // Re-publishing the same id updates installed copies in place.
  id: "@my-blocks/surface",
  name: "Surface",
  version: "1.0.0",
  params: [
    { name: "kind", type: "enum", default: "rock", options: ["rock", "ground"] },
  ],
  place: ["Start point", "End point"], // one point pick per label, in order
  draw: ({ params, inputs: [start, end] }) => {
    params.kind; // "rock" | "ground" — inferred from the params table
    return [{ type: "line", a: start, b: end }];
  },
});

Notable optional members: place may instead be an interactive ({ params, pickPoint, pickObject }) function run once at insertion; dependencies lists ids of blocks your draw emits instances of (installs pull them along); paramVisibility({ params }) hides property rows; previewInputs curates the inputs used for thumbnails. Units are millimeters, Y-up, angles in radians CCW.

Writing a command

A command is a macro with a single defineCommand default export. Its whole run is one undo step; Esc during a pick reverts cleanly.

// commands/circle-here.cmd.ts
import { defineCommand } from "lineadraw";

export default defineCommand({
  id: "@my-blocks/circle-here",
  name: "Circle here",
  run: async ({ document, pickPoint, prompt, showToast }) => {
    const center = await pickPoint("Center point");
    const r = await prompt("Radius");
    document.add([{ type: "circle", center, radius: Number.parseFloat(r) }]);
    showToast("Done", "success");
  },
});

Imports are limited to "lineadraw" and "lineadraw/helpers" (geometry helpers) — the editor resolves both when executing your module.

The CLI

lineadraw manifest   Validate all modules and write .lineadraw/marketplace.json
lineadraw check      Validate without writing; fail if the committed manifest is stale
lineadraw init       Add the marketplace structure to the current npm project

The manifest is deterministic (repo-relative paths, no git metadata), so check is a byte-for-byte diff — the included CI workflow runs it on every push and PR. With @lineadraw/sdk installed as a devDependency, manifest/check additionally dry-run every block and render thumbnails; without it the CLI still fully works.

Collection name and owner come from your package.json:

{ "lineadraw": { "marketplaceName": "My blocks", "marketplaceOwner": "Me" } }

Using a marketplace in the editor

In the editor: Library → Marketplace tab → + and enter owner/repo (or owner/repo@branch). For a private repository, create a fine-grained personal access token with read-only Contents access to just that repository and paste it in the add dialog — it is stored only on that device. Installing embeds the module (and its declared dependency closure) in the document, so drawings keep working offline and travel with the file.

Ecosystem

  • Linea editor — the browser CAD app that runs these modules.
  • lineadraw/lineadraw — the public collection: real blocks/commands to learn from, agent skill, and guides.
  • @lineadraw/sdk — headless Node API over the same kernel (open/edit/render/export .linea documents; also powers the CLI's block dry-runs).
  • @lineadraw/mcp — MCP server with the full editor as an in-chat app.