Skip to content

Feature: Publish mdxjs-rs to npm with native bindings #71

@jp-knj

Description

@jp-knj

Summary

I'd like to propose adding npm package distribution for mdxjs-rs to make it easier to integrate into Node.js projects like Astro, Next.js, and other build tools.

Background

Currently, mdxjs-rs is an excellent Rust implementation of MDX, but it requires custom bindings to use from Node.js. This creates barriers for adoption:

  • Each project needs to create their own bindings
  • Maintenance burden is duplicated across projects
  • Performance benefits are not easily accessible

Use Case

At Astro, we're working on integrating mdxjs-rs to provide 5-15x faster MDX compilation for large sites (PR #14080). However, we need to either:

  1. Create custom bindings (maintenance burden)
  2. Use third-party packages like @rspress/mdx-rs (which appears unmaintained)

Proposal

Would you consider:

  1. Publishing official npm package with pre-built binaries for major platforms

    • Similar to how @swc/core or @parcel/watcher work
    • Using N-API for stability across Node versions
  2. Minimal API surface to start:

    import { compile, compileSync } from 'mdxjs-rs';
    
    const result = await compile(mdxContent, {
      filepath: 'example.mdx',
      development: true
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions