recma-attach-exports
v0.0.1
Published
recma plugin to attach named exports to the default export
Downloads
5
Readme
recma-attach-exports
recma plugin to attach named exports to the default export
Installation
npm install recma-attach-exports
import { compile } from '@mdx-js/mdx'
import { recmaAttachExports } from 'recma-attach-exports'
let mdx = `export const meta = { title: 'Hello world' }`
await compile(mdx, {
recmaPlugins: [recmaAttachExports],
})
Example transformation based on the above snippet:
/*@jsxRuntime automatic @jsxImportSource react*/
import {Fragment as _Fragment, jsx as _jsx} from "react/jsx-runtime";
- export const meta = {
+ const meta = {
title: 'Hello world'
};
function _createMdxContent(props) {
return _jsx(_Fragment, {});
}
function MDXContent(props = {}) {
const {wrapper: MDXLayout} = props.components || ({});
return MDXLayout ? _jsx(MDXLayout, Object.assign({}, props, {
children: _jsx(_createMdxContent, props)
})) : _createMdxContent(props);
}
export default MDXContent;
+ MDXContent.meta = meta;
Options
exclude
Default: []
A list of named exports to exclude from transformation, e.g. ['getStaticProps']