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

@palamedes/extractor

v1.25.0

Published

Native message extractor for Palamedes macro syntax

Readme

@palamedes/extractor

npm version CI Sponsored by Sebastian Software License: MIT OR Apache-2.0

Fast message extraction for teams that want a lower-level API alongside the CLI.

@palamedes/extractor uses Palamedes' native core first to pull messages out of JavaScript, TypeScript, JSX, and MDX codebases without sending the workflow through a Babel-heavy path.

When To Use This Package

Use @palamedes/extractor when you want:

  • direct control over extraction in your own scripts or tools
  • a lower-level extractor for custom workflows
  • the same extraction engine that powers the Palamedes CLI

If you just want the supported command-line workflow, use @palamedes/cli.

Installation

pnpm add -D @palamedes/extractor

Minimal Example

import { extractor } from "@palamedes/extractor";

const source =
  'import { t } from "@palamedes/core/macro"; function message(name) { return t`Hello ${name}` }';
const messages = [];

await extractor.extract("example.ts", source, (message) => {
  messages.push(message);
});

console.log(messages);

Supported Inputs

  • t, plural, select, selectOrdinal
  • <Trans>, <Plural>, <Select>, <SelectOrdinal>
  • i18n._(...) and i18n.t\...`` style runtime calls
  • JavaScript, TypeScript, JSX, and TSX sources
  • MDX semantic units, inline rich text, expressions, images, and JSX

The extractor rejects eager t, plural, select, and selectOrdinal macros, plus <Plural>, <Select>, and <SelectOrdinal>, when they appear outside a function, method, or callback. <Trans> is safe at module scope because translation occurs during component rendering. Class field initializers do not count as function scope; use a method or getter instead.

Rich JSX children inside <Trans> are extracted with numeric component slots. For example, <Trans><strong>A</strong> and <strong>B</strong></Trans> extracts as <0>A</0> and <1>B</1>.

Key Exports

  • extractor
  • createExtractor(options?)
  • extractMessages(source, filename, mdxOptions?)
  • ExtractedMessageInfo

Configure MDX attributes and frontmatter for direct extraction:

import { createExtractor, extractMessages } from "@palamedes/extractor";

const mdx = {
  translatableAttributes: ["alt", "title", "aria-label"],
  frontMatterFields: ["title", "description"],
};

const messages = extractMessages(source, "guide.mdx", mdx);
const configuredExtractor = createExtractor({ mdx });

Related Packages

MDX uses the explicit palamedes-ignore directive rather than lingui-extract-ignore.

palamedes is part of the Ferramenta family — Rust-native developer tools that keep the APIs the ecosystem already knows.

Siblings: ferroni · ferriki · ferromark · ferrolex · ferrocat · ferrovia · ferralk · ferrugo.

License

Sebastian Software

MIT OR Apache-2.0 © 2026 Sebastian Software