dumi 2.4.42 → 2.4.44

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.
@@ -84,8 +84,17 @@ var exportStatic_default = (api) => {
84
84
  ],
85
85
  "id"
86
86
  );
87
+ const localeSuffixes = api.config.locales.map((locale) => "suffix" in locale ? locale.suffix : "").filter(Boolean);
88
+ const exampleIds = import_plugin_utils.lodash.uniq(
89
+ examples.flatMap(({ id }) => [
90
+ id,
91
+ ...localeSuffixes.map(
92
+ (suffix) => id.endsWith(suffix) ? id : `${id}${suffix}`
93
+ )
94
+ ])
95
+ );
87
96
  api.appData.exportHtmlData.push(
88
- ...examples.map(({ id }) => ({
97
+ ...exampleIds.map((id) => ({
89
98
  route: { path: `/${routePrefix}/${id}` },
90
99
  file: `${routePrefix}/${id}/index.html`,
91
100
  prerender: false
@@ -167,19 +167,22 @@ export function useDemo(
167
167
  version?: string,
168
168
  routeId?: string,
169
169
  ): IDemoData | undefined {
170
+ const mappedDemoId = loader
171
+ ? undefined
172
+ : getDemoIdCandidates(id).find((candidate) => demoIdMap[candidate]);
170
173
  const cacheKey = version
171
174
  ? `${id}:${version}`
172
175
  : routeId
173
176
  ? `${id}:route=${routeId}`
174
177
  : id;
175
- const getter = loader ?? demoIdMap[id];
178
+ const getter = loader ?? (mappedDemoId ? demoIdMap[mappedDemoId] : undefined);
176
179
 
177
180
  if (!demosCache.get(cacheKey)) {
178
181
  demosCache.set(
179
182
  cacheKey,
180
183
  getter
181
184
  ? getter().then(({ demos }) => {
182
- const demo = demos[id];
185
+ const demo = demos[id] ?? (mappedDemoId && demos[mappedDemoId]);
183
186
  if (!demo) return undefined;
184
187
 
185
188
  // expand context for omit ext
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dumi",
3
- "version": "2.4.42",
3
+ "version": "2.4.44",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",