Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: mdx-js/mdx
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.16.3
Choose a base ref
...
head repository: mdx-js/mdx
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.16.4
Choose a head ref
  • 4 commits
  • 13 files changed
  • 2 contributors

Commits on Nov 23, 2018

  1. Fix create-mdx name by basing it on example (#329)

    Closes GH-316.
    wooorm authored and johno committed Nov 23, 2018
    1

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    e190ed7 View commit details
  2. Remove default field from import nodes (#327)

    Closes GH-313.
    wooorm authored and johno committed Nov 23, 2018
    1

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    2270df3 View commit details
  3. Assign props at the top level of render (#326)

    * Assign props at the top level of render
    
    * Set layout to null if not defined
    
    * Pass props in runtime as well
    johno authored Nov 23, 2018
    1

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    8978bb1 View commit details
  4. v0.16.4

    johno committed Nov 23, 2018
    1

    Unverified

    No user is associated with the committer email.
    Copy the full SHA
    21a3cc7 View commit details
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"lerna": "3.4.0",
"version": "0.16.3",
"version": "0.16.4",
"packages": [
"packages/*"
],
3 changes: 2 additions & 1 deletion packages/create-mdx/cli.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env node
const init = require('initit')

const [example = 'next', name = 'next-mdx'] = process.argv.slice(2, 3)
const example = process.argv[2] || 'next'
const name = process.argv[3] || example + '-mdx'
const template = `mdx-js/mdx/examples/${example}`

init({name, template})
2 changes: 1 addition & 1 deletion packages/create-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-mdx",
"version": "0.16.1",
"version": "0.16.4",
"description": "Initialize an MDX project",
"license": "MIT",
"keywords": [
4 changes: 2 additions & 2 deletions packages/loader/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdx-js/loader",
"version": "0.16.3",
"version": "0.16.4",
"description": "Loader for MDX",
"license": "MIT",
"keywords": [
@@ -27,7 +27,7 @@
"index.js"
],
"dependencies": {
"@mdx-js/mdx": "^0.16.3",
"@mdx-js/mdx": "^0.16.4",
"@mdx-js/tag": "^0.16.1",
"loader-utils": "^1.1.0"
},
8 changes: 6 additions & 2 deletions packages/mdx/index.js
Original file line number Diff line number Diff line change
@@ -25,13 +25,17 @@ const tokenizeEsSyntax = (eat, value) => {
const index = value.indexOf(EMPTY_NEWLINE)
const subvalue = index !== -1 ? value.slice(0, index) : value

if (isExport(subvalue) || isImport(subvalue)) {
if (isExport(subvalue)) {
return eat(subvalue)({
type: isExport(subvalue) ? 'export' : 'import',
type: 'export',
default: isExportDefault(subvalue),
value: subvalue
})
}

if (isImport(subvalue)) {
return eat(subvalue)({type: 'import', value: subvalue})
}
}

tokenizeEsSyntax.locator = (value, fromIndex) => {
4 changes: 2 additions & 2 deletions packages/mdx/mdx-hast-to-jsx.js
Original file line number Diff line number Diff line change
@@ -105,10 +105,10 @@ function toJSX(node, parentNode = {}, options = {}) {
} class MDXContent extends React.Component {
constructor(props) {
super(props)
this.layout = ${layout}
this.layout = ${layout || 'null'}
}
render() {
const { components = {} } = this.props
const { components = {}, ...props } = this.props
return <MDXTag
name="wrapper"
2 changes: 1 addition & 1 deletion packages/mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdx-js/mdx",
"version": "0.16.3",
"version": "0.16.4",
"description": "Parse MDX and transpile to JSX",
"license": "MIT",
"keywords": [
4 changes: 2 additions & 2 deletions packages/mdx/test/index.test.js
Original file line number Diff line number Diff line change
@@ -85,10 +85,10 @@ it('Should match sample blog post snapshot', async () => {
"export default class MDXContent extends React.Component {
constructor(props) {
super(props);
this.layout = undefined;
this.layout = null;
}
render() {
const { components = {} } = this.props;
const { components = {}, ...props } = this.props;
return (
<MDXTag name=\\"wrapper\\" components={components}>
4 changes: 2 additions & 2 deletions packages/parcel-plugin-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdx-js/parcel-plugin-mdx",
"version": "0.16.3",
"version": "0.16.4",
"description": "Parcel plugin for MDX",
"license": "MIT",
"keywords": [
@@ -27,7 +27,7 @@
"src"
],
"dependencies": {
"@mdx-js/mdx": "^0.16.3",
"@mdx-js/mdx": "^0.16.4",
"parcel-bundler": "^1.4.1"
},
"peerDependencies": {
8 changes: 6 additions & 2 deletions packages/remark-mdx/index.js
Original file line number Diff line number Diff line change
@@ -69,13 +69,17 @@ function tokenizeEsSyntax(eat, value) {
const index = value.indexOf(EMPTY_NEWLINE)
const subvalue = index !== -1 ? value.slice(0, index) : value

if (isExport(subvalue) || isImport(subvalue)) {
if (isExport(subvalue)) {
return eat(subvalue)({
type: isExport(subvalue) ? 'export' : 'import',
type: 'export',
default: isExportDefault(subvalue),
value: subvalue
})
}

if (isImport(subvalue)) {
return eat(subvalue)({type: 'import', value: subvalue})
}
}

function tokenizeEsSyntaxLocator(value, fromIndex) {
2 changes: 1 addition & 1 deletion packages/remark-mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@mdx-js/remark-mdx",
"version": "0.16.1",
"version": "0.16.4",
"description": "Support import, export, and JSX in markdown",
"license": "MIT",
"keywords": [
4 changes: 2 additions & 2 deletions packages/runtime/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mdx-js/runtime",
"version": "0.16.3",
"version": "0.16.4",
"description": "Parse and render MDX in a runtime environment",
"license": "MIT",
"keywords": [
@@ -30,7 +30,7 @@
"src/"
],
"dependencies": {
"@mdx-js/mdx": "^0.16.3",
"@mdx-js/mdx": "^0.16.4",
"@mdx-js/tag": "^0.16.1",
"buble": "^0.19.6"
},
2 changes: 1 addition & 1 deletion packages/runtime/src/index.js
Original file line number Diff line number Diff line change
@@ -37,7 +37,7 @@ export default ({
...keys,
`${code}
return React.createElement(MDXContent, { components });`
return React.createElement(MDXContent, { components, ...props });`
)

return fn({}, React, ...values)