@umijs/bundler-webpack 4.0.5 → 4.0.8
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 → client}/client/client.d.ts +0 -0
- package/client/client/client.js +172 -192
- package/client/constants.d.ts +15 -0
- package/client/constants.js +28 -19
- package/client/utils/formatWebpackMessages.d.ts +12 -0
- package/client/utils/formatWebpackMessages.js +68 -86
- package/dist/build.d.ts +1 -1
- package/dist/build.js +105 -61
- package/dist/cli.js +77 -69
- package/dist/config/_sampleFeature.js +33 -9
- package/dist/config/assetRules.js +45 -36
- package/dist/config/bundleAnalyzerPlugin.js +39 -17
- package/dist/config/compressPlugin.js +113 -95
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +204 -215
- package/dist/config/copyPlugin.js +58 -33
- package/dist/config/cssRules.js +136 -131
- package/dist/config/definePlugin.d.ts +1 -0
- package/dist/config/definePlugin.js +71 -31
- package/dist/config/detectDeadCode.js +120 -108
- package/dist/config/detectDeadCodePlugin.js +78 -63
- package/dist/config/fastRefreshPlugin.js +39 -20
- package/dist/config/forkTSCheckerPlugin.js +38 -19
- package/dist/config/harmonyLinkingErrorPlugin.js +48 -29
- package/dist/config/ignorePlugin.js +38 -14
- package/dist/config/javaScriptRules.js +146 -173
- package/dist/config/manifestPlugin.js +51 -15
- package/dist/config/miniCSSExtractPlugin.js +42 -22
- package/dist/config/nodePolyfill.js +65 -26
- package/dist/config/nodePrefixPlugin.js +36 -12
- package/dist/config/progressPlugin.js +37 -13
- package/dist/config/purgecssWebpackPlugin.js +41 -19
- package/dist/config/speedMeasureWebpackPlugin.js +41 -20
- package/dist/config/ssrPlugin.js +83 -63
- package/dist/config/svgRules.js +74 -46
- package/dist/constants.js +57 -22
- package/dist/dev.d.ts +1 -1
- package/dist/dev.js +170 -129
- package/dist/index.d.ts +0 -2
- package/dist/index.js +22 -35
- package/dist/loader/svgr.js +73 -54
- package/dist/loader/swc.js +110 -69
- package/dist/parcelCSS.d.ts +2 -0
- package/dist/parcelCSS.js +32 -0
- package/dist/plugins/ProgressPlugin.js +66 -43
- package/dist/plugins/RuntimePublicPathPlugin.js +42 -23
- package/dist/plugins/_SamplePlugin.js +39 -14
- package/dist/requireHook.js +37 -27
- package/dist/schema.js +119 -95
- package/dist/server/server.d.ts +0 -1
- package/dist/server/server.js +214 -184
- package/dist/server/ws.d.ts +0 -2
- package/dist/server/ws.js +63 -38
- package/dist/swcPlugins/autoCSSModules.js +50 -31
- package/dist/swcPlugins/changeImportFromString.js +31 -9
- package/dist/swcPlugins/lockCoreJS.js +44 -20
- package/dist/types.js +61 -30
- package/dist/utils/browsersList.js +31 -8
- package/dist/utils/depMatch.js +63 -39
- package/dist/utils/formatWebpackMessages.js +93 -91
- package/dist/utils/getEsBuildTarget.js +32 -10
- package/package.json +9 -11
- package/compiled/fork-ts-checker-webpack-plugin/LICENSE +0 -21
- package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
- package/compiled/fork-ts-checker-webpack-plugin/index.js +0 -42
- package/compiled/fork-ts-checker-webpack-plugin/package.json +0 -1
- package/dist/client/client.js +0 -245
|
@@ -1,16 +1,40 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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
|
+
// ignorePlugin.ts
|
|
20
|
+
var ignorePlugin_exports = {};
|
|
21
|
+
__export(ignorePlugin_exports, {
|
|
22
|
+
addIgnorePlugin: () => addIgnorePlugin
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ignorePlugin_exports);
|
|
25
|
+
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
5
26
|
async function addIgnorePlugin(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
27
|
+
const { config, userConfig } = opts;
|
|
28
|
+
if (userConfig.ignoreMomentLocale) {
|
|
29
|
+
config.plugin("ignore-moment-locale").use(import_webpack.IgnorePlugin, [
|
|
30
|
+
{
|
|
31
|
+
resourceRegExp: /^\.\/locale$/,
|
|
32
|
+
contextRegExp: /moment$/
|
|
33
|
+
}
|
|
34
|
+
]);
|
|
35
|
+
}
|
|
15
36
|
}
|
|
16
|
-
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
addIgnorePlugin
|
|
40
|
+
});
|
|
@@ -1,180 +1,153 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
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 });
|
|
10
|
+
};
|
|
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
|
+
// javaScriptRules.ts
|
|
23
|
+
var javaScriptRules_exports = {};
|
|
24
|
+
__export(javaScriptRules_exports, {
|
|
25
|
+
addJavaScriptRules: () => addJavaScriptRules
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(javaScriptRules_exports);
|
|
28
|
+
var import_mfsu = require("@umijs/mfsu");
|
|
29
|
+
var import_utils = require("@umijs/utils");
|
|
30
|
+
var import_path = require("path");
|
|
31
|
+
var import_webpack = require("../../compiled/webpack");
|
|
32
|
+
var import_constants = require("../constants");
|
|
33
|
+
var import_types = require("../types");
|
|
34
|
+
var import_depMatch = require("../utils/depMatch");
|
|
11
35
|
async function addJavaScriptRules(opts) {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.end()
|
|
28
|
-
.exclude.add(/node_modules/)
|
|
29
|
-
.end(),
|
|
30
|
-
config.module.rule('jsx-ts-tsx').test(/\.(jsx|ts|tsx)$/),
|
|
31
|
-
config.module
|
|
32
|
-
.rule('extra-src')
|
|
33
|
-
.test(/\.(js|mjs)$/)
|
|
34
|
-
.include.add([
|
|
35
|
-
// support extraBabelIncludes
|
|
36
|
-
...opts.extraBabelIncludes.map((p) => {
|
|
37
|
-
// handle absolute path
|
|
38
|
-
if ((0, path_1.isAbsolute)(p)) {
|
|
39
|
-
return p;
|
|
40
|
-
}
|
|
41
|
-
// resolve npm package name
|
|
42
|
-
try {
|
|
43
|
-
if (p.startsWith('./')) {
|
|
44
|
-
return require.resolve(p, { paths: [cwd] });
|
|
45
|
-
}
|
|
46
|
-
return (0, path_1.dirname)(require.resolve(`${p}/package.json`, { paths: [cwd] }));
|
|
47
|
-
}
|
|
48
|
-
catch (e) {
|
|
49
|
-
if (e.code === 'MODULE_NOT_FOUND') {
|
|
50
|
-
throw new Error('Cannot resolve extraBabelIncludes: ' + p);
|
|
51
|
-
}
|
|
52
|
-
throw e;
|
|
53
|
-
}
|
|
54
|
-
}),
|
|
55
|
-
// support es5ImcompatibleVersions
|
|
56
|
-
(path) => {
|
|
57
|
-
try {
|
|
58
|
-
// do src transform for bundler-webpack/client/client/client.js
|
|
59
|
-
if (path.includes('client/client/client'))
|
|
60
|
-
return true;
|
|
61
|
-
return (0, depMatch_1.isMatch)({ path, pkgs: depPkgs });
|
|
62
|
-
}
|
|
63
|
-
catch (e) {
|
|
64
|
-
console.error(utils_1.chalk.red(e));
|
|
65
|
-
throw e;
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
])
|
|
69
|
-
.end(),
|
|
70
|
-
];
|
|
71
|
-
if (userConfig.mdx) {
|
|
72
|
-
srcRules.push(config.module.rule('markdown').test(/\.mdx?$/));
|
|
73
|
-
}
|
|
74
|
-
const depRules = [
|
|
75
|
-
config.module
|
|
76
|
-
.rule('dep')
|
|
77
|
-
.test(/\.(js|mjs)$/)
|
|
78
|
-
.include.add(/node_modules/)
|
|
79
|
-
.end()
|
|
80
|
-
.exclude.add((path) => {
|
|
81
|
-
try {
|
|
82
|
-
return (0, depMatch_1.isMatch)({ path, pkgs: depPkgs });
|
|
83
|
-
}
|
|
84
|
-
catch (e) {
|
|
85
|
-
console.error(utils_1.chalk.red(e));
|
|
86
|
-
throw e;
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
.end(),
|
|
90
|
-
];
|
|
91
|
-
srcRules
|
|
92
|
-
.concat(depRules)
|
|
93
|
-
.forEach((rule) => rule.resolve.set('fullySpecified', false));
|
|
94
|
-
// const prefix = existsSync(join(cwd, 'src')) ? join(cwd, 'src') : cwd;
|
|
95
|
-
const srcTranspiler = userConfig.srcTranspiler || types_1.Transpiler.babel;
|
|
96
|
-
srcRules.forEach((rule) => {
|
|
97
|
-
if (srcTranspiler === types_1.Transpiler.babel) {
|
|
98
|
-
rule
|
|
99
|
-
.use('babel-loader')
|
|
100
|
-
.loader(require.resolve('../../compiled/babel-loader'))
|
|
101
|
-
.options({
|
|
102
|
-
// Tell babel to guess the type, instead assuming all files are modules
|
|
103
|
-
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
|
|
104
|
-
sourceType: 'unambiguous',
|
|
105
|
-
babelrc: false,
|
|
106
|
-
cacheDirectory: false,
|
|
107
|
-
// process.env.BABEL_CACHE !== 'none'
|
|
108
|
-
// ? join(cwd, `.umi/.cache/babel-loader`)
|
|
109
|
-
// : false,
|
|
110
|
-
targets: userConfig.targets,
|
|
111
|
-
presets: [
|
|
112
|
-
opts.babelPreset || [
|
|
113
|
-
require.resolve('@umijs/babel-preset-umi'),
|
|
114
|
-
{
|
|
115
|
-
presetEnv: {},
|
|
116
|
-
presetReact: {},
|
|
117
|
-
presetTypeScript: {},
|
|
118
|
-
pluginTransformRuntime: {},
|
|
119
|
-
pluginLockCoreJS: {},
|
|
120
|
-
pluginDynamicImportNode: false,
|
|
121
|
-
pluginAutoCSSModules: userConfig.autoCSSModules,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
...opts.extraBabelPresets,
|
|
125
|
-
...(userConfig.extraBabelPresets || []).filter(Boolean),
|
|
126
|
-
],
|
|
127
|
-
plugins: [
|
|
128
|
-
useFastRefresh && require.resolve('react-refresh/babel'),
|
|
129
|
-
...opts.extraBabelPlugins,
|
|
130
|
-
...(userConfig.extraBabelPlugins || []),
|
|
131
|
-
].filter(Boolean),
|
|
132
|
-
});
|
|
36
|
+
var _a, _b;
|
|
37
|
+
const { config, userConfig, cwd, name } = opts;
|
|
38
|
+
const isDev = opts.env === import_types.Env.development;
|
|
39
|
+
const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== import_constants.MFSU_NAME;
|
|
40
|
+
const depPkgs = Object.assign({}, (0, import_depMatch.es5ImcompatibleVersionsToPkg)());
|
|
41
|
+
const srcRules = [
|
|
42
|
+
config.module.rule("src").test(/\.(js|mjs)$/).include.add([
|
|
43
|
+
cwd,
|
|
44
|
+
...process.env.APP_ROOT ? [process.cwd()] : []
|
|
45
|
+
]).end().exclude.add(/node_modules/).end(),
|
|
46
|
+
config.module.rule("jsx-ts-tsx").test(/\.(jsx|ts|tsx)$/),
|
|
47
|
+
config.module.rule("extra-src").test(/\.(js|mjs)$/).include.add([
|
|
48
|
+
...opts.extraBabelIncludes.map((p) => {
|
|
49
|
+
if ((0, import_path.isAbsolute)(p)) {
|
|
50
|
+
return p;
|
|
133
51
|
}
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
52
|
+
try {
|
|
53
|
+
if (p.startsWith("./")) {
|
|
54
|
+
return require.resolve(p, { paths: [cwd] });
|
|
55
|
+
}
|
|
56
|
+
return (0, import_path.dirname)(import_utils.resolve.sync(`${p}/package.json`, { basedir: cwd }));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
if (e.code === "MODULE_NOT_FOUND") {
|
|
59
|
+
throw new Error("Cannot resolve extraBabelIncludes: " + p);
|
|
60
|
+
}
|
|
61
|
+
throw e;
|
|
142
62
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
config.plugin('react-provide-plugin').use(webpack_1.ProvidePlugin, [
|
|
153
|
-
{
|
|
154
|
-
React: 'react',
|
|
155
|
-
},
|
|
156
|
-
]);
|
|
63
|
+
}),
|
|
64
|
+
(path) => {
|
|
65
|
+
try {
|
|
66
|
+
if (path.includes("client/client/client"))
|
|
67
|
+
return true;
|
|
68
|
+
return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
|
|
69
|
+
} catch (e) {
|
|
70
|
+
console.error(import_utils.chalk.red(e));
|
|
71
|
+
throw e;
|
|
157
72
|
}
|
|
158
|
-
|
|
159
|
-
|
|
73
|
+
}
|
|
74
|
+
]).end()
|
|
75
|
+
];
|
|
76
|
+
if (userConfig.mdx) {
|
|
77
|
+
srcRules.push(config.module.rule("markdown").test(/\.mdx?$/));
|
|
78
|
+
}
|
|
79
|
+
const depRules = [
|
|
80
|
+
config.module.rule("dep").test(/\.(js|mjs)$/).include.add(/node_modules/).end().exclude.add((path) => {
|
|
81
|
+
try {
|
|
82
|
+
return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.error(import_utils.chalk.red(e));
|
|
85
|
+
throw e;
|
|
86
|
+
}
|
|
87
|
+
}).end()
|
|
88
|
+
];
|
|
89
|
+
srcRules.concat(depRules).forEach((rule) => rule.resolve.set("fullySpecified", false));
|
|
90
|
+
const srcTranspiler = userConfig.srcTranspiler || import_types.Transpiler.babel;
|
|
91
|
+
srcRules.forEach((rule) => {
|
|
92
|
+
if (srcTranspiler === import_types.Transpiler.babel) {
|
|
93
|
+
rule.use("babel-loader").loader(require.resolve("../../compiled/babel-loader")).options({
|
|
94
|
+
sourceType: "unambiguous",
|
|
95
|
+
babelrc: false,
|
|
96
|
+
cacheDirectory: false,
|
|
97
|
+
targets: userConfig.targets,
|
|
98
|
+
presets: [
|
|
99
|
+
opts.babelPreset || [
|
|
100
|
+
require.resolve("@umijs/babel-preset-umi"),
|
|
101
|
+
{
|
|
102
|
+
presetEnv: {},
|
|
103
|
+
presetReact: {},
|
|
104
|
+
presetTypeScript: {},
|
|
105
|
+
pluginTransformRuntime: {},
|
|
106
|
+
pluginLockCoreJS: {},
|
|
107
|
+
pluginDynamicImportNode: false,
|
|
108
|
+
pluginAutoCSSModules: userConfig.autoCSSModules
|
|
109
|
+
}
|
|
110
|
+
],
|
|
111
|
+
...opts.extraBabelPresets,
|
|
112
|
+
...(userConfig.extraBabelPresets || []).filter(Boolean)
|
|
113
|
+
],
|
|
114
|
+
plugins: [
|
|
115
|
+
useFastRefresh && require.resolve("react-refresh/babel"),
|
|
116
|
+
...opts.extraBabelPlugins,
|
|
117
|
+
...userConfig.extraBabelPlugins || []
|
|
118
|
+
].filter(Boolean)
|
|
119
|
+
});
|
|
120
|
+
} else if (srcTranspiler === import_types.Transpiler.swc) {
|
|
121
|
+
const AutoCSSModule = require("../swcPlugins/autoCSSModules").default;
|
|
122
|
+
rule.use("swc-loader").loader(require.resolve("../loader/swc")).options({
|
|
123
|
+
plugin: (m) => new AutoCSSModule().visitProgram(m)
|
|
124
|
+
});
|
|
125
|
+
} else if (srcTranspiler === import_types.Transpiler.esbuild) {
|
|
126
|
+
rule.use("esbuild-loader").loader(import_mfsu.esbuildLoader).options({
|
|
127
|
+
target: isDev ? "esnext" : "es2015",
|
|
128
|
+
handler: [import_mfsu.autoCssModulesHandler, ...opts.extraEsbuildLoaderHandler]
|
|
129
|
+
});
|
|
130
|
+
config.plugin("react-provide-plugin").use(import_webpack.ProvidePlugin, [
|
|
131
|
+
{
|
|
132
|
+
React: "react"
|
|
160
133
|
}
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
.rule('mdx')
|
|
165
|
-
.test(/\.mdx?$/)
|
|
166
|
-
.use('mdx-loader')
|
|
167
|
-
.loader((_a = userConfig.mdx) === null || _a === void 0 ? void 0 : _a.loader)
|
|
168
|
-
.options((_b = userConfig.mdx) === null || _b === void 0 ? void 0 : _b.loaderOptions);
|
|
134
|
+
]);
|
|
135
|
+
} else {
|
|
136
|
+
throw new Error(`Unsupported srcTranspiler ${srcTranspiler}.`);
|
|
169
137
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
138
|
+
});
|
|
139
|
+
if (userConfig.mdx) {
|
|
140
|
+
config.module.rule("mdx").test(/\.mdx?$/).use("mdx-loader").loader((_a = userConfig.mdx) == null ? void 0 : _a.loader).options((_b = userConfig.mdx) == null ? void 0 : _b.loaderOptions);
|
|
141
|
+
}
|
|
142
|
+
const depTranspiler = userConfig.depTranspiler || import_types.Transpiler.none;
|
|
143
|
+
depRules.forEach((_rule) => {
|
|
144
|
+
if (depTranspiler === import_types.Transpiler.none) {
|
|
145
|
+
} else {
|
|
146
|
+
throw new Error(`Unsupported depTranspiler ${depTranspiler}.`);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
179
149
|
}
|
|
180
|
-
|
|
150
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
151
|
+
0 && (module.exports = {
|
|
152
|
+
addJavaScriptRules
|
|
153
|
+
});
|
|
@@ -1,17 +1,53 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
15
16
|
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __export = (target, all) => {
|
|
20
|
+
for (var name in all)
|
|
21
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
22
|
+
};
|
|
23
|
+
var __copyProps = (to, from, except, desc) => {
|
|
24
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
25
|
+
for (let key of __getOwnPropNames(from))
|
|
26
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
27
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
28
|
+
}
|
|
29
|
+
return to;
|
|
30
|
+
};
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// manifestPlugin.ts
|
|
34
|
+
var manifestPlugin_exports = {};
|
|
35
|
+
__export(manifestPlugin_exports, {
|
|
36
|
+
addManifestPlugin: () => addManifestPlugin
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(manifestPlugin_exports);
|
|
39
|
+
var import_webpack_manifest_plugin = require("@umijs/bundler-webpack/compiled/webpack-manifest-plugin");
|
|
40
|
+
async function addManifestPlugin(opts) {
|
|
41
|
+
const { config, userConfig } = opts;
|
|
42
|
+
if (userConfig.manifest) {
|
|
43
|
+
config.plugin("manifest-plugin").use(import_webpack_manifest_plugin.WebpackManifestPlugin, [
|
|
44
|
+
__spreadValues({
|
|
45
|
+
fileName: "asset-manifest.json"
|
|
46
|
+
}, userConfig.manifest)
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
16
49
|
}
|
|
17
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
addManifestPlugin
|
|
53
|
+
});
|
|
@@ -1,25 +1,45 @@
|
|
|
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
|
-
|
|
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
|
+
// miniCSSExtractPlugin.ts
|
|
23
|
+
var miniCSSExtractPlugin_exports = {};
|
|
24
|
+
__export(miniCSSExtractPlugin_exports, {
|
|
25
|
+
addMiniCSSExtractPlugin: () => addMiniCSSExtractPlugin
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(miniCSSExtractPlugin_exports);
|
|
28
|
+
var import_mini_css_extract_plugin = __toESM(require("@umijs/bundler-webpack/compiled/mini-css-extract-plugin"));
|
|
9
29
|
async function addMiniCSSExtractPlugin(opts) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
},
|
|
22
|
-
]);
|
|
23
|
-
}
|
|
30
|
+
const { config, userConfig, useHash } = opts;
|
|
31
|
+
const hash = useHash ? ".[contenthash:8]" : "";
|
|
32
|
+
if (!userConfig.styleLoader) {
|
|
33
|
+
config.plugin("mini-css-extract-plugin").use(import_mini_css_extract_plugin.default, [
|
|
34
|
+
{
|
|
35
|
+
filename: `[name]${hash}.css`,
|
|
36
|
+
chunkFilename: opts.userConfig.ssr ? `umi${hash}.css` : `[name]${hash}.chunk.css`,
|
|
37
|
+
ignoreOrder: true
|
|
38
|
+
}
|
|
39
|
+
]);
|
|
40
|
+
}
|
|
24
41
|
}
|
|
25
|
-
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
addMiniCSSExtractPlugin
|
|
45
|
+
});
|
|
@@ -1,28 +1,67 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
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]);
|
|
18
|
+
}
|
|
19
|
+
return a;
|
|
20
|
+
};
|
|
21
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
22
|
+
var __export = (target, all) => {
|
|
23
|
+
for (var name in all)
|
|
24
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
25
|
+
};
|
|
26
|
+
var __copyProps = (to, from, except, desc) => {
|
|
27
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
28
|
+
for (let key of __getOwnPropNames(from))
|
|
29
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
30
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
31
|
+
}
|
|
32
|
+
return to;
|
|
33
|
+
};
|
|
34
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
35
|
+
|
|
36
|
+
// nodePolyfill.ts
|
|
37
|
+
var nodePolyfill_exports = {};
|
|
38
|
+
__export(nodePolyfill_exports, {
|
|
39
|
+
addNodePolyfill: () => addNodePolyfill
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(nodePolyfill_exports);
|
|
42
|
+
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
5
43
|
async function addNodePolyfill(opts) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
https: false,
|
|
26
|
-
});
|
|
44
|
+
const { config } = opts;
|
|
45
|
+
const nodeLibs = require("node-libs-browser");
|
|
46
|
+
config.plugin("node-polyfill-provider").use(import_webpack.ProvidePlugin, [
|
|
47
|
+
{
|
|
48
|
+
Buffer: ["buffer", "Buffer"],
|
|
49
|
+
process: nodeLibs["process"]
|
|
50
|
+
}
|
|
51
|
+
]);
|
|
52
|
+
config.resolve.fallback.merge(__spreadProps(__spreadValues({}, Object.keys(nodeLibs).reduce((memo, key) => {
|
|
53
|
+
if (nodeLibs[key]) {
|
|
54
|
+
memo[key] = nodeLibs[key];
|
|
55
|
+
} else {
|
|
56
|
+
memo[key] = false;
|
|
57
|
+
}
|
|
58
|
+
return memo;
|
|
59
|
+
}, {})), {
|
|
60
|
+
http: false,
|
|
61
|
+
https: false
|
|
62
|
+
}));
|
|
27
63
|
}
|
|
28
|
-
|
|
64
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
65
|
+
0 && (module.exports = {
|
|
66
|
+
addNodePolyfill
|
|
67
|
+
});
|