@umijs/bundler-webpack 4.0.0-canary.20220325.1 → 4.0.0-canary.20220412.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/client/client/client.js +57 -37
- package/client/constants.js +9 -0
- package/compiled/cssnano/index.js +6 -6
- package/compiled/fork-ts-checker-webpack-plugin/index.js +7 -13
- package/compiled/react-refresh/LICENSE +21 -0
- package/compiled/react-refresh/index.js +9 -7
- package/compiled/react-refresh/package.json +1 -0
- package/compiled/webpack/HotModuleReplacement.runtime.js +29 -14
- package/compiled/webpack/JavascriptHotModuleReplacement.runtime.js +4 -3
- package/compiled/webpack/index.js +4430 -2883
- package/dist/client/client.js +10 -3
- package/dist/config/compressPlugin.js +9 -1
- package/dist/config/config.js +3 -0
- package/dist/config/nodePolyfill.js +1 -1
- package/dist/config/nodePrefixPlugin.d.ts +11 -0
- package/dist/config/nodePrefixPlugin.js +25 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +7 -1
- package/dist/dev.d.ts +2 -0
- package/dist/dev.js +7 -0
- package/dist/schema.js +1 -0
- package/dist/server/https.d.ts +5 -0
- package/dist/server/https.js +73 -0
- package/dist/server/server.d.ts +2 -1
- package/dist/server/server.js +29 -4
- package/dist/server/ws.d.ts +3 -2
- package/dist/types.d.ts +6 -0
- package/dist/utils/getEsBuildTarget.d.ts +5 -0
- package/dist/utils/getEsBuildTarget.js +12 -0
- package/package.json +13 -11
package/dist/client/client.js
CHANGED
|
@@ -41,14 +41,21 @@ const ErrorOverlay = __importStar(require("react-error-overlay"));
|
|
|
41
41
|
const constants_1 = require("../constants");
|
|
42
42
|
const formatWebpackMessages_1 = require("../utils/formatWebpackMessages");
|
|
43
43
|
console.log('[webpack] connecting...');
|
|
44
|
+
function getSocketHost() {
|
|
45
|
+
let l = location;
|
|
46
|
+
if (process.env.SOCKET_SERVER) {
|
|
47
|
+
l = new URL(process.env.SOCKET_SERVER);
|
|
48
|
+
}
|
|
49
|
+
const host = l.host;
|
|
50
|
+
const isHttps = l.protocol === 'https:';
|
|
51
|
+
return `${isHttps ? 'wss' : 'ws'}://${host}`;
|
|
52
|
+
}
|
|
44
53
|
let pingTimer = null;
|
|
45
|
-
const host = location.host;
|
|
46
|
-
const wsUrl = `ws://${host}`;
|
|
47
54
|
let isFirstCompilation = true;
|
|
48
55
|
let mostRecentCompilationHash = null;
|
|
49
56
|
let hasCompileErrors = false;
|
|
50
57
|
let hadRuntimeError = false;
|
|
51
|
-
const socket = new WebSocket(
|
|
58
|
+
const socket = new WebSocket(getSocketHost(), 'webpack-hmr');
|
|
52
59
|
socket.addEventListener('message', ({ data }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
60
|
data = JSON.parse(data);
|
|
54
61
|
if (data.type === 'connected') {
|
|
@@ -19,6 +19,7 @@ const terser_webpack_plugin_1 = __importDefault(require("../../compiled/terser-w
|
|
|
19
19
|
const ESBuildCSSMinifyPlugin_1 = __importDefault(require("../plugins/ESBuildCSSMinifyPlugin"));
|
|
20
20
|
const ParcelCSSMinifyPlugin_1 = require("../plugins/ParcelCSSMinifyPlugin");
|
|
21
21
|
const types_1 = require("../types");
|
|
22
|
+
const getEsBuildTarget_1 = require("../utils/getEsBuildTarget");
|
|
22
23
|
function addCompressPlugin(opts) {
|
|
23
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
24
25
|
const { config, userConfig, env } = opts;
|
|
@@ -32,8 +33,14 @@ function addCompressPlugin(opts) {
|
|
|
32
33
|
}
|
|
33
34
|
config.optimization.minimize(true);
|
|
34
35
|
let minify;
|
|
36
|
+
let terserOptions;
|
|
35
37
|
if (jsMinifier === types_1.JSMinifier.esbuild) {
|
|
36
38
|
minify = terser_webpack_plugin_1.default.esbuildMinify;
|
|
39
|
+
terserOptions = {
|
|
40
|
+
target: (0, getEsBuildTarget_1.getEsBuildTarget)({
|
|
41
|
+
targets: userConfig.targets || {},
|
|
42
|
+
}),
|
|
43
|
+
};
|
|
37
44
|
}
|
|
38
45
|
else if (jsMinifier === types_1.JSMinifier.terser) {
|
|
39
46
|
minify = terser_webpack_plugin_1.default.terserMinify;
|
|
@@ -47,11 +54,12 @@ function addCompressPlugin(opts) {
|
|
|
47
54
|
else if (jsMinifier !== types_1.JSMinifier.none) {
|
|
48
55
|
throw new Error(`Unsupported jsMinifier ${userConfig.jsMinifier}.`);
|
|
49
56
|
}
|
|
57
|
+
terserOptions = Object.assign(Object.assign({}, terserOptions), userConfig.jsMinifierOptions);
|
|
50
58
|
if (jsMinifier !== types_1.JSMinifier.none) {
|
|
51
59
|
config.optimization.minimizer(`js-${jsMinifier}`).use(terser_webpack_plugin_1.default, [
|
|
52
60
|
{
|
|
53
61
|
minify,
|
|
54
|
-
terserOptions
|
|
62
|
+
terserOptions,
|
|
55
63
|
},
|
|
56
64
|
]);
|
|
57
65
|
}
|
package/dist/config/config.js
CHANGED
|
@@ -35,6 +35,7 @@ const javaScriptRules_1 = require("./javaScriptRules");
|
|
|
35
35
|
const manifestPlugin_1 = require("./manifestPlugin");
|
|
36
36
|
const miniCSSExtractPlugin_1 = require("./miniCSSExtractPlugin");
|
|
37
37
|
const nodePolyfill_1 = require("./nodePolyfill");
|
|
38
|
+
const nodePrefixPlugin_1 = require("./nodePrefixPlugin");
|
|
38
39
|
const progressPlugin_1 = require("./progressPlugin");
|
|
39
40
|
const speedMeasureWebpackPlugin_1 = require("./speedMeasureWebpackPlugin");
|
|
40
41
|
const svgRules_1 = require("./svgRules");
|
|
@@ -153,6 +154,8 @@ function getConfig(opts) {
|
|
|
153
154
|
// await applyPurgeCSSWebpackPlugin(applyOpts);
|
|
154
155
|
// handle HarmonyLinkingError
|
|
155
156
|
yield (0, harmonyLinkingErrorPlugin_1.addHarmonyLinkingErrorPlugin)(applyOpts);
|
|
157
|
+
// remove node: prefix
|
|
158
|
+
yield (0, nodePrefixPlugin_1.addNodePrefixPlugin)(applyOpts);
|
|
156
159
|
// runtimePublicPath
|
|
157
160
|
if (userConfig.runtimePublicPath) {
|
|
158
161
|
config.plugin('runtimePublicPath').use(RuntimePublicPathPlugin_1.RuntimePublicPathPlugin);
|
|
@@ -14,12 +14,12 @@ const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
|
14
14
|
function addNodePolyfill(opts) {
|
|
15
15
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16
16
|
const { config } = opts;
|
|
17
|
-
const nodeLibs = require('node-libs-browser');
|
|
18
17
|
config.plugin('node-polyfill-provider').use(webpack_1.ProvidePlugin, [
|
|
19
18
|
{
|
|
20
19
|
Buffer: ['buffer', 'Buffer'],
|
|
21
20
|
},
|
|
22
21
|
]);
|
|
22
|
+
const nodeLibs = require('node-libs-browser');
|
|
23
23
|
config.resolve.fallback.merge(Object.assign(Object.assign({}, Object.keys(nodeLibs).reduce((memo, key) => {
|
|
24
24
|
if (nodeLibs[key]) {
|
|
25
25
|
memo[key] = nodeLibs[key];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Config from '@umijs/bundler-webpack/compiled/webpack-5-chain';
|
|
2
|
+
import { Env, IConfig } from '../types';
|
|
3
|
+
interface IOpts {
|
|
4
|
+
name?: string;
|
|
5
|
+
config: Config;
|
|
6
|
+
userConfig: IConfig;
|
|
7
|
+
cwd: string;
|
|
8
|
+
env: Env;
|
|
9
|
+
}
|
|
10
|
+
export declare function addNodePrefixPlugin(opts: IOpts): Promise<void>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.addNodePrefixPlugin = void 0;
|
|
13
|
+
const webpack_1 = require("@umijs/bundler-webpack/compiled/webpack");
|
|
14
|
+
function addNodePrefixPlugin(opts) {
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
const { config } = opts;
|
|
17
|
+
config.plugin('node-prefix-plugin').use(webpack_1.NormalModuleReplacementPlugin, [
|
|
18
|
+
/^node:/,
|
|
19
|
+
(resource) => {
|
|
20
|
+
resource.request = resource.request.replace(/^node:/, '');
|
|
21
|
+
},
|
|
22
|
+
]);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.addNodePrefixPlugin = addNodePrefixPlugin;
|
package/dist/constants.d.ts
CHANGED
package/dist/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.DEFAULT_BROWSER_TARGETS = exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
|
|
3
|
+
exports.DEFAULT_ESBUILD_TARGET_KEYS = exports.DEFAULT_BROWSER_TARGETS = exports.MESSAGE_TYPE = exports.MFSU_NAME = exports.DEFAULT_OUTPUT_PATH = exports.DEFAULT_DEVTOOL = void 0;
|
|
4
4
|
exports.DEFAULT_DEVTOOL = 'cheap-module-source-map';
|
|
5
5
|
exports.DEFAULT_OUTPUT_PATH = 'dist';
|
|
6
6
|
exports.MFSU_NAME = 'MFSU';
|
|
@@ -16,3 +16,9 @@ var MESSAGE_TYPE;
|
|
|
16
16
|
exports.DEFAULT_BROWSER_TARGETS = {
|
|
17
17
|
chrome: 80,
|
|
18
18
|
};
|
|
19
|
+
exports.DEFAULT_ESBUILD_TARGET_KEYS = [
|
|
20
|
+
'chrome',
|
|
21
|
+
'firefox',
|
|
22
|
+
'edge',
|
|
23
|
+
'safari',
|
|
24
|
+
];
|
package/dist/dev.d.ts
CHANGED
package/dist/dev.js
CHANGED
|
@@ -41,11 +41,17 @@ function dev(opts) {
|
|
|
41
41
|
runtimePublicPath: opts.config.runtimePublicPath,
|
|
42
42
|
tmpBase: ((_d = opts.config.mfsu) === null || _d === void 0 ? void 0 : _d.cacheDirectory) ||
|
|
43
43
|
(0, path_1.join)(opts.cwd, 'node_modules/.cache/mfsu'),
|
|
44
|
+
onMFSUProgress: opts.onMFSUProgress,
|
|
44
45
|
getCacheDependency() {
|
|
45
46
|
var _a;
|
|
46
47
|
return {
|
|
47
48
|
version: require('../package.json').version,
|
|
48
49
|
esbuildMode: !!((_a = opts.config.mfsu) === null || _a === void 0 ? void 0 : _a.esbuild),
|
|
50
|
+
alias: opts.config.alias,
|
|
51
|
+
externals: opts.config.externals,
|
|
52
|
+
theme: opts.config.theme,
|
|
53
|
+
runtimePublicPath: !!opts.config.runtimePublicPath,
|
|
54
|
+
publicPath: opts.config.publicPath,
|
|
49
55
|
};
|
|
50
56
|
},
|
|
51
57
|
});
|
|
@@ -108,6 +114,7 @@ function dev(opts) {
|
|
|
108
114
|
host: opts.host,
|
|
109
115
|
afterMiddlewares: [...(opts.afterMiddlewares || [])],
|
|
110
116
|
onDevCompileDone: opts.onDevCompileDone,
|
|
117
|
+
onProgress: opts.onProgress,
|
|
111
118
|
});
|
|
112
119
|
});
|
|
113
120
|
}
|
package/dist/schema.js
CHANGED
|
@@ -46,6 +46,7 @@ function getSchemas() {
|
|
|
46
46
|
fastRefresh: (Joi) => Joi.boolean(),
|
|
47
47
|
forkTSChecker: (Joi) => Joi.object(),
|
|
48
48
|
hash: (Joi) => Joi.boolean(),
|
|
49
|
+
https: (Joi) => Joi.object(),
|
|
49
50
|
ignoreMomentLocale: (Joi) => Joi.boolean(),
|
|
50
51
|
inlineLimit: (Joi) => Joi.number(),
|
|
51
52
|
jsMinifier: (Joi) => Joi.string().valid(types_1.JSMinifier.esbuild, types_1.JSMinifier.swc, types_1.JSMinifier.terser, types_1.JSMinifier.uglifyJs, types_1.JSMinifier.none),
|
|
@@ -0,0 +1,73 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.createHttpsServer = void 0;
|
|
16
|
+
const utils_1 = require("@umijs/utils");
|
|
17
|
+
const fs_1 = require("fs");
|
|
18
|
+
const https_1 = __importDefault(require("https"));
|
|
19
|
+
const path_1 = require("path");
|
|
20
|
+
const defaultHttpsHosts = ['localhost', '127.0.0.1'];
|
|
21
|
+
function createHttpsServer(app, httpsConfig) {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
utils_1.logger.wait('[HTTPS] Starting service in https mode...');
|
|
24
|
+
// Check if mkcert is installed
|
|
25
|
+
try {
|
|
26
|
+
yield utils_1.execa.execa('mkcert', ['--version']);
|
|
27
|
+
}
|
|
28
|
+
catch (e) {
|
|
29
|
+
utils_1.logger.error('[HTTPS] The mkcert has not been installed.');
|
|
30
|
+
utils_1.logger.info('[HTTPS] Please follow the guide to install manually.');
|
|
31
|
+
switch (process.platform) {
|
|
32
|
+
case 'darwin':
|
|
33
|
+
console.log(utils_1.chalk.green('$ brew install mkcert'));
|
|
34
|
+
console.log(utils_1.chalk.gray('# If you use firefox, please install nss.'));
|
|
35
|
+
console.log(utils_1.chalk.green('$ brew install nss'));
|
|
36
|
+
console.log(utils_1.chalk.green('$ mkcert -install'));
|
|
37
|
+
break;
|
|
38
|
+
case 'win32':
|
|
39
|
+
console.log(utils_1.chalk.green('Checkout https://github.com/FiloSottile/mkcert#windows'));
|
|
40
|
+
break;
|
|
41
|
+
case 'linux':
|
|
42
|
+
console.log(utils_1.chalk.green('Checkout https://github.com/FiloSottile/mkcert#linux'));
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
throw new Error(`[HTTPS] mkcert not found.`);
|
|
48
|
+
}
|
|
49
|
+
let { key, cert, hosts } = httpsConfig;
|
|
50
|
+
hosts = hosts || defaultHttpsHosts;
|
|
51
|
+
if (!key || !cert) {
|
|
52
|
+
key = (0, path_1.join)(__dirname, 'umi.key.pem');
|
|
53
|
+
cert = (0, path_1.join)(__dirname, 'umi.pem');
|
|
54
|
+
}
|
|
55
|
+
// Generate cert and key files if they are not exist.
|
|
56
|
+
if (!(0, fs_1.existsSync)(key) || !(0, fs_1.existsSync)(cert)) {
|
|
57
|
+
utils_1.logger.wait('[HTTPS] Generating cert and key files...');
|
|
58
|
+
yield utils_1.execa.execa('mkcert', [
|
|
59
|
+
'-cert-file',
|
|
60
|
+
cert,
|
|
61
|
+
'-key-file',
|
|
62
|
+
key,
|
|
63
|
+
...hosts,
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
// Create server
|
|
67
|
+
return https_1.default.createServer({
|
|
68
|
+
key: (0, fs_1.readFileSync)(key, 'utf-8'),
|
|
69
|
+
cert: (0, fs_1.readFileSync)(cert, 'utf-8'),
|
|
70
|
+
}, app);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
exports.createHttpsServer = createHttpsServer;
|
package/dist/server/server.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ interface IOpts {
|
|
|
11
11
|
beforeMiddlewares?: any[];
|
|
12
12
|
afterMiddlewares?: any[];
|
|
13
13
|
onDevCompileDone?: Function;
|
|
14
|
+
onProgress?: Function;
|
|
14
15
|
}
|
|
15
|
-
export declare function createServer(opts: IOpts): Promise<http.Server>;
|
|
16
|
+
export declare function createServer(opts: IOpts): Promise<import("https").Server | http.Server | null>;
|
|
16
17
|
export {};
|
package/dist/server/server.js
CHANGED
|
@@ -21,6 +21,7 @@ const fs_1 = require("fs");
|
|
|
21
21
|
const http_1 = __importDefault(require("http"));
|
|
22
22
|
const path_1 = require("path");
|
|
23
23
|
const constants_1 = require("../constants");
|
|
24
|
+
const https_1 = require("./https");
|
|
24
25
|
const ws_1 = require("./ws");
|
|
25
26
|
function createServer(opts) {
|
|
26
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -62,10 +63,28 @@ function createServer(opts) {
|
|
|
62
63
|
}
|
|
63
64
|
});
|
|
64
65
|
// webpack dev middleware
|
|
65
|
-
const
|
|
66
|
+
const configs = Array.isArray(webpackConfig)
|
|
67
|
+
? webpackConfig
|
|
68
|
+
: [webpackConfig];
|
|
69
|
+
const progresses = [];
|
|
70
|
+
if (opts.onProgress) {
|
|
71
|
+
configs.forEach((config) => {
|
|
72
|
+
const progress = {
|
|
73
|
+
percent: 0,
|
|
74
|
+
status: 'waiting',
|
|
75
|
+
};
|
|
76
|
+
progresses.push(progress);
|
|
77
|
+
config.plugins.push(new webpack_1.default.ProgressPlugin((percent, msg) => {
|
|
78
|
+
progress.percent = percent;
|
|
79
|
+
progress.status = msg;
|
|
80
|
+
opts.onProgress({ progresses });
|
|
81
|
+
}));
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
const compiler = (0, webpack_1.default)(configs);
|
|
66
85
|
const webpackDevMiddleware = require('@umijs/bundler-webpack/compiled/webpack-dev-middleware');
|
|
67
86
|
const compilerMiddleware = webpackDevMiddleware(compiler, {
|
|
68
|
-
publicPath: '/',
|
|
87
|
+
publicPath: userConfig.publicPath || '/',
|
|
69
88
|
writeToDisk: userConfig.writeToDisk,
|
|
70
89
|
stats: 'none',
|
|
71
90
|
// watchOptions: { ignored }
|
|
@@ -171,17 +190,23 @@ function createServer(opts) {
|
|
|
171
190
|
next();
|
|
172
191
|
}
|
|
173
192
|
});
|
|
174
|
-
const server =
|
|
193
|
+
const server = userConfig.https
|
|
194
|
+
? yield (0, https_1.createHttpsServer)(app, userConfig.https)
|
|
195
|
+
: http_1.default.createServer(app);
|
|
196
|
+
if (!server) {
|
|
197
|
+
return null;
|
|
198
|
+
}
|
|
175
199
|
const ws = (0, ws_1.createWebSocketServer)(server);
|
|
176
200
|
ws.wss.on('connection', (socket) => {
|
|
177
201
|
if (stats) {
|
|
178
202
|
sendStats(getStats(stats), false, socket);
|
|
179
203
|
}
|
|
180
204
|
});
|
|
205
|
+
const protocol = userConfig.https ? 'https:' : 'http:';
|
|
181
206
|
const port = opts.port || 8000;
|
|
182
207
|
server.listen(port, () => {
|
|
183
208
|
const host = opts.host && opts.host !== '0.0.0.0' ? opts.host : '127.0.0.1';
|
|
184
|
-
utils_1.logger.ready(`App listening at ${utils_1.chalk.green(
|
|
209
|
+
utils_1.logger.ready(`App listening at ${utils_1.chalk.green(`${protocol}//${host}:${port}`)}`);
|
|
185
210
|
});
|
|
186
211
|
return server;
|
|
187
212
|
});
|
package/dist/server/ws.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { Server } from 'http';
|
|
2
|
+
import { Server as HttpServer } from 'http';
|
|
3
|
+
import { Server as HttpsServer } from 'https';
|
|
3
4
|
import WebSocket from '../../compiled/ws';
|
|
4
|
-
export declare function createWebSocketServer(server:
|
|
5
|
+
export declare function createWebSocketServer(server: HttpServer | HttpsServer): {
|
|
5
6
|
send(message: string): void;
|
|
6
7
|
wss: WebSocket.Server;
|
|
7
8
|
close(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -41,6 +41,11 @@ export interface DeadCodeParams {
|
|
|
41
41
|
detectUnusedExport?: boolean;
|
|
42
42
|
context?: string;
|
|
43
43
|
}
|
|
44
|
+
export interface HttpsParams {
|
|
45
|
+
key?: string;
|
|
46
|
+
cert?: string;
|
|
47
|
+
hosts?: string[];
|
|
48
|
+
}
|
|
44
49
|
export interface IConfig {
|
|
45
50
|
alias?: Record<string, string>;
|
|
46
51
|
autoCSSModules?: boolean;
|
|
@@ -63,6 +68,7 @@ export interface IConfig {
|
|
|
63
68
|
depTranspiler?: Transpiler;
|
|
64
69
|
devtool?: Config.DevTool;
|
|
65
70
|
deadCode?: DeadCodeParams;
|
|
71
|
+
https?: HttpsParams;
|
|
66
72
|
externals?: WebpackConfig['externals'];
|
|
67
73
|
esm?: {
|
|
68
74
|
[key: string]: any;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getEsBuildTarget = void 0;
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
function getEsBuildTarget({ targets }) {
|
|
6
|
+
return Object.keys(targets)
|
|
7
|
+
.filter((key) => constants_1.DEFAULT_ESBUILD_TARGET_KEYS.includes(key))
|
|
8
|
+
.map((key) => {
|
|
9
|
+
return `${key}${targets[key] === true ? '0' : targets[key]}`;
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
exports.getEsBuildTarget = getEsBuildTarget;
|
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.20220412.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",
|
|
@@ -29,15 +29,16 @@
|
|
|
29
29
|
"test": "jest -c ../../jest.turbo.config.ts"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@parcel/css": "1.
|
|
33
|
-
"@pmmmwh/react-refresh-webpack-plugin": "0.5.
|
|
32
|
+
"@parcel/css": "1.8.1",
|
|
33
|
+
"@pmmmwh/react-refresh-webpack-plugin": "0.5.5",
|
|
34
34
|
"@svgr/core": "6.2.1",
|
|
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/
|
|
40
|
-
"@umijs/
|
|
38
|
+
"@umijs/babel-preset-umi": "4.0.0-canary.20220412.1",
|
|
39
|
+
"@umijs/bundler-utils": "4.0.0-canary.20220412.1",
|
|
40
|
+
"@umijs/mfsu": "4.0.0-canary.20220412.1",
|
|
41
|
+
"@umijs/utils": "4.0.0-canary.20220412.1",
|
|
41
42
|
"css-loader": "6.7.1",
|
|
42
43
|
"es5-imcompatible-versions": "^0.1.73",
|
|
43
44
|
"jest-worker": "27.5.1",
|
|
@@ -47,7 +48,7 @@
|
|
|
47
48
|
"react-error-overlay": "6.0.9"
|
|
48
49
|
},
|
|
49
50
|
"devDependencies": {
|
|
50
|
-
"@swc/core": "1.2.
|
|
51
|
+
"@swc/core": "1.2.165",
|
|
51
52
|
"@types/webpack-sources": "3.2.0",
|
|
52
53
|
"@types/ws": "8.5.3",
|
|
53
54
|
"autoprefixer": "10.4.4",
|
|
@@ -56,15 +57,15 @@
|
|
|
56
57
|
"connect-history-api-fallback": "1.6.0",
|
|
57
58
|
"copy-webpack-plugin": "10.2.4",
|
|
58
59
|
"css-minimizer-webpack-plugin": "3.4.1",
|
|
59
|
-
"cssnano": "5.1.
|
|
60
|
-
"fork-ts-checker-webpack-plugin": "7.2.
|
|
60
|
+
"cssnano": "5.1.7",
|
|
61
|
+
"fork-ts-checker-webpack-plugin": "7.2.4",
|
|
61
62
|
"http-proxy-middleware": "2.0.4",
|
|
62
63
|
"less-loader": "10.2.0",
|
|
63
64
|
"mini-css-extract-plugin": "2.6.0",
|
|
64
65
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
65
66
|
"postcss-loader": "6.2.1",
|
|
66
67
|
"purgecss-webpack-plugin": "4.1.3",
|
|
67
|
-
"react-refresh": "0.
|
|
68
|
+
"react-refresh": "0.12.0",
|
|
68
69
|
"sass-loader": "12.6.0",
|
|
69
70
|
"schema-utils": "4.0.0",
|
|
70
71
|
"speed-measure-webpack-plugin": "1.5.0",
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"terser": "5.12.1",
|
|
75
76
|
"terser-webpack-plugin": "5.3.1",
|
|
76
77
|
"url-loader": "4.1.1",
|
|
77
|
-
"webpack": "5.
|
|
78
|
+
"webpack": "5.72.0",
|
|
78
79
|
"webpack-5-chain": "8.0.0",
|
|
79
80
|
"webpack-bundle-analyzer": "4.5.0",
|
|
80
81
|
"webpack-dev-middleware": "5.3.1",
|
|
@@ -174,6 +175,7 @@
|
|
|
174
175
|
"postcss-flexbugs-fixes",
|
|
175
176
|
"postcss-loader",
|
|
176
177
|
"purgecss-webpack-plugin",
|
|
178
|
+
"react-refresh",
|
|
177
179
|
"sass-loader",
|
|
178
180
|
"speed-measure-webpack-plugin",
|
|
179
181
|
"style-loader",
|