Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mdx-js/runtime

Package Overview
Dependencies
Maintainers
3
Versions
178
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mdx-js/runtime - npm Package Compare versions

Comparing version 0.16.0 to 0.16.1

42

package.json
{
"name": "@mdx-js/runtime",
"version": "0.16.1",
"description": "Parse and render MDX in a runtime environment",
"version": "0.16.0",
"license": "MIT",
"author": "John Otander",
"keywords": [
"mdx",
"markdown",
"react",
"jsx",
"remark",
"mdxast"
],
"homepage": "https://mdxjs.com",
"repository": "mdx-js/mdx",
"bugs": "https://github.com/mdx-js/mdx/issues",
"author": "John Otander <johnotander@gmail.com> (http://johnotander.com)",
"contributors": [
"John Otander <johnotander@gmail.com> (http://johnotander.com)",
"Tim Neutkens <tim@zeit.co>",
"Matija Marohnić <matija.marohnic@gmail.com>",
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)"
],
"main": "dist",
"scripts": {
"test": "jest",
"prepare": "babel src -d dist"
"test": "jest"
},
"keywords": [
"mdx",
"react"
"files": [
"dist/",
"src/"
],
"dependencies": {
"@mdx-js/mdx": "^0.16.1",
"@mdx-js/tag": "^0.16.1",
"buble": "^0.19.3"
},
"devDependencies": {

@@ -28,11 +49,6 @@ "babel-cli": "^6.26.0",

},
"dependencies": {
"@mdx-js/mdx": "^0.16.0",
"@mdx-js/tag": "^0.16.0",
"buble": "^0.19.3"
},
"jest": {
"testEnvironment": "node"
},
"gitHead": "2c1c8676327f97b060283c5a9047574d8ada11ec"
"gitHead": "b69654652e22043592da6db45bc8306b05c783ad"
}

@@ -1,15 +0,21 @@

# Runtime MDX
# `@mdx-js/runtime`
Parse and render MDX in a runtime environment
[![Build Status][build-badge]][build]
[![lerna][lerna-badge]][lerna]
[![Join the community on Spectrum][spectrum-badge]][spectrum]
## :warning: Warning
Parse and render [MDX][] in a runtime environment.
This is not the preferred way to use MDX since it introduces a substantial amount of overhead and dramatically increases bundle sizes.
It should also not be used with user input that isn't sandboxed.
> :warning: **warning**: this is not the preferred way to use MDX since it
> introduces a substantial amount of overhead and dramatically increases
> bundle sizes.
> It should also not be used with user input that isn’t sandboxed.
## Installation
[npm][]:
```sh
npm i -S @mdx-js/runtime
```
npm install --save @mdx-js/runtime
```

@@ -33,4 +39,40 @@ ## Usage

## Related
## Contribute
- [MDX Docs](https://github.com/mdx-js/mdx)
See [`contributing.md` in `mdx-js/mdx`][contributing] for ways to get started.
This organisation has a [Code of Conduct][coc].
By interacting with this repository, organisation, or community you agree to
abide by its terms.
## License
[MIT][] © [Compositor][] and [ZEIT][]
<!-- Definitions -->
[build]: https://travis-ci.org/mdx-js/mdx
[build-badge]: https://travis-ci.org/mdx-js/mdx.svg?branch=master
[lerna]: https://lernajs.io/
[lerna-badge]: https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg
[spectrum]: https://spectrum.chat/mdx
[spectrum-badge]: https://withspectrum.github.io/badge/badge.svg
[contributing]: https://github.com/mdx-js/mdx/blob/master/contributing.md
[coc]: https://github.com/mdx-js/mdx/blob/master/code-of-conduct.md
[mit]: license
[compositor]: https://compositor.io
[zeit]: https://zeit.co
[mdx]: https://github.com/mdx-js/mdx
[npm]: https://docs.npmjs.com/cli/install
import React from 'react'
import { transform } from 'buble'
import {transform} from 'buble'
import mdx from '@mdx-js/mdx'
import { MDXTag } from '@mdx-js/tag'
import {MDXTag} from '@mdx-js/tag'
export default ({ scope = {}, components = {}, mdPlugins = [], hastPlugins = [], children, ...props }) => {
export default ({
scope = {},
components = {},
mdPlugins = [],
hastPlugins = [],
children,
...props
}) => {
const fullScope = {

@@ -14,15 +21,25 @@ MDXTag,

const jsx = mdx.sync(children, {
mdPlugins,
hastPlugins,
skipExport: true,
}).trim()
const jsx = mdx
.sync(children, {
mdPlugins,
hastPlugins,
skipExport: true
})
.trim()
const { code } = transform(jsx)
const {code} = transform(jsx)
const keys = Object.keys(fullScope)
const values = keys.map(key => fullScope[key])
const fn = new Function('_fn', 'React', ...keys, `return ${code}`)
// eslint-disable-next-line no-new-func
const fn = new Function(
'_fn',
'React',
...keys,
`${code}
return React.createElement(MDXContent);`
)
return fn({}, React, ...values)
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc