@umijs/plugin-docs 4.0.55 → 4.0.57
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.js +5 -13
- package/dist/index.js +5 -19
- package/package.json +2 -2
package/dist/compiler.js
CHANGED
|
@@ -16,10 +16,7 @@ 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(
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
23
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
21
|
|
|
25
22
|
// src/compiler.ts
|
|
@@ -60,16 +57,14 @@ async function compile(opts) {
|
|
|
60
57
|
});
|
|
61
58
|
try {
|
|
62
59
|
let result = String(await compiler.process(opts.content));
|
|
63
|
-
result = result.replace(
|
|
64
|
-
"function MDXContent(props = {}) {",
|
|
65
|
-
`
|
|
60
|
+
result = result.replace("function MDXContent(props = {}) {", `
|
|
66
61
|
import { useEffect } from 'react';
|
|
67
62
|
|
|
68
63
|
function MDXContent(props = {}) {
|
|
69
64
|
|
|
70
65
|
useEffect(() => {
|
|
71
66
|
if (window.location.hash.length !== 0) {
|
|
72
|
-
//
|
|
67
|
+
// \u4E3A\u4E86\u53F3\u4FA7\u5185\u5BB9\u533A\u80FD\u6B63\u5E38\u8DF3\u8F6C
|
|
73
68
|
const hash = decodeURIComponent(window.location.hash);
|
|
74
69
|
setTimeout(() => {
|
|
75
70
|
document.getElementById(hash.slice(1))?.scrollIntoView();
|
|
@@ -83,15 +78,12 @@ function MDXContent(props = {}) {
|
|
|
83
78
|
});
|
|
84
79
|
}, []);
|
|
85
80
|
|
|
86
|
-
`
|
|
87
|
-
);
|
|
81
|
+
`);
|
|
88
82
|
return { result };
|
|
89
83
|
} catch (e) {
|
|
90
84
|
import_plugin_utils.logger.error(e.reason);
|
|
91
85
|
import_plugin_utils.logger.error(`Above error occurred in ${opts.fileName} at line ${e.line}`);
|
|
92
|
-
import_plugin_utils.logger.error(
|
|
93
|
-
opts.content.split("\n").filter((_, i) => i == e.line - 1).join("\n")
|
|
94
|
-
);
|
|
86
|
+
import_plugin_utils.logger.error(opts.content.split("\n").filter((_, i) => i == e.line - 1).join("\n"));
|
|
95
87
|
import_plugin_utils.logger.error(" ".repeat(e.column - 1) + "^");
|
|
96
88
|
if (process.env.NODE_ENV === "production") {
|
|
97
89
|
throw new Error("compile error", { cause: e });
|
package/dist/index.js
CHANGED
|
@@ -16,10 +16,7 @@ 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(
|
|
20
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
21
|
-
mod
|
|
22
|
-
));
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
23
20
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
24
21
|
|
|
25
22
|
// src/index.ts
|
|
@@ -85,10 +82,7 @@ var src_default = (api) => {
|
|
|
85
82
|
for (const route in r) {
|
|
86
83
|
if (r[route].path.match(/^[a-z]{2}-[A-Z]{2}\/.*/))
|
|
87
84
|
continue;
|
|
88
|
-
const defaultLangFile = r[route].file.replace(
|
|
89
|
-
/(.[a-z]{2}-[A-Z]{2})?.md$/,
|
|
90
|
-
""
|
|
91
|
-
);
|
|
85
|
+
const defaultLangFile = r[route].file.replace(/(.[a-z]{2}-[A-Z]{2})?.md$/, "");
|
|
92
86
|
Object.keys(locales).map((l) => {
|
|
93
87
|
if (r[defaultLangFile] && !r[defaultLangFile + "." + l]) {
|
|
94
88
|
r[defaultLangFile + "." + l] = {
|
|
@@ -117,9 +111,7 @@ var src_default = (api) => {
|
|
|
117
111
|
api.writeTmpFile({
|
|
118
112
|
path: "index.ts",
|
|
119
113
|
content: `
|
|
120
|
-
export { ${exports.filter((item) => !item.startsWith("$")).join(", ")} } from '${(0, import_utils.winPath)(
|
|
121
|
-
require.resolve("../client/theme-doc/index.ts")
|
|
122
|
-
)}';
|
|
114
|
+
export { ${exports.filter((item) => !item.startsWith("$")).join(", ")} } from '${(0, import_utils.winPath)(require.resolve("../client/theme-doc/index.ts"))}';
|
|
123
115
|
`
|
|
124
116
|
});
|
|
125
117
|
api.writeTmpFile({
|
|
@@ -127,9 +119,7 @@ export { ${exports.filter((item) => !item.startsWith("$")).join(", ")} } from '$
|
|
|
127
119
|
content: `
|
|
128
120
|
import React from 'react';
|
|
129
121
|
import { useOutlet, useAppData, useLocation, Link, history } from 'umi';
|
|
130
|
-
import { $Layout as Layout } from '${(0, import_utils.winPath)(
|
|
131
|
-
require.resolve("../client/theme-doc/index.ts")
|
|
132
|
-
)}';
|
|
122
|
+
import { $Layout as Layout } from '${(0, import_utils.winPath)(require.resolve("../client/theme-doc/index.ts"))}';
|
|
133
123
|
${themeExists ? `import themeConfig from '${themeConfigPath}'` : `const themeConfig = {}`}
|
|
134
124
|
|
|
135
125
|
${injectLocale}
|
|
@@ -160,11 +150,7 @@ export default () => {
|
|
|
160
150
|
});
|
|
161
151
|
};
|
|
162
152
|
function withTmpPath(opts) {
|
|
163
|
-
return (0, import_path.join)(
|
|
164
|
-
opts.api.paths.absTmpPath,
|
|
165
|
-
opts.api.plugin.key && !opts.noPluginDir ? `plugin-${opts.api.plugin.key}` : "",
|
|
166
|
-
opts.path
|
|
167
|
-
);
|
|
153
|
+
return (0, import_path.join)(opts.api.paths.absTmpPath, opts.api.plugin.key && !opts.noPluginDir ? `plugin-${opts.api.plugin.key}` : "", opts.path);
|
|
168
154
|
}
|
|
169
155
|
// Annotate the CommonJS export names for ESM import in node:
|
|
170
156
|
0 && (module.exports = {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.57",
|
|
4
4
|
"description": "@umijs/plugin-docs",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugin-docs#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"rehype-slug": "5.0.1",
|
|
44
44
|
"remark-gfm": "^3.0.1",
|
|
45
45
|
"tailwindcss": "^3.2.4",
|
|
46
|
-
"umi": "4.0.
|
|
46
|
+
"umi": "4.0.57"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|