webpack-dev-server 5.2.2 → 5.2.3
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/README.md +4 -4
- package/bin/webpack-dev-server.js +17 -16
- package/client/clients/SockJSClient.js +18 -20
- package/client/clients/WebSocketClient.js +17 -11
- package/client/index.js +111 -72
- package/client/modules/logger/index.js +42 -35
- package/client/modules/sockjs-client/index.js +0 -1
- package/client/overlay.js +129 -79
- package/client/progress.js +40 -13
- package/client/socket.js +17 -13
- package/client/utils/log.js +1 -1
- package/client/utils/sendMessage.js +5 -3
- package/lib/Server.js +336 -317
- package/lib/getPort.js +21 -22
- package/lib/servers/BaseServer.js +1 -1
- package/lib/servers/SockJSServer.js +16 -14
- package/lib/servers/WebsocketServer.js +17 -22
- package/package.json +36 -31
- package/types/bin/webpack-dev-server.d.ts +1 -1
- package/types/lib/Server.d.ts +216 -149
- package/types/lib/getPort.d.ts +3 -3
- package/types/lib/servers/BaseServer.d.ts +1 -1
package/types/lib/Server.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export = Server;
|
|
2
2
|
/**
|
|
3
|
-
* @typedef {
|
|
3
|
+
* @typedef {object} BasicApplication
|
|
4
4
|
* @property {typeof useFn} use
|
|
5
5
|
*/
|
|
6
6
|
/**
|
|
@@ -1123,62 +1123,64 @@ declare class Server<
|
|
|
1123
1123
|
};
|
|
1124
1124
|
};
|
|
1125
1125
|
/**
|
|
1126
|
-
* @
|
|
1127
|
-
* @returns {
|
|
1126
|
+
* @private
|
|
1127
|
+
* @returns {StatsOptions} default stats options
|
|
1128
|
+
*/
|
|
1129
|
+
private static get DEFAULT_STATS();
|
|
1130
|
+
/**
|
|
1131
|
+
* @param {string} URL url
|
|
1132
|
+
* @returns {boolean} true when URL is absolute, otherwise false
|
|
1128
1133
|
*/
|
|
1129
1134
|
static isAbsoluteURL(URL: string): boolean;
|
|
1130
1135
|
/**
|
|
1131
|
-
* @param {string} gatewayOrFamily or family
|
|
1132
|
-
* @param {boolean}
|
|
1133
|
-
* @returns {string | undefined}
|
|
1136
|
+
* @param {string} gatewayOrFamily gateway or family
|
|
1137
|
+
* @param {boolean=} isInternal ip should be internal
|
|
1138
|
+
* @returns {string | undefined} resolved IP
|
|
1134
1139
|
*/
|
|
1135
1140
|
static findIp(
|
|
1136
1141
|
gatewayOrFamily: string,
|
|
1137
|
-
isInternal?: boolean,
|
|
1142
|
+
isInternal?: boolean | undefined,
|
|
1138
1143
|
): string | undefined;
|
|
1139
1144
|
/**
|
|
1140
|
-
* @param {"v4" | "v6"} family
|
|
1141
|
-
* @returns {Promise<string | undefined>}
|
|
1145
|
+
* @param {"v4" | "v6"} family family
|
|
1146
|
+
* @returns {Promise<string | undefined>} internal API
|
|
1142
1147
|
*/
|
|
1143
1148
|
static internalIP(family: "v4" | "v6"): Promise<string | undefined>;
|
|
1144
1149
|
/**
|
|
1145
|
-
* @param {"v4" | "v6"} family
|
|
1146
|
-
* @returns {string | undefined}
|
|
1150
|
+
* @param {"v4" | "v6"} family family
|
|
1151
|
+
* @returns {string | undefined} internal IP
|
|
1147
1152
|
*/
|
|
1148
1153
|
static internalIPSync(family: "v4" | "v6"): string | undefined;
|
|
1149
1154
|
/**
|
|
1150
|
-
* @param {Host} hostname
|
|
1151
|
-
* @returns {Promise<string>}
|
|
1155
|
+
* @param {Host} hostname hostname
|
|
1156
|
+
* @returns {Promise<string>} resolved hostname
|
|
1152
1157
|
*/
|
|
1153
1158
|
static getHostname(hostname: Host): Promise<string>;
|
|
1154
1159
|
/**
|
|
1155
|
-
* @param {Port} port
|
|
1156
|
-
* @param {string} host
|
|
1157
|
-
* @returns {Promise<number | string>}
|
|
1160
|
+
* @param {Port} port port
|
|
1161
|
+
* @param {string} host host
|
|
1162
|
+
* @returns {Promise<number | string>} free port
|
|
1158
1163
|
*/
|
|
1159
1164
|
static getFreePort(port: Port, host: string): Promise<number | string>;
|
|
1160
1165
|
/**
|
|
1161
|
-
* @returns {string}
|
|
1166
|
+
* @returns {string} path to cache dir
|
|
1162
1167
|
*/
|
|
1163
1168
|
static findCacheDir(): string;
|
|
1164
1169
|
/**
|
|
1165
1170
|
* @private
|
|
1166
|
-
* @param {Compiler} compiler
|
|
1167
|
-
* @returns
|
|
1171
|
+
* @param {Compiler} compiler compiler
|
|
1172
|
+
* @returns {boolean} true when target is `web`, otherwise false
|
|
1168
1173
|
*/
|
|
1169
1174
|
private static isWebTarget;
|
|
1170
1175
|
/**
|
|
1171
|
-
* @param {Configuration<A, S>} options
|
|
1172
|
-
* @param {Compiler | MultiCompiler} compiler
|
|
1176
|
+
* @param {Configuration<A, S>} options options
|
|
1177
|
+
* @param {Compiler | MultiCompiler} compiler compiler
|
|
1173
1178
|
*/
|
|
1174
|
-
constructor(
|
|
1175
|
-
options: Configuration<A, S> | undefined,
|
|
1176
|
-
compiler: Compiler | MultiCompiler,
|
|
1177
|
-
);
|
|
1179
|
+
constructor(options: Configuration<A, S>, compiler: Compiler | MultiCompiler);
|
|
1178
1180
|
compiler: import("webpack").Compiler | import("webpack").MultiCompiler;
|
|
1179
1181
|
/**
|
|
1180
1182
|
* @type {ReturnType<Compiler["getInfrastructureLogger"]>}
|
|
1181
|
-
|
|
1183
|
+
*/
|
|
1182
1184
|
logger: ReturnType<Compiler["getInfrastructureLogger"]>;
|
|
1183
1185
|
options: Configuration<A, S>;
|
|
1184
1186
|
/**
|
|
@@ -1187,7 +1189,7 @@ declare class Server<
|
|
|
1187
1189
|
staticWatchers: FSWatcher[];
|
|
1188
1190
|
/**
|
|
1189
1191
|
* @private
|
|
1190
|
-
* @type {{ name: string | symbol, listener: (...args:
|
|
1192
|
+
* @type {{ name: string | symbol, listener: (...args: EXPECTED_ANY[]) => void}[] }}
|
|
1191
1193
|
*/
|
|
1192
1194
|
private listeners;
|
|
1193
1195
|
/**
|
|
@@ -1206,12 +1208,12 @@ declare class Server<
|
|
|
1206
1208
|
private currentHash;
|
|
1207
1209
|
/**
|
|
1208
1210
|
* @private
|
|
1209
|
-
* @param {Compiler} compiler
|
|
1211
|
+
* @param {Compiler} compiler compiler
|
|
1210
1212
|
*/
|
|
1211
1213
|
private addAdditionalEntries;
|
|
1212
1214
|
/**
|
|
1213
1215
|
* @private
|
|
1214
|
-
* @returns {Compiler["options"]}
|
|
1216
|
+
* @returns {Compiler["options"]} compiler options
|
|
1215
1217
|
*/
|
|
1216
1218
|
private getCompilerOptions;
|
|
1217
1219
|
/**
|
|
@@ -1221,13 +1223,13 @@ declare class Server<
|
|
|
1221
1223
|
private normalizeOptions;
|
|
1222
1224
|
/**
|
|
1223
1225
|
* @private
|
|
1224
|
-
* @returns {string}
|
|
1226
|
+
* @returns {string} client transport
|
|
1225
1227
|
*/
|
|
1226
1228
|
private getClientTransport;
|
|
1227
1229
|
/**
|
|
1228
1230
|
* @template T
|
|
1229
1231
|
* @private
|
|
1230
|
-
* @returns {T}
|
|
1232
|
+
* @returns {T} server transport
|
|
1231
1233
|
*/
|
|
1232
1234
|
private getServerTransport;
|
|
1233
1235
|
/**
|
|
@@ -1235,7 +1237,7 @@ declare class Server<
|
|
|
1235
1237
|
*/
|
|
1236
1238
|
getClientEntry(): string;
|
|
1237
1239
|
/**
|
|
1238
|
-
* @returns {string | void}
|
|
1240
|
+
* @returns {string | void} client hot entry
|
|
1239
1241
|
*/
|
|
1240
1242
|
getClientHotEntry(): string | void;
|
|
1241
1243
|
/**
|
|
@@ -1253,12 +1255,12 @@ declare class Server<
|
|
|
1253
1255
|
* @returns {Promise<void>}
|
|
1254
1256
|
*/
|
|
1255
1257
|
private setupApp;
|
|
1256
|
-
/** @type {A | undefined}*/
|
|
1258
|
+
/** @type {A | undefined} */
|
|
1257
1259
|
app: A | undefined;
|
|
1258
1260
|
/**
|
|
1259
1261
|
* @private
|
|
1260
|
-
* @param {Stats | MultiStats} statsObj
|
|
1261
|
-
* @returns {StatsCompilation}
|
|
1262
|
+
* @param {Stats | MultiStats} statsObj stats
|
|
1263
|
+
* @returns {StatsCompilation} stats of compilation
|
|
1262
1264
|
*/
|
|
1263
1265
|
private getStats;
|
|
1264
1266
|
/**
|
|
@@ -1304,7 +1306,7 @@ declare class Server<
|
|
|
1304
1306
|
* @returns {Promise<void>}
|
|
1305
1307
|
*/
|
|
1306
1308
|
private createServer;
|
|
1307
|
-
/** @type {S | undefined}*/
|
|
1309
|
+
/** @type {S | undefined} */
|
|
1308
1310
|
server: S | undefined;
|
|
1309
1311
|
isTlsServer: boolean | undefined;
|
|
1310
1312
|
/**
|
|
@@ -1316,7 +1318,7 @@ declare class Server<
|
|
|
1316
1318
|
webSocketServer: WebSocketServerImplementation | undefined | null;
|
|
1317
1319
|
/**
|
|
1318
1320
|
* @private
|
|
1319
|
-
* @param {string} defaultOpenTarget
|
|
1321
|
+
* @param {string} defaultOpenTarget default open target
|
|
1320
1322
|
* @returns {Promise<void>}
|
|
1321
1323
|
*/
|
|
1322
1324
|
private openBrowser;
|
|
@@ -1332,6 +1334,7 @@ declare class Server<
|
|
|
1332
1334
|
private bonjour;
|
|
1333
1335
|
/**
|
|
1334
1336
|
* @private
|
|
1337
|
+
* @param {() => void} callback callback
|
|
1335
1338
|
* @returns {void}
|
|
1336
1339
|
*/
|
|
1337
1340
|
private stopBonjour;
|
|
@@ -1342,79 +1345,83 @@ declare class Server<
|
|
|
1342
1345
|
private logStatus;
|
|
1343
1346
|
/**
|
|
1344
1347
|
* @private
|
|
1345
|
-
* @param {Request} req
|
|
1346
|
-
* @param {Response} res
|
|
1347
|
-
* @param {NextFunction} next
|
|
1348
|
+
* @param {Request} req request
|
|
1349
|
+
* @param {Response} res response
|
|
1350
|
+
* @param {NextFunction} next next function
|
|
1348
1351
|
*/
|
|
1349
1352
|
private setHeaders;
|
|
1350
1353
|
/**
|
|
1351
1354
|
* @private
|
|
1352
|
-
* @param {string} value
|
|
1353
|
-
* @returns {boolean}
|
|
1355
|
+
* @param {string} value value
|
|
1356
|
+
* @returns {boolean} true when host allowed, otherwise false
|
|
1354
1357
|
*/
|
|
1355
1358
|
private isHostAllowed;
|
|
1356
1359
|
/**
|
|
1357
1360
|
* @private
|
|
1358
|
-
* @param {{ [key: string]: string | undefined }} headers
|
|
1359
|
-
* @param {string} headerToCheck
|
|
1360
|
-
* @param {boolean} validateHost
|
|
1361
|
-
* @returns {boolean}
|
|
1361
|
+
* @param {{ [key: string]: string | undefined }} headers headers
|
|
1362
|
+
* @param {string} headerToCheck header to check
|
|
1363
|
+
* @param {boolean} validateHost need to validate host
|
|
1364
|
+
* @returns {boolean} true when host is valid, otherwise false
|
|
1362
1365
|
*/
|
|
1363
1366
|
private isValidHost;
|
|
1364
1367
|
/**
|
|
1365
1368
|
* @private
|
|
1366
|
-
* @param {{ [key: string]: string | undefined }} headers
|
|
1367
|
-
* @returns {boolean}
|
|
1369
|
+
* @param {{ [key: string]: string | undefined }} headers headers
|
|
1370
|
+
* @returns {boolean} true when is same origin, otherwise false
|
|
1368
1371
|
*/
|
|
1369
1372
|
private isSameOrigin;
|
|
1370
1373
|
/**
|
|
1371
|
-
* @param {ClientConnection[]} clients
|
|
1372
|
-
* @param {string} type
|
|
1373
|
-
* @param {
|
|
1374
|
-
* @param {
|
|
1374
|
+
* @param {ClientConnection[]} clients clients
|
|
1375
|
+
* @param {string} type type
|
|
1376
|
+
* @param {EXPECTED_ANY=} data data
|
|
1377
|
+
* @param {EXPECTED_ANY=} params params
|
|
1375
1378
|
*/
|
|
1376
1379
|
sendMessage(
|
|
1377
1380
|
clients: ClientConnection[],
|
|
1378
1381
|
type: string,
|
|
1379
|
-
data?:
|
|
1380
|
-
params?:
|
|
1382
|
+
data?: EXPECTED_ANY | undefined,
|
|
1383
|
+
params?: EXPECTED_ANY | undefined,
|
|
1381
1384
|
): void;
|
|
1382
1385
|
/**
|
|
1383
1386
|
* @private
|
|
1384
|
-
* @param {ClientConnection[]} clients
|
|
1385
|
-
* @param {StatsCompilation} stats
|
|
1386
|
-
* @param {boolean}
|
|
1387
|
+
* @param {ClientConnection[]} clients clients
|
|
1388
|
+
* @param {StatsCompilation} stats stats
|
|
1389
|
+
* @param {boolean=} force force
|
|
1387
1390
|
*/
|
|
1388
1391
|
private sendStats;
|
|
1389
1392
|
/**
|
|
1390
|
-
* @param {string | string[]} watchPath
|
|
1391
|
-
* @param {WatchOptions}
|
|
1393
|
+
* @param {string | string[]} watchPath watch path
|
|
1394
|
+
* @param {WatchOptions=} watchOptions watch options
|
|
1392
1395
|
*/
|
|
1393
|
-
watchFiles(
|
|
1396
|
+
watchFiles(
|
|
1397
|
+
watchPath: string | string[],
|
|
1398
|
+
watchOptions?: WatchOptions | undefined,
|
|
1399
|
+
): void;
|
|
1394
1400
|
/**
|
|
1395
|
-
* @param {import("webpack-dev-middleware").Callback}
|
|
1401
|
+
* @param {import("webpack-dev-middleware").Callback=} callback callback
|
|
1396
1402
|
*/
|
|
1397
|
-
invalidate(
|
|
1403
|
+
invalidate(
|
|
1404
|
+
callback?: import("webpack-dev-middleware").Callback | undefined,
|
|
1405
|
+
): void;
|
|
1398
1406
|
/**
|
|
1399
1407
|
* @returns {Promise<void>}
|
|
1400
1408
|
*/
|
|
1401
1409
|
start(): Promise<void>;
|
|
1402
1410
|
/**
|
|
1403
|
-
* @param {(err?: Error) => void}
|
|
1411
|
+
* @param {((err?: Error) => void)=} callback callback
|
|
1404
1412
|
*/
|
|
1405
|
-
startCallback(callback?: (err?: Error) => void): void;
|
|
1413
|
+
startCallback(callback?: ((err?: Error) => void) | undefined): void;
|
|
1406
1414
|
/**
|
|
1407
1415
|
* @returns {Promise<void>}
|
|
1408
1416
|
*/
|
|
1409
1417
|
stop(): Promise<void>;
|
|
1410
1418
|
/**
|
|
1411
|
-
* @param {(err?: Error) => void}
|
|
1419
|
+
* @param {((err?: Error) => void)=} callback callback
|
|
1412
1420
|
*/
|
|
1413
|
-
stopCallback(callback?: (err?: Error) => void): void;
|
|
1421
|
+
stopCallback(callback?: ((err?: Error) => void) | undefined): void;
|
|
1414
1422
|
}
|
|
1415
1423
|
declare namespace Server {
|
|
1416
1424
|
export {
|
|
1417
|
-
DEFAULT_STATS,
|
|
1418
1425
|
Schema,
|
|
1419
1426
|
Compiler,
|
|
1420
1427
|
MultiCompiler,
|
|
@@ -1446,6 +1453,7 @@ declare namespace Server {
|
|
|
1446
1453
|
ExpressErrorRequestHandler,
|
|
1447
1454
|
ExpressRequest,
|
|
1448
1455
|
ExpressResponse,
|
|
1456
|
+
EXPECTED_ANY,
|
|
1449
1457
|
NextFunction,
|
|
1450
1458
|
SimpleHandleFunction,
|
|
1451
1459
|
NextHandleFunction,
|
|
@@ -1482,12 +1490,10 @@ declare namespace Server {
|
|
|
1482
1490
|
Middleware,
|
|
1483
1491
|
BasicServer,
|
|
1484
1492
|
Configuration,
|
|
1493
|
+
FunctionReturning,
|
|
1485
1494
|
BasicApplication,
|
|
1486
1495
|
};
|
|
1487
1496
|
}
|
|
1488
|
-
declare class DEFAULT_STATS {
|
|
1489
|
-
private constructor();
|
|
1490
|
-
}
|
|
1491
1497
|
type Schema = import("schema-utils/declarations/validate").Schema;
|
|
1492
1498
|
type Compiler = import("webpack").Compiler;
|
|
1493
1499
|
type MultiCompiler = import("webpack").MultiCompiler;
|
|
@@ -1520,7 +1526,8 @@ type ExpressRequestHandler = import("express").RequestHandler;
|
|
|
1520
1526
|
type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
|
|
1521
1527
|
type ExpressRequest = import("express").Request;
|
|
1522
1528
|
type ExpressResponse = import("express").Response;
|
|
1523
|
-
type
|
|
1529
|
+
type EXPECTED_ANY = any;
|
|
1530
|
+
type NextFunction = (err?: EXPECTED_ANY) => void;
|
|
1524
1531
|
type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
|
|
1525
1532
|
type NextHandleFunction = (
|
|
1526
1533
|
req: IncomingMessage,
|
|
@@ -1528,7 +1535,7 @@ type NextHandleFunction = (
|
|
|
1528
1535
|
next: NextFunction,
|
|
1529
1536
|
) => void;
|
|
1530
1537
|
type ErrorHandleFunction = (
|
|
1531
|
-
err:
|
|
1538
|
+
err: EXPECTED_ANY,
|
|
1532
1539
|
req: IncomingMessage,
|
|
1533
1540
|
res: ServerResponse,
|
|
1534
1541
|
next: NextFunction,
|
|
@@ -1561,9 +1568,15 @@ type DevMiddlewareContext<
|
|
|
1561
1568
|
type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string;
|
|
1562
1569
|
type Port = number | string | "auto";
|
|
1563
1570
|
type WatchFiles = {
|
|
1571
|
+
/**
|
|
1572
|
+
* paths
|
|
1573
|
+
*/
|
|
1564
1574
|
paths: string | string[];
|
|
1575
|
+
/**
|
|
1576
|
+
* options
|
|
1577
|
+
*/
|
|
1565
1578
|
options?:
|
|
1566
|
-
| (
|
|
1579
|
+
| (WatchOptions & {
|
|
1567
1580
|
aggregateTimeout?: number;
|
|
1568
1581
|
ignored?: WatchOptions["ignored"];
|
|
1569
1582
|
poll?: number | boolean;
|
|
@@ -1571,21 +1584,34 @@ type WatchFiles = {
|
|
|
1571
1584
|
| undefined;
|
|
1572
1585
|
};
|
|
1573
1586
|
type Static = {
|
|
1587
|
+
/**
|
|
1588
|
+
* directory
|
|
1589
|
+
*/
|
|
1574
1590
|
directory?: string | undefined;
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1591
|
+
/**
|
|
1592
|
+
* public path
|
|
1593
|
+
*/
|
|
1594
|
+
publicPath?: (string | string[]) | undefined;
|
|
1595
|
+
/**
|
|
1596
|
+
* serve index
|
|
1597
|
+
*/
|
|
1598
|
+
serveIndex?: (boolean | ServeIndexOptions) | undefined;
|
|
1599
|
+
/**
|
|
1600
|
+
* static options
|
|
1601
|
+
*/
|
|
1602
|
+
staticOptions?: ServeStaticOptions | undefined;
|
|
1603
|
+
/**
|
|
1604
|
+
* watch and watch options
|
|
1605
|
+
*/
|
|
1582
1606
|
watch?:
|
|
1583
|
-
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1607
|
+
| (
|
|
1608
|
+
| boolean
|
|
1609
|
+
| (WatchOptions & {
|
|
1610
|
+
aggregateTimeout?: number;
|
|
1611
|
+
ignored?: WatchOptions["ignored"];
|
|
1612
|
+
poll?: number | boolean;
|
|
1613
|
+
})
|
|
1614
|
+
)
|
|
1589
1615
|
| undefined;
|
|
1590
1616
|
};
|
|
1591
1617
|
type NormalizedStatic = {
|
|
@@ -1607,7 +1633,7 @@ type ServerType<
|
|
|
1607
1633
|
| "spdy"
|
|
1608
1634
|
| "http2"
|
|
1609
1635
|
| string
|
|
1610
|
-
| ((
|
|
1636
|
+
| ((serverOptions: ServerOptions, application: A) => S);
|
|
1611
1637
|
type ServerConfiguration<
|
|
1612
1638
|
A extends BasicApplication = import("express").Application,
|
|
1613
1639
|
S extends BasicServer = import("http").Server<
|
|
@@ -1615,12 +1641,26 @@ type ServerConfiguration<
|
|
|
1615
1641
|
typeof import("http").ServerResponse
|
|
1616
1642
|
>,
|
|
1617
1643
|
> = {
|
|
1644
|
+
/**
|
|
1645
|
+
* type
|
|
1646
|
+
*/
|
|
1618
1647
|
type?: ServerType<A, S> | undefined;
|
|
1648
|
+
/**
|
|
1649
|
+
* options
|
|
1650
|
+
*/
|
|
1619
1651
|
options?: ServerOptions | undefined;
|
|
1620
1652
|
};
|
|
1621
1653
|
type WebSocketServerConfiguration = {
|
|
1622
|
-
|
|
1623
|
-
|
|
1654
|
+
/**
|
|
1655
|
+
* type
|
|
1656
|
+
*/
|
|
1657
|
+
type?:
|
|
1658
|
+
| ("sockjs" | "ws" | string | (() => WebSocketServerConfiguration))
|
|
1659
|
+
| undefined;
|
|
1660
|
+
/**
|
|
1661
|
+
* options
|
|
1662
|
+
*/
|
|
1663
|
+
options?: Record<string, EXPECTED_ANY> | undefined;
|
|
1624
1664
|
};
|
|
1625
1665
|
type ClientConnection = (
|
|
1626
1666
|
| import("ws").WebSocket
|
|
@@ -1665,36 +1705,79 @@ type OpenApp = {
|
|
|
1665
1705
|
arguments?: string[] | undefined;
|
|
1666
1706
|
};
|
|
1667
1707
|
type Open = {
|
|
1668
|
-
app?: string | string[] | OpenApp | undefined;
|
|
1669
|
-
|
|
1708
|
+
app?: (string | string[] | OpenApp) | undefined;
|
|
1709
|
+
/**
|
|
1710
|
+
* target
|
|
1711
|
+
*/
|
|
1712
|
+
target?: (string | string[]) | undefined;
|
|
1670
1713
|
};
|
|
1671
1714
|
type NormalizedOpen = {
|
|
1672
1715
|
target: string;
|
|
1673
1716
|
options: import("open").Options;
|
|
1674
1717
|
};
|
|
1675
1718
|
type WebSocketURL = {
|
|
1719
|
+
/**
|
|
1720
|
+
* hostname
|
|
1721
|
+
*/
|
|
1676
1722
|
hostname?: string | undefined;
|
|
1723
|
+
/**
|
|
1724
|
+
* password
|
|
1725
|
+
*/
|
|
1677
1726
|
password?: string | undefined;
|
|
1727
|
+
/**
|
|
1728
|
+
* pathname
|
|
1729
|
+
*/
|
|
1678
1730
|
pathname?: string | undefined;
|
|
1679
|
-
|
|
1731
|
+
/**
|
|
1732
|
+
* port
|
|
1733
|
+
*/
|
|
1734
|
+
port?: (number | string) | undefined;
|
|
1735
|
+
/**
|
|
1736
|
+
* protocol
|
|
1737
|
+
*/
|
|
1680
1738
|
protocol?: string | undefined;
|
|
1739
|
+
/**
|
|
1740
|
+
* username
|
|
1741
|
+
*/
|
|
1681
1742
|
username?: string | undefined;
|
|
1682
1743
|
};
|
|
1683
1744
|
type OverlayMessageOptions = boolean | ((error: Error) => void);
|
|
1684
1745
|
type ClientConfiguration = {
|
|
1685
|
-
|
|
1746
|
+
/**
|
|
1747
|
+
* logging
|
|
1748
|
+
*/
|
|
1749
|
+
logging?:
|
|
1750
|
+
| ("log" | "info" | "warn" | "error" | "none" | "verbose")
|
|
1751
|
+
| undefined;
|
|
1752
|
+
/**
|
|
1753
|
+
* overlay
|
|
1754
|
+
*/
|
|
1686
1755
|
overlay?:
|
|
1687
|
-
|
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1756
|
+
| (
|
|
1757
|
+
| boolean
|
|
1758
|
+
| {
|
|
1759
|
+
warnings?: OverlayMessageOptions;
|
|
1760
|
+
errors?: OverlayMessageOptions;
|
|
1761
|
+
runtimeErrors?: OverlayMessageOptions;
|
|
1762
|
+
}
|
|
1763
|
+
)
|
|
1693
1764
|
| undefined;
|
|
1765
|
+
/**
|
|
1766
|
+
* progress
|
|
1767
|
+
*/
|
|
1694
1768
|
progress?: boolean | undefined;
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1769
|
+
/**
|
|
1770
|
+
* reconnect
|
|
1771
|
+
*/
|
|
1772
|
+
reconnect?: (boolean | number) | undefined;
|
|
1773
|
+
/**
|
|
1774
|
+
* web socket transport
|
|
1775
|
+
*/
|
|
1776
|
+
webSocketTransport?: ("ws" | "sockjs" | string) | undefined;
|
|
1777
|
+
/**
|
|
1778
|
+
* web socket URL
|
|
1779
|
+
*/
|
|
1780
|
+
webSocketURL?: (string | WebSocketURL) | undefined;
|
|
1698
1781
|
};
|
|
1699
1782
|
type Headers =
|
|
1700
1783
|
| Array<{
|
|
@@ -1721,81 +1804,65 @@ type Configuration<
|
|
|
1721
1804
|
typeof import("http").ServerResponse
|
|
1722
1805
|
>,
|
|
1723
1806
|
> = {
|
|
1724
|
-
ipc?:
|
|
1725
|
-
host?:
|
|
1807
|
+
ipc?: (boolean | string) | undefined;
|
|
1808
|
+
host?: Host | undefined;
|
|
1726
1809
|
port?: Port | undefined;
|
|
1727
|
-
hot?: boolean | "only" | undefined;
|
|
1810
|
+
hot?: (boolean | "only") | undefined;
|
|
1728
1811
|
liveReload?: boolean | undefined;
|
|
1729
|
-
devMiddleware?:
|
|
1730
|
-
| DevMiddlewareOptions<
|
|
1731
|
-
import("express").Request<
|
|
1732
|
-
import("express-serve-static-core").ParamsDictionary,
|
|
1733
|
-
any,
|
|
1734
|
-
any,
|
|
1735
|
-
qs.ParsedQs,
|
|
1736
|
-
Record<string, any>
|
|
1737
|
-
>,
|
|
1738
|
-
import("express").Response<any, Record<string, any>>
|
|
1739
|
-
>
|
|
1740
|
-
| undefined;
|
|
1812
|
+
devMiddleware?: DevMiddlewareOptions<Request, Response> | undefined;
|
|
1741
1813
|
compress?: boolean | undefined;
|
|
1742
|
-
allowedHosts?: string | string[] | undefined;
|
|
1743
|
-
historyApiFallback?:
|
|
1744
|
-
|
|
1745
|
-
| import("connect-history-api-fallback").Options
|
|
1746
|
-
| undefined;
|
|
1747
|
-
bonjour?:
|
|
1748
|
-
| boolean
|
|
1749
|
-
| Record<string, never>
|
|
1750
|
-
| import("bonjour-service").Service
|
|
1751
|
-
| undefined;
|
|
1814
|
+
allowedHosts?: ("auto" | "all" | string | string[]) | undefined;
|
|
1815
|
+
historyApiFallback?: (boolean | ConnectHistoryApiFallbackOptions) | undefined;
|
|
1816
|
+
bonjour?: (boolean | Record<string, never> | BonjourOptions) | undefined;
|
|
1752
1817
|
watchFiles?:
|
|
1753
|
-
| string
|
|
1754
|
-
| string[]
|
|
1755
|
-
| WatchFiles
|
|
1756
|
-
| (string | WatchFiles)[]
|
|
1818
|
+
| (string | string[] | WatchFiles | Array<string | WatchFiles>)
|
|
1757
1819
|
| undefined;
|
|
1758
|
-
static?:
|
|
1759
|
-
server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
|
|
1820
|
+
static?: (boolean | string | Static | Array<string | Static>) | undefined;
|
|
1821
|
+
server?: (ServerType<A, S> | ServerConfiguration<A, S>) | undefined;
|
|
1760
1822
|
app?: (() => Promise<A>) | undefined;
|
|
1761
|
-
webSocketServer?:
|
|
1823
|
+
webSocketServer?:
|
|
1824
|
+
| (boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration)
|
|
1825
|
+
| undefined;
|
|
1762
1826
|
proxy?: ProxyConfigArray | undefined;
|
|
1763
|
-
open?:
|
|
1827
|
+
open?: (boolean | string | Open | Array<string | Open>) | undefined;
|
|
1764
1828
|
setupExitSignals?: boolean | undefined;
|
|
1765
|
-
client?: boolean | ClientConfiguration | undefined;
|
|
1829
|
+
client?: (boolean | ClientConfiguration) | undefined;
|
|
1766
1830
|
headers?:
|
|
1767
|
-
|
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1831
|
+
| (
|
|
1832
|
+
| Headers
|
|
1833
|
+
| ((
|
|
1834
|
+
req: Request,
|
|
1835
|
+
res: Response,
|
|
1836
|
+
context: DevMiddlewareContext<Request, Response> | undefined,
|
|
1837
|
+
) => Headers)
|
|
1838
|
+
)
|
|
1773
1839
|
| undefined;
|
|
1774
1840
|
onListening?: ((devServer: Server<A, S>) => void) | undefined;
|
|
1775
1841
|
setupMiddlewares?:
|
|
1776
1842
|
| ((middlewares: Middleware[], devServer: Server<A, S>) => Middleware[])
|
|
1777
1843
|
| undefined;
|
|
1778
1844
|
};
|
|
1845
|
+
type FunctionReturning<T> = () => T;
|
|
1779
1846
|
type BasicApplication = {
|
|
1780
1847
|
use: typeof useFn;
|
|
1781
1848
|
};
|
|
1782
1849
|
/**
|
|
1783
1850
|
* @overload
|
|
1784
|
-
* @param {NextHandleFunction} fn
|
|
1785
|
-
* @returns {BasicApplication}
|
|
1851
|
+
* @param {NextHandleFunction} fn function
|
|
1852
|
+
* @returns {BasicApplication} application
|
|
1786
1853
|
*/
|
|
1787
1854
|
declare function useFn(fn: NextHandleFunction): BasicApplication;
|
|
1788
1855
|
/**
|
|
1789
1856
|
* @overload
|
|
1790
|
-
* @param {HandleFunction} fn
|
|
1791
|
-
* @returns {BasicApplication}
|
|
1857
|
+
* @param {HandleFunction} fn function
|
|
1858
|
+
* @returns {BasicApplication} application
|
|
1792
1859
|
*/
|
|
1793
1860
|
declare function useFn(fn: HandleFunction): BasicApplication;
|
|
1794
1861
|
/**
|
|
1795
1862
|
* @overload
|
|
1796
|
-
* @param {string} route
|
|
1797
|
-
* @param {NextHandleFunction} fn
|
|
1798
|
-
* @returns {BasicApplication}
|
|
1863
|
+
* @param {string} route route
|
|
1864
|
+
* @param {NextHandleFunction} fn function
|
|
1865
|
+
* @returns {BasicApplication} application
|
|
1799
1866
|
*/
|
|
1800
1867
|
declare function useFn(route: string, fn: NextHandleFunction): BasicApplication;
|
|
1801
1868
|
|
package/types/lib/getPort.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export = getPorts;
|
|
2
2
|
/**
|
|
3
|
-
* @param {number} basePort
|
|
4
|
-
* @param {string=} host
|
|
5
|
-
* @
|
|
3
|
+
* @param {number} basePort base port
|
|
4
|
+
* @param {string=} host host
|
|
5
|
+
* @returns {Promise<number>} resolved port
|
|
6
6
|
*/
|
|
7
7
|
declare function getPorts(
|
|
8
8
|
basePort: number,
|