@umijs/plugins 4.0.6 → 4.0.9
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/access.js +69 -53
- package/dist/analytics.js +62 -41
- package/dist/antd.js +139 -123
- package/dist/dva.js +133 -142
- package/dist/icons.js +28 -4
- package/dist/initial-state.js +71 -54
- package/dist/layout.js +201 -209
- package/dist/locale.js +214 -192
- package/dist/model.js +79 -78
- package/dist/moment2dayjs.js +102 -81
- package/dist/qiankun/constants.js +41 -8
- package/dist/qiankun/master.js +147 -121
- package/dist/qiankun/slave.js +160 -150
- package/dist/qiankun.js +46 -19
- package/dist/request.js +87 -56
- package/dist/tailwindcss.js +70 -49
- package/dist/unocss.js +57 -37
- package/dist/utils/astUtils.js +38 -34
- package/dist/utils/localeUtils.js +125 -120
- package/dist/utils/modelUtils.js +216 -237
- package/dist/utils/resolveProjectDep.js +36 -13
- package/dist/utils/withTmpPath.js +31 -9
- package/libs/locale/SelectLang.tpl +1 -1
- package/libs/locale/localeExports.tpl +4 -3
- package/libs/qiankun/master/MicroApp.tsx +17 -12
- package/libs/qiankun/slave/lifecycles.ts +20 -6
- package/package.json +6 -6
package/dist/access.js
CHANGED
|
@@ -1,41 +1,57 @@
|
|
|
1
|
-
|
|
2
|
-
var
|
|
3
|
-
|
|
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 });
|
|
4
10
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
20
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
21
|
+
|
|
22
|
+
// access.ts
|
|
23
|
+
var access_exports = {};
|
|
24
|
+
__export(access_exports, {
|
|
25
|
+
default: () => access_default
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(access_exports);
|
|
28
|
+
var import_fs = __toESM(require("fs"));
|
|
29
|
+
var import_path = require("path");
|
|
30
|
+
var import_withTmpPath = require("./utils/withTmpPath");
|
|
31
|
+
var access_default = (api) => {
|
|
32
|
+
api.describe({
|
|
33
|
+
config: {
|
|
34
|
+
schema(Joi) {
|
|
35
|
+
return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
enableBy: api.EnableBy.config
|
|
39
|
+
});
|
|
40
|
+
api.onGenerateFiles(async () => {
|
|
41
|
+
const hasAccessFile = ["js", "jsx", "ts", "tsx"].some((ext) => import_fs.default.existsSync((0, import_path.join)(api.paths.absSrcPath, `access.${ext}`)));
|
|
42
|
+
api.writeTmpFile({
|
|
43
|
+
path: "runtime.tsx",
|
|
44
|
+
content: `
|
|
45
|
+
import React from 'react';${hasAccessFile ? `
|
|
27
46
|
import accessFactory from '@/access'
|
|
28
47
|
import { useModel } from '@@/plugin-model';
|
|
29
|
-
`
|
|
30
|
-
: ''}
|
|
48
|
+
` : ""}
|
|
31
49
|
import { AccessContext } from './context';
|
|
32
50
|
|
|
33
|
-
function Provider(props) {${hasAccessFile
|
|
34
|
-
? `
|
|
51
|
+
function Provider(props) {${hasAccessFile ? `
|
|
35
52
|
const { initialState } = useModel('@@initialState');
|
|
36
53
|
const access = React.useMemo(() => accessFactory(initialState), [initialState]);
|
|
37
|
-
`
|
|
38
|
-
: `
|
|
54
|
+
` : `
|
|
39
55
|
const access = {};
|
|
40
56
|
`}
|
|
41
57
|
return (
|
|
@@ -48,12 +64,11 @@ function Provider(props) {${hasAccessFile
|
|
|
48
64
|
export function accessProvider(container) {
|
|
49
65
|
return <Provider>{ container }</Provider>;
|
|
50
66
|
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
content: `
|
|
67
|
+
`
|
|
68
|
+
});
|
|
69
|
+
api.writeTmpFile({
|
|
70
|
+
path: "index.tsx",
|
|
71
|
+
content: `
|
|
57
72
|
import React, { PropsWithChildren } from 'react';
|
|
58
73
|
import { AccessContext } from './context';
|
|
59
74
|
import type { IRoute } from 'umi';
|
|
@@ -81,7 +96,7 @@ export const useAccessMarkedRoutes = (routes: IRoute[]) => {
|
|
|
81
96
|
const accessCode = route.access || parentAccessCode;
|
|
82
97
|
|
|
83
98
|
// set default status
|
|
84
|
-
route.unaccessible = ${api.config.access.strictMode ?
|
|
99
|
+
route.unaccessible = ${api.config.access.strictMode ? "true" : "false"};
|
|
85
100
|
|
|
86
101
|
// check access code
|
|
87
102
|
if (typeof accessCode === 'string') {
|
|
@@ -118,22 +133,23 @@ export const useAccessMarkedRoutes = (routes: IRoute[]) => {
|
|
|
118
133
|
|
|
119
134
|
return markdedRoutes;
|
|
120
135
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
content: `
|
|
136
|
+
`
|
|
137
|
+
});
|
|
138
|
+
api.writeTmpFile({
|
|
139
|
+
path: "context.ts",
|
|
140
|
+
content: `
|
|
127
141
|
import React from 'react';
|
|
128
142
|
export const AccessContext = React.createContext<any>(null);
|
|
129
|
-
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
api.addRuntimePlugin(() => {
|
|
133
|
-
return [(0, withTmpPath_1.withTmpPath)({ api, path: 'runtime.tsx' })];
|
|
143
|
+
`
|
|
134
144
|
});
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
145
|
+
});
|
|
146
|
+
api.addRuntimePlugin(() => {
|
|
147
|
+
return [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })];
|
|
148
|
+
});
|
|
149
|
+
api.addTmpGenerateWatcherPaths(() => [
|
|
150
|
+
(0, import_path.join)(api.paths.absSrcPath, "access.ts"),
|
|
151
|
+
(0, import_path.join)(api.paths.absSrcPath, "access.js")
|
|
152
|
+
]);
|
|
139
153
|
};
|
|
154
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
155
|
+
0 && (module.exports = {});
|
package/dist/analytics.js
CHANGED
|
@@ -1,23 +1,44 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
+
// analytics.ts
|
|
20
|
+
var analytics_exports = {};
|
|
21
|
+
__export(analytics_exports, {
|
|
22
|
+
default: () => analytics_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(analytics_exports);
|
|
25
|
+
var analytics_default = (api) => {
|
|
26
|
+
const GA_KEY = process.env.GA_KEY;
|
|
27
|
+
const enableBy = (opts) => {
|
|
28
|
+
return opts.config.analytics || GA_KEY;
|
|
29
|
+
};
|
|
30
|
+
api.describe({
|
|
31
|
+
key: "analytics",
|
|
32
|
+
config: {
|
|
33
|
+
schema(Joi) {
|
|
34
|
+
return Joi.alternatives().try(Joi.object(), Joi.boolean().invalid(true));
|
|
35
|
+
},
|
|
36
|
+
onChange: api.ConfigChangeType.reload
|
|
37
|
+
},
|
|
38
|
+
enableBy
|
|
39
|
+
});
|
|
40
|
+
const baiduTpl = (code) => {
|
|
41
|
+
return `
|
|
21
42
|
(function() {
|
|
22
43
|
var hm = document.createElement('script');
|
|
23
44
|
hm.src = '//hm.baidu.com/hm.js?${code}';
|
|
@@ -25,9 +46,9 @@ exports.default = (api) => {
|
|
|
25
46
|
s.parentNode.insertBefore(hm, s);
|
|
26
47
|
})();
|
|
27
48
|
`;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
49
|
+
};
|
|
50
|
+
const gaTpl = (code) => {
|
|
51
|
+
return `
|
|
31
52
|
(function(){
|
|
32
53
|
if (!location.port) {
|
|
33
54
|
(function (i, s, o, g, r, a, m) {
|
|
@@ -46,22 +67,22 @@ exports.default = (api) => {
|
|
|
46
67
|
}
|
|
47
68
|
})();
|
|
48
69
|
`;
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
].filter(Boolean);
|
|
66
|
-
});
|
|
70
|
+
};
|
|
71
|
+
api.addHTMLHeadScripts(() => {
|
|
72
|
+
const { analytics = {} } = api.config;
|
|
73
|
+
const { ga = GA_KEY, baidu } = analytics;
|
|
74
|
+
return [
|
|
75
|
+
baidu && {
|
|
76
|
+
content: "var _hmt = _hmt || [];"
|
|
77
|
+
},
|
|
78
|
+
api.env !== "development" && baidu && {
|
|
79
|
+
content: baiduTpl(baidu)
|
|
80
|
+
},
|
|
81
|
+
api.env !== "development" && ga && {
|
|
82
|
+
content: gaTpl(ga)
|
|
83
|
+
}
|
|
84
|
+
].filter(Boolean);
|
|
85
|
+
});
|
|
67
86
|
};
|
|
87
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
88
|
+
0 && (module.exports = {});
|
package/dist/antd.js
CHANGED
|
@@ -1,109 +1,128 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __spreadValues = (a, b) => {
|
|
11
|
+
for (var prop in b || (b = {}))
|
|
12
|
+
if (__hasOwnProp.call(b, prop))
|
|
13
|
+
__defNormalProp(a, prop, b[prop]);
|
|
14
|
+
if (__getOwnPropSymbols)
|
|
15
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
16
|
+
if (__propIsEnum.call(b, prop))
|
|
17
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
18
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// antd.ts
|
|
37
|
+
var antd_exports = {};
|
|
38
|
+
__export(antd_exports, {
|
|
39
|
+
default: () => antd_default
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(antd_exports);
|
|
42
|
+
var import_path = require("path");
|
|
43
|
+
var import_plugin_utils = require("umi/plugin-utils");
|
|
44
|
+
var import_resolveProjectDep = require("./utils/resolveProjectDep");
|
|
45
|
+
var import_withTmpPath = require("./utils/withTmpPath");
|
|
46
|
+
var antd_default = (api) => {
|
|
47
|
+
let pkgPath;
|
|
48
|
+
try {
|
|
49
|
+
pkgPath = (0, import_resolveProjectDep.resolveProjectDep)({
|
|
50
|
+
pkg: api.pkg,
|
|
51
|
+
cwd: api.cwd,
|
|
52
|
+
dep: "antd"
|
|
53
|
+
}) || (0, import_path.dirname)(require.resolve("antd/package.json"));
|
|
54
|
+
} catch (e) {
|
|
55
|
+
}
|
|
56
|
+
api.describe({
|
|
57
|
+
config: {
|
|
58
|
+
schema(Joi) {
|
|
59
|
+
return Joi.alternatives().try(Joi.object({
|
|
60
|
+
configProvider: Joi.object(),
|
|
61
|
+
dark: Joi.boolean(),
|
|
62
|
+
compact: Joi.boolean(),
|
|
63
|
+
import: Joi.boolean(),
|
|
64
|
+
style: Joi.string().allow("less", "css")
|
|
65
|
+
}), Joi.boolean().invalid(true));
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
enableBy({ userConfig }) {
|
|
69
|
+
return process.env.UMI_PLUGIN_ANTD_ENABLE || userConfig.antd;
|
|
44
70
|
}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// antd config provider
|
|
101
|
-
api.onGenerateFiles(() => {
|
|
102
|
-
if (!api.config.antd.configProvider)
|
|
103
|
-
return;
|
|
104
|
-
api.writeTmpFile({
|
|
105
|
-
path: `runtime.tsx`,
|
|
106
|
-
content: plugin_utils_1.Mustache.render(`
|
|
71
|
+
});
|
|
72
|
+
function checkPkgPath() {
|
|
73
|
+
if (!pkgPath) {
|
|
74
|
+
throw new Error(`Can't find antd package. Please install antd first.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
api.modifyAppData((memo) => {
|
|
78
|
+
checkPkgPath();
|
|
79
|
+
const version = require(`${pkgPath}/package.json`).version;
|
|
80
|
+
memo.antd = {
|
|
81
|
+
pkgPath,
|
|
82
|
+
version
|
|
83
|
+
};
|
|
84
|
+
return memo;
|
|
85
|
+
});
|
|
86
|
+
api.modifyConfig((memo) => {
|
|
87
|
+
checkPkgPath();
|
|
88
|
+
let antd = memo.antd || {};
|
|
89
|
+
if (process.env.UMI_PLUGIN_ANTD_ENABLE) {
|
|
90
|
+
const { defaultConfig } = JSON.parse(process.env.UMI_PLUGIN_ANTD_ENABLE);
|
|
91
|
+
antd = Object.assign(defaultConfig, antd);
|
|
92
|
+
}
|
|
93
|
+
memo.alias.antd = pkgPath;
|
|
94
|
+
if (antd.dayjs) {
|
|
95
|
+
memo.alias.moment = (0, import_path.dirname)(require.resolve("dayjs/package.json"));
|
|
96
|
+
}
|
|
97
|
+
if (antd.dark || antd.compact) {
|
|
98
|
+
const { getThemeVariables } = require("antd/dist/theme");
|
|
99
|
+
memo.theme = __spreadValues(__spreadValues({}, getThemeVariables(antd)), memo.theme);
|
|
100
|
+
}
|
|
101
|
+
memo.theme = __spreadValues({
|
|
102
|
+
"root-entry-name": "default"
|
|
103
|
+
}, memo.theme);
|
|
104
|
+
return memo;
|
|
105
|
+
});
|
|
106
|
+
api.addExtraBabelPlugins(() => {
|
|
107
|
+
const style = api.config.antd.style || "less";
|
|
108
|
+
return api.config.antd.import && !api.appData.vite ? [
|
|
109
|
+
[
|
|
110
|
+
require.resolve("babel-plugin-import"),
|
|
111
|
+
{
|
|
112
|
+
libraryName: "antd",
|
|
113
|
+
libraryDirectory: "es",
|
|
114
|
+
style: style === "less" ? true : "css"
|
|
115
|
+
},
|
|
116
|
+
"antd"
|
|
117
|
+
]
|
|
118
|
+
] : [];
|
|
119
|
+
});
|
|
120
|
+
api.onGenerateFiles(() => {
|
|
121
|
+
if (!api.config.antd.configProvider)
|
|
122
|
+
return;
|
|
123
|
+
api.writeTmpFile({
|
|
124
|
+
path: `runtime.tsx`,
|
|
125
|
+
content: import_plugin_utils.Mustache.render(`
|
|
107
126
|
import React from 'react';
|
|
108
127
|
import { ConfigProvider, Modal, message, notification } from 'antd';
|
|
109
128
|
|
|
@@ -123,24 +142,21 @@ export function rootContainer(container) {
|
|
|
123
142
|
return <ConfigProvider {...finalConfig}>{container}</ConfigProvider>;
|
|
124
143
|
}
|
|
125
144
|
`.trim(), {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
api.addRuntimePlugin(() => {
|
|
131
|
-
return api.config.antd.configProvider
|
|
132
|
-
? [(0, withTmpPath_1.withTmpPath)({ api, path: 'runtime.tsx' })]
|
|
133
|
-
: [];
|
|
134
|
-
});
|
|
135
|
-
// import antd style if antd.import is not configured
|
|
136
|
-
api.addEntryImportsAhead(() => {
|
|
137
|
-
const style = api.config.antd.style || 'less';
|
|
138
|
-
return api.config.antd.import && !api.appData.vite
|
|
139
|
-
? []
|
|
140
|
-
: [
|
|
141
|
-
{
|
|
142
|
-
source: style === 'less' ? 'antd/dist/antd.less' : 'antd/dist/antd.css',
|
|
143
|
-
},
|
|
144
|
-
];
|
|
145
|
+
config: JSON.stringify(api.config.antd.configProvider)
|
|
146
|
+
})
|
|
145
147
|
});
|
|
148
|
+
});
|
|
149
|
+
api.addRuntimePlugin(() => {
|
|
150
|
+
return api.config.antd.configProvider ? [(0, import_withTmpPath.withTmpPath)({ api, path: "runtime.tsx" })] : [];
|
|
151
|
+
});
|
|
152
|
+
api.addEntryImportsAhead(() => {
|
|
153
|
+
const style = api.config.antd.style || "less";
|
|
154
|
+
return api.config.antd.import && !api.appData.vite ? [] : [
|
|
155
|
+
{
|
|
156
|
+
source: style === "less" ? "antd/dist/antd.less" : "antd/dist/antd.css"
|
|
157
|
+
}
|
|
158
|
+
];
|
|
159
|
+
});
|
|
146
160
|
};
|
|
161
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
162
|
+
0 && (module.exports = {});
|