Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

mdxld-workers

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mdxld-workers

Compile and deploy MDXLD files to Cloudflare Workers

latest
Source
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

mdxld-workers

npm version License: MIT

Compile and deploy MDXLD files to Cloudflare Workers using Hono JSX and the Workers Platform API.

Features

  • 🚀 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

Installation

pnpm add @ai-primitives/mdxld-workers

Usage

CLI Usage

# 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

Configuration

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"
  }
}

API Usage

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',
})

Development

# 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

Contributing

Please read our Contributing Guide to learn about our development process and how to propose bugfixes and improvements.

License

MIT © AI Primitives

Dependencies

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

Keywords

mdxld

FAQs

Package last updated on 21 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts