@umijs/bundler-webpack 4.0.0-canary.20220427.1 → 4.0.0-canary.20220429.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/config/config.js +2 -2
- package/dist/server/server.d.ts +1 -1
- package/dist/server/server.js +2 -2
- package/dist/server/ws.d.ts +3 -1
- package/dist/types.d.ts +2 -6
- package/package.json +5 -5
- package/dist/server/https.d.ts +0 -5
- package/dist/server/https.js +0 -73
package/dist/config/config.js
CHANGED
|
@@ -35,7 +35,6 @@ 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");
|
|
39
38
|
const progressPlugin_1 = require("./progressPlugin");
|
|
40
39
|
const speedMeasureWebpackPlugin_1 = require("./speedMeasureWebpackPlugin");
|
|
41
40
|
const svgRules_1 = require("./svgRules");
|
|
@@ -156,7 +155,8 @@ function getConfig(opts) {
|
|
|
156
155
|
// handle HarmonyLinkingError
|
|
157
156
|
yield (0, harmonyLinkingErrorPlugin_1.addHarmonyLinkingErrorPlugin)(applyOpts);
|
|
158
157
|
// remove node: prefix
|
|
159
|
-
|
|
158
|
+
// disable for performance
|
|
159
|
+
// await addNodePrefixPlugin(applyOpts);
|
|
160
160
|
// runtimePublicPath
|
|
161
161
|
if (userConfig.runtimePublicPath) {
|
|
162
162
|
config.plugin('runtimePublicPath').use(RuntimePublicPathPlugin_1.RuntimePublicPathPlugin);
|
package/dist/server/server.d.ts
CHANGED
|
@@ -13,5 +13,5 @@ interface IOpts {
|
|
|
13
13
|
onDevCompileDone?: Function;
|
|
14
14
|
onProgress?: Function;
|
|
15
15
|
}
|
|
16
|
-
export declare function createServer(opts: IOpts): Promise<import("https").Server |
|
|
16
|
+
export declare function createServer(opts: IOpts): Promise<http.Server | import("https").Server | null>;
|
|
17
17
|
export {};
|
package/dist/server/server.js
CHANGED
|
@@ -13,6 +13,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.createServer = void 0;
|
|
16
|
+
const bundler_utils_1 = require("@umijs/bundler-utils");
|
|
16
17
|
const express_1 = __importDefault(require("@umijs/bundler-utils/compiled/express"));
|
|
17
18
|
const http_proxy_middleware_1 = require("@umijs/bundler-webpack/compiled/http-proxy-middleware");
|
|
18
19
|
const webpack_1 = __importDefault(require("@umijs/bundler-webpack/compiled/webpack"));
|
|
@@ -21,7 +22,6 @@ const fs_1 = require("fs");
|
|
|
21
22
|
const http_1 = __importDefault(require("http"));
|
|
22
23
|
const path_1 = require("path");
|
|
23
24
|
const constants_1 = require("../constants");
|
|
24
|
-
const https_1 = require("./https");
|
|
25
25
|
const ws_1 = require("./ws");
|
|
26
26
|
function createServer(opts) {
|
|
27
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -179,7 +179,7 @@ function createServer(opts) {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
const server = userConfig.https
|
|
182
|
-
? yield (0,
|
|
182
|
+
? yield (0, bundler_utils_1.createHttpsServer)(app, userConfig.https)
|
|
183
183
|
: http_1.default.createServer(app);
|
|
184
184
|
if (!server) {
|
|
185
185
|
return null;
|
package/dist/server/ws.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
import type { SpdyServer as Server } from '@umijs/bundler-utils';
|
|
2
3
|
import { Server as HttpServer } from 'http';
|
|
4
|
+
import { Http2Server } from 'http2';
|
|
3
5
|
import { Server as HttpsServer } from 'https';
|
|
4
6
|
import WebSocket from '../../compiled/ws';
|
|
5
|
-
export declare function createWebSocketServer(server: HttpServer | HttpsServer): {
|
|
7
|
+
export declare function createWebSocketServer(server: HttpServer | HttpsServer | Http2Server | Server): {
|
|
6
8
|
send(message: string): void;
|
|
7
9
|
wss: WebSocket.Server;
|
|
8
10
|
close(): void;
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Config as SwcConfig } from '@swc/core';
|
|
2
|
+
import type { HttpsServerOptions } from '@umijs/bundler-utils';
|
|
2
3
|
import type { Options as ProxyOptions } from '../compiled/http-proxy-middleware';
|
|
3
4
|
import { Configuration } from '../compiled/webpack';
|
|
4
5
|
import Config from '../compiled/webpack-5-chain';
|
|
@@ -41,11 +42,6 @@ export interface DeadCodeParams {
|
|
|
41
42
|
detectUnusedExport?: boolean;
|
|
42
43
|
context?: string;
|
|
43
44
|
}
|
|
44
|
-
export interface HttpsParams {
|
|
45
|
-
key?: string;
|
|
46
|
-
cert?: string;
|
|
47
|
-
hosts?: string[];
|
|
48
|
-
}
|
|
49
45
|
export interface IConfig {
|
|
50
46
|
alias?: Record<string, string>;
|
|
51
47
|
autoCSSModules?: boolean;
|
|
@@ -68,7 +64,7 @@ export interface IConfig {
|
|
|
68
64
|
depTranspiler?: Transpiler;
|
|
69
65
|
devtool?: Config.DevTool;
|
|
70
66
|
deadCode?: DeadCodeParams;
|
|
71
|
-
https?:
|
|
67
|
+
https?: HttpsServerOptions;
|
|
72
68
|
externals?: WebpackConfig['externals'];
|
|
73
69
|
esm?: {
|
|
74
70
|
[key: string]: any;
|
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.20220429.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.20220429.1",
|
|
39
|
+
"@umijs/bundler-utils": "4.0.0-canary.20220429.1",
|
|
40
|
+
"@umijs/mfsu": "4.0.0-canary.20220429.1",
|
|
41
|
+
"@umijs/utils": "4.0.0-canary.20220429.1",
|
|
42
42
|
"css-loader": "6.7.1",
|
|
43
43
|
"es5-imcompatible-versions": "^0.1.73",
|
|
44
44
|
"jest-worker": "27.5.1",
|
package/dist/server/https.d.ts
DELETED
package/dist/server/https.js
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
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;
|