diff --git a/packages/mdx/test/compile.js b/packages/mdx/test/compile.js index 4385ec205..c09165c82 100644 --- a/packages/mdx/test/compile.js +++ b/packages/mdx/test/compile.js @@ -778,16 +778,16 @@ test('jsx', async () => { String(compileSync('*a*', {jsx: true})), [ '/*@jsxRuntime automatic @jsxImportSource react*/', + 'function _createMdxContent(props) {', + ' const _components = Object.assign({', + ' p: "p",', + ' em: "em"', + ' }, props.components);', + ' return <_components.p><_components.em>{"a"};', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' const _components = Object.assign({', - ' p: "p",', - ' em: "em"', - ' }, props.components);', - ' return <_components.p><_components.em>{"a"};', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', '' @@ -799,12 +799,12 @@ test('jsx', async () => { String(compileSync('', {jsx: true})), [ '/*@jsxRuntime automatic @jsxImportSource react*/', + 'function _createMdxContent(props) {', + ' return ;', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' return ;', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', '' @@ -816,15 +816,15 @@ test('jsx', async () => { String(compileSync('<>', {jsx: true})), [ '/*@jsxRuntime automatic @jsxImportSource react*/', + 'function _createMdxContent(props) {', + ' const {c} = props.components || ({});', + ' if (!c) _missingMdxReference("c", false);', + ' if (!c.d) _missingMdxReference("c.d", true);', + ' return <><>;', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' const {c} = props.components || ({});', - ' if (!c) _missingMdxReference("c", false);', - ' if (!c.d) _missingMdxReference("c.d", true);', - ' return <><>;', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', 'function _missingMdxReference(id, component) {', @@ -840,12 +840,12 @@ test('jsx', async () => { [ '/*@jsxRuntime automatic @jsxImportSource react*/', '/*1*/', + 'function _createMdxContent(props) {', + ' return <><>{"a "}{}{" b"};', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' return <><>{"a "}{}{" b"};', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', '' @@ -857,15 +857,15 @@ test('jsx', async () => { String(compileSync('{}', {jsx: true})), [ '/*@jsxRuntime automatic @jsxImportSource react*/', + 'function _createMdxContent(props) {', + ' const _components = Object.assign({', + ' "a-b": "a-b"', + ' }, props.components);', + ' return <>{<_components.a-b>};', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' const _components = Object.assign({', - ' "a-b": "a-b"', - ' }, props.components);', - ' return <>{<_components.a-b>};', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', '' @@ -877,15 +877,15 @@ test('jsx', async () => { String(compileSync('Hello {props.name}', {jsx: true})), [ '/*@jsxRuntime automatic @jsxImportSource react*/', + 'function _createMdxContent(props) {', + ' const _components = Object.assign({', + ' p: "p"', + ' }, props.components);', + ' return <_components.p>{"Hello "}{props.name};', + '}', 'function MDXContent(props = {}) {', ' const {wrapper: MDXLayout} = props.components || ({});', - ' return MDXLayout ? <_createMdxContent /> : _createMdxContent();', - ' function _createMdxContent() {', - ' const _components = Object.assign({', - ' p: "p"', - ' }, props.components);', - ' return <_components.p>{"Hello "}{props.name};', - ' }', + ' return MDXLayout ? <_createMdxContent {...props} /> : _createMdxContent(props);', '}', 'export default MDXContent;', '' diff --git a/packages/rollup/test/index.test.js b/packages/rollup/test/index.test.js index 0f6168215..ae0b0781b 100644 --- a/packages/rollup/test/index.test.js +++ b/packages/rollup/test/index.test.js @@ -34,7 +34,7 @@ test('@mdx-js/rollup', async () => { assert.equal( output[0].map ? output[0].map.mappings : undefined, - ';;;MAAaA,OAAU,GAAA,MAAAC,GAAA,CAAAC,QAAA,EAAA;AAAQ,EAAA,QAAA,EAAA,QAAA;;;;;;;;;;;;AAE7B,MAAA,QAAA,EAAA,CAAA,SAAA,EAAAD,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;', + ';;;MAAaA,OAAU,GAAA,MAAAC,GAAA,CAAAC,QAAA,EAAA;AAAQ,EAAA,QAAA,EAAA,QAAA;;;;;;;AAE7B,IAAA,QAAA,EAAA,CAAA,SAAA,EAAAD,GAAA,CAAA,OAAA,EAAA,EAAA,CAAA,CAAA;;;;;;;;;;;;', 'should add a source map' )