ko 6.6.2 → 6.6.4
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/lib/actions/dev.js +6 -3
- package/lib/types.d.ts +16 -15
- package/package.json +1 -1
package/lib/actions/dev.js
CHANGED
|
@@ -9,6 +9,7 @@ const webpack_2 = __importDefault(require("../webpack"));
|
|
|
9
9
|
const factory_1 = __importDefault(require("./factory"));
|
|
10
10
|
const detect_port_1 = __importDefault(require("detect-port"));
|
|
11
11
|
const inquirer_1 = __importDefault(require("inquirer"));
|
|
12
|
+
const lodash_1 = require("lodash");
|
|
12
13
|
class Dev extends factory_1.default {
|
|
13
14
|
constructor(service) {
|
|
14
15
|
super(service);
|
|
@@ -21,7 +22,7 @@ class Dev extends factory_1.default {
|
|
|
21
22
|
warnings: false,
|
|
22
23
|
runtimeErrors: true,
|
|
23
24
|
},
|
|
24
|
-
}, staticPath, historyApiFallback = false, } = serve;
|
|
25
|
+
}, staticPath, historyApiFallback = false, ...others } = serve;
|
|
25
26
|
return {
|
|
26
27
|
port,
|
|
27
28
|
host,
|
|
@@ -36,6 +37,7 @@ class Dev extends factory_1.default {
|
|
|
36
37
|
setupExitSignals: false,
|
|
37
38
|
allowedHosts: 'all',
|
|
38
39
|
historyApiFallback,
|
|
40
|
+
...others,
|
|
39
41
|
};
|
|
40
42
|
}
|
|
41
43
|
async generateConfig() {
|
|
@@ -119,10 +121,11 @@ class Dev extends factory_1.default {
|
|
|
119
121
|
process.env.NODE_ENV = 'development';
|
|
120
122
|
this.service.freezeCliOptsWith(cliOpts);
|
|
121
123
|
const config = await this.generateConfig();
|
|
122
|
-
const
|
|
124
|
+
const serverConfig = (0, lodash_1.omit)(config.devServer, 'compilationSuccessInfo');
|
|
125
|
+
const port = serverConfig.port;
|
|
123
126
|
const newPort = (await this.checkPort(port));
|
|
124
127
|
const compiler = (0, webpack_1.default)(config);
|
|
125
|
-
const devServer = new webpack_dev_server_1.default({ ...
|
|
128
|
+
const devServer = new webpack_dev_server_1.default({ ...serverConfig, port: newPort }, compiler);
|
|
126
129
|
await devServer.start();
|
|
127
130
|
const exitProcess = (callback) => () => {
|
|
128
131
|
callback && callback();
|
package/lib/types.d.ts
CHANGED
|
@@ -2,7 +2,19 @@ import { Pattern } from 'copy-webpack-plugin';
|
|
|
2
2
|
import { Plugin } from 'postcss';
|
|
3
3
|
import { IKeys, IOpts } from 'ko-lints';
|
|
4
4
|
import { IOpts as AutoPolyfillsWebpackPluginOptions } from '@dtinsight/auto-polyfills-webpack-plugin';
|
|
5
|
-
import { ClientConfiguration } from 'webpack-dev-server';
|
|
5
|
+
import { ClientConfiguration, Configuration as WebpackDevServerConfiguration } from 'webpack-dev-server';
|
|
6
|
+
export interface IServeConfig extends WebpackDevServerConfiguration {
|
|
7
|
+
proxy?: Record<string, any>;
|
|
8
|
+
host: string;
|
|
9
|
+
port: number;
|
|
10
|
+
staticPath?: string;
|
|
11
|
+
client?: boolean | ClientConfiguration | undefined;
|
|
12
|
+
historyApiFallback?: any;
|
|
13
|
+
compilationSuccessInfo?: {
|
|
14
|
+
messages: string[];
|
|
15
|
+
notes?: string[];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
6
18
|
export type IOptions = {
|
|
7
19
|
/**
|
|
8
20
|
* The current working directory.
|
|
@@ -83,20 +95,9 @@ export type IOptions = {
|
|
|
83
95
|
/**
|
|
84
96
|
* Options for the development server.
|
|
85
97
|
* Docs url: https://webpack.js.org/configuration/dev-server/
|
|
86
|
-
* @param {
|
|
87
|
-
*/
|
|
88
|
-
serve:
|
|
89
|
-
proxy?: Record<string, any>;
|
|
90
|
-
host: string;
|
|
91
|
-
port: number;
|
|
92
|
-
staticPath?: string;
|
|
93
|
-
client?: boolean | ClientConfiguration | undefined;
|
|
94
|
-
historyApiFallback?: any;
|
|
95
|
-
compilationSuccessInfo?: {
|
|
96
|
-
messages: string[];
|
|
97
|
-
notes?: string[];
|
|
98
|
-
};
|
|
99
|
-
};
|
|
98
|
+
* @param {IServeConfig}
|
|
99
|
+
*/
|
|
100
|
+
serve: IServeConfig;
|
|
100
101
|
/**
|
|
101
102
|
* Experimental features to enable.
|
|
102
103
|
* @param {{speedUp?: boolean, minimizer?: boolean, disableLazyImports?: boolean, enableCssModule?: boolean, compress?: any}}
|