@umijs/plugins 4.0.0-canary.20230630.1 → 4.0.0-canary.20230811.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/layout.js
CHANGED
|
@@ -64,6 +64,8 @@ var layout_default = (api) => {
|
|
|
64
64
|
antdVersion = require(`${pkgPath2}/package.json`).version;
|
|
65
65
|
} catch (e) {
|
|
66
66
|
}
|
|
67
|
+
const isAntd5 = antdVersion.startsWith("5");
|
|
68
|
+
const layoutFile = isAntd5 ? "Layout.css" : "Layout.less";
|
|
67
69
|
api.describe({
|
|
68
70
|
key: "layout",
|
|
69
71
|
config: {
|
|
@@ -130,7 +132,7 @@ import React, { useMemo } from 'react';
|
|
|
130
132
|
import {
|
|
131
133
|
ProLayout,
|
|
132
134
|
} from "${resolvedPkgPath}";
|
|
133
|
-
import '
|
|
135
|
+
import './${layoutFile}';
|
|
134
136
|
import Logo from './Logo';
|
|
135
137
|
import Exception from './Exception';
|
|
136
138
|
import { getRightRenderContent } from './rightRender';
|
|
@@ -517,12 +519,12 @@ export function getRightRenderContent (opts: {
|
|
|
517
519
|
})
|
|
518
520
|
});
|
|
519
521
|
api.writeTmpFile({
|
|
520
|
-
path:
|
|
522
|
+
path: layoutFile,
|
|
521
523
|
content: `
|
|
522
524
|
${// antd@5里面没有这个样式了
|
|
523
|
-
|
|
525
|
+
isAntd5 ? "" : "@import '~antd/es/style/themes/default.less';"}
|
|
524
526
|
@media screen and (max-width: 480px) {
|
|
525
|
-
|
|
527
|
+
/* 在小屏幕的时候可以有更好的体验 */
|
|
526
528
|
.umi-plugin-layout-container {
|
|
527
529
|
width: 100% !important;
|
|
528
530
|
}
|
|
@@ -530,13 +532,11 @@ ${// antd@5里面没有这个样式了
|
|
|
530
532
|
border-radius: 0 !important;
|
|
531
533
|
}
|
|
532
534
|
}
|
|
533
|
-
.umi-plugin-layout-menu {
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
min-width: 160px;
|
|
539
|
-
}
|
|
535
|
+
.umi-plugin-layout-menu .anticon {
|
|
536
|
+
margin-right: 8px;
|
|
537
|
+
}
|
|
538
|
+
.umi-plugin-layout-menu .ant-dropdown-menu-item {
|
|
539
|
+
min-width: 160px;
|
|
540
540
|
}
|
|
541
541
|
.umi-plugin-layout-right {
|
|
542
542
|
display: flex !important;
|
|
@@ -544,30 +544,30 @@ ${// antd@5里面没有这个样式了
|
|
|
544
544
|
height: 100%;
|
|
545
545
|
margin-left: auto;
|
|
546
546
|
overflow: hidden;
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
547
|
+
}
|
|
548
|
+
.umi-plugin-layout-right .umi-plugin-layout-action {
|
|
549
|
+
display: flex;
|
|
550
|
+
align-items: center;
|
|
551
|
+
height: 100%;
|
|
552
|
+
padding: 0 12px;
|
|
553
|
+
cursor: pointer;
|
|
554
|
+
transition: all 0.3s;
|
|
555
|
+
}
|
|
556
|
+
.umi-plugin-layout-right .umi-plugin-layout-action > i {
|
|
557
|
+
color: rgba(255, 255, 255, 0.85);
|
|
558
|
+
vertical-align: middle;
|
|
559
|
+
}
|
|
560
|
+
.umi-plugin-layout-right .umi-plugin-layout-action:hover {
|
|
561
|
+
background: rgba(0, 0, 0, 0.025);
|
|
562
|
+
}
|
|
563
|
+
.umi-plugin-layout-right .umi-plugin-layout-action.opened {
|
|
564
|
+
background: rgba(0, 0, 0, 0.025);
|
|
565
|
+
}
|
|
566
|
+
.umi-plugin-layout-right .umi-plugin-layout-search {
|
|
567
|
+
padding: 0 12px;
|
|
568
|
+
}
|
|
569
|
+
.umi-plugin-layout-right .umi-plugin-layout-search:hover {
|
|
570
|
+
background: transparent;
|
|
571
571
|
}
|
|
572
572
|
.umi-plugin-layout-name {
|
|
573
573
|
margin-left: 8px;
|
package/dist/qiankun/master.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(master_exports, {
|
|
|
33
33
|
isMasterEnable: () => isMasterEnable
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(master_exports);
|
|
36
|
+
var import_assert = __toESM(require("assert"));
|
|
36
37
|
var import_fs = require("fs");
|
|
37
38
|
var import_path = require("path");
|
|
38
39
|
var import_umi = require("umi");
|
|
@@ -47,6 +48,15 @@ function isMasterEnable(opts) {
|
|
|
47
48
|
}
|
|
48
49
|
return !!process.env.INITIAL_QIANKUN_MASTER_OPTIONS;
|
|
49
50
|
}
|
|
51
|
+
function getCustomLoader(api) {
|
|
52
|
+
var _a, _b, _c;
|
|
53
|
+
const loader = (_b = (_a = api.config.qiankun) == null ? void 0 : _a.master) == null ? void 0 : _b.loader;
|
|
54
|
+
(0, import_assert.default)(
|
|
55
|
+
!loader || ((_c = loader.startsWith) == null ? void 0 : _c.call(loader, "@/")),
|
|
56
|
+
"[@umijs/plugin-qiankun]: loader only support root path, eg: @/loading"
|
|
57
|
+
);
|
|
58
|
+
return loader;
|
|
59
|
+
}
|
|
50
60
|
var master_default = (api) => {
|
|
51
61
|
api.describe({
|
|
52
62
|
key: "qiankun-master",
|
|
@@ -134,8 +144,13 @@ export const setMasterOptions = (newOpts) => options = ({ ...options, ...newOpts
|
|
|
134
144
|
});
|
|
135
145
|
api.writeTmpFile({
|
|
136
146
|
path: "MicroAppLoader.tsx",
|
|
137
|
-
|
|
138
|
-
|
|
147
|
+
content: getCustomLoader(api) ? (
|
|
148
|
+
// 用户自定义的 loading 优先级最高
|
|
149
|
+
`export { default } from '${getCustomLoader(api)}';`
|
|
150
|
+
) : api.isPluginEnable("antd") ? getFileContent("AntdLoader.tsx") : (
|
|
151
|
+
// 开启了 antd 插件的时候,使用 antd 的 loader 组件,否则提示用户必须设置一个自定义的 loader 组件
|
|
152
|
+
`export default function Loader() { console.warn(\`[plugins/qiankun]: Seems like you'r not using @umijs/plugin-antd, you need to provide a custom loader or set autoSetLoading false to shut down this warning!\`); return null; }`
|
|
153
|
+
)
|
|
139
154
|
});
|
|
140
155
|
[
|
|
141
156
|
"common.ts",
|
package/dist/tailwindcss.js
CHANGED
|
@@ -22,8 +22,11 @@ __export(tailwindcss_exports, {
|
|
|
22
22
|
default: () => tailwindcss_default
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(tailwindcss_exports);
|
|
25
|
+
var import_fs = require("fs");
|
|
25
26
|
var import_path = require("path");
|
|
26
27
|
var import_plugin_utils = require("umi/plugin-utils");
|
|
28
|
+
var CHECK_INTERVAL = 300;
|
|
29
|
+
var CHECK_TIMEOUT_UNIT_SECOND = 5;
|
|
27
30
|
var tailwindcss_default = (api) => {
|
|
28
31
|
api.describe({
|
|
29
32
|
key: "tailwindcss",
|
|
@@ -71,7 +74,21 @@ var tailwindcss_default = (api) => {
|
|
|
71
74
|
});
|
|
72
75
|
} else {
|
|
73
76
|
api.logger.info("tailwindcss service started");
|
|
74
|
-
|
|
77
|
+
const interval = setInterval(() => {
|
|
78
|
+
if ((0, import_fs.existsSync)(generatedPath)) {
|
|
79
|
+
clearInterval(interval);
|
|
80
|
+
resolve();
|
|
81
|
+
}
|
|
82
|
+
}, CHECK_INTERVAL);
|
|
83
|
+
const timer = setTimeout(() => {
|
|
84
|
+
if (!(0, import_fs.existsSync)(generatedPath)) {
|
|
85
|
+
clearInterval(timer);
|
|
86
|
+
api.logger.error(
|
|
87
|
+
`tailwindcss generate failed after ${CHECK_TIMEOUT_UNIT_SECOND} seconds, please check your tailwind.css and tailwind.config.js`
|
|
88
|
+
);
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
}, CHECK_TIMEOUT_UNIT_SECOND * 1e3);
|
|
75
92
|
}
|
|
76
93
|
});
|
|
77
94
|
});
|
|
@@ -16,9 +16,9 @@ export function getMicroAppRouteComponent(opts: {
|
|
|
16
16
|
const match = useMatch(routePath);
|
|
17
17
|
const url = match ? match.pathnameBase : '';
|
|
18
18
|
// 默认取静态配置的 base
|
|
19
|
-
let umiConfigBase = base === '/' ? '' : base;
|
|
19
|
+
let umiConfigBase = base === '/' ? '' : trimEndSlash(base);
|
|
20
20
|
// 匹配模式下,routePath 不会作为 prefix
|
|
21
|
-
const prefix = routeMode === MicroAppRouteMode.MATCH ? '' : (url
|
|
21
|
+
const prefix = routeMode === MicroAppRouteMode.MATCH ? '' : trimEndSlash(url);
|
|
22
22
|
|
|
23
23
|
// 拼接子应用挂载路由
|
|
24
24
|
let runtimeMatchedBase = umiConfigBase + prefix;
|
|
@@ -39,3 +39,7 @@ export function getMicroAppRouteComponent(opts: {
|
|
|
39
39
|
|
|
40
40
|
return RouteComponent;
|
|
41
41
|
}
|
|
42
|
+
|
|
43
|
+
function trimEndSlash(p: string) {
|
|
44
|
+
return p.endsWith('/') ? p.slice(0, -1) : p;
|
|
45
|
+
}
|
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.20230811.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",
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"styled-components": "6.0.0-rc.0",
|
|
45
45
|
"tslib": "^2",
|
|
46
46
|
"warning": "^4.0.3",
|
|
47
|
-
"@umijs/
|
|
48
|
-
"@umijs/
|
|
47
|
+
"@umijs/valtio": "1.0.3",
|
|
48
|
+
"@umijs/bundler-utils": "4.0.0-canary.20230811.1"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"antd": "^4.24.1",
|
|
52
|
-
"umi": "4.0.0-canary.
|
|
52
|
+
"umi": "4.0.0-canary.20230811.1"
|
|
53
53
|
},
|
|
54
54
|
"publishConfig": {
|
|
55
55
|
"access": "public"
|