@umijs/plugin-docs 4.0.0-beta.17 → 4.0.0-beta.18
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/dist/compiler.d.ts +0 -3
- package/dist/compiler.js +3 -9
- package/dist/index.js +7 -0
- package/package.json +6 -3
package/dist/compiler.d.ts
CHANGED
package/dist/compiler.js
CHANGED
|
@@ -15,10 +15,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
15
15
|
exports.compile = void 0;
|
|
16
16
|
// @ts-ignore
|
|
17
17
|
const mdx_1 = __importDefault(require("@mdx-js/mdx"));
|
|
18
|
+
const remark_slug_1 = __importDefault(require("remark-slug"));
|
|
18
19
|
function compile(opts) {
|
|
19
20
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20
21
|
let result = yield (0, mdx_1.default)(opts.content, {
|
|
21
|
-
remarkPlugins: [],
|
|
22
|
+
remarkPlugins: [remark_slug_1.default],
|
|
22
23
|
rehypePlugins: [],
|
|
23
24
|
compilers: [],
|
|
24
25
|
});
|
|
@@ -27,14 +28,7 @@ import React from 'react';
|
|
|
27
28
|
${result}`;
|
|
28
29
|
result = result.replace('/* @jsxRuntime classic */', '');
|
|
29
30
|
result = result.replace('/* @jsx mdx */', '');
|
|
30
|
-
|
|
31
|
-
result = `${result}\nMDXContent.title = '${title}';`;
|
|
32
|
-
return {
|
|
33
|
-
result,
|
|
34
|
-
meta: {
|
|
35
|
-
title,
|
|
36
|
-
},
|
|
37
|
-
};
|
|
31
|
+
return { result };
|
|
38
32
|
});
|
|
39
33
|
}
|
|
40
34
|
exports.compile = compile;
|
package/dist/index.js
CHANGED
|
@@ -72,6 +72,13 @@ exports.default = (api) => {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
|
+
// @TODO: 需要能够动态解析 theme 中导出的组件,现在是硬编码
|
|
76
|
+
api.writeTmpFile({
|
|
77
|
+
path: 'index.ts',
|
|
78
|
+
content: `
|
|
79
|
+
export { Message } from '${require.resolve('../client/theme-doc')}';
|
|
80
|
+
`,
|
|
81
|
+
});
|
|
75
82
|
api.writeTmpFile({
|
|
76
83
|
path: 'Layout.tsx',
|
|
77
84
|
content: `
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.18",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/plugin-docs#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -22,11 +22,14 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@mdx-js/mdx": "1.6.22",
|
|
25
|
-
"
|
|
25
|
+
"keymaster": "^1.6.2",
|
|
26
|
+
"remark-slug": "6.1.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
29
|
+
"@types/keymaster": "^1.6.30",
|
|
30
|
+
"classnames": "^2.3.1",
|
|
28
31
|
"tailwindcss": "^3.0.15",
|
|
29
|
-
"umi": "4.0.0-beta.
|
|
32
|
+
"umi": "4.0.0-beta.18"
|
|
30
33
|
},
|
|
31
34
|
"publishConfig": {
|
|
32
35
|
"access": "public"
|