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 🙏

© 2024 – Pkg Stats / Ryan Hefner

mdxe

v1.1.1

Published

Zero-Config Executable MDX

Downloads

167

Readme

mdxe - Zero-Config Executable MDX

mdxe is a lightweight, zero-config CLI tool and build utility designed for MDX files. It offers an effortless way to execute, render, and preview MDX content without the hassle of manual setup.

Features

  • Zero Config: Get started immediately without worrying about configuration.
  • Multiple Renderers: Support for both React and Hono JSX rendering modes.
  • CLI Execution: Evaluate MDX files directly in the console using Ink for a rich, interactive terminal experience.
  • Dev Server by Default: Automatically starts a browser-based preview environment powered by Vite alongside the CLI evaluation.
  • File Watching: Automatically updates both the CLI and browser preview as you make changes to the MDX file.
  • Cloudflare Workers Support: Build and deploy MDX content directly to Cloudflare Workers using Hono JSX.

Installation

Install mdxe globally using npm:

npm install -g mdxe

Or use mdxe via npx without needing to install it globally:

npx mdxe <file.mdx>

Usage

Default Behavior

Run the following command to evaluate and display the MDX content in your terminal and start a development server:

mdxe <file.mdx>
  • In the CLI: The MDX content will be rendered in the terminal using Ink.
  • In the Browser: The MDX file will be served and watched via a Vite-powered dev server. A URL (e.g., http://localhost:3000) will be logged to the console, allowing you to open the file in your browser.

Both environments will update automatically when changes are made to the MDX file.

Build Static Output

Compile your MDX file into a static site or export it for production:

mdxe build <file.mdx>

The static output will be placed in the dist directory by default.

Command Options

  • --port <number>: Specify a custom port for the dev server (default: 3000).
  • --out-dir <path>: Set the output directory for the build command (default: dist).
  • --open: Automatically open the browser when starting the dev server.
  • --watch: Enable file watching for live previews or builds.
  • --no-browser: Disable the browser preview, keeping only the CLI evaluation.
  • --renderer <type>: Choose the rendering engine ('react' or 'hono', default: 'react').
  • --worker-build: Build for Cloudflare Workers deployment (requires Hono renderer).

Examples

Default Execution (React)

mdxe example.mdx

This renders the MDX content in the terminal and starts a live preview server in the browser using React.

Using Hono JSX Renderer

mdxe example.mdx --renderer hono

This uses the Hono JSX renderer for both terminal and browser preview.

Build for Cloudflare Workers

mdxe example.mdx --renderer hono --worker-build

This builds the MDX file for deployment to Cloudflare Workers using Hono JSX.

Start Dev Server with Custom Port

mdxe example.mdx --port 4000 --open

This starts a development server on port 4000 and opens the browser automatically.

Build Static Files

mdxe build example.mdx --out-dir static

This compiles the MDX file into the static directory.

Worker Deployment

When using the --worker-build flag, mdxe will:

  1. Process MDX files using the Hono JSX renderer
  2. Generate a Cloudflare Workers compatible entry point
  3. Bundle all dependencies using esbuild
  4. Output the worker files to the specified directory

Example deployment workflow:

# Build the worker
mdxe example.mdx --renderer hono --worker-build --out-dir worker

# Deploy using wrangler
cd worker && wrangler publish

Why MDXE?

  • Simplicity: Focus on writing MDX without worrying about build tools.
  • Flexibility: Evaluate MDX for terminal-based workflows or run a live preview for web development.
  • Modern Tooling: Built on top of Vite for fast, modern development.

Contributing

We welcome contributions! If you have ideas or issues, please feel free to open a GitHub issue or submit a pull request.

License

This project is licensed under the MIT License.


Happy MDX-ing with mdxe! 🚀