vite-plugin-react-deck 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs +4 -3
- package/index.mjs +4 -3
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -43,12 +43,12 @@ function extractMainCodeAsChildren(source) {
|
|
|
43
43
|
const hasLayout = withWrapper.match(/\n\s*return (<>|_jsxs\(_Fragment)/gm);
|
|
44
44
|
if (hasLayout) {
|
|
45
45
|
return withWrapper.replace(/\n\s*return <>/gm, "\nreturn <MDXLayout {...props}>").replace(/<\/>;\s*$/gm, "</MDXLayout>;\n").replace(
|
|
46
|
-
|
|
46
|
+
/return _jsxs?\(_Fragment, \{/,
|
|
47
47
|
" return _jsx(MDXLayout, {...props,"
|
|
48
48
|
);
|
|
49
49
|
}
|
|
50
50
|
const result = withWrapper.replace(/\n\s*return\s*</gm, "\nreturn <MDXLayout {...props}><").replace(/>;\s*$/gm, "></MDXLayout>;\n").replace(
|
|
51
|
-
|
|
51
|
+
/return _jsxs?\(_components/gm,
|
|
52
52
|
" return _jsx(MDXLayout, {...props, children: _jsx(_components"
|
|
53
53
|
).replace(/}\);$/gm, "})});");
|
|
54
54
|
return result;
|
|
@@ -97,7 +97,7 @@ ${slide}
|
|
|
97
97
|
};
|
|
98
98
|
})
|
|
99
99
|
);
|
|
100
|
-
|
|
100
|
+
const output = addInlineModules(
|
|
101
101
|
`
|
|
102
102
|
import React from 'react';
|
|
103
103
|
${isProd ? 'import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";import {useMDXComponents as _provideComponents} from "@mdx-js/react" ' : "import {useMDXComponents as _provideComponents} from '@mdx-js/react';"}
|
|
@@ -119,6 +119,7 @@ export default {
|
|
|
119
119
|
};`,
|
|
120
120
|
inlineModules
|
|
121
121
|
);
|
|
122
|
+
return output;
|
|
122
123
|
}
|
|
123
124
|
var MOD_REG = /\\`|`(?:\\`|[^`])*`|(^(?:import|export).*$)/gm;
|
|
124
125
|
function extractInlineModules(source, {
|
package/index.mjs
CHANGED
|
@@ -20,12 +20,12 @@ function extractMainCodeAsChildren(source) {
|
|
|
20
20
|
const hasLayout = withWrapper.match(/\n\s*return (<>|_jsxs\(_Fragment)/gm);
|
|
21
21
|
if (hasLayout) {
|
|
22
22
|
return withWrapper.replace(/\n\s*return <>/gm, "\nreturn <MDXLayout {...props}>").replace(/<\/>;\s*$/gm, "</MDXLayout>;\n").replace(
|
|
23
|
-
|
|
23
|
+
/return _jsxs?\(_Fragment, \{/,
|
|
24
24
|
" return _jsx(MDXLayout, {...props,"
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
const result = withWrapper.replace(/\n\s*return\s*</gm, "\nreturn <MDXLayout {...props}><").replace(/>;\s*$/gm, "></MDXLayout>;\n").replace(
|
|
28
|
-
|
|
28
|
+
/return _jsxs?\(_components/gm,
|
|
29
29
|
" return _jsx(MDXLayout, {...props, children: _jsx(_components"
|
|
30
30
|
).replace(/}\);$/gm, "})});");
|
|
31
31
|
return result;
|
|
@@ -74,7 +74,7 @@ ${slide}
|
|
|
74
74
|
};
|
|
75
75
|
})
|
|
76
76
|
);
|
|
77
|
-
|
|
77
|
+
const output = addInlineModules(
|
|
78
78
|
`
|
|
79
79
|
import React from 'react';
|
|
80
80
|
${isProd ? 'import {Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs} from "react/jsx-runtime";import {useMDXComponents as _provideComponents} from "@mdx-js/react" ' : "import {useMDXComponents as _provideComponents} from '@mdx-js/react';"}
|
|
@@ -96,6 +96,7 @@ export default {
|
|
|
96
96
|
};`,
|
|
97
97
|
inlineModules
|
|
98
98
|
);
|
|
99
|
+
return output;
|
|
99
100
|
}
|
|
100
101
|
var MOD_REG = /\\`|`(?:\\`|[^`])*`|(^(?:import|export).*$)/gm;
|
|
101
102
|
function extractInlineModules(source, {
|