@umijs/bundler-webpack 4.5.3 → 4.6.0
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/build.js +3 -5
- package/dist/config/cssRules.js +1 -2
- package/dist/config/detectCssModulesInDependence.js +4 -6
- package/dist/config/detectDeadCode.js +1 -2
- package/dist/config/detectDeadCodePlugin.js +5 -5
- package/dist/config/javaScriptRules.js +1 -2
- package/dist/config/ssrPlugin.js +2 -0
- package/dist/loader/svgr.js +1 -2
- package/dist/plugins/EsbuildMinifyFix.js +1 -0
- package/dist/plugins/ProgressPlugin.js +1 -0
- package/dist/plugins/_SamplePlugin.js +1 -0
- package/dist/requireHook.js +1 -2
- package/dist/utils/pkgUpContainsName.js +1 -2
- package/package.json +5 -5
package/dist/build.js
CHANGED
|
@@ -95,9 +95,8 @@ async function build(opts) {
|
|
|
95
95
|
} else {
|
|
96
96
|
resolve2(stats);
|
|
97
97
|
}
|
|
98
|
-
if (!opts.watch)
|
|
99
|
-
|
|
100
|
-
});
|
|
98
|
+
if (!opts.watch) compiler.close(() => {
|
|
99
|
+
});
|
|
101
100
|
};
|
|
102
101
|
if (opts.watch) {
|
|
103
102
|
const watching = compiler.watch(
|
|
@@ -111,8 +110,7 @@ async function build(opts) {
|
|
|
111
110
|
});
|
|
112
111
|
}
|
|
113
112
|
function esbuildCompressErrorHelper(errorMsg) {
|
|
114
|
-
if (typeof errorMsg !== "string")
|
|
115
|
-
return;
|
|
113
|
+
if (typeof errorMsg !== "string") return;
|
|
116
114
|
if (
|
|
117
115
|
// https://github.com/evanw/esbuild/blob/a5f781ecd5edeb3fb6ae8d1045507ab850462614/internal/js_parser/js_parser_lower.go#L18
|
|
118
116
|
errorMsg.includes("configured target environment") && errorMsg.includes("es2015")
|
package/dist/config/cssRules.js
CHANGED
|
@@ -26,8 +26,7 @@ var import_utils = require("@umijs/utils");
|
|
|
26
26
|
var import_path = require("path");
|
|
27
27
|
async function addDependenceCssModulesDetector(opts) {
|
|
28
28
|
const { config, cwd, userConfig } = opts;
|
|
29
|
-
if (!userConfig.checkDepCssModules)
|
|
30
|
-
return;
|
|
29
|
+
if (!userConfig.checkDepCssModules) return;
|
|
31
30
|
const matchers = opts.extraBabelIncludes.map(function(p) {
|
|
32
31
|
if (import_utils.lodash.isRegExp(p)) {
|
|
33
32
|
return p;
|
|
@@ -60,10 +59,12 @@ async function addDependenceCssModulesDetector(opts) {
|
|
|
60
59
|
});
|
|
61
60
|
config.plugin("dep-css-modules-detector").use(DetectCSsModulePlugin, [matchers]);
|
|
62
61
|
}
|
|
63
|
-
var
|
|
62
|
+
var DetectCSsModulePlugin = class _DetectCSsModulePlugin {
|
|
64
63
|
constructor(skipMatcher = []) {
|
|
65
64
|
this.skipMatcher = skipMatcher;
|
|
66
65
|
}
|
|
66
|
+
static PLUGIN_NAME = "depCssModulesDetector";
|
|
67
|
+
static ERROR_NAME = "USE CSS-MODULES IN NODE_MODULES";
|
|
67
68
|
isCallRequireStyle(statement) {
|
|
68
69
|
if (
|
|
69
70
|
// var x= require(...) ?
|
|
@@ -136,9 +137,6 @@ var _DetectCSsModulePlugin = class {
|
|
|
136
137
|
throw Error(_DetectCSsModulePlugin.ERROR_NAME);
|
|
137
138
|
}
|
|
138
139
|
};
|
|
139
|
-
var DetectCSsModulePlugin = _DetectCSsModulePlugin;
|
|
140
|
-
DetectCSsModulePlugin.PLUGIN_NAME = "depCssModulesDetector";
|
|
141
|
-
DetectCSsModulePlugin.ERROR_NAME = "USE CSS-MODULES IN NODE_MODULES";
|
|
142
140
|
var toRegExp = (test) => {
|
|
143
141
|
if (typeof test === "string") {
|
|
144
142
|
return new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
|
|
@@ -90,8 +90,7 @@ var outputUnusedExportMap = (compilation, chunk, module2, includedFileMap, unuse
|
|
|
90
90
|
return;
|
|
91
91
|
}
|
|
92
92
|
const path2 = (0, import_utils.winPath)(module2.resource);
|
|
93
|
-
if (!/^((?!(node_modules)).)*$/.test(path2))
|
|
94
|
-
return;
|
|
93
|
+
if (!/^((?!(node_modules)).)*$/.test(path2)) return;
|
|
95
94
|
const providedExports = compilation.chunkGraph.moduleGraph.getProvidedExports(module2);
|
|
96
95
|
const usedExports = compilation.chunkGraph.moduleGraph.getUsedExports(
|
|
97
96
|
module2,
|
|
@@ -42,12 +42,8 @@ var defaultOptions = {
|
|
|
42
42
|
detectUnusedExport: true
|
|
43
43
|
};
|
|
44
44
|
var DetectDeadCodePlugin = class {
|
|
45
|
+
options = defaultOptions;
|
|
45
46
|
constructor(options) {
|
|
46
|
-
this.options = defaultOptions;
|
|
47
|
-
this.handleAfterEmit = (compilation, callback) => {
|
|
48
|
-
(0, import_detectDeadCode.default)(compilation, this.options);
|
|
49
|
-
callback();
|
|
50
|
-
};
|
|
51
47
|
if (!options) {
|
|
52
48
|
return;
|
|
53
49
|
}
|
|
@@ -68,6 +64,10 @@ var DetectDeadCodePlugin = class {
|
|
|
68
64
|
this.handleAfterEmit
|
|
69
65
|
);
|
|
70
66
|
}
|
|
67
|
+
handleAfterEmit = (compilation, callback) => {
|
|
68
|
+
(0, import_detectDeadCode.default)(compilation, this.options);
|
|
69
|
+
callback();
|
|
70
|
+
};
|
|
71
71
|
};
|
|
72
72
|
async function addDetectDeadCodePlugin(opts) {
|
|
73
73
|
const { config, userConfig } = opts;
|
|
@@ -86,8 +86,7 @@ async function addJavaScriptRules(opts) {
|
|
|
86
86
|
// support es5ImcompatibleVersions
|
|
87
87
|
(path) => {
|
|
88
88
|
try {
|
|
89
|
-
if (path.includes("client/client/client"))
|
|
90
|
-
return true;
|
|
89
|
+
if (path.includes("client/client/client")) return true;
|
|
91
90
|
return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
|
|
92
91
|
} catch (e) {
|
|
93
92
|
console.error(import_utils.chalk.red(e));
|
package/dist/config/ssrPlugin.js
CHANGED
package/dist/loader/svgr.js
CHANGED
|
@@ -56,8 +56,7 @@ function svgrLoader(contents) {
|
|
|
56
56
|
const callback = this.async();
|
|
57
57
|
const options = this.getOptions();
|
|
58
58
|
const previousExport = (() => {
|
|
59
|
-
if (contents.startsWith("export "))
|
|
60
|
-
return contents;
|
|
59
|
+
if (contents.startsWith("export ")) return contents;
|
|
61
60
|
const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
|
|
62
61
|
return exportMatches ? `export default ${exportMatches[1]}` : null;
|
|
63
62
|
})();
|
|
@@ -26,6 +26,7 @@ var import_webpack = require("@umijs/bundler-webpack/compiled/webpack");
|
|
|
26
26
|
var import_utils = require("@umijs/utils");
|
|
27
27
|
var PLUGIN_NAME = "ProgressPlugin";
|
|
28
28
|
var UmiProgressPlugin = class extends import_webpack.ProgressPlugin {
|
|
29
|
+
options;
|
|
29
30
|
constructor(options = {}) {
|
|
30
31
|
super({ activeModules: true });
|
|
31
32
|
this.options = options;
|
package/dist/requireHook.js
CHANGED
|
@@ -43,7 +43,6 @@ var mod = require("module");
|
|
|
43
43
|
var resolveFilename = mod._resolveFilename;
|
|
44
44
|
mod._resolveFilename = function(request, parent, isMain, options) {
|
|
45
45
|
const hookResolved = hookPropertyMap.get(request);
|
|
46
|
-
if (hookResolved)
|
|
47
|
-
request = hookResolved;
|
|
46
|
+
if (hookResolved) request = hookResolved;
|
|
48
47
|
return resolveFilename.call(mod, request, parent, isMain, options);
|
|
49
48
|
};
|
|
@@ -36,8 +36,7 @@ var import_utils = require("@umijs/utils");
|
|
|
36
36
|
var import_path = __toESM(require("path"));
|
|
37
37
|
function pkgUpContainsName(file) {
|
|
38
38
|
let pkgPath = import_utils.pkgUp.pkgUpSync({ cwd: file });
|
|
39
|
-
if (!pkgPath)
|
|
40
|
-
return null;
|
|
39
|
+
if (!pkgPath) return null;
|
|
41
40
|
const { name } = require(pkgPath);
|
|
42
41
|
if (!name) {
|
|
43
42
|
return pkgUpContainsName(import_path.default.resolve(pkgPath, "../.."));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi/issues",
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
"postcss-preset-env": "7.5.0",
|
|
39
39
|
"react-error-overlay": "6.0.9",
|
|
40
40
|
"react-refresh": "0.14.0",
|
|
41
|
-
"@umijs/babel-preset-umi": "4.
|
|
42
|
-
"@umijs/
|
|
43
|
-
"@umijs/
|
|
44
|
-
"@umijs/
|
|
41
|
+
"@umijs/babel-preset-umi": "4.6.0",
|
|
42
|
+
"@umijs/utils": "4.6.0",
|
|
43
|
+
"@umijs/bundler-utils": "4.6.0",
|
|
44
|
+
"@umijs/mfsu": "4.6.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@swc/core": "1.3.67",
|