dumi 2.4.52 → 2.4.53

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.
@@ -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,12 @@ __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
41
  var visit;
42
42
  var toString;
43
43
  (async () => {
@@ -46,12 +46,12 @@ var toString;
46
46
  })();
47
47
  function getGuessAtomId(opts) {
48
48
  const parsed = import_path.default.parse(opts.fileLocaleLessPath);
49
- const clearFileName = (0, import_tabs.getHostForTabRouteFile)(parsed.name);
49
+ const clearFileName = (0, import_utils.getHostForTabRouteFile)(parsed.name);
50
50
  const atomFile = [".tsx", ".jsx"].map((ext) => import_path.default.join(parsed.dir, `${clearFileName}${ext}`)).find(import_fs.default.existsSync);
51
51
  if (atomFile) {
52
52
  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
53
  if (atomAbsDir) {
54
- return (0, import_plugin_utils.winPath)(import_path.default.relative(atomAbsDir, atomFile)).replace(
54
+ return (0, import_utils2.winPath)(import_path.default.relative(atomAbsDir, atomFile)).replace(
55
55
  /((^|\/)index)?\.\w+$/,
56
56
  ""
57
57
  );
@@ -64,7 +64,7 @@ function remarkMeta(opts) {
64
64
  vFile.data.frontmatter = {
65
65
  title: "",
66
66
  toc: "menu",
67
- filename: (0, import_plugin_utils.winPath)(import_path.default.relative(opts.cwd, opts.fileAbsPath)),
67
+ filename: (0, import_utils2.winPath)(import_path.default.relative(opts.cwd, opts.fileAbsPath)),
68
68
  ...guessAtomId && { atomId: guessAtomId }
69
69
  };
70
70
  try {
@@ -96,16 +96,16 @@ function remarkMeta(opts) {
96
96
  },
97
97
  // use filename as title
98
98
  () => {
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)
99
+ if ((0, import_utils.isTabRouteFile)(opts.fileAbsPath)) {
100
+ vFile.data.frontmatter.title = import_utils2.lodash.startCase(
101
+ (0, import_utils.getTabKeyFromFile)(opts.fileAbsPath)
102
102
  );
103
103
  } else {
104
104
  const pathWithoutIndex = opts.fileAbsPath.replace(
105
105
  /(\/index([^/]+)?)?\.md$/,
106
106
  ""
107
107
  );
108
- vFile.data.frontmatter.title = import_plugin_utils.lodash.startCase(
108
+ vFile.data.frontmatter.title = import_utils2.lodash.startCase(
109
109
  import_path.default.basename(pathWithoutIndex)
110
110
  );
111
111
  }
@@ -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.53",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",