dumi 2.4.0 → 2.4.2

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.
@@ -108,8 +108,8 @@ var compile_default = (api) => {
108
108
  locales: api.config.locales,
109
109
  pkg: api.pkg
110
110
  };
111
+ memo.module.rule("watch-parent").pre().resourceQuery(/watch=parent/).use("null-loader").loader(require.resolve("../../loaders/null")).end();
111
112
  const mdRule = memo.module.rule("dumi-md").type("javascript/auto").test(/\.md$/);
112
- mdRule.oneOf("md-null").pre().resourceQuery(/watch=parent/).use("null-loader").loader(require.resolve("../../loaders/null")).end();
113
113
  ["frontmatter", "text", "demo-index"].forEach((type) => {
114
114
  mdRule.oneOf(`md-${type}`).resourceQuery(new RegExp(`${type}$`)).use(`md-${type}-loader`).loader(loaderPath).options({
115
115
  ...loaderBaseOpts,
@@ -33,6 +33,6 @@ function demoLoader(raw) {
33
33
  type: "external",
34
34
  fileAbsPath: this.resourcePath
35
35
  });
36
- code = code + `import '${(0, import_utils.winPath)(this.resourcePath)}?watch=parent';`;
36
+ code = `import '${(0, import_utils.winPath)(this.resourcePath)}?watch=parent';${code}`;
37
37
  return code;
38
38
  }
@@ -147,41 +147,29 @@ export function getRouteMetaById<T extends { syncOnly?: boolean }>(
147
147
  toc,
148
148
  texts: [],
149
149
  };
150
- if (filesMeta[id]) {
151
- const { frontmatter, toc, textGetter, tabs } = filesMeta[id];
152
- routeMeta.frontmatter = frontmatter;
153
- routeMeta.toc = toc;
154
150
 
155
- if (opts?.syncOnly) {
151
+ if (opts?.syncOnly) {
152
+ if (tabs) {
153
+ routeMeta.tabs = tabs.map((tabId) =>
154
+ genTab(tabId, getRouteMetaById(tabId, opts)),
155
+ );
156
+ }
157
+ return routeMeta;
158
+ } else {
159
+ return new Promise(async (resolve) => {
160
+ if (textGetter) {
161
+ ({ texts: routeMeta.texts } = await textGetter());
162
+ }
156
163
  if (tabs) {
157
- routeMeta.tabs = tabs.map((tabId) =>
158
- genTab(tabId, getRouteMetaById(tabId, opts)),
164
+ routeMeta.tabs = await Promise.all(
165
+ tabs.map(async (tabId) =>
166
+ genTab(tabId, await getRouteMetaById(tabId, opts)),
167
+ ),
159
168
  );
160
169
  }
161
-
162
- return routeMeta;
163
- } else {
164
- return new Promise(async (resolve) => {
165
- if (textGetter) {
166
- ({ texts: routeMeta.texts } = await textGetter());
167
- }
168
-
169
- if (tabs) {
170
- routeMeta.tabs = await Promise.all(
171
- tabs.map(async (tabId) =>
172
- genTab(tabId, await getRouteMetaById(tabId, opts)),
173
- ),
174
- );
175
- }
176
-
177
- resolve(routeMeta);
178
- });
179
- }
180
- }
181
- if (opts?.syncOnly) {
182
- return routeMeta;
170
+ resolve(routeMeta);
171
+ });
183
172
  }
184
- return Promise.resolve(routeMeta);
185
173
  }
186
174
  }
187
175
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",