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

@lit-pigeon/figma-import

v0.1.5

Published

Import a Figma frame into a Lit Pigeon PigeonDocument.

Readme

@lit-pigeon/figma-import

Convert a Figma frame into a Lit Pigeon PigeonDocument. Standalone library — also reachable via the import_figma_frame tool in @lit-pigeon/mcp-server.

Install

pnpm add @lit-pigeon/figma-import

Usage

import { importFromFigma } from '@lit-pigeon/figma-import';
import { MjmlRenderer } from '@lit-pigeon/renderer-mjml';

const { document, warnings } = await importFromFigma(
  'FILE_KEY',        // segment after /file/ or /design/ in a Figma URL
  '0:1',             // node-id of the frame, URL-decoded
  process.env.FIGMA_TOKEN!,
  {
    documentName: 'Welcome to Lumen',
    previewText: 'Glad you joined us.',
  },
);

console.log(warnings); // soft warnings — skipped nodes, guesses

const { html } = await new MjmlRenderer().render(document);

Already have the Figma frame JSON (e.g. from a cached fetch)? Skip the network round-trip:

import { figmaFrameToDocument } from '@lit-pigeon/figma-import';
const { document } = figmaFrameToDocument(frameNode, { imageUrls: myImageMap });

Conversion heuristics

| Figma node | Becomes | Notes | |---|---|---| | Top FRAME | PigeonDocument.body | Width clamped to [300, 800]; solid background fill becomes body.backgroundColor. | | Direct child FRAME with layoutMode: HORIZONTAL (+ >1 visible kids) | Multi-column row | columnRatios projected onto a 12-grid from measured widths (every column gets at least 1). | | Any other direct child | Single-column row | One block per row. | | TEXT | text block | Colour, font-size, font-weight, font-family, alignment, and line-height are extracted. | | FRAME/INSTANCE with corner-radius, one TEXT child, height ≤ 80px, solid fill | button block | Heuristic — won't trigger for non-button shapes. | | RECTANGLE/FRAME with an IMAGE fill | image block | Requires imageUrls[imageRef] to resolve. importFromFigma fetches that map automatically. | | VECTOR, ELLIPSE, decorative shapes | skipped, warned | The library returns soft warnings; the import still succeeds. |

What you don't get yet (planned):

  • Hero blocks (image background + text overlay) — currently lands as a plain image + adjacent text.
  • Multi-line rich-text formatting per character — text is rendered as a single styled <p>.
  • Dividers and spacers — Figma's pixel-perfect dividers don't map cleanly; use a text block for now.

Getting a Figma access token

  1. Visit https://www.figma.com/developers/api#access-tokens.
  2. Create a personal-access token (file:read scope is sufficient for this library).
  3. Pass it as the third argument to importFromFigma.

From a Figma URL

https://www.figma.com/design/abcd1234/My-Email?node-id=12%3A34
                              ─┬─────         ──┬───
                          fileKey         encoded frameId

URL-decode the node-id query param to get the frame id (12:34 in this case).

Via MCP

If you're using @lit-pigeon/mcp-server, you don't need to write any code:

You: Use lit-pigeon to import this Figma frame as an email — file key
     abcd1234, frame id 12:34. Token: figd_…
Model: [calls import_figma_frame { fileKey, frameId, accessToken }]
       [calls render_to_html { documentId }]
       …returns the rendered HTML.

License

MIT