@umijs/bundler-webpack 4.0.0-rc.1 → 4.0.0-rc.2

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.
Files changed (65) hide show
  1. package/compiled/autoprefixer/browserslist/index.d.ts +4 -0
  2. package/compiled/autoprefixer/index.js +3 -3
  3. package/compiled/autoprefixer/postcss/lib/at-rule.d.ts +1 -1
  4. package/compiled/autoprefixer/postcss/lib/comment.d.ts +1 -1
  5. package/compiled/autoprefixer/postcss/lib/declaration.d.ts +1 -1
  6. package/compiled/autoprefixer/postcss/lib/rule.d.ts +1 -1
  7. package/compiled/autoprefixer/source-map-js/source-map.d.ts +99 -82
  8. package/compiled/copy-webpack-plugin/576.index.js +1171 -0
  9. package/compiled/copy-webpack-plugin/index.js +16 -10
  10. package/compiled/copy-webpack-plugin/package.json +1 -1
  11. package/compiled/css-minimizer-webpack-plugin/index.js +8 -2
  12. package/compiled/css-minimizer-webpack-plugin/minify.js +25 -11
  13. package/compiled/css-minimizer-webpack-plugin/package.json +1 -1
  14. package/compiled/css-minimizer-webpack-plugin/utils.js +225 -28
  15. package/compiled/cssnano/index.js +12 -11
  16. package/compiled/express/index.js +57 -74
  17. package/compiled/fork-ts-checker-webpack-plugin/index.js +14 -15
  18. package/compiled/http-proxy-middleware/dist/types.d.ts +5 -5
  19. package/compiled/http-proxy-middleware/http-proxy/index.d.ts +1 -1
  20. package/compiled/http-proxy-middleware/index.js +10 -10
  21. package/compiled/mini-css-extract-plugin/hmr/hotModuleReplacement.js +60 -8
  22. package/compiled/mini-css-extract-plugin/hmr/normalize-url.js +13 -1
  23. package/compiled/mini-css-extract-plugin/index.js +4427 -3979
  24. package/compiled/mini-css-extract-plugin/loader.js +177 -54
  25. package/compiled/mini-css-extract-plugin/package.json +1 -1
  26. package/compiled/mini-css-extract-plugin/utils.js +77 -23
  27. package/compiled/sass-loader/index.js +1 -1
  28. package/compiled/terser-webpack-plugin/index.js +296 -297
  29. package/compiled/terser-webpack-plugin/minify.js +4 -2
  30. package/compiled/terser-webpack-plugin/package.json +1 -1
  31. package/compiled/terser-webpack-plugin/types/index.d.ts +180 -146
  32. package/compiled/terser-webpack-plugin/types/minify.d.ts +17 -0
  33. package/compiled/terser-webpack-plugin/types/utils.d.ts +1 -3
  34. package/compiled/terser-webpack-plugin/utils.js +9 -12
  35. package/compiled/webpack/index.js +8652 -3904
  36. package/compiled/webpack-dev-middleware/index.js +7 -7
  37. package/compiled/webpack-dev-middleware/package.json +1 -1
  38. package/compiled/webpack-manifest-plugin/index.js +1 -1
  39. package/compiled/webpack-sources/index.js +1 -1
  40. package/compiled/ws/index.d.ts +1 -2
  41. package/compiled/ws/index.js +1 -1
  42. package/dist/build.d.ts +2 -1
  43. package/dist/build.js +1 -1
  44. package/dist/config/config.js +4 -3
  45. package/dist/config/detectDeadCode.d.ts +12 -0
  46. package/dist/config/detectDeadCode.js +120 -0
  47. package/dist/config/detectDeadCodePlugin.d.ts +9 -0
  48. package/dist/config/detectDeadCodePlugin.js +71 -0
  49. package/dist/config/javaScriptRules.js +3 -6
  50. package/dist/constants.d.ts +3 -0
  51. package/dist/constants.js +4 -1
  52. package/dist/dev.d.ts +1 -0
  53. package/dist/dev.js +7 -5
  54. package/dist/loader/swc.js +14 -18
  55. package/dist/requireHook.js +1 -1
  56. package/dist/schema.js +2 -0
  57. package/dist/swcPlugins/autoCSSModules.d.ts +7 -2
  58. package/dist/swcPlugins/autoCSSModules.js +11 -16
  59. package/dist/types.d.ts +9 -12
  60. package/dist/utils/depMatch.js +1 -1
  61. package/package.json +31 -31
  62. package/dist/esbuildHandler/autoCssModules.d.ts +0 -2
  63. package/dist/esbuildHandler/autoCssModules.js +0 -23
  64. package/dist/loader/esbuild.d.ts +0 -5
  65. package/dist/loader/esbuild.js +0 -53
@@ -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;