@mdx-js/esbuild

esbuild plugin for MDX

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@mdx-js/esbuild
3.0.12 months ago2 years agoMinified + gzip package size for @mdx-js/esbuild in KB

Readme

@mdx-js/esbuild
!Buildbuild-badgebuild !Coveragecoverage-badgecoverage !Downloadsdownloads-badgedownloads !Sponsorssponsors-badgecollective !Backersbackers-badgecollective !Chatchat-badgechat
esbuild plugin for MDX.

Contents

mdx(options?) Options

What is this?

This package is an esbuild plugin to support MDX.

When should I use this?

This integration is useful if you’re using esbuild (or another tool that uses esbuild).
If you want to evaluate MDX code then the lower-level compiler (@mdx-js/mdx) can be used. to support nonstandard JSX runtime (such as Vue), @mdx-js/mdx can also be used, or our webpack loader (@mdx-js/loader) or Rollup plugin (@mdx-js/rollup).

Install

This package is ESM onlyesm. In Node.js (version 16+), install with npm:
npm install @mdx-js/esbuild

Use

Do something like this with the esbuild API:
import mdx from '@mdx-js/esbuild'
import esbuild from 'esbuild'

await esbuild.build({
  // Replace `index.js` with your entry point that imports MDX files:
  entryPoints: ['index.js'],
  format: 'esm',
  outfile: 'output.js',
  plugins: [mdx({/* jsxImportSource: …, otherOptions… */})]
})

API

This package exports no identifiers. The default export is mdxapi-mdx.

mdx(options?)

Create an esbuild plugin to compile MDX to JS.
esbuild takes care of turning modern JavaScript features into syntax that works wherever you want it to. With other integrations you might need to use Babel for this, but with esbuild that’s not needed. See esbuild’s docs for more info.
Parameters
— configuration
Returns
ESBuild plugin (Pluginesbuild-plugin from esbuild).

Options

Configuration (TypeScript type).
Options are the same as CompileOptions from @mdx-js/mdxcompile-options.

Types

This package is fully typed with TypeScript. It exports the additional type Optionsapi-options. See § Typestypes on our website for information.

Compatibility

Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of Node. This means we try to keep the current release line, @mdx-js/esbuild@^3, compatible with Node.js 16.

Security

See § Securitysecurity on our website for information.

Contribute

See § Contributecontribute on our website for ways to get started. See § Supportsupport for ways to get help.
This project has a code of conductcoc. By interacting with this repository, organization, or community you agree to abide by its terms.

License

MIT © Titus Wormerauthor