@umijs/bundler-webpack 3.5.26 → 3.5.29-alpha.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.
@@ -392,18 +392,26 @@ function _getConfig() {
392
392
 
393
393
  const copyPatterns = [(0, _fs().existsSync)((0, _path().join)(cwd, 'public')) && {
394
394
  from: (0, _path().join)(cwd, 'public'),
395
- to: absOutputPath
395
+ info: {
396
+ minimized: true
397
+ }
396
398
  }, ...(config.copy ? config.copy.map(item => {
397
399
  if (typeof item === 'string') {
398
400
  return {
399
401
  from: (0, _path().join)(cwd, item),
400
- to: absOutputPath
402
+ to: absOutputPath,
403
+ info: {
404
+ minimized: true
405
+ }
401
406
  };
402
407
  }
403
408
 
404
409
  return {
405
410
  from: (0, _path().join)(cwd, item.from),
406
- to: (0, _path().join)(absOutputPath, item.to)
411
+ to: (0, _path().join)(absOutputPath, item.to),
412
+ info: {
413
+ minimized: true
414
+ }
407
415
  };
408
416
  }) : [])].filter(Boolean);
409
417
 
@@ -475,7 +483,7 @@ function _getConfig() {
475
483
  } else if (!opts.__disableTerserForTest) {
476
484
  webpackConfig.optimization.minimizer('terser').use(require.resolve('../webpack/plugins/terser-webpack-plugin'), [{
477
485
  terserOptions: (0, _utils().deepmerge)(_terserOptions.default, config.terserOptions || {}),
478
- sourceMap: config.devtool !== false,
486
+ sourceMap: Boolean(config.devtool),
479
487
  cache: process.env.TERSER_CACHE !== 'none',
480
488
  // 兼容内部流程系统,读到的 cpu 数并非真实的
481
489
  // 使用 SIGMA_MAX_PROCESSORS_LIMIT 指定真核数
@@ -38,6 +38,8 @@ function _path() {
38
38
  return data;
39
39
  }
40
40
 
41
+ var _pkgUpContainName = require("./pkgUpContainName");
42
+
41
43
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
42
44
 
43
45
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -85,9 +87,7 @@ function isMatch(opts) {
85
87
  function getPkgPath(opts) {
86
88
  const dir = (0, _path().dirname)(opts.path);
87
89
  if (dir in pkgPathCache) return pkgPathCache[dir];
88
- pkgPathCache[dir] = _utils().pkgUp.sync({
89
- cwd: opts.path
90
- });
90
+ pkgPathCache[dir] = (0, _pkgUpContainName.pkgUpContainName)(dir);
91
91
  return pkgPathCache[dir];
92
92
  }
93
93
 
@@ -16,16 +16,6 @@ function _react() {
16
16
  return data;
17
17
  }
18
18
 
19
- function _utils() {
20
- const data = require("@umijs/utils");
21
-
22
- _utils = function _utils() {
23
- return data;
24
- };
25
-
26
- return data;
27
- }
28
-
29
19
  function _path() {
30
20
  const data = require("path");
31
21
 
@@ -36,6 +26,8 @@ function _path() {
36
26
  return data;
37
27
  }
38
28
 
29
+ var _pkgUpContainName = require("./pkgUpContainName");
30
+
39
31
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
40
32
 
41
33
  const pkgPathCache = {};
@@ -43,9 +35,7 @@ const pkgPathCache = {};
43
35
  function getPkgPath(filePath) {
44
36
  const dir = (0, _path().dirname)(filePath);
45
37
  if (dir in pkgPathCache) return pkgPathCache[dir];
46
- pkgPathCache[dir] = _utils().pkgUp.sync({
47
- cwd: filePath
48
- });
38
+ pkgPathCache[dir] = (0, _pkgUpContainName.pkgUpContainName)(dir);
49
39
  return pkgPathCache[dir];
50
40
  }
51
41
 
@@ -0,0 +1 @@
1
+ export declare const pkgUpContainName: (dir: string) => string | null;
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pkgUpContainName = void 0;
7
+
8
+ function _react() {
9
+ const data = _interopRequireDefault(require("react"));
10
+
11
+ _react = function _react() {
12
+ return data;
13
+ };
14
+
15
+ return data;
16
+ }
17
+
18
+ function _utils() {
19
+ const data = require("@umijs/utils");
20
+
21
+ _utils = function _utils() {
22
+ return data;
23
+ };
24
+
25
+ return data;
26
+ }
27
+
28
+ function _path() {
29
+ const data = _interopRequireDefault(require("path"));
30
+
31
+ _path = function _path() {
32
+ return data;
33
+ };
34
+
35
+ return data;
36
+ }
37
+
38
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
39
+
40
+ const pkgUpContainName = dir => {
41
+ let pkgPath = _utils().pkgUp.sync({
42
+ cwd: dir
43
+ });
44
+
45
+ if (!pkgPath) return pkgPath;
46
+
47
+ const _require = require(pkgPath),
48
+ name = _require.name; // invalid package
49
+
50
+
51
+ if (!name) return pkgUpContainName(_path().default.dirname(dir));
52
+ return pkgPath;
53
+ };
54
+
55
+ exports.pkgUpContainName = pkgUpContainName;
package/lib/index.js CHANGED
@@ -152,6 +152,8 @@ class Bundler {
152
152
  } catch (e) {}
153
153
 
154
154
  console.error(err);
155
+
156
+ _utils().printHelp.feedback();
155
157
  }
156
158
  });
157
159
  resolve({
@@ -169,6 +171,9 @@ class Bundler {
169
171
  } catch (e) {}
170
172
 
171
173
  console.error(err);
174
+
175
+ _utils().printHelp.feedback();
176
+
172
177
  return reject(new Error('build failed'));
173
178
  } // ref: https://github.com/webpack/webpack/issues/12345#issuecomment-755273757
174
179
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "3.5.26",
3
+ "version": "3.5.29-alpha.0",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -21,7 +21,7 @@
21
21
  ],
22
22
  "license": "MIT",
23
23
  "bugs": "http://github.com/umijs/umi/issues",
24
- "homepage": "https://github.com/umijs/umi/tree/master/packages/bundler-webpack#readme",
24
+ "homepage": "https://github.com/umijs/umi/tree/3.x/packages/bundler-webpack#readme",
25
25
  "publishConfig": {
26
26
  "access": "public"
27
27
  },
@@ -37,10 +37,10 @@
37
37
  "strip-ansi": "6.0.0"
38
38
  },
39
39
  "dependencies": {
40
- "@umijs/bundler-utils": "3.5.26",
41
- "@umijs/deps": "3.5.26",
42
- "@umijs/types": "3.5.26",
43
- "@umijs/utils": "3.5.26",
40
+ "@umijs/bundler-utils": "3.5.29-alpha.0",
41
+ "@umijs/deps": "3.5.29-alpha.0",
42
+ "@umijs/types": "3.5.29-alpha.0",
43
+ "@umijs/utils": "3.5.29-alpha.0",
44
44
  "jest-worker": "26.6.2",
45
45
  "node-libs-browser": "2.2.1",
46
46
  "normalize-url": "1.9.1",