@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.4
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/autoprefixer/browserslist/index.d.ts +4 -0
- package/compiled/autoprefixer/index.js +3 -3
- package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
- package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
- package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
- package/compiled/copy-webpack-plugin/576.index.js +1171 -0
- package/compiled/copy-webpack-plugin/index.js +16 -10
- package/compiled/copy-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
- package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
- package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
- package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
- package/compiled/cssnano/index.js +12 -11
- package/compiled/cssnano/package.json +1 -1
- package/compiled/express/index.js +57 -74
- package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
- package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
- package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
- package/compiled/http-proxy-middleware/index.js +10 -10
- package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
- package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
- package/compiled/mini-css-extract-plugin/index.js +4427 -3979
- package/compiled/mini-css-extract-plugin/loader.js +177 -54
- package/compiled/mini-css-extract-plugin/package.json +1 -1
- package/compiled/mini-css-extract-plugin/utils.js +77 -23
- package/compiled/sass-loader/index.js +1 -1
- package/compiled/terser/index.js +1 -1
- package/compiled/terser-webpack-plugin/index.js +296 -297
- package/compiled/terser-webpack-plugin/minify.js +4 -2
- package/compiled/terser-webpack-plugin/package.json +1 -1
- package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
- package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
- package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
- package/compiled/terser-webpack-plugin/utils.js +9 -12
- package/compiled/webpack/index.js +8652 -3904
- package/compiled/webpack-dev-middleware/index.js +7 -7
- package/compiled/webpack-dev-middleware/package.json +1 -1
- package/compiled/webpack-manifest-plugin/index.js +1 -1
- package/compiled/webpack-sources/index.js +1 -1
- package/compiled/ws/index.d.ts +1 -2
- package/compiled/ws/index.js +1 -1
- package/dist/build.d.ts +2 -1
- package/dist/build.js +1 -1
- package/dist/client/client.js +5 -1
- package/dist/config/compressPlugin.js +6 -0
- package/dist/config/config.js +4 -3
- package/dist/config/detectDeadCode.d.ts +12 -0
- package/dist/config/detectDeadCode.js +120 -0
- package/dist/config/detectDeadCodePlugin.d.ts +9 -0
- package/dist/config/detectDeadCodePlugin.js +75 -0
- package/dist/config/javaScriptRules.js +3 -6
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +4 -1
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +7 -5
- package/dist/index.js +5 -1
- package/dist/loader/swc.js +14 -18
- package/dist/plugins/ParcelCSSMinifyPlugin.d.ts +10 -0
- package/dist/plugins/ParcelCSSMinifyPlugin.js +74 -0
- package/dist/plugins/ProgressPlugin.js +2 -2
- package/dist/requireHook.js +1 -1
- package/dist/schema.js +3 -1
- package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
- package/dist/swcPlugins/autoCSSModules.js +11 -16
- package/dist/swcPlugins/lockCoreJS.d.ts +1 -1
- package/dist/types.d.ts +10 -12
- package/dist/types.js +1 -0
- package/dist/utils/depMatch.js +1 -1
- package/package.json +33 -32
- package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
- package/dist/esbuildHandler/autoCssModules.js +0 -23
- package/dist/loader/esbuild.d.ts +0 -5
- package/dist/loader/esbuild.js +0 -53
package/dist/utils/depMatch.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.0-rc.
|
|
3
|
+
"version": "4.0.0-rc.4",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
|
|
6
6
|
"bugs": "https://github.com/umijs/umi-next/issues",
|
|
@@ -28,60 +28,61 @@
|
|
|
28
28
|
"generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@
|
|
32
|
-
"@
|
|
33
|
-
"@svgr/
|
|
34
|
-
"@svgr/plugin-
|
|
35
|
-
"@
|
|
36
|
-
"@types/hapi__joi": "17.1.
|
|
37
|
-
"@umijs/babel-preset-umi": "4.0.0-rc.
|
|
38
|
-
"@umijs/mfsu": "4.0.0-rc.
|
|
39
|
-
"@umijs/utils": "4.0.0-rc.
|
|
40
|
-
"css-loader": "6.
|
|
31
|
+
"@parcel/css": "1.5.0",
|
|
32
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.4",
|
|
33
|
+
"@svgr/core": "6.2.1",
|
|
34
|
+
"@svgr/plugin-jsx": "^6.2.1",
|
|
35
|
+
"@svgr/plugin-svgo": "^6.2.0",
|
|
36
|
+
"@types/hapi__joi": "17.1.8",
|
|
37
|
+
"@umijs/babel-preset-umi": "4.0.0-rc.4",
|
|
38
|
+
"@umijs/mfsu": "4.0.0-rc.4",
|
|
39
|
+
"@umijs/utils": "4.0.0-rc.4",
|
|
40
|
+
"css-loader": "6.6.0",
|
|
41
41
|
"es5-imcompatible-versions": "^0.1.73",
|
|
42
|
-
"jest-worker": "27.
|
|
42
|
+
"jest-worker": "27.5.1",
|
|
43
43
|
"node-libs-browser": "2.2.1",
|
|
44
|
-
"postcss": "^8.4.
|
|
45
|
-
"postcss-preset-env": "7.
|
|
44
|
+
"postcss": "^8.4.7",
|
|
45
|
+
"postcss-preset-env": "7.4.2",
|
|
46
46
|
"react-error-overlay": "6.0.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@swc/core": "1.2.147",
|
|
49
50
|
"@types/express": "4.17.13",
|
|
50
51
|
"@types/webpack-sources": "3.2.0",
|
|
51
|
-
"@types/ws": "8.2
|
|
52
|
-
"autoprefixer": "10.4.
|
|
52
|
+
"@types/ws": "8.5.2",
|
|
53
|
+
"autoprefixer": "10.4.2",
|
|
53
54
|
"babel-loader": "8.2.3",
|
|
54
55
|
"compression": "1.7.4",
|
|
55
56
|
"connect-history-api-fallback": "1.6.0",
|
|
56
|
-
"copy-webpack-plugin": "
|
|
57
|
-
"css-minimizer-webpack-plugin": "3.
|
|
58
|
-
"cssnano": "5.0
|
|
59
|
-
"express": "4.17.
|
|
60
|
-
"fork-ts-checker-webpack-plugin": "
|
|
61
|
-
"http-proxy-middleware": "2.0.
|
|
57
|
+
"copy-webpack-plugin": "10.2.4",
|
|
58
|
+
"css-minimizer-webpack-plugin": "3.4.1",
|
|
59
|
+
"cssnano": "5.1.0",
|
|
60
|
+
"express": "4.17.3",
|
|
61
|
+
"fork-ts-checker-webpack-plugin": "7.2.1",
|
|
62
|
+
"http-proxy-middleware": "2.0.3",
|
|
62
63
|
"less": "4.1.2",
|
|
63
64
|
"less-loader": "10.2.0",
|
|
64
|
-
"mini-css-extract-plugin": "2.
|
|
65
|
+
"mini-css-extract-plugin": "2.5.3",
|
|
65
66
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
66
67
|
"postcss-loader": "6.2.1",
|
|
67
|
-
"purgecss-webpack-plugin": "4.
|
|
68
|
+
"purgecss-webpack-plugin": "4.1.3",
|
|
68
69
|
"react-refresh": "0.11.0",
|
|
69
|
-
"sass-loader": "12.
|
|
70
|
+
"sass-loader": "12.6.0",
|
|
70
71
|
"schema-utils": "4.0.0",
|
|
71
72
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
72
73
|
"style-loader": "3.3.1",
|
|
73
74
|
"svgo-loader": "3.0.0",
|
|
74
75
|
"tapable": "2.2.1",
|
|
75
|
-
"terser": "5.
|
|
76
|
-
"terser-webpack-plugin": "5.
|
|
76
|
+
"terser": "5.12.0",
|
|
77
|
+
"terser-webpack-plugin": "5.3.1",
|
|
77
78
|
"url-loader": "4.1.1",
|
|
78
|
-
"webpack": "5.
|
|
79
|
+
"webpack": "5.69.1",
|
|
79
80
|
"webpack-5-chain": "8.0.0",
|
|
80
81
|
"webpack-bundle-analyzer": "4.5.0",
|
|
81
|
-
"webpack-dev-middleware": "5.
|
|
82
|
-
"webpack-manifest-plugin": "4.
|
|
83
|
-
"webpack-sources": "3.2.
|
|
84
|
-
"ws": "8.
|
|
82
|
+
"webpack-dev-middleware": "5.3.1",
|
|
83
|
+
"webpack-manifest-plugin": "4.1.1",
|
|
84
|
+
"webpack-sources": "3.2.3",
|
|
85
|
+
"ws": "8.5.0"
|
|
85
86
|
},
|
|
86
87
|
"publishConfig": {
|
|
87
88
|
"access": "public"
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const utils_1 = require("@umijs/utils");
|
|
4
|
-
const CSS_MODULES_QUERY = '?modules';
|
|
5
|
-
const QUERY_LENGTH = CSS_MODULES_QUERY.length;
|
|
6
|
-
function autoCssModulesHandler(opts) {
|
|
7
|
-
let { code } = opts;
|
|
8
|
-
let offset = 0;
|
|
9
|
-
opts.imports.forEach((i) => {
|
|
10
|
-
if (i.d < 0 && (0, utils_1.isStyleFile)({ filename: i.n })) {
|
|
11
|
-
// import x from './index.less'
|
|
12
|
-
// => import x from '
|
|
13
|
-
const importSegment = code.substring(i.ss + offset, i.s + offset);
|
|
14
|
-
// is css module
|
|
15
|
-
if (~importSegment.indexOf(' from')) {
|
|
16
|
-
code = `${code.substring(0, i.e + offset)}${CSS_MODULES_QUERY}${code.substring(i.e + offset)}`;
|
|
17
|
-
offset += QUERY_LENGTH;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
return code;
|
|
22
|
-
}
|
|
23
|
-
exports.default = autoCssModulesHandler;
|
package/dist/loader/esbuild.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { LoaderContext } from '../../compiled/webpack';
|
|
2
|
-
import type { IEsbuildLoaderOpts } from '../types';
|
|
3
|
-
declare function esbuildLoader(this: LoaderContext<IEsbuildLoaderOpts>, source: string): Promise<void>;
|
|
4
|
-
export default esbuildLoader;
|
|
5
|
-
export declare const esbuildLoaderPath: string;
|
package/dist/loader/esbuild.js
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
12
|
-
var t = {};
|
|
13
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
14
|
-
t[p] = s[p];
|
|
15
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
16
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
17
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
18
|
-
t[p[i]] = s[p[i]];
|
|
19
|
-
}
|
|
20
|
-
return t;
|
|
21
|
-
};
|
|
22
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
exports.esbuildLoaderPath = void 0;
|
|
24
|
-
const es_module_lexer_1 = require("@umijs/bundler-utils/compiled/es-module-lexer");
|
|
25
|
-
const esbuild_1 = require("@umijs/bundler-utils/compiled/esbuild");
|
|
26
|
-
const path_1 = require("path");
|
|
27
|
-
function esbuildLoader(source) {
|
|
28
|
-
var _a;
|
|
29
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
-
const done = this.async();
|
|
31
|
-
const options = this.getOptions();
|
|
32
|
-
const { handler = [] } = options, otherOptions = __rest(options, ["handler"]);
|
|
33
|
-
const filePath = this.resourcePath;
|
|
34
|
-
const ext = (0, path_1.extname)(filePath).slice(1);
|
|
35
|
-
const transformOptions = Object.assign(Object.assign({}, otherOptions), { target: (_a = options.target) !== null && _a !== void 0 ? _a : 'es2015', loader: ext !== null && ext !== void 0 ? ext : 'js', sourcemap: this.sourceMap, sourcefile: filePath });
|
|
36
|
-
try {
|
|
37
|
-
let { code, map } = yield (0, esbuild_1.transform)(source, transformOptions);
|
|
38
|
-
if (handler.length) {
|
|
39
|
-
yield es_module_lexer_1.init;
|
|
40
|
-
handler.forEach((handle) => {
|
|
41
|
-
const [imports, exports] = (0, es_module_lexer_1.parse)(code);
|
|
42
|
-
code = handle({ code, imports, exports, filePath });
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
done(null, code, map && JSON.parse(map));
|
|
46
|
-
}
|
|
47
|
-
catch (error) {
|
|
48
|
-
done(error);
|
|
49
|
-
}
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.default = esbuildLoader;
|
|
53
|
-
exports.esbuildLoaderPath = __filename;
|