dumi 2.4.52 → 2.4.54

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.
Files changed (32) hide show
  1. package/compiled/file-system-cache/LICENSE +134 -0
  2. package/compiled/file-system-cache/index.d.ts +3 -0
  3. package/compiled/file-system-cache/index.js +1 -0
  4. package/compiled/file-system-cache/package.json +1 -0
  5. package/dist/assetParsers/block.js +32 -10
  6. package/dist/features/compile/index.js +5 -1
  7. package/dist/features/compile/utoopackLoaders.d.ts +3 -2
  8. package/dist/features/compile/utoopackLoaders.js +7 -6
  9. package/dist/features/meta.js +4 -4
  10. package/dist/features/tabs/utils.d.ts +3 -0
  11. package/dist/features/tabs/utils.js +41 -0
  12. package/dist/features/tabs.d.ts +1 -3
  13. package/dist/features/tabs.js +12 -19
  14. package/dist/loaders/constants.d.ts +2 -0
  15. package/dist/loaders/constants.js +32 -0
  16. package/dist/loaders/demo/index.js +3 -3
  17. package/dist/loaders/markdown/index.js +137 -67
  18. package/dist/loaders/markdown/transformer/rehypeDemo.js +7 -7
  19. package/dist/loaders/markdown/transformer/rehypeJsxify.js +1 -1
  20. package/dist/loaders/markdown/transformer/rehypeLink.js +32 -18
  21. package/dist/loaders/markdown/transformer/rehypeRaw.js +2 -2
  22. package/dist/loaders/markdown/transformer/rehypeSlug.d.ts +5 -0
  23. package/dist/loaders/markdown/transformer/rehypeSlug.js +105 -9
  24. package/dist/loaders/markdown/transformer/rehypeText.d.ts +2 -1
  25. package/dist/loaders/markdown/transformer/rehypeText.js +3 -3
  26. package/dist/loaders/markdown/transformer/remarkBreaks.js +4 -4
  27. package/dist/loaders/markdown/transformer/remarkEmbed.js +2 -2
  28. package/dist/loaders/markdown/transformer/remarkMeta.js +13 -10
  29. package/dist/techStacks/utils.js +2 -2
  30. package/dist/utils.d.ts +2 -1
  31. package/dist/utils.js +16 -16
  32. package/package.json +6 -6
@@ -30,9 +30,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var rehypeSlug_exports = {};
31
31
  __export(rehypeSlug_exports, {
32
32
  HEADING_TAGS: () => HEADING_TAGS,
33
- default: () => rehypeSlug
33
+ default: () => rehypeSlug,
34
+ stripCustomAnchorMarker: () => stripCustomAnchorMarker
34
35
  });
35
36
  module.exports = __toCommonJS(rehypeSlug_exports);
37
+ var import_utils = require("@umijs/utils");
36
38
  var import_github_slugger = __toESM(require("github-slugger"));
37
39
  var import_rehypeDemo = require("./rehypeDemo");
38
40
  var visit;
@@ -42,13 +44,91 @@ var toString;
42
44
  ({ toString } = await import("hast-util-to-string"));
43
45
  })();
44
46
  var HEADING_TAGS = ["h1", "h2", "h3", "h4", "h5", "h6"];
47
+ var CUSTOM_ANCHOR_RE = /\s*\{#([^}]+)\}\s*$/;
48
+ function getCustomAnchorId(text) {
49
+ var _a;
50
+ return ((_a = text.match(CUSTOM_ANCHOR_RE)) == null ? void 0 : _a[1].trim()) || void 0;
51
+ }
52
+ function stripCustomAnchorMarker(text) {
53
+ return getCustomAnchorId(text) ? text.replace(CUSTOM_ANCHOR_RE, "") : text;
54
+ }
55
+ function extractCustomAnchor(node) {
56
+ const lastChild = node.children[node.children.length - 1];
57
+ if ((lastChild == null ? void 0 : lastChild.type) !== "text" || !lastChild.value.includes("{#"))
58
+ return;
59
+ const rawId = getCustomAnchorId(lastChild.value);
60
+ if (!rawId)
61
+ return;
62
+ lastChild.value = stripCustomAnchorMarker(lastChild.value);
63
+ if (!lastChild.value)
64
+ node.children.pop();
65
+ return rawId;
66
+ }
45
67
  function rehypeSlug() {
46
68
  return async (tree, vFile) => {
69
+ var _a;
47
70
  const slugger = new import_github_slugger.default();
71
+ const customAnchors = /* @__PURE__ */ new Map();
72
+ const reservedIds = /* @__PURE__ */ new Set();
73
+ const demoIds = /* @__PURE__ */ new Set();
74
+ const filename = (_a = vFile.data.frontmatter) == null ? void 0 : _a.filename;
75
+ visit(tree, "element", (node) => {
76
+ var _a2, _b;
77
+ if (![import_rehypeDemo.DUMI_DEMO_TAG, import_rehypeDemo.DUMI_DEMO_GRID_TAG].includes(node.tagName) || !((_a2 = node.data) == null ? void 0 : _a2[import_rehypeDemo.DEMO_PROP_VALUE_KEY])) {
78
+ return;
79
+ }
80
+ const demos = [].concat(
81
+ (_b = node.data) == null ? void 0 : _b[import_rehypeDemo.DEMO_PROP_VALUE_KEY]
82
+ );
83
+ demos.forEach(({ demo }) => {
84
+ if (demo.inline)
85
+ return;
86
+ demoIds.add(demo.id);
87
+ slugger.slug(demo.id);
88
+ });
89
+ });
90
+ const existingIds = /* @__PURE__ */ new Set();
91
+ const markedHeadings = [];
92
+ visit(tree, "element", (node) => {
93
+ var _a2;
94
+ if (!HEADING_TAGS.includes(node.tagName))
95
+ return;
96
+ const existingId = (_a2 = node.properties) == null ? void 0 : _a2.id;
97
+ const rawId = extractCustomAnchor(node);
98
+ if (rawId) {
99
+ markedHeadings.push({ node, rawId, existingId });
100
+ } else if (existingId) {
101
+ existingIds.add(existingId);
102
+ reservedIds.add(existingId);
103
+ }
104
+ });
105
+ markedHeadings.forEach(({ node, rawId, existingId }) => {
106
+ let id = rawId;
107
+ let suffix = 1;
108
+ while (reservedIds.has(id) || demoIds.has(id)) {
109
+ id = `${rawId}-${suffix++}`;
110
+ }
111
+ if (id !== rawId) {
112
+ const reason = demoIds.has(rawId) ? "conflicts with demo id" : existingIds.has(rawId) ? "conflicts with an existing heading id" : "is duplicated";
113
+ import_utils.logger.warn(
114
+ `Custom anchor "${rawId}" ${reason}, fallback to "${id}" instead. at ${filename}`
115
+ );
116
+ }
117
+ if (existingId && existingId !== id) {
118
+ import_utils.logger.warn(
119
+ `Custom anchor "${id}" overrides the existing id "${existingId}" of heading "${toString(
120
+ node
121
+ )}". at ${filename}`
122
+ );
123
+ }
124
+ reservedIds.add(id);
125
+ customAnchors.set(node, id);
126
+ });
48
127
  vFile.data.toc = [];
49
128
  visit(tree, "element", (node) => {
50
- var _a, _b, _c;
129
+ var _a2, _b;
51
130
  if (HEADING_TAGS.includes(node.tagName)) {
131
+ const customAnchor = customAnchors.get(node);
52
132
  const title = toString({
53
133
  type: "element",
54
134
  tagName: node.tagName,
@@ -59,22 +139,37 @@ function rehypeSlug() {
59
139
  }).trim();
60
140
  const depth = Number(node.tagName.slice(1));
61
141
  node.properties ?? (node.properties = {});
62
- (_a = node.properties).id ?? (_a.id = slugger.slug(title));
142
+ if (customAnchor) {
143
+ node.properties.id = customAnchor;
144
+ } else if (!node.properties.id) {
145
+ let id = slugger.slug(title);
146
+ const conflictedId = id;
147
+ while (reservedIds.has(id)) {
148
+ id = slugger.slug(title);
149
+ }
150
+ if (id !== conflictedId) {
151
+ import_utils.logger.warn(
152
+ `Heading "${title}" conflicts with the anchor "${conflictedId}", fallback to "${id}" instead. at ${filename}`
153
+ );
154
+ }
155
+ node.properties.id = id;
156
+ }
63
157
  vFile.data.toc.push({
64
158
  id: node.properties.id,
65
159
  depth,
66
160
  title
67
161
  });
68
- } else if ([import_rehypeDemo.DUMI_DEMO_TAG, import_rehypeDemo.DUMI_DEMO_GRID_TAG].includes(node.tagName) && ((_b = node.data) == null ? void 0 : _b[import_rehypeDemo.DEMO_PROP_VALUE_KEY])) {
162
+ } else if ([import_rehypeDemo.DUMI_DEMO_TAG, import_rehypeDemo.DUMI_DEMO_GRID_TAG].includes(node.tagName) && ((_a2 = node.data) == null ? void 0 : _a2[import_rehypeDemo.DEMO_PROP_VALUE_KEY])) {
69
163
  const demos = [].concat(
70
- (_c = node.data) == null ? void 0 : _c[import_rehypeDemo.DEMO_PROP_VALUE_KEY]
164
+ (_b = node.data) == null ? void 0 : _b[import_rehypeDemo.DEMO_PROP_VALUE_KEY]
71
165
  );
72
166
  demos.forEach(({ demo, previewerProps }) => {
73
- var _a2, _b2;
167
+ var _a3, _b2;
74
168
  if (!demo.inline && previewerProps.title) {
75
169
  vFile.data.toc.push({
76
- id: slugger.slug(demo.id),
77
- depth: ((_b2 = (_a2 = vFile.data.frontmatter) == null ? void 0 : _a2.demo) == null ? void 0 : _b2.tocDepth) || 3,
170
+ // must keep the same id as previewer rendered anchor
171
+ id: demo.id,
172
+ depth: ((_b2 = (_a3 = vFile.data.frontmatter) == null ? void 0 : _a3.demo) == null ? void 0 : _b2.tocDepth) || 3,
78
173
  title: previewerProps.title,
79
174
  // put debug flag to control hide/show in toc
80
175
  ...previewerProps.debug ? { _debug_demo: true } : {}
@@ -87,5 +182,6 @@ function rehypeSlug() {
87
182
  }
88
183
  // Annotate the CommonJS export names for ESM import in node:
89
184
  0 && (module.exports = {
90
- HEADING_TAGS
185
+ HEADING_TAGS,
186
+ stripCustomAnchorMarker
91
187
  });
@@ -1,4 +1,5 @@
1
+ import { CONTENT_TEXTS_OBJ_NAME } from '../../constants';
1
2
  import type { Root } from 'hast';
2
3
  import type { Transformer } from 'unified';
3
- export declare const CONTENT_TEXTS_OBJ_NAME = "$$contentTexts";
4
+ export { CONTENT_TEXTS_OBJ_NAME };
4
5
  export default function rehypeText(): Transformer<Root>;
@@ -29,13 +29,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
29
29
  // src/loaders/markdown/transformer/rehypeText.ts
30
30
  var rehypeText_exports = {};
31
31
  __export(rehypeText_exports, {
32
- CONTENT_TEXTS_OBJ_NAME: () => CONTENT_TEXTS_OBJ_NAME,
32
+ CONTENT_TEXTS_OBJ_NAME: () => import_constants.CONTENT_TEXTS_OBJ_NAME,
33
33
  default: () => rehypeText
34
34
  });
35
35
  module.exports = __toCommonJS(rehypeText_exports);
36
+ var import_constants = require("../../constants");
36
37
  var import_rehypeIsolation = require("./rehypeIsolation");
37
38
  var import_rehypeSlug = require("./rehypeSlug");
38
- var CONTENT_TEXTS_OBJ_NAME = "$$contentTexts";
39
39
  var visit;
40
40
  (async () => {
41
41
  ({ visitParents: visit } = await import("unist-util-visit-parents"));
@@ -92,7 +92,7 @@ function rehypeText() {
92
92
  computed: true,
93
93
  object: {
94
94
  type: "Identifier",
95
- name: CONTENT_TEXTS_OBJ_NAME
95
+ name: import_constants.CONTENT_TEXTS_OBJ_NAME
96
96
  },
97
97
  property: {
98
98
  type: "Literal",
@@ -32,7 +32,7 @@ __export(remarkBreaks_exports, {
32
32
  default: () => remarkBreaks
33
33
  });
34
34
  module.exports = __toCommonJS(remarkBreaks_exports);
35
- var import_plugin_utils = require("umi/plugin-utils");
35
+ var import_utils = require("@umijs/utils");
36
36
  var findAndReplace;
37
37
  (async () => {
38
38
  ({ findAndReplace } = await import("mdast-util-find-and-replace"));
@@ -42,13 +42,13 @@ function logDeprecationWarning(fileAbsPath) {
42
42
  if (warningLock.get(fileAbsPath))
43
43
  return;
44
44
  warningLock.set(fileAbsPath, true);
45
- import_plugin_utils.logger.warn(
45
+ import_utils.logger.warn(
46
46
  "Detected that you are using soft breaks, dumi will transform them into spaces after the declaration",
47
47
  "version greater than or equal to `2.2.0`, however, they are still being transformed as line breaks now, please",
48
48
  "migrate them to hard breaks before upgrading the declaration version for dumi.\n",
49
- import_plugin_utils.chalk.grey(` at ${fileAbsPath}
49
+ import_utils.chalk.grey(` at ${fileAbsPath}
50
50
  `),
51
- import_plugin_utils.chalk.grey(" see also: https://github.com/umijs/dumi/issues/1683\n")
51
+ import_utils.chalk.grey(" see also: https://github.com/umijs/dumi/issues/1683\n")
52
52
  );
53
53
  }
54
54
  function remarkBreaks(opts) {
@@ -33,10 +33,10 @@ __export(remarkEmbed_exports, {
33
33
  });
34
34
  module.exports = __toCommonJS(remarkEmbed_exports);
35
35
  var import_utils = require("../../../utils");
36
+ var import_utils2 = require("@umijs/utils");
36
37
  var import_enhanced_resolve = __toESM(require("enhanced-resolve"));
37
38
  var import_fs = __toESM(require("fs"));
38
39
  var import_path = __toESM(require("path"));
39
- var import_plugin_utils = require("umi/plugin-utils");
40
40
  var import_url = __toESM(require("url"));
41
41
  var import_remarkContainer = __toESM(require("./remarkContainer"));
42
42
  var EMBED_OPEN_TAG = "<embed ";
@@ -59,7 +59,7 @@ function remarkReplaceSrc(opts) {
59
59
  function getEmbedRltPath(value) {
60
60
  const { fileAbsPath, parentAbsPath } = opts;
61
61
  const absPath = import_path.default.resolve(fileAbsPath, "..", value);
62
- return (0, import_plugin_utils.winPath)(import_path.default.relative(import_path.default.dirname(parentAbsPath), absPath)).replace(/^([^.])/, "./$1");
62
+ return (0, import_utils2.winPath)(import_path.default.relative(import_path.default.dirname(parentAbsPath), absPath)).replace(/^([^.])/, "./$1");
63
63
  }
64
64
  return (ast) => {
65
65
  visit(
@@ -32,12 +32,13 @@ __export(remarkMeta_exports, {
32
32
  default: () => remarkMeta
33
33
  });
34
34
  module.exports = __toCommonJS(remarkMeta_exports);
35
- var import_tabs = require("../../../features/tabs");
35
+ var import_utils = require("../../../features/tabs/utils");
36
+ var import_utils2 = require("@umijs/utils");
36
37
  var import_child_process = require("child_process");
37
38
  var import_fs = __toESM(require("fs"));
38
39
  var import_js_yaml = __toESM(require("js-yaml"));
39
40
  var import_path = __toESM(require("path"));
40
- var import_plugin_utils = require("umi/plugin-utils");
41
+ var import_rehypeSlug = require("./rehypeSlug");
41
42
  var visit;
42
43
  var toString;
43
44
  (async () => {
@@ -46,12 +47,12 @@ var toString;
46
47
  })();
47
48
  function getGuessAtomId(opts) {
48
49
  const parsed = import_path.default.parse(opts.fileLocaleLessPath);
49
- const clearFileName = (0, import_tabs.getHostForTabRouteFile)(parsed.name);
50
+ const clearFileName = (0, import_utils.getHostForTabRouteFile)(parsed.name);
50
51
  const atomFile = [".tsx", ".jsx"].map((ext) => import_path.default.join(parsed.dir, `${clearFileName}${ext}`)).find(import_fs.default.existsSync);
51
52
  if (atomFile) {
52
53
  const atomAbsDir = opts.resolve.atomDirs.map(({ dir }) => import_path.default.resolve(opts.cwd, dir)).sort((a, b) => b.split("/").length - a.split("/").length).find((dir) => atomFile.startsWith(dir));
53
54
  if (atomAbsDir) {
54
- return (0, import_plugin_utils.winPath)(import_path.default.relative(atomAbsDir, atomFile)).replace(
55
+ return (0, import_utils2.winPath)(import_path.default.relative(atomAbsDir, atomFile)).replace(
55
56
  /((^|\/)index)?\.\w+$/,
56
57
  ""
57
58
  );
@@ -64,7 +65,7 @@ function remarkMeta(opts) {
64
65
  vFile.data.frontmatter = {
65
66
  title: "",
66
67
  toc: "menu",
67
- filename: (0, import_plugin_utils.winPath)(import_path.default.relative(opts.cwd, opts.fileAbsPath)),
68
+ filename: (0, import_utils2.winPath)(import_path.default.relative(opts.cwd, opts.fileAbsPath)),
68
69
  ...guessAtomId && { atomId: guessAtomId }
69
70
  };
70
71
  try {
@@ -90,22 +91,24 @@ function remarkMeta(opts) {
90
91
  () => {
91
92
  visit(tree, "heading", (node) => {
92
93
  if (node.depth === 1) {
93
- vFile.data.frontmatter.title = toString(node.children);
94
+ vFile.data.frontmatter.title = (0, import_rehypeSlug.stripCustomAnchorMarker)(
95
+ toString(node.children)
96
+ );
94
97
  }
95
98
  });
96
99
  },
97
100
  // use filename as title
98
101
  () => {
99
- if ((0, import_tabs.isTabRouteFile)(opts.fileAbsPath)) {
100
- vFile.data.frontmatter.title = import_plugin_utils.lodash.startCase(
101
- (0, import_tabs.getTabKeyFromFile)(opts.fileAbsPath)
102
+ if ((0, import_utils.isTabRouteFile)(opts.fileAbsPath)) {
103
+ vFile.data.frontmatter.title = import_utils2.lodash.startCase(
104
+ (0, import_utils.getTabKeyFromFile)(opts.fileAbsPath)
102
105
  );
103
106
  } else {
104
107
  const pathWithoutIndex = opts.fileAbsPath.replace(
105
108
  /(\/index([^/]+)?)?\.md$/,
106
109
  ""
107
110
  );
108
- vFile.data.frontmatter.title = import_plugin_utils.lodash.startCase(
111
+ vFile.data.frontmatter.title = import_utils2.lodash.startCase(
109
112
  import_path.default.basename(pathWithoutIndex)
110
113
  );
111
114
  }
@@ -39,7 +39,6 @@ __export(utils_exports, {
39
39
  wrapDemoWithFn: () => wrapDemoWithFn
40
40
  });
41
41
  module.exports = __toCommonJS(utils_exports);
42
- var import_core = require("@swc/core");
43
42
  var import_types = require("../types");
44
43
  function extractScript(htmlLike) {
45
44
  const htmlScriptReg = /<script\b(?:\s[^>]*>|>)(.*?)<\/script>/gims;
@@ -84,7 +83,8 @@ function wrapDemoWithFn(code, opts) {
84
83
  parserConfig,
85
84
  plugins: babelPlugins
86
85
  }) : code;
87
- const result = (0, import_core.transformSync)(source, {
86
+ const { transformSync } = require("@swc/core");
87
+ const result = transformSync(source, {
88
88
  filename,
89
89
  jsc: {
90
90
  parser: parserConfig,
package/dist/utils.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { Range, RangeOptions } from '@umijs/utils/compiled/semver';
2
- import Cache from 'file-system-cache';
2
+ import type CreateCache from '../compiled/file-system-cache';
3
3
  import type { RunLoaderOption as InternalRunLoaderOption, RunLoaderResult } from '../compiled/loader-runner';
4
+ declare const Cache: typeof CreateCache;
4
5
  export type * from '../compiled/loader-runner';
5
6
  export { getContext } from '../compiled/loader-runner';
6
7
  /**
package/dist/utils.js CHANGED
@@ -46,18 +46,18 @@ __export(utils_exports, {
46
46
  tryFatherBuildConfigs: () => tryFatherBuildConfigs
47
47
  });
48
48
  module.exports = __toCommonJS(utils_exports);
49
+ var import_utils = require("@umijs/utils");
49
50
  var import_crypto = require("crypto");
50
- var import_file_system_cache = __toESM(require("file-system-cache"));
51
51
  var import_fs = __toESM(require("fs"));
52
52
  var import_js_yaml = __toESM(require("js-yaml"));
53
53
  var import_path = __toESM(require("path"));
54
- var import_plugin_utils = require("umi/plugin-utils");
55
54
  var import_util = require("util");
56
55
  var import_loader_runner = require("../compiled/loader-runner");
57
56
  var import_constants = require("./constants");
58
57
  var import_loader_runner2 = require("../compiled/loader-runner");
58
+ var Cache = require("../compiled/file-system-cache").default;
59
59
  function getFileIdFromFsPath(fsPath) {
60
- return import_plugin_utils.lodash.kebabCase((0, import_plugin_utils.winPath)(fsPath).replace(/((\/|^)index)?\.\w+$/g, ""));
60
+ return import_utils.lodash.kebabCase((0, import_utils.winPath)(fsPath).replace(/((\/|^)index)?\.\w+$/g, ""));
61
61
  }
62
62
  var getFileRangeLines = (content2, range) => {
63
63
  const [, start, end] = (range == null ? void 0 : range.match(/^L(\d+)(?:-L(\d+))?$/)) || [];
@@ -72,7 +72,7 @@ var getFileContentByRegExp = (content, regexp, filePath) => {
72
72
  try {
73
73
  return content.match(eval(regexp))[0];
74
74
  } catch (err) {
75
- import_plugin_utils.logger.error(`Extract markdown content failed, use the full content.
75
+ import_utils.logger.error(`Extract markdown content failed, use the full content.
76
76
  RegExp: ${regexp}
77
77
  File: ${filePath}
78
78
  Error: ${err}`);
@@ -102,7 +102,7 @@ function getCache(ns) {
102
102
  }, getSync() {
103
103
  } };
104
104
  }
105
- return caches[ns] ?? (caches[ns] = (0, import_file_system_cache.default)({ basePath: import_path.default.resolve(cacheDir, ns) }));
105
+ return caches[ns] ?? (caches[ns] = Cache({ basePath: import_path.default.resolve(cacheDir, ns) }));
106
106
  }
107
107
  async function tryFatherBuildConfigs(cwd) {
108
108
  let configs = [];
@@ -128,7 +128,7 @@ async function tryFatherBuildConfigs(cwd) {
128
128
  return configs;
129
129
  }
130
130
  function getProjectRoot(cwd) {
131
- const splittedCwd = (0, import_plugin_utils.winPath)(cwd).split("/");
131
+ const splittedCwd = (0, import_utils.winPath)(cwd).split("/");
132
132
  for (let level = -1; level >= -3; level -= 1) {
133
133
  const rootCwd = splittedCwd.slice(0, level).join("/");
134
134
  if (!rootCwd)
@@ -137,20 +137,20 @@ function getProjectRoot(cwd) {
137
137
  if (import_fs.default.existsSync(pkgPath) && (["pnpm-workspace.yaml", "lerna.json"].some(
138
138
  (f) => import_fs.default.existsSync(import_path.default.join(rootCwd, f))
139
139
  ) || require(pkgPath).workspace)) {
140
- return (0, import_plugin_utils.winPath)(rootCwd);
140
+ return (0, import_utils.winPath)(rootCwd);
141
141
  }
142
142
  }
143
- return (0, import_plugin_utils.winPath)(cwd);
143
+ return (0, import_utils.winPath)(cwd);
144
144
  }
145
145
  function lastSlash(str) {
146
146
  return str[str.length - 1] === "/" ? str : `${str}/`;
147
147
  }
148
148
  function componentToChunkName(component, cwdPath = "/") {
149
- const cwd = (0, import_plugin_utils.winPath)(cwdPath);
150
- return typeof component === "string" ? (0, import_plugin_utils.winPath)(component).replace(
149
+ const cwd = (0, import_utils.winPath)(cwdPath);
150
+ return typeof component === "string" ? (0, import_utils.winPath)(component).replace(
151
151
  new RegExp(
152
152
  `^(${// match app cwd first
153
- import_plugin_utils.lodash.escapeRegExp(lastSlash(cwd))})`
153
+ import_utils.lodash.escapeRegExp(lastSlash(cwd))})`
154
154
  ),
155
155
  ""
156
156
  ).replace(/^.(\/|\\)/, "").replace(/(\/|\\)/g, "__").replace(/^src__/, "").replace(/\.\.__/g, "").replace(/^pages__/, "p__") : "";
@@ -174,11 +174,11 @@ function runLoaders(options, callback) {
174
174
  return promisifyRunLoaders(options);
175
175
  }
176
176
  function isVersionInRange(version, range, options = { includePrerelease: true }) {
177
- if (import_plugin_utils.semver.valid(version)) {
178
- return import_plugin_utils.semver.satisfies(version, range, options);
177
+ if (import_utils.semver.valid(version)) {
178
+ return import_utils.semver.satisfies(version, range, options);
179
179
  }
180
- if (import_plugin_utils.semver.validRange(version)) {
181
- return import_plugin_utils.semver.subset(version, range, options);
180
+ if (import_utils.semver.validRange(version)) {
181
+ return import_utils.semver.subset(version, range, options);
182
182
  }
183
183
  return false;
184
184
  }
@@ -187,7 +187,7 @@ function toImportSpecifier(source) {
187
187
  return source;
188
188
  if (/^(?:node|data|file):/.test(source))
189
189
  return source;
190
- return (0, import_plugin_utils.winPath)(source);
190
+ return (0, import_utils.winPath)(source);
191
191
  }
192
192
  // Annotate the CommonJS export names for ESM import in node:
193
193
  0 && (module.exports = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.4.52",
3
+ "version": "2.4.54",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -54,11 +54,11 @@
54
54
  "prettier --cache --write"
55
55
  ],
56
56
  "*.{js,jsx}": [
57
- "eslint --fix",
57
+ "utoo-lint --fix",
58
58
  "prettier --cache --write"
59
59
  ],
60
60
  "*.{ts,tsx}": [
61
- "eslint --fix",
61
+ "utoo-lint --fix",
62
62
  "prettier --cache --parser=typescript --write"
63
63
  ]
64
64
  },
@@ -148,9 +148,9 @@
148
148
  "@types/react-copy-to-clipboard": "^5.0.4",
149
149
  "@types/react-dom": "^18.2.7",
150
150
  "@typescript/native-preview": "7.0.0-dev.20260623.1",
151
- "@umijs/lint": "^4.7.4",
151
+ "@umijs/lint": "^4.7.28",
152
152
  "@umijs/plugins": "4.7.4",
153
- "eslint": "^8.46.0",
153
+ "@utoo/lint": "^0.4.12",
154
154
  "esno": "^4.7.0",
155
155
  "fast-glob": "^3.3.1",
156
156
  "father": "^4.6.23",
@@ -193,7 +193,7 @@
193
193
  "format": "prettier --cache --write .",
194
194
  "lint": "npm run lint:es && npm run lint:css",
195
195
  "lint:css": "stylelint \"{src,test}/**/*.{css,less}\"",
196
- "lint:es": "eslint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
196
+ "lint:es": "utoo-lint \"{src,test}/**/*.{js,jsx,ts,tsx}\"",
197
197
  "release": "esno scripts/release.ts",
198
198
  "release:publish": "esno scripts/releasePublish.ts",
199
199
  "test": "vitest run",