dumi 2.2.1-alpha.0 → 2.2.2
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/compiled/crates/swc_plugin_react_demo.wasm +0 -0
- package/dist/assetParsers/atom.js +15 -5
- package/dist/assetParsers/block.js +27 -9
- package/dist/cli.js +8 -1
- package/dist/client/pages/Demo/index.js +3 -8
- package/dist/client/theme-api/AtomRenderer.d.ts +2 -2
- package/dist/client/theme-api/AtomRenderer.js +19 -35
- package/dist/client/theme-api/DumiDemo.js +8 -13
- package/dist/client/theme-api/DumiDemoGrid.js +12 -26
- package/dist/client/theme-api/DumiPage.js +16 -34
- package/dist/client/theme-api/openCodeSandbox.js +28 -26
- package/dist/client/theme-api/openStackBlitz.js +15 -16
- package/dist/client/theme-api/types.d.ts +15 -12
- package/dist/client/theme-api/useAtomAssets.js +1 -2
- package/dist/client/theme-api/useLocale.js +10 -19
- package/dist/client/theme-api/useNavData.js +78 -103
- package/dist/client/theme-api/usePrefersColor.d.ts +2 -2
- package/dist/client/theme-api/usePrefersColor.js +39 -66
- package/dist/client/theme-api/useRouteMeta.js +9 -23
- package/dist/client/theme-api/useSidebarData.js +124 -158
- package/dist/client/theme-api/useSiteSearch/index.d.ts +1 -1
- package/dist/client/theme-api/useSiteSearch/index.js +24 -38
- package/dist/client/theme-api/useTabMeta.js +8 -19
- package/dist/client/theme-api/utils.d.ts +6 -0
- package/dist/client/theme-api/utils.js +40 -46
- package/dist/client/typings.d.ts +0 -5
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +3 -0
- package/dist/features/assets.js +23 -4
- package/dist/features/autoAlias.js +8 -3
- package/dist/features/compile/babelLoaderCustomize.js +0 -2
- package/dist/features/compile/index.js +22 -10
- package/dist/features/configPlugins/index.js +3 -4
- package/dist/features/configPlugins/schema.d.ts +1 -1
- package/dist/features/configPlugins/schema.js +20 -3
- package/dist/features/derivative.js +54 -11
- package/dist/features/exportStatic.js +11 -7
- package/dist/features/exports.js +8 -3
- package/dist/features/html2sketch.js +7 -5
- package/dist/features/locales.js +53 -17
- package/dist/features/meta.js +23 -10
- package/dist/features/parser.js +17 -5
- package/dist/features/routes.js +63 -24
- package/dist/features/sideEffects/docSideEffectsWebpackPlugin.js +27 -16
- package/dist/features/sideEffects/index.js +13 -4
- package/dist/features/sitemap.js +17 -5
- package/dist/features/tabs.js +23 -11
- package/dist/features/theme/index.js +152 -39
- package/dist/features/theme/loader.js +23 -7
- package/dist/index.js +10 -2
- package/dist/loaders/demo/index.js +3 -3
- package/dist/loaders/markdown/index.d.ts +1 -1
- package/dist/loaders/markdown/index.js +36 -24
- package/dist/loaders/markdown/transformer/index.d.ts +4 -2
- package/dist/loaders/markdown/transformer/index.js +48 -19
- package/dist/loaders/markdown/transformer/rehypeDemo.d.ts +3 -1
- package/dist/loaders/markdown/transformer/rehypeDemo.js +125 -68
- package/dist/loaders/markdown/transformer/rehypeDesc.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeEnhancedTag.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeHighlightLine.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeImg.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeIsolation.js +36 -21
- package/dist/loaders/markdown/transformer/rehypeJsxify.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeLink.d.ts +1 -1
- package/dist/loaders/markdown/transformer/rehypeLink.js +24 -9
- package/dist/loaders/markdown/transformer/rehypeRaw.d.ts +1 -1
- package/dist/loaders/markdown/transformer/rehypeRaw.js +20 -6
- package/dist/loaders/markdown/transformer/rehypeSlug.js +16 -3
- package/dist/loaders/markdown/transformer/rehypeStrip.js +8 -3
- package/dist/loaders/markdown/transformer/rehypeText.js +14 -5
- package/dist/loaders/markdown/transformer/remarkBreaks.d.ts +3 -0
- package/dist/loaders/markdown/transformer/remarkBreaks.js +65 -0
- package/dist/loaders/markdown/transformer/remarkContainer.js +28 -13
- package/dist/loaders/markdown/transformer/remarkEmbed.js +43 -21
- package/dist/loaders/markdown/transformer/remarkMeta.d.ts +3 -1
- package/dist/loaders/markdown/transformer/remarkMeta.js +39 -9
- package/dist/loaders/page/index.js +12 -4
- package/dist/loaders/pre-raw/index.js +0 -2
- package/dist/preset.js +8 -3
- package/dist/registerMethods.js +0 -2
- package/dist/service/dev.js +8 -1
- package/dist/service/printHelp.js +3 -1
- package/dist/techStacks/react.js +8 -3
- package/dist/types.d.ts +6 -6
- package/dist/utils.d.ts +1 -1
- package/dist/utils.js +15 -6
- package/package.json +12 -10
- package/theme-default/builtins/API/index.js +15 -36
- package/theme-default/builtins/Badge/index.js +0 -3
- package/theme-default/builtins/Container/index.js +6 -15
- package/theme-default/builtins/Previewer/index.js +1 -8
- package/theme-default/builtins/SourceCode/index.js +15 -27
- package/theme-default/builtins/Table/index.js +10 -25
- package/theme-default/builtins/Tree/index.js +13 -44
- package/theme-default/layouts/DocLayout/index.js +14 -27
- package/theme-default/locales/en-US.json +4 -0
- package/theme-default/locales/zh-CN.json +4 -0
- package/theme-default/slots/ColorSwitch/index.js +7 -22
- package/theme-default/slots/Content/index.js +5 -7
- package/theme-default/slots/Content/index.less +16 -1
- package/theme-default/slots/ContentFooter/index.d.ts +4 -0
- package/theme-default/slots/ContentFooter/index.js +93 -0
- package/theme-default/slots/ContentFooter/index.less +163 -0
- package/theme-default/slots/ContentTabs/index.d.ts +1 -1
- package/theme-default/slots/ContentTabs/index.js +5 -5
- package/theme-default/slots/Features/index.js +6 -11
- package/theme-default/slots/Footer/index.js +1 -4
- package/theme-default/slots/Header/index.js +7 -18
- package/theme-default/slots/HeaderExtra/index.js +0 -2
- package/theme-default/slots/Hero/index.js +2 -6
- package/theme-default/slots/HeroTitle/index.js +0 -2
- package/theme-default/slots/LangSwitch/index.js +23 -35
- package/theme-default/slots/Logo/index.js +1 -4
- package/theme-default/slots/Navbar/index.js +14 -29
- package/theme-default/slots/NavbarExtra/index.js +0 -2
- package/theme-default/slots/NotFound/index.js +0 -2
- package/theme-default/slots/PreviewerActions/index.js +13 -35
- package/theme-default/slots/PreviewerActionsExtra/index.js +0 -2
- package/theme-default/slots/RtlSwitch/index.js +6 -20
- package/theme-default/slots/RtlSwitch/index.less +5 -0
- package/theme-default/slots/SearchBar/Input.d.ts +1 -1
- package/theme-default/slots/SearchBar/Input.js +6 -5
- package/theme-default/slots/SearchBar/Mask.d.ts +1 -1
- package/theme-default/slots/SearchBar/Mask.js +0 -1
- package/theme-default/slots/SearchBar/index.js +20 -41
- package/theme-default/slots/SearchResult/index.d.ts +1 -1
- package/theme-default/slots/SearchResult/index.js +13 -36
- package/theme-default/slots/Sidebar/index.js +1 -4
- package/theme-default/slots/SocialIcon/index.d.ts +2 -2
- package/theme-default/slots/SocialIcon/index.js +1 -3
- package/theme-default/slots/Toc/index.js +12 -28
|
@@ -16,7 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
20
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
28
|
|
|
22
29
|
// src/features/theme/index.ts
|
|
@@ -27,7 +34,9 @@ __export(theme_exports, {
|
|
|
27
34
|
module.exports = __toCommonJS(theme_exports);
|
|
28
35
|
var import_constants = require("../../constants");
|
|
29
36
|
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
37
|
+
var import_child_process = require("child_process");
|
|
30
38
|
var import_fs = __toESM(require("fs"));
|
|
39
|
+
var import_hosted_git_info = __toESM(require("hosted-git-info"));
|
|
31
40
|
var import_path = __toESM(require("path"));
|
|
32
41
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
33
42
|
var import_derivative = require("../derivative");
|
|
@@ -35,19 +44,33 @@ var import_loader = __toESM(require("./loader"));
|
|
|
35
44
|
var DEFAULT_THEME_PATH = import_path.default.join(__dirname, "../../../theme-default");
|
|
36
45
|
function getPkgThemeName(api) {
|
|
37
46
|
if (process.env.DUMI_THEME) {
|
|
38
|
-
const
|
|
39
|
-
|
|
47
|
+
const envThemePkgPath = require.resolve(
|
|
48
|
+
import_path.default.join(process.env.DUMI_THEME, "package.json"),
|
|
49
|
+
{ paths: [api.cwd] }
|
|
50
|
+
);
|
|
51
|
+
return require(envThemePkgPath).name;
|
|
40
52
|
}
|
|
41
|
-
const validDeps = Object.assign(
|
|
42
|
-
|
|
53
|
+
const validDeps = Object.assign(
|
|
54
|
+
{},
|
|
55
|
+
api.pkg.dependencies,
|
|
56
|
+
api.pkg.devDependencies
|
|
57
|
+
);
|
|
58
|
+
const pkgThemeName = Object.keys(validDeps).find(
|
|
59
|
+
(pkg) => pkg.split("/").pop().startsWith(import_constants.THEME_PREFIX)
|
|
60
|
+
);
|
|
43
61
|
return pkgThemeName;
|
|
44
62
|
}
|
|
45
63
|
function getPkgThemePath(api) {
|
|
46
64
|
const pkgThemeName = getPkgThemeName(api);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
65
|
+
if (process.env.DUMI_THEME) {
|
|
66
|
+
return import_path.default.resolve(api.cwd, process.env.DUMI_THEME);
|
|
67
|
+
}
|
|
68
|
+
return pkgThemeName && import_path.default.dirname(
|
|
69
|
+
import_plugin_utils.resolve.sync(`${pkgThemeName}/package.json`, {
|
|
70
|
+
basedir: api.cwd,
|
|
71
|
+
preserveSymlinks: true
|
|
72
|
+
})
|
|
73
|
+
);
|
|
51
74
|
}
|
|
52
75
|
function getModuleExports(modulePath) {
|
|
53
76
|
return (0, import_bundler_utils.parseModuleSync)({
|
|
@@ -65,7 +88,10 @@ function checkMinor2ByPkg(pkg) {
|
|
|
65
88
|
var theme_default = (api) => {
|
|
66
89
|
const defaultThemeData = (0, import_loader.default)(DEFAULT_THEME_PATH);
|
|
67
90
|
const pkgThemePath = getPkgThemePath(api);
|
|
68
|
-
const pkgThemeData = (0, import_plugin_utils.deepmerge)(
|
|
91
|
+
const pkgThemeData = (0, import_plugin_utils.deepmerge)(
|
|
92
|
+
defaultThemeData,
|
|
93
|
+
pkgThemePath ? (0, import_loader.default)(import_path.default.join(pkgThemePath, "dist")) : {}
|
|
94
|
+
);
|
|
69
95
|
const localThemePath = import_path.default.join(api.cwd, import_constants.LOCAL_THEME_DIR);
|
|
70
96
|
const localThemeData = import_fs.default.existsSync(localThemePath) ? (0, import_loader.default)(localThemePath) : void 0;
|
|
71
97
|
const themeMapKeys = [
|
|
@@ -80,13 +106,18 @@ var theme_default = (api) => {
|
|
|
80
106
|
api.registerPlugins([plugin]);
|
|
81
107
|
}
|
|
82
108
|
});
|
|
83
|
-
(0, import_derivative.safeExcludeInMFSU)(
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
109
|
+
(0, import_derivative.safeExcludeInMFSU)(
|
|
110
|
+
api,
|
|
111
|
+
[
|
|
112
|
+
"dumi/theme-default",
|
|
113
|
+
// for svgr
|
|
114
|
+
"@ant-design/icons-svg",
|
|
115
|
+
getPkgThemeName(api)
|
|
116
|
+
].filter(Boolean).map((pkg) => new RegExp(pkg))
|
|
117
|
+
);
|
|
88
118
|
api.register({
|
|
89
119
|
key: "modifyAppData",
|
|
120
|
+
// prepare themeData before umi appData, for generate layout routes
|
|
90
121
|
before: "appData",
|
|
91
122
|
async fn(memo) {
|
|
92
123
|
originalThemeData = await api.applyPlugins({
|
|
@@ -119,11 +150,14 @@ var theme_default = (api) => {
|
|
|
119
150
|
api.modifyAppData((memo) => {
|
|
120
151
|
memo._2LevelNavAvailable = checkMinor2ByPkg(api.pkg);
|
|
121
152
|
if (pkgThemePath && !memo._2LevelNavAvailable) {
|
|
122
|
-
memo._2LevelNavAvailable = checkMinor2ByPkg(
|
|
153
|
+
memo._2LevelNavAvailable = checkMinor2ByPkg(
|
|
154
|
+
require(import_path.default.join(pkgThemePath, "package.json"))
|
|
155
|
+
);
|
|
123
156
|
}
|
|
124
157
|
return memo;
|
|
125
158
|
});
|
|
126
159
|
api.modifyConfig((memo) => {
|
|
160
|
+
var _a, _b;
|
|
127
161
|
if (localThemeData) {
|
|
128
162
|
themeMapKeys.forEach((key) => {
|
|
129
163
|
Object.values(localThemeData[key] || {}).forEach((item) => {
|
|
@@ -132,10 +166,34 @@ var theme_default = (api) => {
|
|
|
132
166
|
});
|
|
133
167
|
}
|
|
134
168
|
memo.alias["dumi/theme"] = "dumi/theme-original";
|
|
135
|
-
memo.alias["dumi/theme-original"] = import_path.default.join(
|
|
169
|
+
memo.alias["dumi/theme-original"] = import_path.default.join(
|
|
170
|
+
api.paths.absTmpPath,
|
|
171
|
+
"dumi/theme"
|
|
172
|
+
);
|
|
136
173
|
memo.alias["dumi/theme-default"] = DEFAULT_THEME_PATH;
|
|
137
174
|
memo.extraBabelIncludes ?? (memo.extraBabelIncludes = []);
|
|
138
|
-
memo.extraBabelIncludes.push(
|
|
175
|
+
memo.extraBabelIncludes.push(
|
|
176
|
+
import_path.default.resolve(__dirname, "../../client/theme-api")
|
|
177
|
+
);
|
|
178
|
+
const repoUrl = ((_a = api.pkg.repository) == null ? void 0 : _a.url) || api.pkg.repository;
|
|
179
|
+
if (((_b = memo.themeConfig) == null ? void 0 : _b.editLink) !== false && typeof repoUrl === "string") {
|
|
180
|
+
const hostedGitIns = import_hosted_git_info.default.fromUrl(repoUrl);
|
|
181
|
+
let branch = "";
|
|
182
|
+
try {
|
|
183
|
+
branch = (0, import_child_process.execSync)("git branch --show-current", {
|
|
184
|
+
stdio: "pipe"
|
|
185
|
+
}).toString().trim();
|
|
186
|
+
} catch {
|
|
187
|
+
branch = "master";
|
|
188
|
+
}
|
|
189
|
+
if (hostedGitIns) {
|
|
190
|
+
memo.themeConfig ?? (memo.themeConfig = {});
|
|
191
|
+
memo.themeConfig.editLink = `${hostedGitIns.edit(
|
|
192
|
+
`${api.pkg.repository.directory || ""}/{filename}`,
|
|
193
|
+
{ committish: branch }
|
|
194
|
+
)}`;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
139
197
|
return memo;
|
|
140
198
|
});
|
|
141
199
|
api.chainWebpack((memo) => {
|
|
@@ -154,6 +212,45 @@ var theme_default = (api) => {
|
|
|
154
212
|
});
|
|
155
213
|
return memo;
|
|
156
214
|
});
|
|
215
|
+
api.onGenerateFiles({
|
|
216
|
+
// execute before umi tmpFiles plugin
|
|
217
|
+
stage: -Infinity,
|
|
218
|
+
fn() {
|
|
219
|
+
const { globalLoading } = api.appData;
|
|
220
|
+
const enableNProgress = !!api.config.themeConfig.nprogress;
|
|
221
|
+
api.appData.globalLoading = "@@/dumi/theme/loading";
|
|
222
|
+
api.writeTmpFile({
|
|
223
|
+
noPluginDir: true,
|
|
224
|
+
path: "dumi/theme/loading.tsx",
|
|
225
|
+
content: `${enableNProgress ? `import nprogress from '${(0, import_plugin_utils.winPath)(
|
|
226
|
+
import_path.default.dirname(require.resolve("nprogress/package"))
|
|
227
|
+
)}';
|
|
228
|
+
import './nprogress.css';` : ""}${globalLoading ? `
|
|
229
|
+
import UserLoading from '${globalLoading}';` : ""}
|
|
230
|
+
import React, { useLayoutEffect, type FC } from 'react';
|
|
231
|
+
import { useSiteData } from 'dumi';
|
|
232
|
+
|
|
233
|
+
const DumiLoading: FC = () => {
|
|
234
|
+
const { setLoading } = useSiteData();
|
|
235
|
+
|
|
236
|
+
useLayoutEffect(() => {
|
|
237
|
+
setLoading(true);${enableNProgress ? `
|
|
238
|
+
nprogress.start();` : ""}
|
|
239
|
+
|
|
240
|
+
return () => {
|
|
241
|
+
setLoading(false);${enableNProgress ? `
|
|
242
|
+
nprogress.done();` : ""}
|
|
243
|
+
}
|
|
244
|
+
}, []);
|
|
245
|
+
|
|
246
|
+
return ${globalLoading ? "<UserLoading />" : "null"};
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export default DumiLoading;
|
|
250
|
+
`
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
});
|
|
157
254
|
api.onGenerateFiles(() => {
|
|
158
255
|
var _a, _b, _c, _d, _e;
|
|
159
256
|
themeMapKeys.forEach((key) => {
|
|
@@ -179,17 +276,14 @@ var theme_default = (api) => {
|
|
|
179
276
|
const entryExports = entryFile ? getModuleExports(entryFile) : [];
|
|
180
277
|
const hasDefaultExport = entryExports.includes("default");
|
|
181
278
|
const hasNamedExport = entryExports.some((exp) => exp !== "default");
|
|
182
|
-
const enableNProgress = !!api.config.themeConfig.nprogress;
|
|
183
279
|
api.writeTmpFile({
|
|
184
280
|
noPluginDir: true,
|
|
185
281
|
path: "dumi/theme/ContextWrapper.tsx",
|
|
186
282
|
content: `import React, { useState, useEffect, useRef } from 'react';
|
|
187
283
|
import { useOutlet, history } from 'dumi';
|
|
188
|
-
${
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
` : ""}
|
|
192
|
-
import { SiteContext } from '${(0, import_plugin_utils.winPath)(require.resolve("../../client/theme-api/context"))}';
|
|
284
|
+
import { SiteContext } from '${(0, import_plugin_utils.winPath)(
|
|
285
|
+
require.resolve("../../client/theme-api/context")
|
|
286
|
+
)}';
|
|
193
287
|
import { demos, components } from '../meta';
|
|
194
288
|
import { locales } from '../locales/config';${hasDefaultExport ? `
|
|
195
289
|
import entryDefaultExport from '${(0, import_plugin_utils.winPath)(entryFile)}';` : ""}${hasNamedExport ? `
|
|
@@ -210,12 +304,6 @@ export default function DumiContextWrapper() {
|
|
|
210
304
|
if (next.location.pathname !== prev.current) {
|
|
211
305
|
prev.current = next.location.pathname;
|
|
212
306
|
|
|
213
|
-
// mark loading when route change, page component will set false when loaded
|
|
214
|
-
setLoading(true);
|
|
215
|
-
|
|
216
|
-
// start nprogress
|
|
217
|
-
${enableNProgress ? `nprogress.start();` : ""}
|
|
218
|
-
|
|
219
307
|
// scroll to top when route changed
|
|
220
308
|
document.documentElement.scrollTo(0, 0);
|
|
221
309
|
}
|
|
@@ -224,7 +312,9 @@ export default function DumiContextWrapper() {
|
|
|
224
312
|
|
|
225
313
|
return (
|
|
226
314
|
<SiteContext.Provider value={{
|
|
227
|
-
pkg: ${JSON.stringify(
|
|
315
|
+
pkg: ${JSON.stringify(
|
|
316
|
+
import_plugin_utils.lodash.pick(api.pkg, ...Object.keys(import_constants.PICKED_PKG_FIELDS))
|
|
317
|
+
)},
|
|
228
318
|
historyType: "${((_a = api.config.history) == null ? void 0 : _a.type) || "browser"}",
|
|
229
319
|
entryExports,
|
|
230
320
|
demos,
|
|
@@ -233,7 +323,12 @@ export default function DumiContextWrapper() {
|
|
|
233
323
|
loading,
|
|
234
324
|
setLoading,
|
|
235
325
|
hostname: ${JSON.stringify((_b = api.config.sitemap) == null ? void 0 : _b.hostname)},
|
|
236
|
-
themeConfig: ${JSON.stringify(
|
|
326
|
+
themeConfig: ${JSON.stringify(
|
|
327
|
+
Object.assign(
|
|
328
|
+
import_plugin_utils.lodash.pick(api.config, "logo", "description", "title"),
|
|
329
|
+
api.config.themeConfig
|
|
330
|
+
)
|
|
331
|
+
)},
|
|
237
332
|
_2_level_nav_available: ${api.appData._2LevelNavAvailable},
|
|
238
333
|
}}>
|
|
239
334
|
{outlet}
|
|
@@ -326,16 +421,34 @@ export default function DumiContextWrapper() {
|
|
|
326
421
|
);
|
|
327
422
|
})();`;
|
|
328
423
|
});
|
|
329
|
-
|
|
424
|
+
api.addEntryImportsAhead(() => [
|
|
425
|
+
{
|
|
426
|
+
specifier: "{ getPluginManager as getDumiPluginManager }",
|
|
427
|
+
source: "./core/plugin"
|
|
428
|
+
},
|
|
429
|
+
{
|
|
430
|
+
specifier: "{ setPluginManager as setDumiPluginManager }",
|
|
431
|
+
source: (0, import_plugin_utils.winPath)(require.resolve("../../client/theme-api/utils"))
|
|
432
|
+
}
|
|
433
|
+
]);
|
|
434
|
+
api.addEntryCode(() => "setDumiPluginManager(getDumiPluginManager());");
|
|
435
|
+
api.addRuntimePluginKey(() => [
|
|
436
|
+
"modifyCodeSandboxData",
|
|
437
|
+
"modifyStackBlitzData"
|
|
438
|
+
]);
|
|
439
|
+
if (
|
|
440
|
+
/*isTnpm*/
|
|
441
|
+
require("@umijs/core/package").__npminstall_done && import_fs.default.existsSync(localThemePath) && import_fs.default.lstatSync(localThemePath).isSymbolicLink()
|
|
442
|
+
) {
|
|
330
443
|
api.chainWebpack((memo) => {
|
|
331
444
|
const devThemeNodeModules = import_path.default.join(api.cwd, "../node_modules");
|
|
332
|
-
memo.snapshot(
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
445
|
+
memo.snapshot(
|
|
446
|
+
(0, import_plugin_utils.deepmerge)(memo.get("snapshot"), {
|
|
447
|
+
immutablePaths: [devThemeNodeModules],
|
|
448
|
+
managedPaths: [devThemeNodeModules]
|
|
449
|
+
})
|
|
450
|
+
);
|
|
336
451
|
return memo;
|
|
337
452
|
});
|
|
338
453
|
}
|
|
339
454
|
};
|
|
340
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
341
|
-
0 && (module.exports = {});
|
|
@@ -16,7 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
20
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
28
|
|
|
22
29
|
// src/features/theme/loader.ts
|
|
@@ -29,7 +36,9 @@ var import_path = __toESM(require("path"));
|
|
|
29
36
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
30
37
|
function getComponentMapFromDir(globExp, dir) {
|
|
31
38
|
return import_plugin_utils.glob.sync(globExp, { cwd: dir }).reduce((ret, file) => {
|
|
32
|
-
const specifier = import_path.default.basename(
|
|
39
|
+
const specifier = import_path.default.basename(
|
|
40
|
+
(0, import_plugin_utils.winPath)(file).replace(/(\/index)?\.[a-z]+$/, "")
|
|
41
|
+
);
|
|
33
42
|
if (/^[A-Z\d]/.test(specifier)) {
|
|
34
43
|
ret[specifier] = {
|
|
35
44
|
specifier,
|
|
@@ -54,11 +63,18 @@ var loader_default = (dir) => {
|
|
|
54
63
|
name: import_path.default.basename(dir),
|
|
55
64
|
path: dir,
|
|
56
65
|
locales: getLocaleMapFromDir("locales/*.json", dir),
|
|
57
|
-
builtins: getComponentMapFromDir(
|
|
58
|
-
|
|
59
|
-
|
|
66
|
+
builtins: getComponentMapFromDir(
|
|
67
|
+
"builtins/{!(*.d),*/index}.{js,jsx,ts,tsx}",
|
|
68
|
+
dir
|
|
69
|
+
),
|
|
70
|
+
slots: getComponentMapFromDir(
|
|
71
|
+
"slots/{!(*.d),*/index}.{js,jsx,ts,tsx}",
|
|
72
|
+
dir
|
|
73
|
+
),
|
|
74
|
+
layouts: getComponentMapFromDir(
|
|
75
|
+
"layouts/{GlobalLayout,DocLayout,DemoLayout}{.,/index.}{js,jsx,ts,tsx}",
|
|
76
|
+
dir
|
|
77
|
+
),
|
|
60
78
|
...plugin ? { plugin: import_path.default.join(dir, plugin) } : {}
|
|
61
79
|
};
|
|
62
80
|
};
|
|
63
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
64
|
-
0 && (module.exports = {});
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
19
|
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
21
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
22
29
|
|
|
23
30
|
// src/index.ts
|
|
@@ -36,5 +43,6 @@ var defineConfig = (config) => config;
|
|
|
36
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
44
|
0 && (module.exports = {
|
|
38
45
|
defineConfig,
|
|
39
|
-
unistUtilVisit
|
|
46
|
+
unistUtilVisit,
|
|
47
|
+
...require("umi")
|
|
40
48
|
});
|
|
@@ -24,12 +24,12 @@ __export(demo_exports, {
|
|
|
24
24
|
module.exports = __toCommonJS(demo_exports);
|
|
25
25
|
function demoLoader(raw) {
|
|
26
26
|
const opts = this.getOptions();
|
|
27
|
-
const techStackName = new URLSearchParams(this.resourceQuery).get(
|
|
27
|
+
const techStackName = new URLSearchParams(this.resourceQuery).get(
|
|
28
|
+
"techStack"
|
|
29
|
+
);
|
|
28
30
|
const techStack = opts.techStacks.find((t) => t.name === techStackName);
|
|
29
31
|
return techStack.transformCode(raw, {
|
|
30
32
|
type: "external",
|
|
31
33
|
fileAbsPath: this.resourcePath
|
|
32
34
|
});
|
|
33
35
|
}
|
|
34
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
-
0 && (module.exports = {});
|
|
@@ -9,6 +9,6 @@ interface IMdLoaderDemosModeOptions extends Omit<IMdLoaderDefaultModeOptions, 'b
|
|
|
9
9
|
onResolveDemos?: (demos: NonNullable<IMdTransformerResult['meta']['demos']>) => void;
|
|
10
10
|
onResolveAtomMeta?: (atomId: string, meta: IMdTransformerResult['meta']['frontmatter']) => void;
|
|
11
11
|
}
|
|
12
|
-
export
|
|
12
|
+
export type IMdLoaderOptions = IMdLoaderDefaultModeOptions | IMdLoaderDemosModeOptions;
|
|
13
13
|
export default function mdLoader(this: any, content: string): void;
|
|
14
14
|
export {};
|
|
@@ -16,7 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
20
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
28
|
|
|
22
29
|
// src/loaders/markdown/index.ts
|
|
@@ -51,7 +58,8 @@ function emit(opts, ret) {
|
|
|
51
58
|
if (frontmatter.atomId && opts.onResolveAtomMeta) {
|
|
52
59
|
opts.onResolveAtomMeta(frontmatter.atomId, frontmatter);
|
|
53
60
|
}
|
|
54
|
-
return import_plugin_utils.Mustache.render(
|
|
61
|
+
return import_plugin_utils.Mustache.render(
|
|
62
|
+
`import React from 'react';
|
|
55
63
|
|
|
56
64
|
export const demos = {
|
|
57
65
|
{{#demos}}
|
|
@@ -64,25 +72,27 @@ export const demos = {
|
|
|
64
72
|
export const frontmatter = {{{frontmatter}}};
|
|
65
73
|
export const toc = {{{toc}}};
|
|
66
74
|
export const texts = {{{texts}}};
|
|
67
|
-
`,
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
`,
|
|
76
|
+
{
|
|
77
|
+
demos,
|
|
78
|
+
frontmatter: JSON.stringify(frontmatter),
|
|
79
|
+
toc: JSON.stringify(toc),
|
|
80
|
+
texts: JSON.stringify(texts),
|
|
81
|
+
renderAsset: function renderAsset() {
|
|
82
|
+
if (!("asset" in this))
|
|
83
|
+
return "null";
|
|
84
|
+
let { asset } = this;
|
|
85
|
+
const { sources } = this;
|
|
86
|
+
Object.keys(this.sources).forEach((file) => {
|
|
87
|
+
if (!asset.dependencies[file])
|
|
88
|
+
return;
|
|
89
|
+
asset = import_plugin_utils.lodash.cloneDeep(asset);
|
|
90
|
+
asset.dependencies[file].value = `{{{require('-!${sources[file]}?dumi-raw').default}}}`;
|
|
91
|
+
});
|
|
92
|
+
return JSON.stringify(asset, null, 2).replace(/"{{{|}}}"/g, "");
|
|
93
|
+
}
|
|
84
94
|
}
|
|
85
|
-
|
|
95
|
+
);
|
|
86
96
|
} else {
|
|
87
97
|
const isTabContent = (0, import_tabs.isTabRouteFile)(this.resourcePath);
|
|
88
98
|
return `${Object.values(opts.builtins).map((item) => `import ${item.specifier} from '${item.source}';`).join("\n")}
|
|
@@ -100,7 +110,9 @@ export default DumiMarkdownContent;`;
|
|
|
100
110
|
}
|
|
101
111
|
}
|
|
102
112
|
function getDepsCacheKey(deps = []) {
|
|
103
|
-
return JSON.stringify(
|
|
113
|
+
return JSON.stringify(
|
|
114
|
+
deps.map((file) => `${file}:${import_fs.default.statSync(file).mtimeMs}`)
|
|
115
|
+
);
|
|
104
116
|
}
|
|
105
117
|
var deferrer = {};
|
|
106
118
|
var depsMapping = {};
|
|
@@ -132,7 +144,9 @@ function mdLoader(content) {
|
|
|
132
144
|
fileAbsPath: (0, import_plugin_utils.winPath)(this.resourcePath)
|
|
133
145
|
});
|
|
134
146
|
deferrer[cacheKey].then((ret) => {
|
|
135
|
-
depsMapping[this.resourcePath] = ret.meta.embeds.concat(
|
|
147
|
+
depsMapping[this.resourcePath] = ret.meta.embeds.concat(
|
|
148
|
+
getDemoSourceFiles(ret.meta.demos)
|
|
149
|
+
);
|
|
136
150
|
const finalCacheKey = [
|
|
137
151
|
baseCacheKey,
|
|
138
152
|
getDepsCacheKey(depsMapping[this.resourcePath])
|
|
@@ -142,5 +156,3 @@ function mdLoader(content) {
|
|
|
142
156
|
delete deferrer[cacheKey];
|
|
143
157
|
}).catch(cb);
|
|
144
158
|
}
|
|
145
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
146
|
-
0 && (module.exports = {});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IParsedBlockAsset } from "../../../assetParsers/block";
|
|
2
|
-
import type { IRouteMeta } from "../../../client/theme-api/types";
|
|
3
|
-
import type { IDumiConfig, IDumiTechStack } from "../../../types";
|
|
2
|
+
import type { ILocalesConfig, IRouteMeta } from "../../../client/theme-api/types";
|
|
3
|
+
import type { IApi, IDumiConfig, IDumiTechStack } from "../../../types";
|
|
4
4
|
import type { IRoute } from 'umi';
|
|
5
5
|
import type { Data } from 'vfile';
|
|
6
6
|
declare module 'hast' {
|
|
@@ -42,6 +42,8 @@ export interface IMdTransformerOptions {
|
|
|
42
42
|
extraRemarkPlugins?: IDumiConfig['extraRemarkPlugins'];
|
|
43
43
|
extraRehypePlugins?: IDumiConfig['extraRehypePlugins'];
|
|
44
44
|
routes: Record<string, IRoute>;
|
|
45
|
+
locales: ILocalesConfig;
|
|
46
|
+
pkg: IApi['pkg'];
|
|
45
47
|
}
|
|
46
48
|
export interface IMdTransformerResult {
|
|
47
49
|
content: string;
|
|
@@ -16,7 +16,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
}
|
|
17
17
|
return to;
|
|
18
18
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
20
27
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
28
|
|
|
22
29
|
// src/loaders/markdown/transformer/index.ts
|
|
@@ -25,7 +32,9 @@ __export(transformer_exports, {
|
|
|
25
32
|
default: () => transformer_default
|
|
26
33
|
});
|
|
27
34
|
module.exports = __toCommonJS(transformer_exports);
|
|
35
|
+
var import_constants = require("../../../constants");
|
|
28
36
|
var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
|
|
37
|
+
var import_plugin_utils = require("umi/plugin-utils");
|
|
29
38
|
var import_rehypeDemo = __toESM(require("./rehypeDemo"));
|
|
30
39
|
var import_rehypeDesc = __toESM(require("./rehypeDesc"));
|
|
31
40
|
var import_rehypeEnhancedTag = __toESM(require("./rehypeEnhancedTag"));
|
|
@@ -38,9 +47,17 @@ var import_rehypeRaw = __toESM(require("./rehypeRaw"));
|
|
|
38
47
|
var import_rehypeSlug = __toESM(require("./rehypeSlug"));
|
|
39
48
|
var import_rehypeStrip = __toESM(require("./rehypeStrip"));
|
|
40
49
|
var import_rehypeText = __toESM(require("./rehypeText"));
|
|
50
|
+
var import_remarkBreaks = __toESM(require("./remarkBreaks"));
|
|
41
51
|
var import_remarkContainer = __toESM(require("./remarkContainer"));
|
|
42
52
|
var import_remarkEmbed = __toESM(require("./remarkEmbed"));
|
|
43
53
|
var import_remarkMeta = __toESM(require("./remarkMeta"));
|
|
54
|
+
function keepSoftBreak(pkg) {
|
|
55
|
+
var _a, _b, _c;
|
|
56
|
+
if (((_a = pkg == null ? void 0 : pkg.name) == null ? void 0 : _a.startsWith("@examples/")) || (pkg == null ? void 0 : pkg.name) === "dumi")
|
|
57
|
+
return false;
|
|
58
|
+
const ver = ((_b = pkg == null ? void 0 : pkg.devDependencies) == null ? void 0 : _b.dumi) ?? ((_c = pkg == null ? void 0 : pkg.dependencies) == null ? void 0 : _c.dumi) ?? "^2.0.0";
|
|
59
|
+
return !import_plugin_utils.semver.subset(ver, import_constants.VERSION_2_DEPRECATE_SOFT_BREAKS);
|
|
60
|
+
}
|
|
44
61
|
function applyUnifiedPlugin(opts) {
|
|
45
62
|
const [plugin, options] = Array.isArray(opts.plugin) ? opts.plugin : [opts.plugin];
|
|
46
63
|
const mod = typeof plugin === "function" ? plugin : require(require.resolve(plugin, { paths: [opts.cwd] }));
|
|
@@ -48,12 +65,12 @@ function applyUnifiedPlugin(opts) {
|
|
|
48
65
|
opts.processor.use(fn, options);
|
|
49
66
|
}
|
|
50
67
|
var transformer_default = async (raw, opts) => {
|
|
51
|
-
var _a, _b;
|
|
68
|
+
var _a, _b, _c;
|
|
69
|
+
let fileLocaleLessPath = opts.fileAbsPath;
|
|
52
70
|
const { unified } = await import("unified");
|
|
53
71
|
const { default: remarkParse } = await import("remark-parse");
|
|
54
72
|
const { default: remarkFrontmatter } = await import("remark-frontmatter");
|
|
55
73
|
const { default: remarkDirective } = await import("remark-directive");
|
|
56
|
-
const { default: remarkBreaks } = await import("remark-breaks");
|
|
57
74
|
const { default: remarkGfm } = await import("remark-gfm");
|
|
58
75
|
const { default: remarkRehype } = await import("remark-rehype");
|
|
59
76
|
const { default: rehypeAutolinkHeadings } = await import("rehype-autolink-headings");
|
|
@@ -62,40 +79,52 @@ var transformer_default = async (raw, opts) => {
|
|
|
62
79
|
extensions: [".js", ".jsx", ".ts", ".tsx"],
|
|
63
80
|
alias: opts.alias
|
|
64
81
|
});
|
|
82
|
+
const fileLocale = (_a = opts.locales.find(
|
|
83
|
+
(locale) => opts.fileAbsPath.endsWith(`.${locale.id}.md`)
|
|
84
|
+
)) == null ? void 0 : _a.id;
|
|
85
|
+
if (fileLocale) {
|
|
86
|
+
fileLocaleLessPath = opts.fileAbsPath.replace(`.${fileLocale}.md`, ".md");
|
|
87
|
+
}
|
|
65
88
|
const processor = unified().use(remarkParse).use(import_remarkEmbed.default, { fileAbsPath: opts.fileAbsPath, alias: opts.alias }).use(remarkFrontmatter).use(import_remarkMeta.default, {
|
|
66
89
|
cwd: opts.cwd,
|
|
67
90
|
fileAbsPath: opts.fileAbsPath,
|
|
91
|
+
fileLocaleLessPath,
|
|
68
92
|
resolve: opts.resolve
|
|
69
|
-
}).use(remarkDirective).use(import_remarkContainer.default).use(
|
|
70
|
-
(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
93
|
+
}).use(remarkDirective).use(import_remarkContainer.default).use(remarkGfm);
|
|
94
|
+
if (keepSoftBreak(opts.pkg)) {
|
|
95
|
+
processor.use(import_remarkBreaks.default, { fileAbsPath: opts.fileAbsPath });
|
|
96
|
+
}
|
|
97
|
+
(_b = opts.extraRemarkPlugins) == null ? void 0 : _b.forEach(
|
|
98
|
+
(plugin) => applyUnifiedPlugin({
|
|
99
|
+
plugin,
|
|
100
|
+
processor,
|
|
101
|
+
cwd: opts.cwd
|
|
102
|
+
})
|
|
103
|
+
);
|
|
75
104
|
processor.use(remarkRehype, { allowDangerousHtml: true }).use(import_rehypeRaw.default, {
|
|
76
105
|
fileAbsPath: opts.fileAbsPath
|
|
77
|
-
}).use(import_rehypeHighlightLine.default, {
|
|
78
|
-
resolve: opts.resolve
|
|
79
|
-
}).use(rehypeRemoveComments, { removeConditional: true }).use(import_rehypeStrip.default).use(import_rehypeImg.default).use(import_rehypeDemo.default, {
|
|
106
|
+
}).use(import_rehypeHighlightLine.default).use(rehypeRemoveComments, { removeConditional: true }).use(import_rehypeStrip.default).use(import_rehypeImg.default).use(import_rehypeDemo.default, {
|
|
80
107
|
techStacks: opts.techStacks,
|
|
81
108
|
cwd: opts.cwd,
|
|
82
109
|
fileAbsPath: opts.fileAbsPath,
|
|
110
|
+
fileLocaleLessPath,
|
|
111
|
+
fileLocale,
|
|
83
112
|
resolve: opts.resolve,
|
|
84
113
|
resolver
|
|
85
114
|
}).use(import_rehypeSlug.default).use(import_rehypeLink.default, {
|
|
86
115
|
fileAbsPath: opts.fileAbsPath,
|
|
87
116
|
routes: opts.routes
|
|
88
117
|
}).use(rehypeAutolinkHeadings).use(import_rehypeIsolation.default).use(import_rehypeEnhancedTag.default).use(import_rehypeDesc.default).use(import_rehypeText.default);
|
|
89
|
-
(
|
|
90
|
-
plugin
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
118
|
+
(_c = opts.extraRehypePlugins) == null ? void 0 : _c.forEach(
|
|
119
|
+
(plugin) => applyUnifiedPlugin({
|
|
120
|
+
plugin,
|
|
121
|
+
processor,
|
|
122
|
+
cwd: opts.cwd
|
|
123
|
+
})
|
|
124
|
+
);
|
|
94
125
|
const result = await processor.use(import_rehypeJsxify.default).process(raw);
|
|
95
126
|
return {
|
|
96
127
|
content: String(result.value),
|
|
97
128
|
meta: result.data
|
|
98
129
|
};
|
|
99
130
|
};
|
|
100
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
101
|
-
0 && (module.exports = {});
|
|
@@ -5,8 +5,10 @@ import type { IMdTransformerOptions } from '.';
|
|
|
5
5
|
export declare const DEMO_PROP_VALUE_KEY = "$demo-prop-value-key";
|
|
6
6
|
export declare const DUMI_DEMO_TAG = "DumiDemo";
|
|
7
7
|
export declare const DUMI_DEMO_GRID_TAG = "DumiDemoGrid";
|
|
8
|
-
|
|
8
|
+
type IRehypeDemoOptions = Pick<IMdTransformerOptions, 'techStacks' | 'cwd' | 'fileAbsPath' | 'resolve'> & {
|
|
9
9
|
resolver: typeof sync;
|
|
10
|
+
fileLocaleLessPath: string;
|
|
11
|
+
fileLocale?: string;
|
|
10
12
|
};
|
|
11
13
|
export default function rehypeDemo(opts: IRehypeDemoOptions): Transformer<Root>;
|
|
12
14
|
export {};
|