Socket
Book a DemoInstallSign in
Socket

recma-attach-exports

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recma-attach-exports

recma plugin to attach named exports to the default export

latest
Source
npmnpm
Version
0.0.1
Version published
Maintainers
1
Created
Source

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']

Keywords

mdx

FAQs

Package last updated on 29 Jun 2023

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