@umijs/plugins 4.0.0-canary.20240626.1 → 4.0.0-canary.20240812.1
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/dist/initial-state.js
CHANGED
|
@@ -65,7 +65,7 @@ export default function InitialStateProvider(props: any) {
|
|
|
65
65
|
appLoaded.current = true;
|
|
66
66
|
}
|
|
67
67
|
}, [loading]);
|
|
68
|
-
if (loading && !appLoaded.current) {
|
|
68
|
+
if (loading && !appLoaded.current && typeof window !== 'undefined') {
|
|
69
69
|
return <Loading />;
|
|
70
70
|
}
|
|
71
71
|
return props.children;
|
package/dist/layout.js
CHANGED
|
@@ -388,11 +388,13 @@ ${icons.map((icon) => {
|
|
|
388
388
|
export default { ${icons.join(", ")} };
|
|
389
389
|
`
|
|
390
390
|
});
|
|
391
|
+
const isIconsFeatureEnable = api.isPluginEnable("icons");
|
|
391
392
|
api.writeTmpFile({
|
|
392
393
|
path: "runtime.tsx",
|
|
393
394
|
content: `
|
|
394
395
|
import React from 'react';
|
|
395
396
|
import icons from './icons';
|
|
397
|
+
${isIconsFeatureEnable ? `import { Icon, getIconComponent } from '@umijs/max';` : ""}
|
|
396
398
|
|
|
397
399
|
function formatIcon(name: string) {
|
|
398
400
|
return name
|
|
@@ -406,6 +408,12 @@ export function patchRoutes({ routes }) {
|
|
|
406
408
|
Object.keys(routes).forEach(key => {
|
|
407
409
|
const { icon } = routes[key];
|
|
408
410
|
if (icon && typeof icon === 'string') {
|
|
411
|
+
${isIconsFeatureEnable ? `const Component = getIconComponent(icon)
|
|
412
|
+
if (Component) {
|
|
413
|
+
routes[key].icon = <Icon icon={icon} width={14} height={14} />;
|
|
414
|
+
return;
|
|
415
|
+
}` : ""}
|
|
416
|
+
|
|
409
417
|
const upperIcon = formatIcon(icon);
|
|
410
418
|
if (icons[upperIcon] || icons[upperIcon + 'Outlined']) {
|
|
411
419
|
routes[key].icon = React.createElement(icons[upperIcon] || icons[upperIcon + 'Outlined']);
|
package/dist/qiankun/master.js
CHANGED
|
@@ -219,6 +219,16 @@ export { MicroAppWithMemoHistory } from './MicroAppWithMemoHistory';
|
|
|
219
219
|
`
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
|
+
api.chainWebpack((config, { ssr }) => {
|
|
223
|
+
if (ssr) {
|
|
224
|
+
const originalExternals = config.get("externals");
|
|
225
|
+
config.externals({
|
|
226
|
+
...originalExternals,
|
|
227
|
+
qiankun: "fs"
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
return config;
|
|
231
|
+
});
|
|
222
232
|
};
|
|
223
233
|
// Annotate the CommonJS export names for ESM import in node:
|
|
224
234
|
0 && (module.exports = {
|
package/dist/qiankun/slave.js
CHANGED
|
@@ -171,7 +171,10 @@ export interface IRuntimeConfig {
|
|
|
171
171
|
`window.publicPath = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__ || "${api.config.publicPath || "/"}";`
|
|
172
172
|
];
|
|
173
173
|
});
|
|
174
|
-
api.chainWebpack((config) => {
|
|
174
|
+
api.chainWebpack((config, { ssr }) => {
|
|
175
|
+
if (ssr) {
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
175
178
|
(0, import_assert.default)(api.pkg.name, "You should have name in package.json.");
|
|
176
179
|
const {
|
|
177
180
|
shouldNotAddLibraryChunkName = api.env === "production" || !Boolean(api.config.mfsu)
|
|
@@ -201,11 +204,14 @@ export interface IRuntimeConfig {
|
|
|
201
204
|
});
|
|
202
205
|
api.addEntryCode(() => [
|
|
203
206
|
`
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
export const
|
|
207
|
-
export const
|
|
208
|
-
|
|
207
|
+
const qiankun_noop = () => new Error('qiankun lifecycle is not available for server runtime!');
|
|
208
|
+
const isServer = typeof window === 'undefined';
|
|
209
|
+
export const bootstrap = isServer ? qiankun_noop: qiankun_genBootstrap(render);
|
|
210
|
+
export const mount = isServer ? qiankun_noop : qiankun_genMount('${api.config.mountElementId}');
|
|
211
|
+
export const unmount = isServer ? qiankun_noop : qiankun_genUnmount('${api.config.mountElementId}');
|
|
212
|
+
export const update = isServer ? qiankun_noop : qiankun_genUpdate();
|
|
213
|
+
// 增加 ssr 的判断
|
|
214
|
+
if (!isServer && !window.__POWERED_BY_QIANKUN__) {
|
|
209
215
|
bootstrap().then(mount);
|
|
210
216
|
}
|
|
211
217
|
`
|
|
@@ -77,6 +77,10 @@ function patchMicroAppRouteComponent(routes: any[]) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
export async function render(oldRender: typeof noop) {
|
|
80
|
+
// 在 ssr 的场景下,直接返回旧的 render
|
|
81
|
+
if (typeof window === 'undefined') {
|
|
82
|
+
return oldRender();
|
|
83
|
+
}
|
|
80
84
|
const runtimeOptions = await getMasterRuntime();
|
|
81
85
|
let masterOptions: MasterOptions = {
|
|
82
86
|
...getMasterOptions(),
|
|
@@ -138,6 +142,10 @@ export async function render(oldRender: typeof noop) {
|
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
export function patchClientRoutes({ routes }: { routes: any[] }) {
|
|
145
|
+
// 在 ssr 的场景下,不执行主应用的 patchClientRoutes
|
|
146
|
+
if (typeof window === 'undefined') {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
141
149
|
const microAppRoutes = [].concat(
|
|
142
150
|
deepFilterLeafRoutes(routes),
|
|
143
151
|
deepFilterLeafRoutes(microAppRuntimeRoutes),
|
|
@@ -3,6 +3,10 @@ import { createHistory } from '@@/core/history';
|
|
|
3
3
|
import qiankunRender, { contextOptsStack } from './lifecycles';
|
|
4
4
|
|
|
5
5
|
export function render(oldRender: any) {
|
|
6
|
+
// 在 ssr 的场景下,直接返回旧的 render
|
|
7
|
+
if (typeof window === 'undefined') {
|
|
8
|
+
return oldRender();
|
|
9
|
+
}
|
|
6
10
|
return qiankunRender().then(oldRender);
|
|
7
11
|
}
|
|
8
12
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/plugins",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20240812.1",
|
|
4
4
|
"description": "@umijs/plugins",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/plugins#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"tslib": "^2",
|
|
47
47
|
"warning": "^4.0.3",
|
|
48
48
|
"@umijs/valtio": "1.0.4",
|
|
49
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
49
|
+
"@umijs/bundler-utils": "4.0.0-canary.20240812.1"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"antd": "^4.24.1",
|
|
53
|
-
"umi": "4.0.0-canary.
|
|
53
|
+
"umi": "4.0.0-canary.20240812.1"
|
|
54
54
|
},
|
|
55
55
|
"publishConfig": {
|
|
56
56
|
"access": "public"
|