@umijs/plugins 4.0.73 → 4.0.75

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.
@@ -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
- // 开启了 antd 插件的时候,使用 antd 的 loader 组件,否则提示用户必须设置一个自定义的 loader 组件
138
- content: api.isPluginEnable("antd") ? getFileContent("AntdLoader.tsx") : `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; }`
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",
@@ -24,6 +24,7 @@ export type MicroAppRoute = {
24
24
 
25
25
  export type MasterOptions = {
26
26
  enable?: boolean;
27
+ loader?: string;
27
28
  apps?: App[];
28
29
  routes?: MicroAppRoute[];
29
30
  lifeCycles?: FrameworkLifeCycles<object>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/plugins",
3
- "version": "4.0.73",
3
+ "version": "4.0.75",
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/bundler-utils": "4.0.73",
47
+ "@umijs/bundler-utils": "4.0.75",
48
48
  "@umijs/valtio": "1.0.3"
49
49
  },
50
50
  "devDependencies": {
51
51
  "antd": "^4.24.1",
52
- "umi": "4.0.73"
52
+ "umi": "4.0.75"
53
53
  },
54
54
  "publishConfig": {
55
55
  "access": "public"