dumi 2.4.43 → 2.4.45

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.
@@ -1,4 +1,11 @@
1
1
  import type { IApi, IDumiTechStack } from '../../types';
2
2
  export declare const techStacks: IDumiTechStack[];
3
+ export declare function getUtoopackDemoAssetsFile(api: {
4
+ env: string;
5
+ paths: {
6
+ absTmpPath: string;
7
+ };
8
+ isPluginEnable: (key: string) => boolean;
9
+ }): string | undefined;
3
10
  export default _default;
4
11
  declare function _default(api: IApi): void;
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var compile_exports = {};
31
31
  __export(compile_exports, {
32
32
  default: () => compile_default,
33
+ getUtoopackDemoAssetsFile: () => getUtoopackDemoAssetsFile,
33
34
  techStacks: () => techStacks
34
35
  });
35
36
  module.exports = __toCommonJS(compile_exports);
@@ -43,6 +44,12 @@ var import_makoHooks = require("./makoHooks");
43
44
  var import_utils2 = require("./utils");
44
45
  var import_utoopackLoaders = require("./utoopackLoaders");
45
46
  var techStacks = [];
47
+ function getUtoopackDemoAssetsFile(api) {
48
+ if (api.env !== "production" || !api.isPluginEnable("exportStatic")) {
49
+ return void 0;
50
+ }
51
+ return import_path.default.join(api.paths.absTmpPath, import_utoopackLoaders.UTOOPACK_DEMO_ASSETS_FILENAME);
52
+ }
46
53
  function normalizeMakoAliases(alias, cwd) {
47
54
  const normalizedAlias = { ...alias };
48
55
  const resolver = import_enhanced_resolve.default.create.sync({
@@ -118,11 +125,9 @@ var compile_default = (api) => {
118
125
  fn() {
119
126
  var _a, _b;
120
127
  if (api.config.utoopack) {
121
- const demoAssetsFile = import_path.default.join(
122
- api.paths.absTmpPath,
123
- import_utoopackLoaders.UTOOPACK_DEMO_ASSETS_FILENAME
124
- );
125
- import_fs.default.rmSync(demoAssetsFile, { force: true });
128
+ const demoAssetsFile = getUtoopackDemoAssetsFile(api);
129
+ if (demoAssetsFile)
130
+ import_fs.default.rmSync(demoAssetsFile, { force: true });
126
131
  api.writeTmpFile({
127
132
  noPluginDir: true,
128
133
  path: import_utoopackLoaders.LOADER_CTX_FILENAME,
@@ -250,5 +255,6 @@ var compile_default = (api) => {
250
255
  };
251
256
  // Annotate the CommonJS export names for ESM import in node:
252
257
  0 && (module.exports = {
258
+ getUtoopackDemoAssetsFile,
253
259
  techStacks
254
260
  });
@@ -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.43",
3
+ "version": "2.4.45",
4
4
  "description": "📖 Documentation Generator of React Component",
5
5
  "keywords": [
6
6
  "generator",
@@ -69,9 +69,9 @@
69
69
  "@swc/core": "1.9.2",
70
70
  "@types/hast": "^2.3.5",
71
71
  "@types/mdast": "^3.0.12",
72
- "@umijs/bundler-utils": "^4.6.74",
73
- "@umijs/core": "^4.6.74",
74
- "@umijs/utils": "^4.6.74",
72
+ "@umijs/bundler-utils": "^4.6.76",
73
+ "@umijs/core": "^4.6.76",
74
+ "@umijs/utils": "^4.6.76",
75
75
  "animated-scroll-to": "^2.3.0",
76
76
  "classnames": "2.3.2",
77
77
  "codesandbox-import-utils": "^2.2.3",
@@ -123,7 +123,7 @@
123
123
  "sass": "^1.64.1",
124
124
  "sitemap": "^7.1.1",
125
125
  "sucrase": "^3.34.0",
126
- "umi": "^4.6.74",
126
+ "umi": "^4.6.76",
127
127
  "unified": "^10.1.2",
128
128
  "unist-util-visit": "^4.1.2",
129
129
  "unist-util-visit-parents": "^5.1.3",
@@ -147,8 +147,8 @@
147
147
  "@types/react-copy-to-clipboard": "^5.0.4",
148
148
  "@types/react-dom": "^18.2.7",
149
149
  "@typescript/native-preview": "7.0.0-dev.20260623.1",
150
- "@umijs/lint": "^4.6.74",
151
- "@umijs/plugins": "4.6.74",
150
+ "@umijs/lint": "^4.6.76",
151
+ "@umijs/plugins": "4.6.76",
152
152
  "eslint": "^8.46.0",
153
153
  "esno": "^4.7.0",
154
154
  "fast-glob": "^3.3.1",