@umijs/bundler-webpack 3.5.35 → 3.5.37
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.
|
@@ -542,13 +542,12 @@ function _getConfig() {
|
|
|
542
542
|
|
|
543
543
|
const nodeLibs = require('node-libs-browser');
|
|
544
544
|
|
|
545
|
-
|
|
545
|
+
const nodePolyfill = process.env.NODE_POLYFILL !== 'none';
|
|
546
|
+
|
|
547
|
+
if (isWebpack5 && nodePolyfill) {
|
|
546
548
|
ret.plugins.push(new bundleImplementor.ProvidePlugin({
|
|
547
|
-
process: nodeLibs['process']
|
|
548
|
-
|
|
549
|
-
ret.plugins.push( // ref: https://github.com/umijs/umi/issues/6914
|
|
550
|
-
// @ts-ignore
|
|
551
|
-
new bundleImplementor.ProvidePlugin({
|
|
549
|
+
process: nodeLibs['process'],
|
|
550
|
+
// ref: https://github.com/umijs/umi/issues/6914
|
|
552
551
|
Buffer: ['buffer', 'Buffer']
|
|
553
552
|
})); // @ts-ignore
|
|
554
553
|
|
|
@@ -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] =
|
|
89
|
-
cwd: opts.path
|
|
90
|
-
});
|
|
90
|
+
pkgPathCache[dir] = (0, _pkgUpContainName.pkgUpContainName)(opts.path);
|
|
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] =
|
|
47
|
-
cwd: filePath
|
|
48
|
-
});
|
|
38
|
+
pkgPathCache[dir] = (0, _pkgUpContainName.pkgUpContainName)(filePath);
|
|
49
39
|
return pkgPathCache[dir];
|
|
50
40
|
}
|
|
51
41
|
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* find the closet package.json which contains `name`
|
|
3
|
+
* why not use pkg-up directly? some package (such as htmlparser2@8) put a `package.json` with
|
|
4
|
+
* `{ "type": "module" }` to provide pure esm dist, but it is not the npm `package.json` we want
|
|
5
|
+
*/
|
|
6
|
+
export declare const pkgUpContainName: (dir: string) => string | null;
|
|
@@ -0,0 +1,63 @@
|
|
|
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
|
+
/**
|
|
41
|
+
* find the closet package.json which contains `name`
|
|
42
|
+
* why not use pkg-up directly? some package (such as htmlparser2@8) put a `package.json` with
|
|
43
|
+
* `{ "type": "module" }` to provide pure esm dist, but it is not the npm `package.json` we want
|
|
44
|
+
*/
|
|
45
|
+
const pkgUpContainName = dir => {
|
|
46
|
+
let pkgPath = _utils().pkgUp.sync({
|
|
47
|
+
cwd: dir
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
if (!pkgPath) return pkgPath;
|
|
51
|
+
|
|
52
|
+
const _require = require(pkgPath),
|
|
53
|
+
name = _require.name; // invalid package
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
if (!name) {
|
|
57
|
+
return pkgUpContainName(_path().default.resolve(dir, '../..'));
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
return pkgPath;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.pkgUpContainName = pkgUpContainName;
|
package/lib/requireHook.js
CHANGED
|
@@ -29,8 +29,10 @@ function getFileName(filePath) {
|
|
|
29
29
|
let inited = false;
|
|
30
30
|
|
|
31
31
|
function init() {
|
|
32
|
+
const skipRequireHookInit = process.env.INIT_REQUIRE_HOOK === 'none'; // Don't hook webpack when has skip flag
|
|
32
33
|
// Allow run once
|
|
33
|
-
|
|
34
|
+
|
|
35
|
+
if (skipRequireHookInit || inited) return;
|
|
34
36
|
inited = true;
|
|
35
37
|
const filesMap = files.map(file => {
|
|
36
38
|
const fileName = getFileName(file);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.37",
|
|
4
4
|
"description": "@umijs/bundler-webpack",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -37,11 +37,11 @@
|
|
|
37
37
|
"strip-ansi": "6.0.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@umijs/bundler-utils": "3.5.
|
|
40
|
+
"@umijs/bundler-utils": "3.5.37",
|
|
41
41
|
"@umijs/case-sensitive-paths-webpack-plugin": "^1.0.1",
|
|
42
|
-
"@umijs/deps": "3.5.
|
|
43
|
-
"@umijs/types": "3.5.
|
|
44
|
-
"@umijs/utils": "3.5.
|
|
42
|
+
"@umijs/deps": "3.5.37",
|
|
43
|
+
"@umijs/types": "3.5.37",
|
|
44
|
+
"@umijs/utils": "3.5.37",
|
|
45
45
|
"jest-worker": "26.6.2",
|
|
46
46
|
"node-libs-browser": "2.2.1",
|
|
47
47
|
"normalize-url": "1.9.1",
|