dumi 2.0.0-beta.11 → 2.0.0-beta.13

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.
@@ -30,7 +30,7 @@ function getSchemas() {
30
30
  resolve: (Joi) => Joi.object({
31
31
  docDirs: Joi.array().items(Joi.alternatives(Joi.string(), Joi.object({ dir: Joi.string(), type: Joi.string().optional() }))).optional(),
32
32
  atomDirs: Joi.array().items(Joi.object({ type: Joi.string(), dir: Joi.string() })).optional(),
33
- entityDirs: Joi.forbidden().error(new Error("`entityDirs` is already deprecated, please rename it to `atomDirs` in `.umirc.ts` or `config/config.ts`")),
33
+ entityDirs: Joi.forbidden().error(new Error("`entityDirs` is already deprecated, please rename it to `atomDirs` in `.dumirc.ts`")),
34
34
  codeBlockMode: Joi.string().valid("active", "passive").optional(),
35
35
  entryFile: Joi.string().optional()
36
36
  }).optional(),
@@ -44,6 +44,12 @@ function localizeUmiRoute(route, locales) {
44
44
  route.absPath = route.path !== "/" ? `/${route.path}` : route.path;
45
45
  }
46
46
  }
47
+ function flatRoute(route) {
48
+ if (route.parentId !== "DocLayout") {
49
+ route.parentId = "DocLayout";
50
+ route.path = route.path === "*" ? route.path : route.absPath.slice(1);
51
+ }
52
+ }
47
53
  var routes_default = (api) => {
48
54
  var _a, _b, _c;
49
55
  const extraWatchPaths = [
@@ -111,9 +117,9 @@ var routes_default = (api) => {
111
117
  };
112
118
  }
113
119
  Object.entries(pages).forEach(([, route]) => {
114
- route.parentId = docLayoutId;
115
120
  route.file = (0, import_plugin_utils.winPath)(import_path.default.resolve(pagesDir, route.file));
116
- route.path = route.absPath.slice(1);
121
+ flatRoute(route);
122
+ routes[route.id] = route;
117
123
  });
118
124
  docDirs.map(normalizeDocDir).forEach(({ type, dir }) => {
119
125
  const base = import_path.default.join(api.cwd, dir);
@@ -123,8 +129,7 @@ var routes_default = (api) => {
123
129
  });
124
130
  Object.entries(dirRoutes).forEach(([key, route]) => {
125
131
  route.id = `${dir}/${key}`;
126
- route.parentId = docLayoutId;
127
- route.path = route.absPath.slice(1);
132
+ flatRoute(route);
128
133
  if (type) {
129
134
  const pluralType = (0, import_pluralize.plural)(type);
130
135
  route.path = `${pluralType}/${route.path}`.replace(/\/+$/, "/");
@@ -48,6 +48,7 @@ var tabs_default = (api) => {
48
48
  });
49
49
  tabsFromPlugins.forEach((tab) => {
50
50
  tab.id ?? (tab.id = `plugin-tab${tab.test ? `-${tab.test}` : ""}-${tab.key}`);
51
+ tab.component = (0, import_plugin_utils.winPath)(tab.component);
51
52
  });
52
53
  return memo;
53
54
  });
@@ -39,7 +39,7 @@ function getPkgThemeName(api) {
39
39
  }
40
40
  function getPkgThemePath(api) {
41
41
  const pkgThemeName = getPkgThemeName(api);
42
- return pkgThemeName && import_path.default.basename(require.resolve(`${pkgThemeName}/package.json`, { paths: [api.cwd] }));
42
+ return pkgThemeName && import_path.default.dirname(require.resolve(`${pkgThemeName}/package.json`, { paths: [api.cwd] }));
43
43
  }
44
44
  var theme_default = (api) => {
45
45
  const defaultThemeData = (0, import_loader.default)(DEFAULT_THEME_PATH);
@@ -147,6 +147,16 @@ export default function DumiContextWrapper() {
147
147
  }`
148
148
  });
149
149
  });
150
+ if (require("@umijs/core/package").__npminstall_done && import_fs.default.existsSync(localThemePath) && import_fs.default.lstatSync(localThemePath).isSymbolicLink()) {
151
+ api.chainWebpack((memo) => {
152
+ const devThemeNodeModules = import_path.default.join(api.cwd, "../node_modules");
153
+ memo.snapshot((0, import_plugin_utils.deepmerge)(memo.get("snapshot"), {
154
+ immutablePaths: [devThemeNodeModules],
155
+ managedPaths: [devThemeNodeModules]
156
+ }));
157
+ return memo;
158
+ });
159
+ }
150
160
  };
151
161
  // Annotate the CommonJS export names for ESM import in node:
152
162
  0 && (module.exports = {});
package/dist/preset.js CHANGED
@@ -25,8 +25,21 @@ __export(preset_exports, {
25
25
  default: () => preset_default
26
26
  });
27
27
  module.exports = __toCommonJS(preset_exports);
28
+ var import_fs = __toESM(require("fs"));
29
+ var import_path = __toESM(require("path"));
30
+ var import_plugin_utils = require("umi/plugin-utils");
28
31
  var preset_default = (api) => {
29
32
  api.describe({ key: "dumi-preset" });
33
+ const legacyConfig = [
34
+ ".umirc.ts",
35
+ ".umirc.js",
36
+ "config/config.ts",
37
+ "config/config.js"
38
+ ].find((file) => import_fs.default.existsSync(import_path.default.join(api.cwd, file)));
39
+ if (legacyConfig) {
40
+ import_plugin_utils.logger.warn(`Detected you are using legacy config file \`${legacyConfig}\`, it will no longer be loaded, please migrate to the new \`.dumirc.ts\` file, and the tmp file also from \`.umi\` to \`.dumi/tmp\`, please update related files such as \`.gitignore\`, \`tsconfig.json\` & etc.`);
41
+ import_plugin_utils.logger.warn(`\u68C0\u6D4B\u5230\u4F60\u5728\u4F7F\u7528\u65E7\u914D\u7F6E\u6587\u4EF6 \`${legacyConfig}\`\uFF0C\u5B83\u5DF2\u4E0D\u518D\u751F\u6548\uFF0C\u8BF7\u5C06\u5185\u5BB9\u8FC1\u79FB\u5230\u65B0\u7684 \`.dumirc.ts\` \u914D\u7F6E\u6587\u4EF6\u4E2D\uFF0C\u53E6\u5916\u4E34\u65F6\u6587\u4EF6\u5939\u4E5F\u4ECE \`.umi\` \u8FC1\u79FB\u5230 \`.dumi/tmp\`\uFF0C\u8BF7\u540C\u65F6\u66F4\u65B0\u76F8\u5173\u6587\u4EF6\u5982 \`.gitignore\`\u3001\`tsconfig.json\` \u7B49`);
42
+ }
30
43
  return {
31
44
  plugins: [
32
45
  require.resolve("./registerMethods"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.0.0-beta.11",
3
+ "version": "2.0.0-beta.13",
4
4
  "description": "Framework for developing UI components",
5
5
  "keywords": [],
6
6
  "license": "MIT",