@umijs/plugin-docs 4.0.6 → 4.0.9
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/client/theme-doc/Search.tsx +2 -2
- package/client/theme-doc/Toc.tsx +3 -2
- package/client/theme-doc/components/Tabbed.tsx +78 -0
- package/client/theme-doc/index.ts +1 -0
- package/client/theme-doc/tailwind.css +25 -9
- package/dist/compiler.js +70 -61
- package/dist/index.js +134 -128
- package/dist/loader.js +41 -21
- package/dist/markdown.js +42 -20
- package/package.json +7 -5
- package/client/theme-doc/tailwind.out.css +0 -2662
- package/client/theme-doc/utils/getLinkFromTitle.ts +0 -15
package/dist/loader.js
CHANGED
|
@@ -1,22 +1,42 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// loader.ts
|
|
20
|
+
var loader_exports = {};
|
|
21
|
+
__export(loader_exports, {
|
|
22
|
+
default: () => loader_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(loader_exports);
|
|
25
|
+
var import_compiler = require("./compiler");
|
|
26
|
+
async function loader_default(content) {
|
|
27
|
+
const filename = this.resourcePath;
|
|
28
|
+
const callback = this.async();
|
|
29
|
+
try {
|
|
30
|
+
const { result } = await (0, import_compiler.compile)({
|
|
31
|
+
content,
|
|
32
|
+
fileName: filename
|
|
33
|
+
});
|
|
34
|
+
return callback(null, result);
|
|
35
|
+
} catch (e) {
|
|
36
|
+
const err = e;
|
|
37
|
+
e.message = `${filename}: ${e.message}`;
|
|
38
|
+
throw err;
|
|
39
|
+
}
|
|
21
40
|
}
|
|
22
|
-
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {});
|
package/dist/markdown.js
CHANGED
|
@@ -1,23 +1,45 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// markdown.ts
|
|
20
|
+
var markdown_exports = {};
|
|
21
|
+
__export(markdown_exports, {
|
|
22
|
+
parseTitle: () => parseTitle
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(markdown_exports);
|
|
4
25
|
function parseTitle(opts) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
title: match[2],
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
i += 1;
|
|
26
|
+
const lines = opts.content.replace(/{[\n\s\t]*\/\*[\s\S]*?\*\/[\n\s\t]*}/g, "").split("\n");
|
|
27
|
+
let i = 0;
|
|
28
|
+
const ret = [];
|
|
29
|
+
while (i < lines.length) {
|
|
30
|
+
const line = lines[i].trim();
|
|
31
|
+
const match = line.match(/^(#+)\s+(.*)/);
|
|
32
|
+
if (match) {
|
|
33
|
+
ret.push({
|
|
34
|
+
level: match[1].length,
|
|
35
|
+
title: match[2]
|
|
36
|
+
});
|
|
20
37
|
}
|
|
21
|
-
|
|
38
|
+
i += 1;
|
|
39
|
+
}
|
|
40
|
+
return ret;
|
|
22
41
|
}
|
|
23
|
-
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
parseTitle
|
|
45
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugin-docs",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.9",
|
|
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",
|
|
@@ -17,15 +17,16 @@
|
|
|
17
17
|
"compiled"
|
|
18
18
|
],
|
|
19
19
|
"scripts": {
|
|
20
|
-
"build": "
|
|
20
|
+
"build": "umi-scripts father build",
|
|
21
21
|
"build:css": "tailwindcss -i ./client/theme-doc/tailwind.css -o ./client/theme-doc/tailwind.out.css",
|
|
22
22
|
"build:deps": "umi-scripts bundleDeps",
|
|
23
23
|
"build:extra": "pnpm build:css",
|
|
24
|
-
"dev": "
|
|
25
|
-
"dev:css": "pnpm build:css --
|
|
24
|
+
"dev": "umi-scripts father dev",
|
|
25
|
+
"dev:css": "pnpm build:css --watch",
|
|
26
26
|
"test": "umi-scripts jest-turbo"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"github-slugger": "^1.4.0",
|
|
29
30
|
"keymaster": "1.6.2",
|
|
30
31
|
"react-helmet": "^6.1.0",
|
|
31
32
|
"rehype-pretty-code": "^0.3.1",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@mdx-js/mdx": "2.1.1",
|
|
37
|
+
"@types/github-slugger": "^1.3.0",
|
|
36
38
|
"@types/keymaster": "^1.6.30",
|
|
37
39
|
"@types/react-helmet": "^6.1.5",
|
|
38
40
|
"classnames": "^2.3.1",
|
|
@@ -40,7 +42,7 @@
|
|
|
40
42
|
"rehype-slug": "5.0.1",
|
|
41
43
|
"remark-gfm": "^3.0.1",
|
|
42
44
|
"tailwindcss": "^3.0.24",
|
|
43
|
-
"umi": "4.0.
|
|
45
|
+
"umi": "4.0.9"
|
|
44
46
|
},
|
|
45
47
|
"publishConfig": {
|
|
46
48
|
"access": "public"
|