@umijs/preset-umi 4.2.6-alpha.0 → 4.2.6-alpha.4
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.
|
@@ -99,11 +99,18 @@ async function getRouteChunkFilesMap(chunks, opts) {
|
|
|
99
99
|
};
|
|
100
100
|
}
|
|
101
101
|
async function getRoutePathFilesMap(routes, fileChunksMap, opts) {
|
|
102
|
+
var _a;
|
|
102
103
|
const { resolver, absPagesPath } = opts;
|
|
103
104
|
const routeFilesMap = {};
|
|
104
105
|
for (const route of Object.values(routes)) {
|
|
105
106
|
if (!route.file)
|
|
106
107
|
continue;
|
|
108
|
+
if (!((_a = route.absPath) == null ? void 0 : _a.startsWith("/"))) {
|
|
109
|
+
import_utils.logger.error(
|
|
110
|
+
`[routePreloadOnLoad]: route absPath error, cannot preload for ${route.absPath}`
|
|
111
|
+
);
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
107
114
|
let current = route;
|
|
108
115
|
const files = [];
|
|
109
116
|
do {
|
|
@@ -127,8 +134,8 @@ async function getRoutePathFilesMap(routes, fileChunksMap, opts) {
|
|
|
127
134
|
const indexes = Array.from(
|
|
128
135
|
// use set to avoid duplicated indexes
|
|
129
136
|
files.reduce((indexSet, file) => {
|
|
130
|
-
var
|
|
131
|
-
(
|
|
137
|
+
var _a2;
|
|
138
|
+
(_a2 = fileChunksMap[file]) == null ? void 0 : _a2.indexes.forEach((i) => indexSet.add(i));
|
|
132
139
|
return indexSet;
|
|
133
140
|
}, /* @__PURE__ */ new Set())
|
|
134
141
|
);
|
|
@@ -296,6 +296,10 @@ declare module '*.txt' {
|
|
|
296
296
|
initialValue: []
|
|
297
297
|
})
|
|
298
298
|
).join("\n");
|
|
299
|
+
const __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ((_b = api.config.ssr) == null ? void 0 : _b.__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) ?? {
|
|
300
|
+
pureApp: false,
|
|
301
|
+
pureHtml: false
|
|
302
|
+
};
|
|
299
303
|
api.writeTmpFile({
|
|
300
304
|
noPluginDir: true,
|
|
301
305
|
path: "umi.ts",
|
|
@@ -317,6 +321,9 @@ declare module '*.txt' {
|
|
|
317
321
|
imports,
|
|
318
322
|
basename: api.config.base,
|
|
319
323
|
historyType: api.config.history.type,
|
|
324
|
+
__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: JSON.stringify(
|
|
325
|
+
__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED
|
|
326
|
+
),
|
|
320
327
|
hydrate: !!api.config.ssr,
|
|
321
328
|
reactRouter5Compat: !!api.config.reactRouter5Compat,
|
|
322
329
|
loadingComponent: api.appData.globalLoading
|
|
@@ -347,7 +354,7 @@ export default function EmptyRoute() {
|
|
|
347
354
|
}
|
|
348
355
|
const hasSrc = api.appData.hasSrcDir;
|
|
349
356
|
const pages = (0, import_path.basename)(
|
|
350
|
-
((
|
|
357
|
+
((_c = api.config.conventionRoutes) == null ? void 0 : _c.base) || api.paths.absPagesPath
|
|
351
358
|
);
|
|
352
359
|
const prefix = hasSrc ? `../../../src/${pages}/` : `../../${pages}/`;
|
|
353
360
|
const clonedRoutes = import_utils.lodash.cloneDeep(routes);
|
|
@@ -405,7 +412,7 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
405
412
|
});
|
|
406
413
|
const plugins = await api.applyPlugins({
|
|
407
414
|
key: "addRuntimePlugin",
|
|
408
|
-
initialValue: [(
|
|
415
|
+
initialValue: [(_d = api.appData.appJS) == null ? void 0 : _d.path].filter(Boolean)
|
|
409
416
|
});
|
|
410
417
|
function checkDuplicatePluginKeys(arr) {
|
|
411
418
|
const duplicates = [];
|
|
@@ -461,10 +468,6 @@ if (process.env.NODE_ENV === 'development') {
|
|
|
461
468
|
if (api.config.ssr) {
|
|
462
469
|
const umiPluginPath = (0, import_utils.winPath)((0, import_path.join)(umiDir, "client/client/plugin.js"));
|
|
463
470
|
const umiServerPath = (0, import_utils.winPath)(require.resolve("@umijs/server/dist/ssr"));
|
|
464
|
-
const __INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ((_d = api.config.ssr) == null ? void 0 : _d.__INTERNAL_DO_NOT_USE_OR_YOU_WILL_BE_FIRED) ?? {
|
|
465
|
-
pureApp: false,
|
|
466
|
-
pureHtml: false
|
|
467
|
-
};
|
|
468
471
|
const mountElementId = api.config.mountElementId;
|
|
469
472
|
const routesWithServerLoader = Object.keys(routes).reduce((memo, id) => {
|
|
470
473
|
if (routes[id].hasServerLoader) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/preset-umi",
|
|
3
|
-
"version": "4.2.6-alpha.
|
|
3
|
+
"version": "4.2.6-alpha.4",
|
|
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",
|
|
@@ -40,20 +40,20 @@
|
|
|
40
40
|
"react-router": "6.3.0",
|
|
41
41
|
"react-router-dom": "6.3.0",
|
|
42
42
|
"regenerator-runtime": "0.13.11",
|
|
43
|
-
"@umijs/babel-preset-umi": "4.2.6-alpha.
|
|
44
|
-
"@umijs/bundler-
|
|
45
|
-
"@umijs/
|
|
46
|
-
"@umijs/
|
|
47
|
-
"@umijs/bundler-
|
|
43
|
+
"@umijs/babel-preset-umi": "4.2.6-alpha.4",
|
|
44
|
+
"@umijs/bundler-vite": "4.2.6-alpha.4",
|
|
45
|
+
"@umijs/ast": "4.2.6-alpha.4",
|
|
46
|
+
"@umijs/bundler-esbuild": "4.2.6-alpha.4",
|
|
47
|
+
"@umijs/bundler-utils": "4.2.6-alpha.4",
|
|
48
|
+
"@umijs/bundler-webpack": "4.2.6-alpha.4",
|
|
49
|
+
"@umijs/mfsu": "4.2.6-alpha.4",
|
|
50
|
+
"@umijs/core": "4.2.6-alpha.4",
|
|
51
|
+
"@umijs/renderer-react": "4.2.6-alpha.4",
|
|
52
|
+
"@umijs/server": "4.2.6-alpha.4",
|
|
48
53
|
"@umijs/did-you-know": "1.0.3",
|
|
49
|
-
"@umijs/
|
|
50
|
-
"@umijs/
|
|
51
|
-
"@umijs/
|
|
52
|
-
"@umijs/utils": "4.2.6-alpha.0",
|
|
53
|
-
"@umijs/plugin-run": "4.2.6-alpha.0",
|
|
54
|
-
"@umijs/zod2ts": "4.2.6-alpha.0",
|
|
55
|
-
"@umijs/mfsu": "4.2.6-alpha.0",
|
|
56
|
-
"@umijs/core": "4.2.6-alpha.0",
|
|
54
|
+
"@umijs/zod2ts": "4.2.6-alpha.4",
|
|
55
|
+
"@umijs/plugin-run": "4.2.6-alpha.4",
|
|
56
|
+
"@umijs/utils": "4.2.6-alpha.4",
|
|
57
57
|
"@umijs/ui": "3.0.1"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
package/templates/umi.tpl
CHANGED