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

@omnitron-dev/lumen-ast

v0.4.14

Published

Pure isomorphic prism-doc/2 AST compiler, math environments, Shiki/Twoslash highlighter, and multi-target emitters

Readme

@omnitron-dev/lumen-ast

The shared document compiler for Lumen. It parses Markdown and PDX into the prism-doc/2 AST, applies audience access rules and emits HTML, Markdown or Typst source.

Capabilities

  • Data-only frontmatter, document diagnostics, headings, links and mathematical environments.
  • KaTeX math, Shiki highlighting and Twoslash queries using the pinned TypeScript compiler.
  • Audience projection before rendering, indexing and export; one semantic HTML tree for static output and component rendering.
  • Shared island-prop validation, bounded code execution, and separate Node-only PDF and MCP entries.

Quick start

pnpm add @omnitron-dev/lumen-ast
import {
  createDocumentAccessPredicate,
  parseDocument,
  projectDocumentAccess,
  toHtmlSsr,
} from '@omnitron-dev/lumen-ast';

const ast = await parseDocument('# Guide\n\nStart here.\n', 'guide.pdx');
const publicDocument = projectDocumentAccess(ast, createDocumentAccessPredicate([]));
if (!publicDocument.allowed) throw new Error('Document is not public');
const html = toHtmlSsr(publicDocument.ast);

Use verified identity and explicit role grants for an authenticated audience. Apply the same projection to search, links and exports; hiding a rendered element is not access control. Malformed metadata and unsupported values produce diagnostics or errors instead of a permissive document.

Public entries

| Entry | Purpose | | --- | --- | | Package root | AST, parser, access projection, math, highlighting, diagrams and emitters. | | /islands | Plain-JSON props codec shared by producers and browser islands. | | /execution and /execution/limits | Bounded QuickJS execution and its limits. | | /diagrams | Diagram contracts and rendering helpers. | | /highlight | Literal-source tokens with dual-theme colors and lazy per-language loading, without the compiler or Twoslash. | | /typst | Node-only PDF compilation with bundled engine and fonts. | | /mcp | Node-only MCP integration. |

Island props reject cycles, accessors, BigInt and other values JSON cannot preserve. Source, depth and output limits are explicit; rendering a theorem or diagram does not prove its claims.

Twoslash uses actual default libraries from the exact TypeScript dependency. Browser execution reads the embedded library set without filesystem or network access. Ordinary package modules are emitted as native ESM with declarations. Only the math tokenizer is bundled separately, excluding its unused legacy KaTeX renderer; bundled third-party notices are included in licenses.

Editing source

toCleanMarkdown is a read/export representation, not a lossless editing format. It can simplify presentation constructs. The authoring path is LumenService.getEditableDocument → Prism ResearchEditor.initialSource → snapshot getSource() → saveLiveEdit with the original revision and hash. Do not overwrite the original document with an audience projection.

Parser positions address the original input, including BOM and frontmatter: offsets are zero-based UTF-16 indices, lines and columns are one-based, and the end is exclusive. Nested JSX, directive attributes and smart references use the same coordinates. rawContent contains the body only; slice the original input when applying a node range. Raw HTML normalization may omit positions; consumers must handle their absence. Escaped smart-reference syntax, code, math and link destinations remain literal.

Document presentation

toHtmlTree returns standard HAST after applying the same URL, HTML and plain-JSON props policies used by toHtmlSsr. The latter serializes that tree; it does not implement a second document walker. Typed element.data.lumen metadata identifies widgets and registered examples for a trusted host renderer. Authored HTML attributes and AST data cannot supply this metadata. Code, math and diagram generators produce their own escaped fragments; authored raw HTML always passes through the HTML policy.

Block widgets use div hosts; widgets in paragraphs, emphasis, authored inline elements and file-tree annotations use span. An inline component must return phrasing content. Registered examples include source disclosures and require a separate block. Static HTML retains the widget fallback and readable source when no component renderer is present.

The filetree container directive accepts an optional title and one nested unordered Markdown list. Start each item with an inline-code filename, then an optional annotation; a trailing / or child list identifies a directory. HTML uses native, initially open disclosures, while Markdown and Typst retain the nested list and annotations. Lumen supplies the shared stylesheet. Prism ResearchEditor preserves the directive as opaque source; the standalone ResearchDocument reader does not interpret it.

Mermaid diagrams retain readable source during SSR and use the real browser engine for layout. Labels support quoted text and Mermaid entity codes such as #quot;. Strict rendering permits a fixed set of text-formatting elements without author-supplied attributes, resources or actions; document directives cannot relax that boundary.

Documentation

Public API · Package exports · Lumen · Prism authoring

License

MIT. Bundled third-party notices are in licenses.