@umijs/bundler-webpack 4.0.0-canary.20220412.2 → 4.0.0-canary.20220418.1
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.d.ts +1 -0
- package/dist/build.js +1 -0
- package/dist/config/config.d.ts +1 -0
- package/dist/config/config.js +4 -2
- package/dist/dev.d.ts +2 -0
- package/dist/dev.js +17 -6
- package/package.json +5 -5
package/dist/build.d.ts
CHANGED
package/dist/build.js
CHANGED
|
@@ -21,6 +21,7 @@ function build(opts) {
|
|
|
21
21
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22
22
|
const webpackConfig = yield (0, config_1.getConfig)({
|
|
23
23
|
cwd: opts.cwd,
|
|
24
|
+
rootDir: opts.rootDir,
|
|
24
25
|
env: types_1.Env.production,
|
|
25
26
|
entry: opts.entry,
|
|
26
27
|
userConfig: opts.config,
|
package/dist/config/config.d.ts
CHANGED
package/dist/config/config.js
CHANGED
|
@@ -169,7 +169,8 @@ function getConfig(opts) {
|
|
|
169
169
|
config: opts.cache.buildDependencies || [],
|
|
170
170
|
},
|
|
171
171
|
cacheDirectory: opts.cache.cacheDirectory ||
|
|
172
|
-
|
|
172
|
+
// 使用 rootDir 是在有 APP_ROOT 时,把 cache 目录放在根目录下
|
|
173
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'bundler-webpack'),
|
|
173
174
|
});
|
|
174
175
|
// tnpm 安装依赖的情况 webpack 默认的 managedPaths 不生效
|
|
175
176
|
// 使用 immutablePaths 避免 node_modules 的内容被写入缓存
|
|
@@ -178,7 +179,8 @@ function getConfig(opts) {
|
|
|
178
179
|
if ( /*isTnpm*/require('@umijs/utils/package').__npminstall_done) {
|
|
179
180
|
config.snapshot({
|
|
180
181
|
immutablePaths: [
|
|
181
|
-
opts.cache.absNodeModulesPath ||
|
|
182
|
+
opts.cache.absNodeModulesPath ||
|
|
183
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules'),
|
|
182
184
|
],
|
|
183
185
|
});
|
|
184
186
|
}
|
package/dist/dev.d.ts
CHANGED
|
@@ -16,8 +16,10 @@ declare type IOpts = {
|
|
|
16
16
|
extraBabelPlugins?: any[];
|
|
17
17
|
extraBabelPresets?: any[];
|
|
18
18
|
cwd: string;
|
|
19
|
+
rootDir?: string;
|
|
19
20
|
config: IConfig;
|
|
20
21
|
entry: Record<string, string>;
|
|
21
22
|
} & Pick<IConfigOpts, 'cache'>;
|
|
23
|
+
export declare function stripUndefined(obj: any): any;
|
|
22
24
|
export declare function dev(opts: IOpts): Promise<void>;
|
|
23
25
|
export {};
|
package/dist/dev.js
CHANGED
|
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
12
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.dev = void 0;
|
|
15
|
+
exports.dev = exports.stripUndefined = void 0;
|
|
16
16
|
const mfsu_1 = require("@umijs/mfsu");
|
|
17
17
|
const utils_1 = require("@umijs/utils");
|
|
18
18
|
const path_1 = require("path");
|
|
@@ -21,6 +21,15 @@ const config_1 = require("./config/config");
|
|
|
21
21
|
const constants_1 = require("./constants");
|
|
22
22
|
const server_1 = require("./server/server");
|
|
23
23
|
const types_1 = require("./types");
|
|
24
|
+
function stripUndefined(obj) {
|
|
25
|
+
Object.keys(obj).forEach((key) => {
|
|
26
|
+
if (obj[key] === undefined) {
|
|
27
|
+
delete obj[key];
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
return obj;
|
|
31
|
+
}
|
|
32
|
+
exports.stripUndefined = stripUndefined;
|
|
24
33
|
function dev(opts) {
|
|
25
34
|
var _a, _b, _c, _d, _e, _f;
|
|
26
35
|
var _g;
|
|
@@ -40,24 +49,25 @@ function dev(opts) {
|
|
|
40
49
|
mfName: (_c = opts.config.mfsu) === null || _c === void 0 ? void 0 : _c.mfName,
|
|
41
50
|
runtimePublicPath: opts.config.runtimePublicPath,
|
|
42
51
|
tmpBase: ((_d = opts.config.mfsu) === null || _d === void 0 ? void 0 : _d.cacheDirectory) ||
|
|
43
|
-
(0, path_1.join)(opts.cwd, 'node_modules/.cache/mfsu'),
|
|
52
|
+
(0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules/.cache/mfsu'),
|
|
44
53
|
onMFSUProgress: opts.onMFSUProgress,
|
|
45
54
|
getCacheDependency() {
|
|
46
55
|
var _a;
|
|
47
|
-
return {
|
|
56
|
+
return stripUndefined({
|
|
48
57
|
version: require('../package.json').version,
|
|
49
58
|
esbuildMode: !!((_a = opts.config.mfsu) === null || _a === void 0 ? void 0 : _a.esbuild),
|
|
50
59
|
alias: opts.config.alias,
|
|
51
60
|
externals: opts.config.externals,
|
|
52
61
|
theme: opts.config.theme,
|
|
53
|
-
runtimePublicPath:
|
|
62
|
+
runtimePublicPath: opts.config.runtimePublicPath,
|
|
54
63
|
publicPath: opts.config.publicPath,
|
|
55
|
-
};
|
|
64
|
+
});
|
|
56
65
|
},
|
|
57
66
|
});
|
|
58
67
|
}
|
|
59
68
|
const webpackConfig = yield (0, config_1.getConfig)({
|
|
60
69
|
cwd: opts.cwd,
|
|
70
|
+
rootDir: opts.rootDir,
|
|
61
71
|
env: types_1.Env.development,
|
|
62
72
|
entry: opts.entry,
|
|
63
73
|
userConfig: opts.config,
|
|
@@ -80,6 +90,7 @@ function dev(opts) {
|
|
|
80
90
|
});
|
|
81
91
|
const depConfig = yield (0, config_1.getConfig)({
|
|
82
92
|
cwd: opts.cwd,
|
|
93
|
+
rootDir: opts.rootDir,
|
|
83
94
|
env: types_1.Env.development,
|
|
84
95
|
entry: opts.entry,
|
|
85
96
|
userConfig: opts.config,
|
|
@@ -89,7 +100,7 @@ function dev(opts) {
|
|
|
89
100
|
chainWebpack: (_e = opts.config.mfsu) === null || _e === void 0 ? void 0 : _e.chainWebpack,
|
|
90
101
|
cache: {
|
|
91
102
|
buildDependencies: (_f = opts.cache) === null || _f === void 0 ? void 0 : _f.buildDependencies,
|
|
92
|
-
cacheDirectory: (0, path_1.join)(opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
|
|
103
|
+
cacheDirectory: (0, path_1.join)(opts.rootDir || opts.cwd, 'node_modules', '.cache', 'mfsu-deps'),
|
|
93
104
|
},
|
|
94
105
|
});
|
|
95
106
|
(_g = webpackConfig.resolve).alias || (_g.alias = {});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umijs/bundler-webpack",
|
|
3
|
-
"version": "4.0.0-canary.
|
|
3
|
+
"version": "4.0.0-canary.20220418.1",
|
|
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",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@svgr/plugin-jsx": "^6.2.1",
|
|
36
36
|
"@svgr/plugin-svgo": "^6.2.0",
|
|
37
37
|
"@types/hapi__joi": "17.1.8",
|
|
38
|
-
"@umijs/babel-preset-umi": "4.0.0-canary.
|
|
39
|
-
"@umijs/bundler-utils": "4.0.0-canary.
|
|
40
|
-
"@umijs/mfsu": "4.0.0-canary.
|
|
41
|
-
"@umijs/utils": "4.0.0-canary.
|
|
38
|
+
"@umijs/babel-preset-umi": "4.0.0-canary.20220418.1",
|
|
39
|
+
"@umijs/bundler-utils": "4.0.0-canary.20220418.1",
|
|
40
|
+
"@umijs/mfsu": "4.0.0-canary.20220418.1",
|
|
41
|
+
"@umijs/utils": "4.0.0-canary.20220418.1",
|
|
42
42
|
"css-loader": "6.7.1",
|
|
43
43
|
"es5-imcompatible-versions": "^0.1.73",
|
|
44
44
|
"jest-worker": "27.5.1",
|