@umijs/bundler-webpack 4.6.0 → 4.6.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.
package/dist/build.js CHANGED
@@ -95,8 +95,9 @@ async function build(opts) {
95
95
  } else {
96
96
  resolve2(stats);
97
97
  }
98
- if (!opts.watch) compiler.close(() => {
99
- });
98
+ if (!opts.watch)
99
+ compiler.close(() => {
100
+ });
100
101
  };
101
102
  if (opts.watch) {
102
103
  const watching = compiler.watch(
@@ -110,7 +111,8 @@ async function build(opts) {
110
111
  });
111
112
  }
112
113
  function esbuildCompressErrorHelper(errorMsg) {
113
- if (typeof errorMsg !== "string") return;
114
+ if (typeof errorMsg !== "string")
115
+ return;
114
116
  if (
115
117
  // https://github.com/evanw/esbuild/blob/a5f781ecd5edeb3fb6ae8d1045507ab850462614/internal/js_parser/js_parser_lower.go#L18
116
118
  errorMsg.includes("configured target environment") && errorMsg.includes("es2015")
@@ -112,7 +112,8 @@ async function addCSSRules(opts) {
112
112
  esModule: true,
113
113
  url: {
114
114
  filter: (url) => {
115
- if (url.startsWith("/")) return false;
115
+ if (url.startsWith("/"))
116
+ return false;
116
117
  return true;
117
118
  }
118
119
  },
@@ -26,7 +26,8 @@ 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) return;
29
+ if (!userConfig.checkDepCssModules)
30
+ return;
30
31
  const matchers = opts.extraBabelIncludes.map(function(p) {
31
32
  if (import_utils.lodash.isRegExp(p)) {
32
33
  return p;
@@ -59,12 +60,10 @@ async function addDependenceCssModulesDetector(opts) {
59
60
  });
60
61
  config.plugin("dep-css-modules-detector").use(DetectCSsModulePlugin, [matchers]);
61
62
  }
62
- var DetectCSsModulePlugin = class _DetectCSsModulePlugin {
63
+ var _DetectCSsModulePlugin = class {
63
64
  constructor(skipMatcher = []) {
64
65
  this.skipMatcher = skipMatcher;
65
66
  }
66
- static PLUGIN_NAME = "depCssModulesDetector";
67
- static ERROR_NAME = "USE CSS-MODULES IN NODE_MODULES";
68
67
  isCallRequireStyle(statement) {
69
68
  if (
70
69
  // var x= require(...) ?
@@ -137,6 +136,9 @@ var DetectCSsModulePlugin = class _DetectCSsModulePlugin {
137
136
  throw Error(_DetectCSsModulePlugin.ERROR_NAME);
138
137
  }
139
138
  };
139
+ var DetectCSsModulePlugin = _DetectCSsModulePlugin;
140
+ DetectCSsModulePlugin.PLUGIN_NAME = "depCssModulesDetector";
141
+ DetectCSsModulePlugin.ERROR_NAME = "USE CSS-MODULES IN NODE_MODULES";
140
142
  var toRegExp = (test) => {
141
143
  if (typeof test === "string") {
142
144
  return new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
@@ -90,7 +90,8 @@ 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)) return;
93
+ if (!/^((?!(node_modules)).)*$/.test(path2))
94
+ return;
94
95
  const providedExports = compilation.chunkGraph.moduleGraph.getProvidedExports(module2);
95
96
  const usedExports = compilation.chunkGraph.moduleGraph.getUsedExports(
96
97
  module2,
@@ -42,8 +42,12 @@ var defaultOptions = {
42
42
  detectUnusedExport: true
43
43
  };
44
44
  var DetectDeadCodePlugin = class {
45
- options = defaultOptions;
46
45
  constructor(options) {
46
+ this.options = defaultOptions;
47
+ this.handleAfterEmit = (compilation, callback) => {
48
+ (0, import_detectDeadCode.default)(compilation, this.options);
49
+ callback();
50
+ };
47
51
  if (!options) {
48
52
  return;
49
53
  }
@@ -64,10 +68,6 @@ var DetectDeadCodePlugin = class {
64
68
  this.handleAfterEmit
65
69
  );
66
70
  }
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,7 +86,8 @@ async function addJavaScriptRules(opts) {
86
86
  // support es5ImcompatibleVersions
87
87
  (path) => {
88
88
  try {
89
- if (path.includes("client/client/client")) return true;
89
+ if (path.includes("client/client/client"))
90
+ return true;
90
91
  return (0, import_depMatch.isMatch)({ path, pkgs: depPkgs });
91
92
  } catch (e) {
92
93
  console.error(import_utils.chalk.red(e));
@@ -29,8 +29,6 @@ var import_path = require("path");
29
29
  var import_constants = require("../constants");
30
30
  var PLUGIN_NAME = "SSR_PLUGIN";
31
31
  var SSRPlugin = class {
32
- opts;
33
- manifest;
34
32
  constructor(opts) {
35
33
  this.opts = opts;
36
34
  this.manifest = /* @__PURE__ */ new Map();
@@ -56,7 +56,8 @@ function svgrLoader(contents) {
56
56
  const callback = this.async();
57
57
  const options = this.getOptions();
58
58
  const previousExport = (() => {
59
- if (contents.startsWith("export ")) return contents;
59
+ if (contents.startsWith("export "))
60
+ return contents;
60
61
  const exportMatches = contents.match(/^module.exports\s*=\s*(.*)/);
61
62
  return exportMatches ? `export default ${exportMatches[1]}` : null;
62
63
  })();
@@ -26,7 +26,6 @@ var import_utils = require("@umijs/utils");
26
26
  var import_webpack = require("../../compiled/webpack");
27
27
  var JS_FILE_REG = /\.(js|mjs|cjs)$/;
28
28
  var EsbuildMinifyFix = class {
29
- name;
30
29
  constructor() {
31
30
  this.name = `EsbuildMinifyFix`;
32
31
  }
@@ -26,7 +26,6 @@ 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;
30
29
  constructor(options = {}) {
31
30
  super({ activeModules: true });
32
31
  this.options = options;
@@ -24,7 +24,6 @@ __export(SamplePlugin_exports, {
24
24
  module.exports = __toCommonJS(SamplePlugin_exports);
25
25
  var PLUGIN_NAME = "SamplePlugin";
26
26
  var _SamplePlugin = class {
27
- options;
28
27
  constructor(options = {}) {
29
28
  this.options = options;
30
29
  }
@@ -43,6 +43,7 @@ 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) request = hookResolved;
46
+ if (hookResolved)
47
+ request = hookResolved;
47
48
  return resolveFilename.call(mod, request, parent, isMain, options);
48
49
  };
@@ -36,7 +36,8 @@ 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) return null;
39
+ if (!pkgPath)
40
+ return null;
40
41
  const { name } = require(pkgPath);
41
42
  if (!name) {
42
43
  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.6.0",
3
+ "version": "4.6.2",
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.6.0",
42
- "@umijs/utils": "4.6.0",
43
- "@umijs/bundler-utils": "4.6.0",
44
- "@umijs/mfsu": "4.6.0"
41
+ "@umijs/babel-preset-umi": "4.6.2",
42
+ "@umijs/bundler-utils": "4.6.2",
43
+ "@umijs/mfsu": "4.6.2",
44
+ "@umijs/utils": "4.6.2"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@swc/core": "1.3.67",