dumi 2.1.20 → 2.1.21

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.
@@ -98,7 +98,8 @@ const LocalesContainer: FC<{ children: ReactNode }> = (props) => {
98
98
  // suffix mode
99
99
  ? history.location.pathname.replace(/([^/])\\/$/, '$1').endsWith(locale.suffix)
100
100
  // base mode
101
- : history.location.pathname.replace(/([^/])\\/$/, '$1').startsWith(locale.base)
101
+ : history.location.pathname.replace(/([^/])\\/$/, '$1')
102
+ .startsWith("${api.config.base.replace(/\/$/, "")}" + locale.base)
102
103
  ));
103
104
  const locale = matched ? matched.id : locales[0].id;
104
105
 
@@ -33,7 +33,7 @@ var import_pluralize = require("pluralize");
33
33
  var import_plugin_utils = require("umi/plugin-utils");
34
34
  var CTX_LAYOUT_ID = "dumi-context-layout";
35
35
  var ALIAS_THEME_TMP = "@/dumi__theme";
36
- var ALIAS_LAYOUTS_TMP = "@/dumi__theme__layouts";
36
+ var ALIAS_LAYOUTS_LOCAL = "@/dumi__theme__layouts";
37
37
  var ALIAS_INTERNAL_PAGES = "@/dumi__pages";
38
38
  function normalizeDocDir(docDir) {
39
39
  return typeof docDir === "object" ? docDir : { dir: docDir };
@@ -64,6 +64,13 @@ function flatRoute(route, docLayoutId) {
64
64
  route.path = route.path === "*" ? route.path : route.absPath.slice(1);
65
65
  }
66
66
  }
67
+ function getAliasLayoutFile({
68
+ source,
69
+ specifier
70
+ }) {
71
+ const alias = source.includes("/.dumi/theme/layouts/") ? ALIAS_LAYOUTS_LOCAL : `${ALIAS_THEME_TMP}/layouts`;
72
+ return `${alias}/${specifier}`;
73
+ }
67
74
  var routes_default = (api) => {
68
75
  var _a, _b, _c;
69
76
  const extraWatchPaths = [
@@ -84,10 +91,7 @@ var routes_default = (api) => {
84
91
  });
85
92
  }
86
93
  memo.alias[ALIAS_THEME_TMP] = (0, import_plugin_utils.winPath)(import_path.default.join(api.paths.absTmpPath, "dumi/theme"));
87
- memo.alias[ALIAS_LAYOUTS_TMP] = [
88
- (0, import_plugin_utils.winPath)(import_path.default.join(api.cwd, import_constants.LOCAL_THEME_DIR, "layouts")),
89
- `${ALIAS_THEME_TMP}/layouts`
90
- ];
94
+ memo.alias[ALIAS_LAYOUTS_LOCAL] = (0, import_plugin_utils.winPath)(import_path.default.join(api.cwd, import_constants.LOCAL_THEME_DIR, "layouts"));
91
95
  memo.alias[ALIAS_INTERNAL_PAGES] = (0, import_plugin_utils.winPath)(import_path.default.join(__dirname, "../client/pages"));
92
96
  return memo;
93
97
  });
@@ -112,7 +116,7 @@ var routes_default = (api) => {
112
116
  routes[DocLayout.specifier] = {
113
117
  id: DocLayout.specifier,
114
118
  path: "/",
115
- file: `${ALIAS_LAYOUTS_TMP}/DocLayout`,
119
+ file: getAliasLayoutFile(DocLayout),
116
120
  parentId: lastLayoutId,
117
121
  absPath: "/",
118
122
  isLayout: true
@@ -123,7 +127,7 @@ var routes_default = (api) => {
123
127
  routes[DemoLayout.specifier] = {
124
128
  id: DemoLayout.specifier,
125
129
  path: "/",
126
- file: `${ALIAS_LAYOUTS_TMP}/DemoLayout`,
130
+ file: getAliasLayoutFile(DemoLayout),
127
131
  parentId: lastLayoutId,
128
132
  absPath: "/",
129
133
  isLayout: true
@@ -204,7 +208,7 @@ var routes_default = (api) => {
204
208
  if (GlobalLayout) {
205
209
  layouts.unshift({
206
210
  id: GlobalLayout.specifier,
207
- file: `${ALIAS_LAYOUTS_TMP}/GlobalLayout`
211
+ file: getAliasLayoutFile(GlobalLayout)
208
212
  });
209
213
  }
210
214
  return layouts;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.1.20",
3
+ "version": "2.1.21",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",