babel-plugin-apply-mdx-type-prop
Apply the MDX type prop used in the MDX pragma
Last updated 6 years ago by johno .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install babel-plugin-apply-mdx-type-prop 
SYNC missed versions from official npm registry.

babel-plugin-apply-mdx-type-prop

Babel plugin that applies the mdxType prop which is used by the MDX pragma.

It also stores all components encountered as names in the plugin state.

Installation

yarn add babel-plugin-apply-mdx-type-prop

Usage

const babel = require('@babel/core')

const BabelPluginApplyMdxTypeProp = require('babel-plugin-apply-mdx-type-prop')

const jsx = `
export const Foo = () => (
  <div>
    <Button />
  </div>
)

export default () => (
  <>
    <h1>Hello!</h1>
    <TomatoBox />
  </>
)
`

const plugin = new BabelPluginApplyMdxTypeProp()

const result = babel.transform(jsx, {
  configFile: false,
  plugins: ['@babel/plugin-syntax-jsx', plugin.plugin]
})

console.log(result.code)
console.log(plugin.state.names)

Input

export const Foo = () => (
  <div>
    <Button />
  </div>
)

export default () => (
  <>
    <h1>Hello!</h1>
    <TomatoBox />
  </>
)

Output

export const Foo = () => (
  <div>
    <Button mdxType="Button" />
  </div>
)

export default () => (
  <>
    <h1>Hello!</h1>
    <TomatoBox mdxType="Button" />
  </>
)

License

MIT

Current Tags

  • 1.6.13-ci.1                                ...           ci (6 years ago)
  • 2.0.0                                ...           latest (2 years ago)
  • 2.0.0-next.8                                ...           next (6 years ago)

61 Versions

  • 2.0.0 [deprecated]           ...           2 years ago
  • 1.6.22                                ...           6 years ago
  • 1.6.21                                ...           6 years ago
  • 1.6.20                                ...           6 years ago
  • 1.6.19                                ...           6 years ago
  • 2.0.0-next.8                                ...           6 years ago
  • 1.6.18                                ...           6 years ago
  • 1.6.17                                ...           6 years ago
  • 2.0.0-next.7                                ...           6 years ago
  • 1.6.16                                ...           6 years ago
  • 1.6.15                                ...           6 years ago
  • 2.0.0-next.6                                ...           6 years ago
  • 2.0.0-next.5                                ...           6 years ago
  • 1.6.14                                ...           6 years ago
  • 2.0.0-next.4                                ...           6 years ago
  • 1.6.13-ci.1                                ...           6 years ago
  • 1.6.13                                ...           6 years ago
  • 1.6.12-ci.2                                ...           6 years ago
  • 1.6.12                                ...           6 years ago
  • 2.0.0-next.3                                ...           6 years ago
  • 1.6.11                                ...           6 years ago
  • 1.6.10                                ...           6 years ago
  • 1.6.9                                ...           6 years ago
  • 1.6.8                                ...           6 years ago
  • 1.6.8-ci.4                                ...           6 years ago
  • 1.6.7                                ...           6 years ago
  • 1.6.6                                ...           6 years ago
  • 1.6.5                                ...           7 years ago
  • 2.0.0-next.1                                ...           7 years ago
  • 1.6.4                                ...           7 years ago
  • 2.0.0-next.0                                ...           7 years ago
  • 1.6.3                                ...           7 years ago
  • 1.6.2                                ...           7 years ago
  • 1.6.1                                ...           7 years ago
  • 1.6.0                                ...           7 years ago
  • 1.5.9                                ...           7 years ago
  • 1.5.8                                ...           7 years ago
  • 1.5.8-ci.13                                ...           7 years ago
  • 1.5.8-alpha.0                                ...           7 years ago
  • 1.5.7                                ...           7 years ago
  • 1.5.7-alpha.0                                ...           7 years ago
  • 1.5.6                                ...           7 years ago
  • 1.5.6-alpha.0                                ...           7 years ago
  • 1.5.6-ci.0                                ...           7 years ago
  • 1.5.5                                ...           7 years ago
  • 1.5.4                                ...           7 years ago
  • 1.5.3                                ...           7 years ago
  • 1.5.2                                ...           7 years ago
  • 1.5.1                                ...           7 years ago
  • 1.5.0                                ...           7 years ago
  • 1.4.5                                ...           7 years ago
  • 1.4.4                                ...           7 years ago
  • 1.4.3                                ...           7 years ago
  • 1.4.2                                ...           7 years ago
  • 1.4.1                                ...           7 years ago
  • 1.4.0                                ...           7 years ago
  • 1.3.2                                ...           7 years ago
  • 1.3.1                                ...           7 years ago
  • 1.3.0                                ...           7 years ago
  • 1.2.2                                ...           7 years ago
  • 1.2.1                                ...           7 years ago
Downloads
Total 107
Today 0
This Week 0
This Month 86
Last Day 0
Last Week 0
Last Month 14
Dependencies (2)
Dev Dependencies (0)
None
Dependents (1)

© 2010 - cnpmjs.org x YWFE | Home | YWFE