Skip to content

Commit da7b2cd

Browse files
just-be-devjohno
authored andcommitted
Add support for export * statements in remark-mdx (#911)
1 parent 02b10c5 commit da7b2cd

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

packages/remark-mdx/extract-imports-and-exports.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ class BabelPluginExtractImportsAndExports {
2222
const {start} = path.node
2323
nodes.push({type: 'export', start})
2424
},
25+
ExportAllDeclaration(path) {
26+
const {start} = path.node
27+
nodes.push({type: 'export', start})
28+
},
2529
ImportDeclaration(path) {
2630
const {start} = path.node
2731

packages/remark-mdx/test/__snapshots__/import-export.test.js.snap

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ Array [
3535
]
3636
`;
3737

38+
exports[`Handles export all 1`] = `
39+
Array [
40+
Object {
41+
"type": "export",
42+
"value": Array [
43+
"export * from './foo'",
44+
],
45+
},
46+
]
47+
`;
48+
3849
exports[`Handles multiline default exports 1`] = `
3950
Array [
4051
Object {

packages/remark-mdx/test/fixtures/import-export.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,9 @@ module.exports = [
2525
{
2626
description: 'Handles multiline default exports',
2727
mdx: ['export default props => (', ' <main {...props} />', ')'].join('\n')
28+
},
29+
{
30+
description: 'Handles export all',
31+
mdx: ["export * from './foo'"]
2832
}
2933
]

0 commit comments

Comments
 (0)