Compile and deploy MDXLD files to Cloudflare Workers using Hono JSX and the Workers Platform API.
- 🚀 Compile MDXLD files into Cloudflare Workers with Hono JSX support
- ⚡️ Deploy workers using the Cloudflare Workers Platform API
- 🔧 Deploy workers using Wrangler CLI
- 📝 Full TypeScript support with proper JSX configuration
- 🎨 Support for both CLI and programmatic usage
pnpm add @ai-primitives/mdxld-workers
# Compile an MDXLD file to a Cloudflare Worker
mdxld-workers compile input.mdx --config worker.config.json
# Deploy using Wrangler
mdxld-workers deploy --name my-worker
# Deploy using Platform API
mdxld-workers deploy-platform --namespace my-namespace --account-id xxx
worker.config.json:
{
"jsx": {
"importSource": "hono/jsx",
"runtime": "react-jsx"
},
"worker": {
"name": "my-worker",
"routes": ["/api/*"],
"compatibilityDate": "2023-12-20"
},
"platform": {
"namespace": "my-namespace",
"accountId": "xxx"
}
}
import { compile, deploy, deployPlatform } from '@ai-primitives/mdxld-workers'
// Compile MDXLD to Worker
const worker = await compile('input.mdx', {
jsx: {
importSource: 'hono/jsx',
runtime: 'react-jsx',
},
})
// Deploy using Wrangler
await deploy(worker, {
name: 'my-worker',
routes: ['/api/*'],
})
// Deploy using Platform API
await deployPlatform(worker, {
namespace: 'my-namespace',
accountId: 'xxx',
})
# Install dependencies
pnpm install
# Run tests
pnpm test
# Run tests in watch mode
pnpm test:watch
# Build the package
pnpm build
# Lint the code
pnpm lint
# Format the code
pnpm format
Please read our Contributing Guide to learn about our development process and how to propose bugfixes and improvements.
MIT © AI Primitives
This package uses the following key dependencies:
- @mdx-js/react for MDX processing
- hono/jsx for JSX runtime
- @cloudflare/workers-types for Worker types
- wrangler for Worker deployment