dumi 2.0.8 → 2.0.9

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.
@@ -50,7 +50,7 @@ var assets_default = (api) => {
50
50
  fn: resolve
51
51
  });
52
52
  api.register({
53
- key: "onCompileDone",
53
+ key: "onBuildComplete",
54
54
  stage: -Infinity,
55
55
  fn: resolve
56
56
  });
@@ -164,12 +164,13 @@ export default function DumiContextWrapper() {
164
164
 
165
165
  useEffect(() => {
166
166
  return history.listen((next) => {
167
- // mark loading when route change, page component will set false when loaded
168
- setLoading(true);
169
-
170
- // scroll to top when route changed
171
167
  if (next.location.pathname !== prev.current) {
172
168
  prev.current = next.location.pathname;
169
+
170
+ // mark loading when route change, page component will set false when loaded
171
+ setLoading(true);
172
+
173
+ // scroll to top when route changed
173
174
  document.documentElement.scrollTo(0, 0);
174
175
  }
175
176
  });
@@ -141,7 +141,7 @@ function rehypeDemo(opts) {
141
141
  if (codeType === "external") {
142
142
  const chunkName = [vFile.data.frontmatter.atomId, "demos"].filter(Boolean).join("__");
143
143
  parseOpts.fileAbsPath = codeNode.properties.src;
144
- parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, import_path.default.parse(parseOpts.fileAbsPath).name, vFile.data.frontmatter.atomId);
144
+ parseOpts.id = getCodeId(opts.cwd, opts.fileAbsPath, import_path.default.parse(parseOpts.fileAbsPath.replace(/\/index\.(j|t)sx?$/, "")).name, vFile.data.frontmatter.atomId);
145
145
  component = `React.lazy(() => import( /* webpackChunkName: "${chunkName}" */ '${(0, import_plugin_utils.winPath)(parseOpts.fileAbsPath)}?techStack=${techStack.name}'))`;
146
146
  if (codeValue)
147
147
  codeNode.properties.title = codeValue;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",