dumi 2.0.0-beta.12 → 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.
@@ -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
  });
@@ -49,7 +49,7 @@ function getCodeLang(node, opts) {
49
49
  var _a, _b, _c, _d;
50
50
  let lang = "";
51
51
  if (typeof ((_a = node.properties) == null ? void 0 : _a.src) === "string") {
52
- node.properties.src = (0, import_plugin_utils.winPath)(opts.resolver(import_path.default.dirname(opts.fileAbsPath), node.properties.src));
52
+ node.properties.src = opts.resolver(import_path.default.dirname(opts.fileAbsPath), node.properties.src);
53
53
  lang = import_path.default.extname(node.properties.src).slice(1);
54
54
  } else if (Array.isArray((_b = node.properties) == null ? void 0 : _b.className) && (opts.codeBlockMode === "passive" ? / demo/.test(String((_c = node.data) == null ? void 0 : _c.meta)) : !/ pure/.test(String((_d = node.data) == null ? void 0 : _d.meta)))) {
55
55
  lang = String(node.properties.className[0]).replace("language-", "");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.0.0-beta.12",
3
+ "version": "2.0.0-beta.13",
4
4
  "description": "Framework for developing UI components",
5
5
  "keywords": [],
6
6
  "license": "MIT",