@umijs/bundler-webpack 4.2.6-alpha.4 → 4.2.6-alpha.6
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/compiled/webpack-5-chain/package.json +1 -1
- package/compiled/webpack-5-chain/types/index.d.ts +1 -1
- package/package.json +6 -6
- package/dist/build.d.ts +0 -22
- package/dist/build.js +0 -151
- package/dist/cli.d.ts +0 -1
- package/dist/cli.js +0 -96
- package/dist/config/_sampleFeature.d.ts +0 -10
- package/dist/config/_sampleFeature.js +0 -35
- package/dist/config/assetRules.d.ts +0 -11
- package/dist/config/assetRules.js +0 -48
- package/dist/config/bundleAnalyzerPlugin.d.ts +0 -10
- package/dist/config/bundleAnalyzerPlugin.js +0 -43
- package/dist/config/compressPlugin.d.ts +0 -10
- package/dist/config/compressPlugin.js +0 -128
- package/dist/config/config.d.ts +0 -29
- package/dist/config/config.js +0 -241
- package/dist/config/copyPlugin.d.ts +0 -10
- package/dist/config/copyPlugin.js +0 -63
- package/dist/config/cssRules.d.ts +0 -11
- package/dist/config/cssRules.js +0 -165
- package/dist/config/definePlugin.d.ts +0 -17
- package/dist/config/definePlugin.js +0 -65
- package/dist/config/detectCssModulesInDependence.d.ts +0 -10
- package/dist/config/detectCssModulesInDependence.js +0 -151
- package/dist/config/detectDeadCode.d.ts +0 -12
- package/dist/config/detectDeadCode.js +0 -191
- package/dist/config/detectDeadCodePlugin.d.ts +0 -9
- package/dist/config/detectDeadCodePlugin.js +0 -82
- package/dist/config/fastRefreshPlugin.d.ts +0 -12
- package/dist/config/fastRefreshPlugin.js +0 -49
- package/dist/config/forkTSCheckerPlugin.d.ts +0 -11
- package/dist/config/forkTSCheckerPlugin.js +0 -49
- package/dist/config/harmonyLinkingErrorPlugin.d.ts +0 -6
- package/dist/config/harmonyLinkingErrorPlugin.js +0 -53
- package/dist/config/ignorePlugin.d.ts +0 -10
- package/dist/config/ignorePlugin.js +0 -40
- package/dist/config/javaScriptRules.d.ts +0 -16
- package/dist/config/javaScriptRules.js +0 -191
- package/dist/config/manifestPlugin.d.ts +0 -11
- package/dist/config/manifestPlugin.js +0 -40
- package/dist/config/miniCSSExtractPlugin.d.ts +0 -11
- package/dist/config/miniCSSExtractPlugin.js +0 -55
- package/dist/config/nodePolyfill.d.ts +0 -10
- package/dist/config/nodePolyfill.js +0 -51
- package/dist/config/nodePrefixPlugin.d.ts +0 -11
- package/dist/config/nodePrefixPlugin.js +0 -38
- package/dist/config/progressPlugin.d.ts +0 -11
- package/dist/config/progressPlugin.js +0 -53
- package/dist/config/purgecssWebpackPlugin.d.ts +0 -10
- package/dist/config/purgecssWebpackPlugin.js +0 -43
- package/dist/config/speedMeasureWebpackPlugin.d.ts +0 -6
- package/dist/config/speedMeasureWebpackPlugin.js +0 -59
- package/dist/config/ssrPlugin.d.ts +0 -11
- package/dist/config/ssrPlugin.js +0 -98
- package/dist/config/svgRules.d.ts +0 -12
- package/dist/config/svgRules.js +0 -70
- package/dist/constants.d.ts +0 -15
- package/dist/constants.js +0 -59
- package/dist/dev.d.ts +0 -40
- package/dist/dev.js +0 -204
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -32
- package/dist/loader/svgr.d.ts +0 -4
- package/dist/loader/svgr.js +0 -84
- package/dist/loader/swc.d.ts +0 -4
- package/dist/loader/swc.js +0 -149
- package/dist/parcelCSS.d.ts +0 -2
- package/dist/parcelCSS.js +0 -39
- package/dist/plugins/EsbuildMinifyFix.d.ts +0 -8
- package/dist/plugins/EsbuildMinifyFix.js +0 -136
- package/dist/plugins/ProgressPlugin.d.ts +0 -15
- package/dist/plugins/ProgressPlugin.js +0 -69
- package/dist/plugins/RuntimePublicPathPlugin.d.ts +0 -4
- package/dist/plugins/RuntimePublicPathPlugin.js +0 -45
- package/dist/plugins/_SamplePlugin.d.ts +0 -9
- package/dist/plugins/_SamplePlugin.js +0 -37
- package/dist/requireHook.d.ts +0 -1
- package/dist/requireHook.js +0 -48
- package/dist/schema.d.ts +0 -4
- package/dist/schema.js +0 -178
- package/dist/server/server.d.ts +0 -17
- package/dist/server/server.js +0 -223
- package/dist/server/ws.d.ts +0 -13
- package/dist/server/ws.js +0 -76
- package/dist/swcPlugins/autoCSSModules.d.ts +0 -17
- package/dist/swcPlugins/autoCSSModules.js +0 -63
- package/dist/swcPlugins/changeImportFromString.d.ts +0 -2
- package/dist/swcPlugins/changeImportFromString.js +0 -32
- package/dist/swcPlugins/lockCoreJS.d.ts +0 -6
- package/dist/swcPlugins/lockCoreJS.js +0 -56
- package/dist/types.d.ts +0 -144
- package/dist/types.js +0 -61
- package/dist/utils/browsersList.d.ts +0 -5
- package/dist/utils/browsersList.js +0 -33
- package/dist/utils/depMatch.d.ts +0 -6
- package/dist/utils/depMatch.js +0 -72
- package/dist/utils/formatWebpackMessages.d.ts +0 -12
- package/dist/utils/formatWebpackMessages.js +0 -128
- package/dist/utils/getEsBuildTarget.d.ts +0 -7
- package/dist/utils/getEsBuildTarget.js +0 -46
- package/dist/utils/pkgUpContainsName.d.ts +0 -1
- package/dist/utils/pkgUpContainsName.js +0 -50
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
// src/config/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");
|
|
26
|
-
async function addIgnorePlugin(opts) {
|
|
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
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
addIgnorePlugin
|
|
40
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Config from '../../compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
config: Config;
|
|
5
|
-
userConfig: IConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
env: Env;
|
|
8
|
-
extraBabelPlugins: any[];
|
|
9
|
-
extraBabelPresets: any[];
|
|
10
|
-
extraBabelIncludes: Array<string | RegExp>;
|
|
11
|
-
extraEsbuildLoaderHandler: any[];
|
|
12
|
-
babelPreset: any;
|
|
13
|
-
name?: string;
|
|
14
|
-
}
|
|
15
|
-
export declare function addJavaScriptRules(opts: IOpts): Promise<void>;
|
|
16
|
-
export {};
|
|
@@ -1,191 +0,0 @@
|
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/config/javaScriptRules.ts
|
|
30
|
-
var javaScriptRules_exports = {};
|
|
31
|
-
__export(javaScriptRules_exports, {
|
|
32
|
-
addJavaScriptRules: () => addJavaScriptRules
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(javaScriptRules_exports);
|
|
35
|
-
var import_mfsu = require("@umijs/mfsu");
|
|
36
|
-
var import_utils = require("@umijs/utils");
|
|
37
|
-
var import_path = require("path");
|
|
38
|
-
var import_webpack = require("../../compiled/webpack");
|
|
39
|
-
var import_constants = require("../constants");
|
|
40
|
-
var import_types = require("../types");
|
|
41
|
-
var import_depMatch = require("../utils/depMatch");
|
|
42
|
-
async function addJavaScriptRules(opts) {
|
|
43
|
-
var _a, _b;
|
|
44
|
-
const { config, userConfig, cwd, name } = opts;
|
|
45
|
-
const isDev = opts.env === import_types.Env.development;
|
|
46
|
-
const useFastRefresh = isDev && userConfig.fastRefresh !== false && name !== import_constants.MFSU_NAME;
|
|
47
|
-
const depPkgs = Object.assign({}, (0, import_depMatch.es5ImcompatibleVersionsToPkg)());
|
|
48
|
-
const srcRules = [
|
|
49
|
-
config.module.rule("src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
50
|
-
cwd,
|
|
51
|
-
// import module out of cwd using APP_ROOT
|
|
52
|
-
// issue: https://github.com/umijs/umi/issues/5594
|
|
53
|
-
...process.env.APP_ROOT ? [process.cwd()] : []
|
|
54
|
-
]).end().exclude.add(/node_modules/).end(),
|
|
55
|
-
config.module.rule("jsx-ts-tsx").test(/\.(jsx|ts|tsx)$/),
|
|
56
|
-
config.module.rule("extra-src").test(/\.(js|mjs|cjs)$/).include.add([
|
|
57
|
-
// support extraBabelIncludes
|
|
58
|
-
...opts.extraBabelIncludes.map((p) => {
|
|
59
|
-
if (import_utils.lodash.isRegExp(p)) {
|
|
60
|
-
return p;
|
|
61
|
-
}
|
|
62
|
-
if ((0, import_path.isAbsolute)(p)) {
|
|
63
|
-
return p;
|
|
64
|
-
}
|
|
65
|
-
try {
|
|
66
|
-
if (p.startsWith("./")) {
|
|
67
|
-
return require.resolve(p, { paths: [cwd] });
|
|
68
|
-
}
|
|
69
|
-
return (0, import_path.dirname)(
|
|
70
|
-
import_utils.resolve.sync(`${p}/package.json`, {
|
|
71
|
-
basedir: cwd,
|
|
72
|
-
// same behavior as webpack, to ensure `include` paths matched
|
|
73
|
-
// ref: https://webpack.js.org/configuration/resolve/#resolvesymlinks
|
|
74
|
-
preserveSymlinks: false
|
|
75
|
-
})
|
|
76
|
-
);
|
|
77
|
-
} catch (e) {
|
|
78
|
-
if (e.code === "MODULE_NOT_FOUND") {
|
|
79
|
-
throw new Error("Cannot resolve extraBabelIncludes: " + p, {
|
|
80
|
-
cause: e
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
throw e;
|
|
84
|
-
}
|
|
85
|
-
}),
|
|
86
|
-
// support es5ImcompatibleVersions
|
|
87
|
-
(path) => {
|
|
88
|
-
try {
|
|
89
|
-
if (path.includes("client/client/client"))
|
|
90
|
-
return true;
|
|
91
|
-
return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
|
|
92
|
-
} catch (e) {
|
|
93
|
-
console.error(import_utils.chalk.red(e));
|
|
94
|
-
throw e;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
]).end()
|
|
98
|
-
];
|
|
99
|
-
if (userConfig.mdx) {
|
|
100
|
-
srcRules.push(config.module.rule("markdown").test(/\.mdx?$/));
|
|
101
|
-
}
|
|
102
|
-
const depRules = [
|
|
103
|
-
config.module.rule("dep").test(/\.(js|mjs|cjs)$/).include.add(/node_modules/).end().exclude.add((path) => {
|
|
104
|
-
try {
|
|
105
|
-
return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
|
|
106
|
-
} catch (e) {
|
|
107
|
-
console.error(import_utils.chalk.red(e));
|
|
108
|
-
throw e;
|
|
109
|
-
}
|
|
110
|
-
}).end()
|
|
111
|
-
];
|
|
112
|
-
srcRules.concat(depRules).forEach((rule) => rule.resolve.set("fullySpecified", false));
|
|
113
|
-
const srcTranspiler = userConfig.srcTranspiler || import_types.Transpiler.babel;
|
|
114
|
-
srcRules.forEach((rule) => {
|
|
115
|
-
var _a2, _b2;
|
|
116
|
-
if (srcTranspiler === import_types.Transpiler.babel) {
|
|
117
|
-
rule.use("babel-loader").loader(require.resolve("../../compiled/babel-loader")).options({
|
|
118
|
-
// Tell babel to guess the type, instead assuming all files are modules
|
|
119
|
-
// https://github.com/webpack/webpack/issues/4039#issuecomment-419284940
|
|
120
|
-
sourceType: "unambiguous",
|
|
121
|
-
babelrc: false,
|
|
122
|
-
configFile: false,
|
|
123
|
-
cacheDirectory: false,
|
|
124
|
-
browserslistConfigFile: false,
|
|
125
|
-
// process.env.BABEL_CACHE !== 'none'
|
|
126
|
-
// ? join(cwd, `.umi/.cache/babel-loader`)
|
|
127
|
-
// : false,
|
|
128
|
-
targets: userConfig.targets,
|
|
129
|
-
// 解决 vue MFSU 解析 需要
|
|
130
|
-
customize: userConfig.babelLoaderCustomize,
|
|
131
|
-
presets: [
|
|
132
|
-
opts.babelPreset || [
|
|
133
|
-
require.resolve("@umijs/babel-preset-umi"),
|
|
134
|
-
{
|
|
135
|
-
presetEnv: {},
|
|
136
|
-
presetReact: {},
|
|
137
|
-
presetTypeScript: {},
|
|
138
|
-
pluginTransformRuntime: {},
|
|
139
|
-
pluginLockCoreJS: {},
|
|
140
|
-
pluginDynamicImportNode: false,
|
|
141
|
-
pluginAutoCSSModules: userConfig.autoCSSModules
|
|
142
|
-
}
|
|
143
|
-
],
|
|
144
|
-
...opts.extraBabelPresets,
|
|
145
|
-
...(userConfig.extraBabelPresets || []).filter(Boolean)
|
|
146
|
-
],
|
|
147
|
-
plugins: [
|
|
148
|
-
useFastRefresh && require.resolve("react-refresh/babel"),
|
|
149
|
-
...opts.extraBabelPlugins,
|
|
150
|
-
...userConfig.extraBabelPlugins || []
|
|
151
|
-
].filter(Boolean)
|
|
152
|
-
});
|
|
153
|
-
} else if (srcTranspiler === import_types.Transpiler.swc) {
|
|
154
|
-
rule.use("swc-loader").loader(require.resolve("../loader/swc")).options({
|
|
155
|
-
excludeFiles: [
|
|
156
|
-
// exclude MFSU virtual entry files, because swc not support top level await
|
|
157
|
-
new RegExp(`/${import_mfsu.VIRTUAL_ENTRY_DIR}/[^\\/]+\\.js$`)
|
|
158
|
-
],
|
|
159
|
-
enableAutoCssModulesPlugin: userConfig.autoCSSModules,
|
|
160
|
-
mergeConfigs: (_a2 = userConfig.srcTranspilerOptions) == null ? void 0 : _a2.swc
|
|
161
|
-
});
|
|
162
|
-
} else if (srcTranspiler === import_types.Transpiler.esbuild) {
|
|
163
|
-
rule.use("esbuild-loader").loader(import_mfsu.esbuildLoader).options({
|
|
164
|
-
target: isDev ? "esnext" : "es2015",
|
|
165
|
-
handler: [import_mfsu.autoCssModulesHandler, ...opts.extraEsbuildLoaderHandler],
|
|
166
|
-
...(_b2 = userConfig.srcTranspilerOptions) == null ? void 0 : _b2.esbuild
|
|
167
|
-
});
|
|
168
|
-
config.plugin("react-provide-plugin").use(import_webpack.ProvidePlugin, [
|
|
169
|
-
{
|
|
170
|
-
React: "react"
|
|
171
|
-
}
|
|
172
|
-
]);
|
|
173
|
-
} else {
|
|
174
|
-
throw new Error(`Unsupported srcTranspiler ${srcTranspiler}.`);
|
|
175
|
-
}
|
|
176
|
-
});
|
|
177
|
-
if (userConfig.mdx) {
|
|
178
|
-
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);
|
|
179
|
-
}
|
|
180
|
-
const depTranspiler = userConfig.depTranspiler || import_types.Transpiler.none;
|
|
181
|
-
depRules.forEach((_rule) => {
|
|
182
|
-
if (depTranspiler === import_types.Transpiler.none) {
|
|
183
|
-
} else {
|
|
184
|
-
throw new Error(`Unsupported depTranspiler ${depTranspiler}.`);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
-
0 && (module.exports = {
|
|
190
|
-
addJavaScriptRules
|
|
191
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import type { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
name?: string;
|
|
5
|
-
config: Config;
|
|
6
|
-
userConfig: IConfig;
|
|
7
|
-
cwd: string;
|
|
8
|
-
env: Env;
|
|
9
|
-
}
|
|
10
|
-
export declare function addManifestPlugin(opts: IOpts): Promise<void>;
|
|
11
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
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
|
-
// src/config/manifestPlugin.ts
|
|
20
|
-
var manifestPlugin_exports = {};
|
|
21
|
-
__export(manifestPlugin_exports, {
|
|
22
|
-
addManifestPlugin: () => addManifestPlugin
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(manifestPlugin_exports);
|
|
25
|
-
var import_webpack_manifest_plugin = require("@umijs/bundler-webpack/compiled/webpack-manifest-plugin");
|
|
26
|
-
async function addManifestPlugin(opts) {
|
|
27
|
-
const { config, userConfig } = opts;
|
|
28
|
-
if (userConfig.manifest) {
|
|
29
|
-
config.plugin("manifest-plugin").use(import_webpack_manifest_plugin.WebpackManifestPlugin, [
|
|
30
|
-
{
|
|
31
|
-
fileName: "asset-manifest.json",
|
|
32
|
-
...userConfig.manifest
|
|
33
|
-
}
|
|
34
|
-
]);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
-
0 && (module.exports = {
|
|
39
|
-
addManifestPlugin
|
|
40
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
config: Config;
|
|
5
|
-
userConfig: IConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
env: Env;
|
|
8
|
-
useHash: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function addMiniCSSExtractPlugin(opts: IOpts): Promise<void>;
|
|
11
|
-
export {};
|
|
@@ -1,55 +0,0 @@
|
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/config/miniCSSExtractPlugin.ts
|
|
30
|
-
var miniCSSExtractPlugin_exports = {};
|
|
31
|
-
__export(miniCSSExtractPlugin_exports, {
|
|
32
|
-
addMiniCSSExtractPlugin: () => addMiniCSSExtractPlugin
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(miniCSSExtractPlugin_exports);
|
|
35
|
-
var import_mini_css_extract_plugin = __toESM(require("@umijs/bundler-webpack/compiled/mini-css-extract-plugin"));
|
|
36
|
-
async function addMiniCSSExtractPlugin(opts) {
|
|
37
|
-
const { config, userConfig, useHash } = opts;
|
|
38
|
-
const hash = useHash ? ".[contenthash:8]" : "";
|
|
39
|
-
if (!userConfig.styleLoader) {
|
|
40
|
-
config.plugin("mini-css-extract-plugin").use(import_mini_css_extract_plugin.default, [
|
|
41
|
-
{
|
|
42
|
-
filename: `[name]${hash}.css`,
|
|
43
|
-
chunkFilename: opts.userConfig.ssr ? (
|
|
44
|
-
// TODO: FIXME
|
|
45
|
-
`umi${hash}.css`
|
|
46
|
-
) : `[name]${hash}.chunk.css`,
|
|
47
|
-
ignoreOrder: true
|
|
48
|
-
}
|
|
49
|
-
]);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
addMiniCSSExtractPlugin
|
|
55
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
config: Config;
|
|
5
|
-
userConfig: IConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
env: Env;
|
|
8
|
-
}
|
|
9
|
-
export declare function addNodePolyfill(opts: IOpts): Promise<void>;
|
|
10
|
-
export {};
|
|
@@ -1,51 +0,0 @@
|
|
|
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
|
-
// src/config/nodePolyfill.ts
|
|
20
|
-
var nodePolyfill_exports = {};
|
|
21
|
-
__export(nodePolyfill_exports, {
|
|
22
|
-
addNodePolyfill: () => addNodePolyfill
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(nodePolyfill_exports);
|
|
25
|
-
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
26
|
-
async function addNodePolyfill(opts) {
|
|
27
|
-
const { config } = opts;
|
|
28
|
-
const nodeLibs = require("node-libs-browser");
|
|
29
|
-
config.plugin("node-polyfill-provider").use(import_webpack.ProvidePlugin, [
|
|
30
|
-
{
|
|
31
|
-
Buffer: ["buffer", "Buffer"],
|
|
32
|
-
process: nodeLibs["process"]
|
|
33
|
-
}
|
|
34
|
-
]);
|
|
35
|
-
config.resolve.fallback.merge({
|
|
36
|
-
...Object.keys(nodeLibs).reduce((memo, key) => {
|
|
37
|
-
if (nodeLibs[key]) {
|
|
38
|
-
memo[key] = nodeLibs[key];
|
|
39
|
-
} else {
|
|
40
|
-
memo[key] = false;
|
|
41
|
-
}
|
|
42
|
-
return memo;
|
|
43
|
-
}, {}),
|
|
44
|
-
http: false,
|
|
45
|
-
https: false
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
-
0 && (module.exports = {
|
|
50
|
-
addNodePolyfill
|
|
51
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
name?: string;
|
|
5
|
-
config: Config;
|
|
6
|
-
userConfig: IConfig;
|
|
7
|
-
cwd: string;
|
|
8
|
-
env: Env;
|
|
9
|
-
}
|
|
10
|
-
export declare function addNodePrefixPlugin(opts: IOpts): Promise<void>;
|
|
11
|
-
export {};
|
|
@@ -1,38 +0,0 @@
|
|
|
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
|
-
// src/config/nodePrefixPlugin.ts
|
|
20
|
-
var nodePrefixPlugin_exports = {};
|
|
21
|
-
__export(nodePrefixPlugin_exports, {
|
|
22
|
-
addNodePrefixPlugin: () => addNodePrefixPlugin
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(nodePrefixPlugin_exports);
|
|
25
|
-
var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
26
|
-
async function addNodePrefixPlugin(opts) {
|
|
27
|
-
const { config } = opts;
|
|
28
|
-
config.plugin("node-prefix-plugin").use(import_webpack.NormalModuleReplacementPlugin, [
|
|
29
|
-
/^node:/,
|
|
30
|
-
(resource) => {
|
|
31
|
-
resource.request = resource.request.replace(/^node:/, "");
|
|
32
|
-
}
|
|
33
|
-
]);
|
|
34
|
-
}
|
|
35
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
36
|
-
0 && (module.exports = {
|
|
37
|
-
addNodePrefixPlugin
|
|
38
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
name?: string;
|
|
5
|
-
config: Config;
|
|
6
|
-
userConfig: IConfig;
|
|
7
|
-
cwd: string;
|
|
8
|
-
env: Env;
|
|
9
|
-
}
|
|
10
|
-
export declare function addProgressPlugin(opts: IOpts): Promise<void>;
|
|
11
|
-
export {};
|
|
@@ -1,53 +0,0 @@
|
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/config/progressPlugin.ts
|
|
30
|
-
var progressPlugin_exports = {};
|
|
31
|
-
__export(progressPlugin_exports, {
|
|
32
|
-
addProgressPlugin: () => addProgressPlugin
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(progressPlugin_exports);
|
|
35
|
-
var import_ProgressPlugin = __toESM(require("../plugins/ProgressPlugin"));
|
|
36
|
-
var import_webpackbar = __toESM(require("../../compiled/webpackbar"));
|
|
37
|
-
var import_types = require("../types");
|
|
38
|
-
async function addProgressPlugin(opts) {
|
|
39
|
-
const { config, name, env } = opts;
|
|
40
|
-
if (env === import_types.Env.production) {
|
|
41
|
-
config.plugin("progress-plugin").use(import_webpackbar.default, [
|
|
42
|
-
{
|
|
43
|
-
name: name || "webpack"
|
|
44
|
-
}
|
|
45
|
-
]);
|
|
46
|
-
} else {
|
|
47
|
-
config.plugin("progress-plugin-dev").use(import_ProgressPlugin.default);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
-
0 && (module.exports = {
|
|
52
|
-
addProgressPlugin
|
|
53
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
-
import { Env, IConfig } from '../types';
|
|
3
|
-
interface IOpts {
|
|
4
|
-
config: Config;
|
|
5
|
-
userConfig: IConfig;
|
|
6
|
-
cwd: string;
|
|
7
|
-
env: Env;
|
|
8
|
-
}
|
|
9
|
-
export declare function applyPurgeCSSWebpackPlugin(opts: IOpts): Promise<void>;
|
|
10
|
-
export {};
|
|
@@ -1,43 +0,0 @@
|
|
|
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
|
-
// src/config/purgecssWebpackPlugin.ts
|
|
20
|
-
var purgecssWebpackPlugin_exports = {};
|
|
21
|
-
__export(purgecssWebpackPlugin_exports, {
|
|
22
|
-
applyPurgeCSSWebpackPlugin: () => applyPurgeCSSWebpackPlugin
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(purgecssWebpackPlugin_exports);
|
|
25
|
-
var import_types = require("../types");
|
|
26
|
-
async function applyPurgeCSSWebpackPlugin(opts) {
|
|
27
|
-
const { config, userConfig, cwd, env } = opts;
|
|
28
|
-
config;
|
|
29
|
-
userConfig;
|
|
30
|
-
cwd;
|
|
31
|
-
env;
|
|
32
|
-
if (userConfig.purgeCSS && env === import_types.Env.production) {
|
|
33
|
-
config.plugin("purgecss-webpack-plugin").use(require("@umijs/bundler-webpack/compiled/purgecss-webpack-plugin"), [
|
|
34
|
-
{
|
|
35
|
-
paths: []
|
|
36
|
-
}
|
|
37
|
-
]);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
41
|
-
0 && (module.exports = {
|
|
42
|
-
applyPurgeCSSWebpackPlugin
|
|
43
|
-
});
|
|
@@ -1,59 +0,0 @@
|
|
|
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(
|
|
20
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
-
mod
|
|
26
|
-
));
|
|
27
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
-
|
|
29
|
-
// src/config/speedMeasureWebpackPlugin.ts
|
|
30
|
-
var speedMeasureWebpackPlugin_exports = {};
|
|
31
|
-
__export(speedMeasureWebpackPlugin_exports, {
|
|
32
|
-
addSpeedMeasureWebpackPlugin: () => addSpeedMeasureWebpackPlugin
|
|
33
|
-
});
|
|
34
|
-
module.exports = __toCommonJS(speedMeasureWebpackPlugin_exports);
|
|
35
|
-
var import_speed_measure_webpack_plugin = __toESM(require("@umijs/bundler-webpack/compiled/speed-measure-webpack-plugin"));
|
|
36
|
-
var import_path = require("path");
|
|
37
|
-
async function addSpeedMeasureWebpackPlugin(opts) {
|
|
38
|
-
var _a, _b;
|
|
39
|
-
let webpackConfig = opts.webpackConfig;
|
|
40
|
-
if (process.env.SPEED_MEASURE) {
|
|
41
|
-
const miniCssExtractPluginIdx = (_a = webpackConfig.plugins) == null ? void 0 : _a.findIndex(
|
|
42
|
-
(plugin) => plugin.constructor.name === "MiniCssExtractPlugin"
|
|
43
|
-
);
|
|
44
|
-
const miniCssExtractPlugin = (_b = webpackConfig.plugins) == null ? void 0 : _b[miniCssExtractPluginIdx];
|
|
45
|
-
const smpOption = process.env.SPEED_MEASURE === "JSON" ? {
|
|
46
|
-
outputFormat: "json",
|
|
47
|
-
outputTarget: (0, import_path.join)(process.cwd(), "SPEED_MEASURE.json")
|
|
48
|
-
} : { outputFormat: "human", outputTarget: console.log };
|
|
49
|
-
webpackConfig = new import_speed_measure_webpack_plugin.default(smpOption).wrap(webpackConfig);
|
|
50
|
-
if (miniCssExtractPlugin) {
|
|
51
|
-
webpackConfig.plugins[miniCssExtractPluginIdx] = miniCssExtractPlugin;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
return webpackConfig;
|
|
55
|
-
}
|
|
56
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
57
|
-
0 && (module.exports = {
|
|
58
|
-
addSpeedMeasureWebpackPlugin
|
|
59
|
-
});
|