@umijs/preset-umi 4.0.52 → 4.0.53
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.
- package/compiled/ini/package.json +1 -1
- package/dist/commands/dev/dev.js +1 -1
- package/dist/features/appData/appData.js +0 -8
- package/dist/features/clientLoader/clientLoader.js +8 -105
- package/dist/features/configPlugins/configPlugins.js +1 -5
- package/dist/features/icons/esbuildIconPlugin.js +2 -2
- package/dist/features/icons/icons.js +180 -8
- package/dist/features/prepare/prepare.js +11 -0
- package/dist/features/routeProps/routeProps.d.ts +3 -0
- package/dist/features/routeProps/routeProps.js +47 -0
- package/dist/features/tmpFiles/getModuleExports.js +14 -3
- package/dist/features/tmpFiles/routes.js +15 -9
- package/dist/features/tmpFiles/tmpFiles.js +46 -6
- package/dist/features/ui/ui.d.ts +3 -0
- package/dist/features/ui/ui.js +39 -0
- package/dist/index.js +3 -1
- package/dist/types.d.ts +0 -8
- package/dist/utils/routeExportExtractor.d.ts +14 -0
- package/dist/utils/routeExportExtractor.js +154 -0
- package/package.json +12 -12
- package/templates/route.tpl +1 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"ini","author":"GitHub Inc.","license":"ISC"}
|
|
1
|
+
{"name":"ini","version":"3.0.0","author":"GitHub Inc.","license":"ISC"}
|
package/dist/commands/dev/dev.js
CHANGED
|
@@ -98,14 +98,6 @@ var appData_default = (api) => {
|
|
|
98
98
|
memo.framework = "react";
|
|
99
99
|
return memo;
|
|
100
100
|
});
|
|
101
|
-
api.registerMethod({
|
|
102
|
-
name: "_refreshRoutes",
|
|
103
|
-
async fn() {
|
|
104
|
-
api.appData.routes = await routesApi.getRoutes({
|
|
105
|
-
api
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
101
|
api.register({
|
|
110
102
|
key: "onGenerateFiles",
|
|
111
103
|
async fn(args) {
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
4
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
5
|
var __export = (target, all) => {
|
|
8
6
|
for (var name in all)
|
|
@@ -16,14 +14,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
14
|
}
|
|
17
15
|
return to;
|
|
18
16
|
};
|
|
19
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
18
|
|
|
29
19
|
// src/features/clientLoader/clientLoader.ts
|
|
@@ -32,8 +22,7 @@ __export(clientLoader_exports, {
|
|
|
32
22
|
default: () => clientLoader_default
|
|
33
23
|
});
|
|
34
24
|
module.exports = __toCommonJS(clientLoader_exports);
|
|
35
|
-
var
|
|
36
|
-
var import_path = require("path");
|
|
25
|
+
var import_routeExportExtractor = require("../../utils/routeExportExtractor");
|
|
37
26
|
var clientLoader_default = (api) => {
|
|
38
27
|
api.describe({
|
|
39
28
|
config: {
|
|
@@ -43,100 +32,14 @@ var clientLoader_default = (api) => {
|
|
|
43
32
|
},
|
|
44
33
|
enableBy: api.EnableBy.config
|
|
45
34
|
});
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
if (route.__hasClientLoader) {
|
|
54
|
-
index += 1;
|
|
55
|
-
clientLoaderImports.push(
|
|
56
|
-
`import { clientLoader as loader_${index} } from '${route.__absFile}';`
|
|
57
|
-
);
|
|
58
|
-
clientLoaderDefines.push(` '${id}': loader_${index},`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
api.writeTmpFile({
|
|
62
|
-
noPluginDir: true,
|
|
63
|
-
path: (0, import_path.join)("core/loaders.ts"),
|
|
64
|
-
content: `
|
|
65
|
-
${clientLoaderImports.join("\n")}
|
|
66
|
-
export default {
|
|
67
|
-
${clientLoaderDefines.join("\n")}
|
|
68
|
-
};
|
|
69
|
-
`
|
|
70
|
-
});
|
|
35
|
+
const entryFile = "core/loaders.ts";
|
|
36
|
+
const outFile = "core/loaders.js";
|
|
37
|
+
(0, import_routeExportExtractor.setupRouteExportExtractor)({
|
|
38
|
+
api,
|
|
39
|
+
entryFile,
|
|
40
|
+
outFile,
|
|
41
|
+
propertyName: "clientLoader"
|
|
71
42
|
});
|
|
72
|
-
api.onBeforeCompiler(async () => {
|
|
73
|
-
await import_esbuild.default.build({
|
|
74
|
-
format: "esm",
|
|
75
|
-
platform: "browser",
|
|
76
|
-
target: "esnext",
|
|
77
|
-
loader,
|
|
78
|
-
watch: api.env === "development" && {},
|
|
79
|
-
bundle: true,
|
|
80
|
-
logLevel: "error",
|
|
81
|
-
entryPoints: [(0, import_path.join)(api.paths.absTmpPath, "core/loaders.ts")],
|
|
82
|
-
outfile: (0, import_path.join)(api.paths.absTmpPath, "core/loaders.js"),
|
|
83
|
-
plugins: [
|
|
84
|
-
{
|
|
85
|
-
name: "imports",
|
|
86
|
-
setup(build) {
|
|
87
|
-
let entry;
|
|
88
|
-
build.onResolve({ filter: /.*/ }, (args) => {
|
|
89
|
-
if (args.kind === "entry-point")
|
|
90
|
-
entry = args.path;
|
|
91
|
-
if (args.kind === "entry-point" || args.importer === entry) {
|
|
92
|
-
return { path: (0, import_path.resolve)(args.resolveDir, args.path) };
|
|
93
|
-
}
|
|
94
|
-
return {
|
|
95
|
-
path: !args.path.startsWith(".") && !args.path.startsWith("/") ? args.path : (0, import_path.resolve)(args.resolveDir, args.path),
|
|
96
|
-
external: true,
|
|
97
|
-
sideEffects: false
|
|
98
|
-
};
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
]
|
|
103
|
-
});
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
var loader = {
|
|
107
|
-
".aac": "file",
|
|
108
|
-
".css": "text",
|
|
109
|
-
".less": "text",
|
|
110
|
-
".sass": "text",
|
|
111
|
-
".scss": "text",
|
|
112
|
-
".eot": "file",
|
|
113
|
-
".flac": "file",
|
|
114
|
-
".gif": "file",
|
|
115
|
-
".htm": "file",
|
|
116
|
-
".html": "file",
|
|
117
|
-
".ico": "file",
|
|
118
|
-
".icon": "file",
|
|
119
|
-
".jpeg": "file",
|
|
120
|
-
".jpg": "file",
|
|
121
|
-
".js": "jsx",
|
|
122
|
-
".jsx": "jsx",
|
|
123
|
-
".json": "json",
|
|
124
|
-
".md": "jsx",
|
|
125
|
-
".mdx": "jsx",
|
|
126
|
-
".mp3": "file",
|
|
127
|
-
".mp4": "file",
|
|
128
|
-
".ogg": "file",
|
|
129
|
-
".otf": "file",
|
|
130
|
-
".png": "file",
|
|
131
|
-
".svg": "file",
|
|
132
|
-
".ts": "ts",
|
|
133
|
-
".tsx": "tsx",
|
|
134
|
-
".ttf": "file",
|
|
135
|
-
".wav": "file",
|
|
136
|
-
".webm": "file",
|
|
137
|
-
".webp": "file",
|
|
138
|
-
".woff": "file",
|
|
139
|
-
".woff2": "file"
|
|
140
43
|
};
|
|
141
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
142
45
|
0 && (module.exports = {});
|
|
@@ -109,11 +109,7 @@ var configPlugins_default = (api) => {
|
|
|
109
109
|
config.default = configDefaults[key];
|
|
110
110
|
}
|
|
111
111
|
if (["routes"].includes(key)) {
|
|
112
|
-
|
|
113
|
-
await api._refreshRoutes();
|
|
114
|
-
await generate({ isFirstTime: false });
|
|
115
|
-
};
|
|
116
|
-
config.onChange = onRoutesChange;
|
|
112
|
+
config.onChange = api.ConfigChangeType.regenerateTmpFiles;
|
|
117
113
|
}
|
|
118
114
|
api.registerPlugins([
|
|
119
115
|
{
|
|
@@ -42,8 +42,8 @@ function esbuildIconPlugin(opts) {
|
|
|
42
42
|
const loaders = ["js", "jsx", "ts", "tsx"];
|
|
43
43
|
loaders.forEach((loader) => {
|
|
44
44
|
const filter = new RegExp(`\\.(${loader})$`);
|
|
45
|
-
build.onLoad({ filter }, (args) => {
|
|
46
|
-
const contents = import_fs.default.
|
|
45
|
+
build.onLoad({ filter }, async (args) => {
|
|
46
|
+
const contents = await import_fs.default.promises.readFile(args.path, "utf-8");
|
|
47
47
|
const icons = (0, import_extract.extractIcons)(contents);
|
|
48
48
|
import_utils.logger.debug(`[icons] ${args.path} > ${icons}`);
|
|
49
49
|
icons.forEach((icon) => {
|
|
@@ -33,6 +33,7 @@ __export(icons_exports, {
|
|
|
33
33
|
});
|
|
34
34
|
module.exports = __toCommonJS(icons_exports);
|
|
35
35
|
var import_utils = require("@umijs/utils");
|
|
36
|
+
var import_fs = __toESM(require("fs"));
|
|
36
37
|
var import_path = __toESM(require("path"));
|
|
37
38
|
var import_depsOnDemand = require("../depsOnDemand/depsOnDemand");
|
|
38
39
|
var icons_default = (api) => {
|
|
@@ -44,7 +45,8 @@ var icons_default = (api) => {
|
|
|
44
45
|
autoInstall: Joi.object(),
|
|
45
46
|
defaultComponentConfig: Joi.object(),
|
|
46
47
|
// e.g. alias: { home: 'fa:home' }
|
|
47
|
-
alias: Joi.object()
|
|
48
|
+
alias: Joi.object(),
|
|
49
|
+
include: Joi.array().items(Joi.string())
|
|
48
50
|
});
|
|
49
51
|
}
|
|
50
52
|
},
|
|
@@ -69,14 +71,16 @@ var icons_default = (api) => {
|
|
|
69
71
|
];
|
|
70
72
|
});
|
|
71
73
|
api.onPrepareBuildSuccess(async () => {
|
|
72
|
-
|
|
74
|
+
const extraIcons = api.config.icons.include || [];
|
|
75
|
+
const allIcons = /* @__PURE__ */ new Set([...icons, ...extraIcons]);
|
|
76
|
+
if (!allIcons.size) {
|
|
73
77
|
import_utils.logger.info(`[icons] no icons was found`);
|
|
74
78
|
return;
|
|
75
79
|
}
|
|
76
80
|
import_utils.logger.info(`[icons] generate icons ${Array.from(icons).join(", ")}`);
|
|
77
81
|
const code = [];
|
|
78
82
|
const { generateIconName, generateSvgr } = (0, import_utils.importLazy)(require.resolve("./svgr"));
|
|
79
|
-
for (const iconStr of
|
|
83
|
+
for (const iconStr of allIcons) {
|
|
80
84
|
const [collect, icon] = iconStr.split(":");
|
|
81
85
|
const iconName = generateIconName({ collect, icon });
|
|
82
86
|
let svgr;
|
|
@@ -105,7 +109,7 @@ var icons_default = (api) => {
|
|
|
105
109
|
});
|
|
106
110
|
})
|
|
107
111
|
},
|
|
108
|
-
localIconDir:
|
|
112
|
+
localIconDir: getLocalIconDir()
|
|
109
113
|
});
|
|
110
114
|
} catch (e) {
|
|
111
115
|
import_utils.logger.error(e);
|
|
@@ -134,6 +138,13 @@ var icons_default = (api) => {
|
|
|
134
138
|
content: EMPTY_ICONS_FILE
|
|
135
139
|
});
|
|
136
140
|
}
|
|
141
|
+
const localIconDir = getLocalIconDir();
|
|
142
|
+
const localIcons = [];
|
|
143
|
+
if (import_fs.default.existsSync(localIconDir)) {
|
|
144
|
+
localIcons.push(
|
|
145
|
+
...import_fs.default.readdirSync(localIconDir).filter((file) => file.endsWith(".svg")).map((file) => file.replace(/\.svg$/, ""))
|
|
146
|
+
);
|
|
147
|
+
}
|
|
137
148
|
api.writeTmpFile({
|
|
138
149
|
path: "index.tsx",
|
|
139
150
|
content: `
|
|
@@ -143,9 +154,160 @@ import './index.css';
|
|
|
143
154
|
|
|
144
155
|
const alias = ${JSON.stringify(api.config.icons.alias || {})};
|
|
145
156
|
type AliasKeys = keyof typeof alias;
|
|
157
|
+
const localIcons = ${JSON.stringify(localIcons)} as const;
|
|
158
|
+
type LocalIconsKeys = typeof localIcons[number];
|
|
159
|
+
|
|
160
|
+
type IconCollections = 'academicons' |
|
|
161
|
+
'akar-icons' |
|
|
162
|
+
'ant-design' |
|
|
163
|
+
'arcticons' |
|
|
164
|
+
'basil' |
|
|
165
|
+
'bi' |
|
|
166
|
+
'bpmn' |
|
|
167
|
+
'brandico' |
|
|
168
|
+
'bx' |
|
|
169
|
+
'bxl' |
|
|
170
|
+
'bxs' |
|
|
171
|
+
'bytesize' |
|
|
172
|
+
'carbon' |
|
|
173
|
+
'charm' |
|
|
174
|
+
'ci' |
|
|
175
|
+
'cib' |
|
|
176
|
+
'cif' |
|
|
177
|
+
'cil' |
|
|
178
|
+
'circle-flags' |
|
|
179
|
+
'circum' |
|
|
180
|
+
'clarity' |
|
|
181
|
+
'codicon' |
|
|
182
|
+
'cryptocurrency-color' |
|
|
183
|
+
'cryptocurrency' |
|
|
184
|
+
'dashicons' |
|
|
185
|
+
'ei' |
|
|
186
|
+
'el' |
|
|
187
|
+
'emblemicons' |
|
|
188
|
+
'emojione-monotone' |
|
|
189
|
+
'emojione-v1' |
|
|
190
|
+
'emojione' |
|
|
191
|
+
'entypo-social' |
|
|
192
|
+
'entypo' |
|
|
193
|
+
'eos-icons' |
|
|
194
|
+
'ep' |
|
|
195
|
+
'et' |
|
|
196
|
+
'eva' |
|
|
197
|
+
'fa-brands' |
|
|
198
|
+
'fa-regular' |
|
|
199
|
+
'fa-solid' |
|
|
200
|
+
'fa' |
|
|
201
|
+
'fa6-brands' |
|
|
202
|
+
'fa6-regular' |
|
|
203
|
+
'fa6-solid' |
|
|
204
|
+
'fad' |
|
|
205
|
+
'fe' |
|
|
206
|
+
'feather' |
|
|
207
|
+
'file-icons' |
|
|
208
|
+
'flag' |
|
|
209
|
+
'flagpack' |
|
|
210
|
+
'flat-color-icons' |
|
|
211
|
+
'flat-ui' |
|
|
212
|
+
'fluent-emoji-flat' |
|
|
213
|
+
'fluent-emoji-high-contrast' |
|
|
214
|
+
'fluent-emoji' |
|
|
215
|
+
'fluent-mdl2' |
|
|
216
|
+
'fluent' |
|
|
217
|
+
'fontelico' |
|
|
218
|
+
'fontisto' |
|
|
219
|
+
'foundation' |
|
|
220
|
+
'fxemoji' |
|
|
221
|
+
'gala' |
|
|
222
|
+
'game-icons' |
|
|
223
|
+
'geo' |
|
|
224
|
+
'gg' |
|
|
225
|
+
'gis' |
|
|
226
|
+
'gridicons' |
|
|
227
|
+
'grommet-icons' |
|
|
228
|
+
'healthicons' |
|
|
229
|
+
'heroicons-outline' |
|
|
230
|
+
'heroicons-solid' |
|
|
231
|
+
'heroicons' |
|
|
232
|
+
'humbleicons' |
|
|
233
|
+
'ic' |
|
|
234
|
+
'icomoon-free' |
|
|
235
|
+
'icon-park-outline' |
|
|
236
|
+
'icon-park-solid' |
|
|
237
|
+
'icon-park-twotone' |
|
|
238
|
+
'icon-park' |
|
|
239
|
+
'iconoir' |
|
|
240
|
+
'icons8' |
|
|
241
|
+
'il' |
|
|
242
|
+
'ion' |
|
|
243
|
+
'iwwa' |
|
|
244
|
+
'jam' |
|
|
245
|
+
'la' |
|
|
246
|
+
'line-md' |
|
|
247
|
+
'logos' |
|
|
248
|
+
'ls' |
|
|
249
|
+
'lucide' |
|
|
250
|
+
'majesticons' |
|
|
251
|
+
'maki' |
|
|
252
|
+
'map' |
|
|
253
|
+
'material-symbols' |
|
|
254
|
+
'mdi-light' |
|
|
255
|
+
'mdi' |
|
|
256
|
+
'medical-icon' |
|
|
257
|
+
'memory' |
|
|
258
|
+
'mi' |
|
|
259
|
+
'mingcute' |
|
|
260
|
+
'mono-icons' |
|
|
261
|
+
'nimbus' |
|
|
262
|
+
'nonicons' |
|
|
263
|
+
'noto-v1' |
|
|
264
|
+
'noto' |
|
|
265
|
+
'octicon' |
|
|
266
|
+
'oi' |
|
|
267
|
+
'ooui' |
|
|
268
|
+
'openmoji' |
|
|
269
|
+
'pajamas' |
|
|
270
|
+
'pepicons-pop' |
|
|
271
|
+
'pepicons-print' |
|
|
272
|
+
'pepicons' |
|
|
273
|
+
'ph' |
|
|
274
|
+
'pixelarticons' |
|
|
275
|
+
'prime' |
|
|
276
|
+
'ps' |
|
|
277
|
+
'quill' |
|
|
278
|
+
'radix-icons' |
|
|
279
|
+
'raphael' |
|
|
280
|
+
'ri' |
|
|
281
|
+
'si-glyph' |
|
|
282
|
+
'simple-icons' |
|
|
283
|
+
'simple-line-icons' |
|
|
284
|
+
'skill-icons' |
|
|
285
|
+
'subway' |
|
|
286
|
+
'svg-spinners' |
|
|
287
|
+
'system-uicons' |
|
|
288
|
+
'tabler' |
|
|
289
|
+
'teenyicons' |
|
|
290
|
+
'topcoat' |
|
|
291
|
+
'twemoji' |
|
|
292
|
+
'typcn' |
|
|
293
|
+
'uil' |
|
|
294
|
+
'uim' |
|
|
295
|
+
'uis' |
|
|
296
|
+
'uit' |
|
|
297
|
+
'uiw' |
|
|
298
|
+
'vaadin' |
|
|
299
|
+
'vs' |
|
|
300
|
+
'vscode-icons' |
|
|
301
|
+
'websymbol' |
|
|
302
|
+
'whh' |
|
|
303
|
+
'wi' |
|
|
304
|
+
'wpf' |
|
|
305
|
+
'zmdi' |
|
|
306
|
+
'zondicons';
|
|
307
|
+
type Icon = \`\${IconCollections}:\${string}\`;
|
|
146
308
|
|
|
147
309
|
interface IUmiIconProps extends React.SVGAttributes<SVGElement> {
|
|
148
|
-
icon: AliasKeys |
|
|
310
|
+
icon: AliasKeys | Icon | \`local:\${LocalIconsKeys}\`;
|
|
149
311
|
hover?: AliasKeys | string;
|
|
150
312
|
className?: string;
|
|
151
313
|
viewBox?: string;
|
|
@@ -157,8 +319,8 @@ interface IUmiIconProps extends React.SVGAttributes<SVGElement> {
|
|
|
157
319
|
flip?: 'vertical' | 'horizontal' | 'horizontal,vertical' | 'vertical,horizontal';
|
|
158
320
|
}
|
|
159
321
|
|
|
160
|
-
export const Icon = React.forwardRef((props
|
|
161
|
-
const { icon, hover, style, className, rotate, flip, ...extraProps } = props;
|
|
322
|
+
export const Icon = React.forwardRef<HTMLSpanElement, IUmiIconProps>((props, ref) => {
|
|
323
|
+
const { icon, hover, style, className = '' , rotate, flip, ...extraProps } = props;
|
|
162
324
|
const iconName = normalizeIconName(alias[icon] || icon);
|
|
163
325
|
const Component = iconsMap[iconName];
|
|
164
326
|
if (!Component) {
|
|
@@ -190,8 +352,12 @@ export const Icon = React.forwardRef((props: IUmiIconProps, ref) => {
|
|
|
190
352
|
svgStyle.msTransform = transformStr;
|
|
191
353
|
svgStyle.transform = transformStr;
|
|
192
354
|
}
|
|
355
|
+
|
|
356
|
+
const spanClassName = HoverComponent ? 'umiIconDoNotUseThis ' : '' + className;
|
|
357
|
+
const spanClass = spanClassName ? { className: spanClassName } : {};
|
|
358
|
+
|
|
193
359
|
return (
|
|
194
|
-
<span role="img" ref={ref}
|
|
360
|
+
<span role="img" ref={ref} {...spanClass} style={style}>
|
|
195
361
|
<Component {...extraProps} className={cls} style={svgStyle} />
|
|
196
362
|
{
|
|
197
363
|
HoverComponent ? <HoverComponent {...extraProps} className={'umiIconDoNotUseThisHover ' + cls} style={svgStyle} /> : null
|
|
@@ -257,6 +423,12 @@ function normalizeIconName(name: string) {
|
|
|
257
423
|
`
|
|
258
424
|
});
|
|
259
425
|
});
|
|
426
|
+
api.addTmpGenerateWatcherPaths(() => {
|
|
427
|
+
return [getLocalIconDir()];
|
|
428
|
+
});
|
|
429
|
+
function getLocalIconDir() {
|
|
430
|
+
return import_path.default.join(api.paths.absSrcPath, "icons");
|
|
431
|
+
}
|
|
260
432
|
};
|
|
261
433
|
// Annotate the CommonJS export names for ESM import in node:
|
|
262
434
|
0 && (module.exports = {});
|
|
@@ -36,6 +36,15 @@ var import_utils = require("@umijs/utils");
|
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
37
|
var import_watch = require("../../commands/dev/watch");
|
|
38
38
|
var prepare_default = (api) => {
|
|
39
|
+
function updateAppdata(_buildResult) {
|
|
40
|
+
const buildResult = import_utils.lodash.cloneDeep(_buildResult);
|
|
41
|
+
(buildResult.outputFiles || []).forEach((file) => {
|
|
42
|
+
file == null ? true : delete file.contents;
|
|
43
|
+
});
|
|
44
|
+
api.appData.prepare = {
|
|
45
|
+
buildResult
|
|
46
|
+
};
|
|
47
|
+
}
|
|
39
48
|
api.register({
|
|
40
49
|
key: "onGenerateFiles",
|
|
41
50
|
async fn({ isFirstTime }) {
|
|
@@ -59,6 +68,7 @@ var prepare_default = (api) => {
|
|
|
59
68
|
entryPoints: [entryFile],
|
|
60
69
|
watch: watch && {
|
|
61
70
|
onRebuildSuccess({ result }) {
|
|
71
|
+
updateAppdata(result);
|
|
62
72
|
api.applyPlugins({
|
|
63
73
|
key: "onPrepareBuildSuccess",
|
|
64
74
|
args: {
|
|
@@ -79,6 +89,7 @@ var prepare_default = (api) => {
|
|
|
79
89
|
(_a = buildResult.stop) == null ? void 0 : _a.call(buildResult);
|
|
80
90
|
});
|
|
81
91
|
}
|
|
92
|
+
updateAppdata(buildResult);
|
|
82
93
|
await api.applyPlugins({
|
|
83
94
|
key: "onPrepareBuildSuccess",
|
|
84
95
|
args: {
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/features/routeProps/routeProps.ts
|
|
20
|
+
var routeProps_exports = {};
|
|
21
|
+
__export(routeProps_exports, {
|
|
22
|
+
default: () => routeProps_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(routeProps_exports);
|
|
25
|
+
var import_routeExportExtractor = require("../../utils/routeExportExtractor");
|
|
26
|
+
var routeProps_default = (api) => {
|
|
27
|
+
api.describe({
|
|
28
|
+
config: {
|
|
29
|
+
schema(Joi) {
|
|
30
|
+
return Joi.object({});
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
enableBy: () => {
|
|
34
|
+
return !api.userConfig.routes;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
const entryFile = "core/routeProps.ts";
|
|
38
|
+
const outFile = "core/routeProps.js";
|
|
39
|
+
(0, import_routeExportExtractor.setupRouteExportExtractor)({
|
|
40
|
+
api,
|
|
41
|
+
entryFile,
|
|
42
|
+
outFile,
|
|
43
|
+
propertyName: "routeProps"
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
47
|
+
0 && (module.exports = {});
|
|
@@ -23,11 +23,22 @@ __export(getModuleExports_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(getModuleExports_exports);
|
|
25
25
|
var import_bundler_utils = require("@umijs/bundler-utils");
|
|
26
|
+
var import_utils = require("@umijs/utils");
|
|
26
27
|
var import_fs = require("fs");
|
|
27
28
|
async function getModuleExports(opts) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
29
|
+
const { file } = opts;
|
|
30
|
+
const content = (0, import_fs.readFileSync)(file, "utf-8");
|
|
31
|
+
try {
|
|
32
|
+
const [_, exports] = await (0, import_bundler_utils.parseModule)({ content, path: file });
|
|
33
|
+
return exports || [];
|
|
34
|
+
} catch (e) {
|
|
35
|
+
console.log(
|
|
36
|
+
`Parse file ${import_utils.chalk.red(
|
|
37
|
+
file
|
|
38
|
+
)} exports error, please check this file esm format.`
|
|
39
|
+
);
|
|
40
|
+
return [];
|
|
41
|
+
}
|
|
31
42
|
}
|
|
32
43
|
// Annotate the CommonJS export names for ESM import in node:
|
|
33
44
|
0 && (module.exports = {
|
|
@@ -111,17 +111,23 @@ async function getRoutes(opts) {
|
|
|
111
111
|
routes[id].__content = (0, import_fs.readFileSync)(file, "utf-8");
|
|
112
112
|
routes[id].__absFile = (0, import_utils.winPath)(file);
|
|
113
113
|
routes[id].__isJSFile = isJSFile;
|
|
114
|
-
|
|
115
|
-
|
|
114
|
+
const enableSSR = opts.api.config.ssr;
|
|
115
|
+
const enableClientLoader = opts.api.config.clientLoader;
|
|
116
|
+
const enableRouteProps = !opts.api.userConfig.routes;
|
|
117
|
+
const needCollectExports = enableSSR || enableClientLoader || enableRouteProps;
|
|
118
|
+
if (needCollectExports) {
|
|
119
|
+
const exports = isJSFile && (0, import_fs.existsSync)(file) ? await (0, import_getModuleExports.getModuleExports)({
|
|
116
120
|
file
|
|
117
121
|
}) : [];
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
122
|
+
if (enableSSR) {
|
|
123
|
+
routes[id].hasServerLoader = exports.includes("serverLoader");
|
|
124
|
+
}
|
|
125
|
+
if (enableClientLoader && exports.includes("clientLoader")) {
|
|
126
|
+
routes[id].clientLoader = `clientLoaders['${id}']`;
|
|
127
|
+
}
|
|
128
|
+
if (enableRouteProps && exports.includes("routeProps")) {
|
|
129
|
+
routes[id].routeProps = `routeProps['${id}']`;
|
|
130
|
+
}
|
|
125
131
|
}
|
|
126
132
|
}
|
|
127
133
|
}
|
|
@@ -39,7 +39,9 @@ var import_umi = require("umi");
|
|
|
39
39
|
var import_constants = require("../../constants");
|
|
40
40
|
var import_getModuleExports = require("./getModuleExports");
|
|
41
41
|
var import_importsToStr = require("./importsToStr");
|
|
42
|
-
var
|
|
42
|
+
var routesApi = (0, import_utils.importLazy)(
|
|
43
|
+
require.resolve("./routes")
|
|
44
|
+
);
|
|
43
45
|
var tmpFiles_default = (api) => {
|
|
44
46
|
const umiDir = process.env.UMI_DIR;
|
|
45
47
|
api.describe({
|
|
@@ -335,9 +337,10 @@ export default function EmptyRoute() {
|
|
|
335
337
|
if (opts.isFirstTime) {
|
|
336
338
|
routes = api.appData.routes;
|
|
337
339
|
} else {
|
|
338
|
-
routes = await
|
|
340
|
+
routes = await routesApi.getRoutes({
|
|
339
341
|
api
|
|
340
342
|
});
|
|
343
|
+
api.appData.routes = routes;
|
|
341
344
|
}
|
|
342
345
|
const hasSrc = api.appData.hasSrcDir;
|
|
343
346
|
const pages = (0, import_path.basename)(
|
|
@@ -353,15 +356,52 @@ export default function EmptyRoute() {
|
|
|
353
356
|
}
|
|
354
357
|
}
|
|
355
358
|
}
|
|
359
|
+
const headerImports = [];
|
|
360
|
+
let routesString = JSON.stringify(clonedRoutes);
|
|
361
|
+
if (api.config.clientLoader) {
|
|
362
|
+
routesString = routesString.replace(/"(clientLoaders\[.*?)"/g, "$1");
|
|
363
|
+
headerImports.push(`import clientLoaders from './loaders.js';`);
|
|
364
|
+
}
|
|
365
|
+
if (!api.userConfig.routes) {
|
|
366
|
+
routesString = routesString.replace(
|
|
367
|
+
/"routeProps":"(routeProps\[.*?)"/g,
|
|
368
|
+
"...$1"
|
|
369
|
+
);
|
|
370
|
+
if (process.env.NODE_ENV === "test") {
|
|
371
|
+
headerImports.push(`import routeProps from './routeProps';`);
|
|
372
|
+
} else {
|
|
373
|
+
headerImports.push(`import routeProps from './routeProps.js';`);
|
|
374
|
+
}
|
|
375
|
+
headerImports.push(`
|
|
376
|
+
if (process.env.NODE_ENV === 'development') {
|
|
377
|
+
Object.entries(routeProps).forEach(([key, value]) => {
|
|
378
|
+
const internalProps = ['path', 'id', 'parentId', 'isLayout', 'isWrapper', 'layout', 'clientLoader'];
|
|
379
|
+
Object.keys(value).forEach((prop) => {
|
|
380
|
+
if (internalProps.includes(prop)) {
|
|
381
|
+
throw new Error(
|
|
382
|
+
\`[UmiJS] route '\${key}' should not have '\${prop}' prop, please remove this property in 'routeProps'.\`
|
|
383
|
+
)
|
|
384
|
+
}
|
|
385
|
+
})
|
|
386
|
+
})
|
|
387
|
+
}
|
|
388
|
+
`);
|
|
389
|
+
}
|
|
390
|
+
if (api.appData.framework === "react") {
|
|
391
|
+
headerImports.push(`import React from 'react';`);
|
|
392
|
+
}
|
|
356
393
|
api.writeTmpFile({
|
|
357
394
|
noPluginDir: true,
|
|
358
395
|
path: "core/route.tsx",
|
|
359
396
|
tplPath: (0, import_path.join)(import_constants.TEMPLATES_DIR, "route.tpl"),
|
|
360
397
|
context: {
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
398
|
+
headerImports: headerImports.join("\n"),
|
|
399
|
+
routes: routesString,
|
|
400
|
+
routeComponents: await routesApi.getRouteComponents({
|
|
401
|
+
routes,
|
|
402
|
+
prefix,
|
|
403
|
+
api
|
|
404
|
+
})
|
|
365
405
|
}
|
|
366
406
|
});
|
|
367
407
|
const plugins = await api.applyPlugins({
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/features/ui/ui.ts
|
|
20
|
+
var ui_exports = {};
|
|
21
|
+
__export(ui_exports, {
|
|
22
|
+
default: () => ui_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ui_exports);
|
|
25
|
+
var ENTRY_PATH = "/__umi_ui/entry";
|
|
26
|
+
var ui_default = (api) => {
|
|
27
|
+
api.describe({
|
|
28
|
+
enableBy() {
|
|
29
|
+
return api.name === "dev" && api.args.ui;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
api.onBeforeMiddleware(({ app }) => {
|
|
33
|
+
app.use(ENTRY_PATH, async (req, _res) => {
|
|
34
|
+
req;
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
39
|
+
0 && (module.exports = {});
|
package/dist/index.js
CHANGED
|
@@ -43,7 +43,6 @@ var src_default = () => {
|
|
|
43
43
|
require.resolve("./features/appData/appData"),
|
|
44
44
|
require.resolve("./features/appData/umiInfo"),
|
|
45
45
|
require.resolve("./features/check/check"),
|
|
46
|
-
require.resolve("./features/clientLoader/clientLoader"),
|
|
47
46
|
require.resolve("./features/codeSplitting/codeSplitting"),
|
|
48
47
|
require.resolve("./features/configPlugins/configPlugins"),
|
|
49
48
|
require.resolve("./features/crossorigin/crossorigin"),
|
|
@@ -64,6 +63,8 @@ var src_default = () => {
|
|
|
64
63
|
require.resolve("./features/ssr/ssr"),
|
|
65
64
|
require.resolve("./features/terminal/terminal"),
|
|
66
65
|
require.resolve("./features/tmpFiles/tmpFiles"),
|
|
66
|
+
require.resolve("./features/clientLoader/clientLoader"),
|
|
67
|
+
require.resolve("./features/routeProps/routeProps"),
|
|
67
68
|
require.resolve("./features/tmpFiles/configTypes"),
|
|
68
69
|
require.resolve("./features/transform/transform"),
|
|
69
70
|
require.resolve("./features/lowImport/lowImport"),
|
|
@@ -76,6 +77,7 @@ var src_default = () => {
|
|
|
76
77
|
require.resolve("./features/classPropertiesLoose/classPropertiesLoose"),
|
|
77
78
|
require.resolve("./features/webpack/webpack"),
|
|
78
79
|
require.resolve("./features/swc/swc"),
|
|
80
|
+
require.resolve("./features/ui/ui"),
|
|
79
81
|
// commands
|
|
80
82
|
require.resolve("./commands/build"),
|
|
81
83
|
require.resolve("./commands/config/config"),
|
package/dist/types.d.ts
CHANGED
|
@@ -199,11 +199,3 @@ export declare type IApi = PluginAPI & IServicePluginAPI & {
|
|
|
199
199
|
tplPath?: string;
|
|
200
200
|
}) => void;
|
|
201
201
|
};
|
|
202
|
-
export interface IApiInternalProps {
|
|
203
|
-
/**
|
|
204
|
-
* 如果不刷新 routes,修改 icon 不会热更新
|
|
205
|
-
* See https://github.com/umijs/umi/issues/10137
|
|
206
|
-
* TODO: 不公开这个方法,先解问题,但此问题应该有更好的解法
|
|
207
|
-
*/
|
|
208
|
-
_refreshRoutes: () => Promise<void>;
|
|
209
|
-
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { IApi } from 'umi';
|
|
2
|
+
interface IRouteExportExtractor {
|
|
3
|
+
api: IApi;
|
|
4
|
+
entryFile: string;
|
|
5
|
+
}
|
|
6
|
+
interface IRouteExportExtractorGenTmpFileOpts extends IRouteExportExtractor {
|
|
7
|
+
propertyName: string;
|
|
8
|
+
}
|
|
9
|
+
interface IRouteExportExtractorSetupBuilderOpts extends IRouteExportExtractor {
|
|
10
|
+
outFile: string;
|
|
11
|
+
}
|
|
12
|
+
declare type ISetupRouteExportExtractorOpts = IRouteExportExtractorGenTmpFileOpts & IRouteExportExtractorSetupBuilderOpts;
|
|
13
|
+
export declare function setupRouteExportExtractor(opts: ISetupRouteExportExtractorOpts): void;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/utils/routeExportExtractor.ts
|
|
30
|
+
var routeExportExtractor_exports = {};
|
|
31
|
+
__export(routeExportExtractor_exports, {
|
|
32
|
+
setupRouteExportExtractor: () => setupRouteExportExtractor
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(routeExportExtractor_exports);
|
|
35
|
+
var import_esbuild = __toESM(require("@umijs/bundler-utils/compiled/esbuild"));
|
|
36
|
+
var import_path = require("path");
|
|
37
|
+
function setupRouteExportExtractor(opts) {
|
|
38
|
+
const { api, entryFile, propertyName, outFile } = opts;
|
|
39
|
+
api.onGenerateFiles(() => {
|
|
40
|
+
generateRouteExportTmpFile({
|
|
41
|
+
api,
|
|
42
|
+
propertyName,
|
|
43
|
+
entryFile
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
api.onBeforeCompiler(
|
|
47
|
+
() => setupExportExtractBuilder({
|
|
48
|
+
api,
|
|
49
|
+
entryFile,
|
|
50
|
+
outFile
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
function generateRouteExportTmpFile(opts) {
|
|
55
|
+
const { api, entryFile, propertyName } = opts;
|
|
56
|
+
const imports = [];
|
|
57
|
+
const defines = [];
|
|
58
|
+
const routeIds = Object.keys(api.appData.routes);
|
|
59
|
+
let index = 0;
|
|
60
|
+
for (const id of routeIds) {
|
|
61
|
+
const route = api.appData.routes[id];
|
|
62
|
+
if (route[propertyName]) {
|
|
63
|
+
index += 1;
|
|
64
|
+
imports.push(
|
|
65
|
+
`import { ${propertyName} as ${propertyName}_${index} } from '${route.__absFile}';`
|
|
66
|
+
);
|
|
67
|
+
defines.push(` '${id}': ${propertyName}_${index},`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
api.writeTmpFile({
|
|
71
|
+
noPluginDir: true,
|
|
72
|
+
path: entryFile,
|
|
73
|
+
content: `
|
|
74
|
+
${imports.join("\n")}
|
|
75
|
+
export default {
|
|
76
|
+
${defines.join("\n")}
|
|
77
|
+
};
|
|
78
|
+
`
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async function setupExportExtractBuilder(opts) {
|
|
82
|
+
const { api, entryFile, outFile } = opts;
|
|
83
|
+
await import_esbuild.default.build({
|
|
84
|
+
format: "esm",
|
|
85
|
+
platform: "browser",
|
|
86
|
+
target: "esnext",
|
|
87
|
+
loader,
|
|
88
|
+
watch: api.env === "development" && {},
|
|
89
|
+
bundle: true,
|
|
90
|
+
logLevel: "error",
|
|
91
|
+
entryPoints: [(0, import_path.join)(api.paths.absTmpPath, entryFile)],
|
|
92
|
+
outfile: (0, import_path.join)(api.paths.absTmpPath, outFile),
|
|
93
|
+
absWorkingDir: api.cwd,
|
|
94
|
+
plugins: [
|
|
95
|
+
{
|
|
96
|
+
name: "imports",
|
|
97
|
+
setup(build) {
|
|
98
|
+
let entry;
|
|
99
|
+
build.onResolve({ filter: /.*/ }, (args) => {
|
|
100
|
+
if (args.kind === "entry-point")
|
|
101
|
+
entry = args.path;
|
|
102
|
+
if (args.kind === "entry-point" || args.importer === entry) {
|
|
103
|
+
return { path: (0, import_path.resolve)(args.resolveDir, args.path) };
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
path: !args.path.startsWith(".") && !args.path.startsWith("/") ? args.path : (0, import_path.resolve)(args.resolveDir, args.path),
|
|
107
|
+
external: true,
|
|
108
|
+
sideEffects: false
|
|
109
|
+
};
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
]
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
var loader = {
|
|
117
|
+
".aac": "file",
|
|
118
|
+
".css": "text",
|
|
119
|
+
".less": "text",
|
|
120
|
+
".sass": "text",
|
|
121
|
+
".scss": "text",
|
|
122
|
+
".eot": "file",
|
|
123
|
+
".flac": "file",
|
|
124
|
+
".gif": "file",
|
|
125
|
+
".htm": "file",
|
|
126
|
+
".html": "file",
|
|
127
|
+
".ico": "file",
|
|
128
|
+
".icon": "file",
|
|
129
|
+
".jpeg": "file",
|
|
130
|
+
".jpg": "file",
|
|
131
|
+
".js": "jsx",
|
|
132
|
+
".jsx": "jsx",
|
|
133
|
+
".json": "json",
|
|
134
|
+
".md": "jsx",
|
|
135
|
+
".mdx": "jsx",
|
|
136
|
+
".mp3": "file",
|
|
137
|
+
".mp4": "file",
|
|
138
|
+
".ogg": "file",
|
|
139
|
+
".otf": "file",
|
|
140
|
+
".png": "file",
|
|
141
|
+
".svg": "file",
|
|
142
|
+
".ts": "ts",
|
|
143
|
+
".tsx": "tsx",
|
|
144
|
+
".ttf": "file",
|
|
145
|
+
".wav": "file",
|
|
146
|
+
".webm": "file",
|
|
147
|
+
".webp": "file",
|
|
148
|
+
".woff": "file",
|
|
149
|
+
".woff2": "file"
|
|
150
|
+
};
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
setupRouteExportExtractor
|
|
154
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.53",
|
|
4
4
|
"description": "@umijs/preset-umi",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/preset-umi#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -27,19 +27,19 @@
|
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@iconify/utils": "2.1.1",
|
|
29
29
|
"@svgr/core": "6.2.1",
|
|
30
|
-
"@umijs/ast": "4.0.
|
|
31
|
-
"@umijs/babel-preset-umi": "4.0.
|
|
32
|
-
"@umijs/bundler-utils": "4.0.
|
|
33
|
-
"@umijs/bundler-vite": "4.0.
|
|
34
|
-
"@umijs/bundler-webpack": "4.0.
|
|
35
|
-
"@umijs/core": "4.0.
|
|
30
|
+
"@umijs/ast": "4.0.53",
|
|
31
|
+
"@umijs/babel-preset-umi": "4.0.53",
|
|
32
|
+
"@umijs/bundler-utils": "4.0.53",
|
|
33
|
+
"@umijs/bundler-vite": "4.0.53",
|
|
34
|
+
"@umijs/bundler-webpack": "4.0.53",
|
|
35
|
+
"@umijs/core": "4.0.53",
|
|
36
36
|
"@umijs/did-you-know": "^1.0.0",
|
|
37
37
|
"@umijs/history": "5.3.1",
|
|
38
|
-
"@umijs/mfsu": "4.0.
|
|
39
|
-
"@umijs/plugin-run": "4.0.
|
|
40
|
-
"@umijs/renderer-react": "4.0.
|
|
41
|
-
"@umijs/server": "4.0.
|
|
42
|
-
"@umijs/utils": "4.0.
|
|
38
|
+
"@umijs/mfsu": "4.0.53",
|
|
39
|
+
"@umijs/plugin-run": "4.0.53",
|
|
40
|
+
"@umijs/renderer-react": "4.0.53",
|
|
41
|
+
"@umijs/server": "4.0.53",
|
|
42
|
+
"@umijs/utils": "4.0.53",
|
|
43
43
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
|
44
44
|
"click-to-react-component": "^1.0.8",
|
|
45
45
|
"core-js": "3.27.1",
|
package/templates/route.tpl
CHANGED
|
@@ -1,9 +1,4 @@
|
|
|
1
|
-
{{
|
|
2
|
-
import clientLoaders from './loaders.js';
|
|
3
|
-
{{/isClientLoaderEnabled}}
|
|
4
|
-
{{#isReact}}
|
|
5
|
-
import React from 'react';
|
|
6
|
-
{{/isReact}}
|
|
1
|
+
{{{ headerImports }}}
|
|
7
2
|
|
|
8
3
|
export async function getRoutes() {
|
|
9
4
|
const routes = {{{ routes }}} as const;
|