dumi 2.4.20 → 2.4.22

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/README.md CHANGED
@@ -14,6 +14,10 @@ To view more online examples and docs, please visit [dumi official site](https:/
14
14
 
15
15
  See [CONTRIBUTING.md](CONTRIBUTING.md)
16
16
 
17
+ <a href="https://openomy.app/github/umijs/dumi" target="_blank" style="display: block; width: 100%;" align="center">
18
+ <img src="https://www.openomy.app/svg?repo=umijs/dumi&chart=bubble&latestMonth=3" target="_blank" alt="Contribution Leaderboard" style="display: block; width: 100%;" />
19
+ </a>
20
+
17
21
  ## Badge
18
22
 
19
23
  Using dumi? Add a README badge to show it off: [![dumi](https://img.shields.io/badge/docs%20by-dumi-blue)](https://github.com/umijs/dumi)
@@ -73,19 +73,21 @@ import '${(0, import_plugin_utils.winPath)(md)}?watch=parent';
73
73
  ).join("\n")}
74
74
  import LoadingComponent from '@@/dumi/theme/loading';
75
75
  import React, { Suspense } from 'react';
76
- import { DumiPage, useTabMeta, useRouteMeta } from 'dumi';
77
-
78
- function DumiMarkdownInner() {
79
- const { texts: ${import_rehypeText.CONTENT_TEXTS_OBJ_NAME} } = use${isTabContent ? "TabMeta" : "RouteMeta"}();
80
-
81
- return ${ret.content};
82
- }
76
+ import { DumiPage } from 'dumi';
77
+ import { texts as ${import_rehypeText.CONTENT_TEXTS_OBJ_NAME} } from '${(0, import_plugin_utils.winPath)(
78
+ this.resourcePath
79
+ )}?type=text';
83
80
 
84
81
  // export named function for fastRefresh
85
82
  // ref: https://github.com/pmmmwh/react-refresh-webpack-plugin/blob/main/docs/TROUBLESHOOTING.md#edits-always-lead-to-full-reload
86
83
  function DumiMarkdownContent() {
87
- // wrap suspense for catch async meta data
88
- return <${wrapper}><Suspense fallback={<LoadingComponent />}><DumiMarkdownInner /></Suspense></${wrapper}>;
84
+ return (
85
+ <${wrapper}>
86
+ <Suspense fallback={<LoadingComponent />}>
87
+ ${ret.content}
88
+ </Suspense>
89
+ </${wrapper}>
90
+ )
89
91
  }
90
92
 
91
93
  export default DumiMarkdownContent;`;
@@ -264,6 +266,8 @@ function emit(opts, ret) {
264
266
  const { demos, embeds } = ret.meta;
265
267
  embeds.forEach((file) => this.addDependency(file));
266
268
  getDemoSourceFiles(demos).forEach((file) => this.addDependency(file));
269
+ if (this.resourceQuery.includes("watch=parent"))
270
+ return null;
267
271
  switch (opts.mode) {
268
272
  case "demo":
269
273
  return emitDemo.call(this, opts, ret);
@@ -69,7 +69,7 @@ function remarkMeta(opts) {
69
69
  };
70
70
  try {
71
71
  vFile.data.frontmatter.lastUpdated = parseInt(
72
- (0, import_child_process.execSync)(`git log -1 --format=%at ${opts.fileAbsPath}`, {
72
+ (0, import_child_process.execSync)(`git log -1 --format=%at -- "${opts.fileAbsPath}"`, {
73
73
  stdio: "pipe"
74
74
  }).toString(),
75
75
  10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.4.20",
3
+ "version": "2.4.22",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -36,6 +36,25 @@
36
36
  "tech-stack-utils.js",
37
37
  "tech-stack-utils.d.ts"
38
38
  ],
39
+ "scripts": {
40
+ "build": "father build && npm run build:crates",
41
+ "build:crates": "cargo build --target wasm32-wasip1 -r --out-dir compiled/crates -Z unstable-options",
42
+ "build:deps": "node scripts/pre-bundle-worker.js && father prebundle",
43
+ "build:suites": "pnpm run --filter=\"./suites/**\" build",
44
+ "dev": "father dev",
45
+ "docs:build": "node ./bin/dumi.js build",
46
+ "docs:dev": "node ./bin/dumi.js dev",
47
+ "docs:sync": "node ./scripts/sync-from-umi.js",
48
+ "format": "prettier --cache --write .",
49
+ "lint": "npm run lint:es && npm run lint:css",
50
+ "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
51
+ "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
52
+ "prepare": "husky install && npm run build && npm run build:suites && node ./bin/dumi.js setup && npm run docs:sync",
53
+ "release": "esno scripts/release.ts",
54
+ "test": "vitest run",
55
+ "vercel:build": "npm run docs:build",
56
+ "vercel:install": "./scripts/vercel-install.sh"
57
+ },
39
58
  "commitlint": {
40
59
  "extends": [
41
60
  "@commitlint/config-conventional"
@@ -75,6 +94,7 @@
75
94
  "copy-to-clipboard": "^3.3.3",
76
95
  "deepmerge": "^4.3.1",
77
96
  "dumi-afx-deps": "^1.0.0-alpha.19",
97
+ "dumi-assets-types": "workspace:*",
78
98
  "enhanced-resolve": "^5.15.0",
79
99
  "estree-util-to-js": "^1.2.0",
80
100
  "estree-util-visit": "^1.2.1",
@@ -125,8 +145,7 @@
125
145
  "unist-util-visit-parents": "^5.1.3",
126
146
  "url": "^0.11.1",
127
147
  "v8-compile-cache": "2.3.0",
128
- "vfile": "^5.3.7",
129
- "dumi-assets-types": "2.4.14"
148
+ "vfile": "^5.3.7"
130
149
  },
131
150
  "devDependencies": {
132
151
  "@commitlint/cli": "^17.6.7",
@@ -144,6 +163,7 @@
144
163
  "@types/react-dom": "^18.2.7",
145
164
  "@umijs/lint": "^4.3.0",
146
165
  "@umijs/plugins": "4.0.32",
166
+ "dumi-theme-mobile": "workspace:*",
147
167
  "eslint": "^8.46.0",
148
168
  "esno": "^4.7.0",
149
169
  "fast-glob": "^3.3.1",
@@ -161,8 +181,7 @@
161
181
  "ts-node": "^10.9.1",
162
182
  "typescript": "~5.0.4",
163
183
  "vitest": "^2.0.0",
164
- "zx": "^7.2.3",
165
- "dumi-theme-mobile": "2.3.5"
184
+ "zx": "^7.2.3"
166
185
  },
167
186
  "peerDependencies": {
168
187
  "react": ">=16.8",
@@ -174,23 +193,5 @@
174
193
  },
175
194
  "authors": [
176
195
  "Peach <scdzwyxst@gmail.com>"
177
- ],
178
- "scripts": {
179
- "build": "father build && npm run build:crates",
180
- "build:crates": "cargo build --target wasm32-wasip1 -r --out-dir compiled/crates -Z unstable-options",
181
- "build:deps": "node scripts/pre-bundle-worker.js && father prebundle",
182
- "build:suites": "pnpm run --filter=\"./suites/**\" build",
183
- "dev": "father dev",
184
- "docs:build": "node ./bin/dumi.js build",
185
- "docs:dev": "node ./bin/dumi.js dev",
186
- "docs:sync": "node ./scripts/sync-from-umi.js",
187
- "format": "prettier --cache --write .",
188
- "lint": "npm run lint:es && npm run lint:css",
189
- "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
190
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
191
- "release": "esno scripts/release.ts",
192
- "test": "vitest run",
193
- "vercel:build": "npm run docs:build",
194
- "vercel:install": "./scripts/vercel-install.sh"
195
- }
196
- }
196
+ ]
197
+ }
@@ -10,21 +10,21 @@ import "./index.less";
10
10
  var IconDark = function IconDark() {
11
11
  return /*#__PURE__*/React.createElement("svg", {
12
12
  viewBox: "0 0 16 16"
13
- }, /*#__PURE__*/React.createElement("path", {
13
+ }, /*#__PURE__*/React.createElement("title", null, "Dark mode"), /*#__PURE__*/React.createElement("path", {
14
14
  d: "M8.218 1.455c3.527.109 6.327 3.018 6.327 6.545 0 3.6-2.945 6.545-6.545 6.545a6.562 6.562 0 0 1-6.036-4h.218c3.6 0 6.545-2.945 6.545-6.545 0-.91-.182-1.745-.509-2.545m0-1.455c-.473 0-.909.218-1.2.618-.29.4-.327.946-.145 1.382.254.655.4 1.31.4 2 0 2.8-2.291 5.09-5.091 5.09h-.218c-.473 0-.91.22-1.2.62-.291.4-.328.945-.146 1.38C1.891 14.074 4.764 16 8 16c4.4 0 8-3.6 8-8a7.972 7.972 0 0 0-7.745-8h-.037Z"
15
15
  }));
16
16
  };
17
17
  var IconLight = function IconLight() {
18
18
  return /*#__PURE__*/React.createElement("svg", {
19
19
  viewBox: "0 0 16 16"
20
- }, /*#__PURE__*/React.createElement("path", {
20
+ }, /*#__PURE__*/React.createElement("title", null, "Light mode"), /*#__PURE__*/React.createElement("path", {
21
21
  d: "M8 13a1 1 0 0 1 1 1v1a1 1 0 1 1-2 0v-1a1 1 0 0 1 1-1ZM8 3a1 1 0 0 1-1-1V1a1 1 0 1 1 2 0v1a1 1 0 0 1-1 1Zm7 4a1 1 0 1 1 0 2h-1a1 1 0 1 1 0-2h1ZM3 8a1 1 0 0 1-1 1H1a1 1 0 1 1 0-2h1a1 1 0 0 1 1 1Zm9.95 3.536.707.707a1 1 0 0 1-1.414 1.414l-.707-.707a1 1 0 0 1 1.414-1.414Zm-9.9-7.072-.707-.707a1 1 0 0 1 1.414-1.414l.707.707A1 1 0 0 1 3.05 4.464Zm9.9 0a1 1 0 0 1-1.414-1.414l.707-.707a1 1 0 0 1 1.414 1.414l-.707.707Zm-9.9 7.072a1 1 0 0 1 1.414 1.414l-.707.707a1 1 0 0 1-1.414-1.414l.707-.707ZM8 4a4 4 0 1 0 0 8 4 4 0 0 0 0-8Zm0 6.5a2.5 2.5 0 1 1 0-5 2.5 2.5 0 0 1 0 5Z"
22
22
  }));
23
23
  };
24
24
  var IconAuto = function IconAuto() {
25
25
  return /*#__PURE__*/React.createElement("svg", {
26
26
  viewBox: "0 0 16 16"
27
- }, /*#__PURE__*/React.createElement("path", {
27
+ }, /*#__PURE__*/React.createElement("title", null, "Auto mode"), /*#__PURE__*/React.createElement("path", {
28
28
  d: "M14.595 8a6.595 6.595 0 1 1-13.19 0 6.595 6.595 0 0 1 13.19 0ZM8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0Zm0 2.014v11.972A5.986 5.986 0 0 0 8 2.014Z"
29
29
  }));
30
30
  };
@@ -10,14 +10,14 @@ import "./index.less";
10
10
  var IconRtl = function IconRtl() {
11
11
  return /*#__PURE__*/React.createElement("svg", {
12
12
  viewBox: "0 0 14 16"
13
- }, /*#__PURE__*/React.createElement("path", {
13
+ }, /*#__PURE__*/React.createElement("title", null, "Right-to-Left"), /*#__PURE__*/React.createElement("path", {
14
14
  d: "M5.003 6.39v3.594c0 .4.275.674.674.674.4 0 .674-.274.674-.674V1.323h1.997v8.661c0 .4.274.674.674.674s.674-.274.674-.674V1.323h3.295c.399 0 .674-.275.674-.674 0-.4-.275-.649-.674-.649H4.928C3.131 0 1.733 1.398 1.733 3.195S3.206 6.39 5.003 6.39Zm0-5.067v3.72c-1.073 0-1.922-.8-1.922-1.873s.799-1.847 1.922-1.847Zm7.988 11.332H2.73l.8-.674c.274-.2.324-.674.124-.923-.2-.275-.674-.325-.923-.125L.735 12.53c-.275.275-.4.525-.4.874 0 .325.125.674.4.874l1.997 1.597a.829.829 0 0 0 .4.125c.199 0 .398-.075.523-.275.2-.274.2-.723-.125-.923l-.998-.799h10.459c.399 0 .674-.274.674-.674 0-.424-.275-.674-.674-.674Z"
15
15
  }));
16
16
  };
17
17
  var IconLtr = function IconLtr() {
18
18
  return /*#__PURE__*/React.createElement("svg", {
19
19
  viewBox: "0 0 14 16"
20
- }, /*#__PURE__*/React.createElement("path", {
20
+ }, /*#__PURE__*/React.createElement("title", null, "Left-to-Right"), /*#__PURE__*/React.createElement("path", {
21
21
  d: "M5.003 6.39v3.594c0 .4.275.674.674.674.4 0 .674-.274.674-.674V1.323h1.997v8.661c0 .4.274.674.674.674s.674-.274.674-.674V1.323h3.295c.399 0 .674-.275.674-.674 0-.4-.275-.649-.674-.649H4.928C3.131 0 1.733 1.398 1.733 3.195S3.206 6.39 5.003 6.39Zm0-5.067v3.72c-1.073 0-1.922-.8-1.922-1.873s.799-1.847 1.922-1.847ZM1.01 12.655h10.26l-.8-.674c-.274-.2-.324-.674-.124-.923.2-.275.674-.325.923-.125l1.997 1.597c.275.275.4.525.4.874 0 .325-.125.674-.4.874l-1.997 1.597a.829.829 0 0 1-.399.125.59.59 0 0 1-.524-.275c-.2-.274-.2-.723.125-.923l.998-.799H1.009c-.399 0-.674-.274-.674-.674 0-.424.275-.674.674-.674Z"
22
22
  }));
23
23
  };
@@ -84,7 +84,8 @@ var SearchBar = function SearchBar() {
84
84
  return /*#__PURE__*/React.createElement("div", {
85
85
  className: "dumi-default-search-bar"
86
86
  }, /*#__PURE__*/React.createElement(IconSearch, {
87
- className: "dumi-default-search-bar-svg"
87
+ className: "dumi-default-search-bar-svg",
88
+ title: "Search"
88
89
  }), /*#__PURE__*/React.createElement(Input, {
89
90
  onFocus: function onFocus() {
90
91
  setFocusing(true);
@@ -39,6 +39,8 @@ var SocialIcon = function SocialIcon(props) {
39
39
  target: "_blank",
40
40
  href: preset.link,
41
41
  rel: "noreferrer"
42
- }, /*#__PURE__*/React.createElement(preset.Icon, null));
42
+ }, /*#__PURE__*/React.createElement(preset.Icon, {
43
+ title: icon
44
+ }));
43
45
  };
44
46
  export default SocialIcon;