webpack-dev-server 5.2.1 → 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 +112 -73
- package/client/modules/logger/index.js +46 -40
- package/client/modules/sockjs-client/index.js +0 -1
- package/client/overlay.js +131 -80
- 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 +354 -336
- 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 +39 -34
- package/types/bin/webpack-dev-server.d.ts +1 -1
- package/types/lib/Server.d.ts +216 -148
- 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,78 +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
|
-
* @
|
|
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
|
|
1361
1365
|
*/
|
|
1362
1366
|
private isValidHost;
|
|
1363
1367
|
/**
|
|
1364
1368
|
* @private
|
|
1365
|
-
* @param {{ [key: string]: string | undefined }} headers
|
|
1366
|
-
* @returns {boolean}
|
|
1369
|
+
* @param {{ [key: string]: string | undefined }} headers headers
|
|
1370
|
+
* @returns {boolean} true when is same origin, otherwise false
|
|
1367
1371
|
*/
|
|
1368
1372
|
private isSameOrigin;
|
|
1369
1373
|
/**
|
|
1370
|
-
* @param {ClientConnection[]} clients
|
|
1371
|
-
* @param {string} type
|
|
1372
|
-
* @param {
|
|
1373
|
-
* @param {
|
|
1374
|
+
* @param {ClientConnection[]} clients clients
|
|
1375
|
+
* @param {string} type type
|
|
1376
|
+
* @param {EXPECTED_ANY=} data data
|
|
1377
|
+
* @param {EXPECTED_ANY=} params params
|
|
1374
1378
|
*/
|
|
1375
1379
|
sendMessage(
|
|
1376
1380
|
clients: ClientConnection[],
|
|
1377
1381
|
type: string,
|
|
1378
|
-
data?:
|
|
1379
|
-
params?:
|
|
1382
|
+
data?: EXPECTED_ANY | undefined,
|
|
1383
|
+
params?: EXPECTED_ANY | undefined,
|
|
1380
1384
|
): void;
|
|
1381
1385
|
/**
|
|
1382
1386
|
* @private
|
|
1383
|
-
* @param {ClientConnection[]} clients
|
|
1384
|
-
* @param {StatsCompilation} stats
|
|
1385
|
-
* @param {boolean}
|
|
1387
|
+
* @param {ClientConnection[]} clients clients
|
|
1388
|
+
* @param {StatsCompilation} stats stats
|
|
1389
|
+
* @param {boolean=} force force
|
|
1386
1390
|
*/
|
|
1387
1391
|
private sendStats;
|
|
1388
1392
|
/**
|
|
1389
|
-
* @param {string | string[]} watchPath
|
|
1390
|
-
* @param {WatchOptions}
|
|
1393
|
+
* @param {string | string[]} watchPath watch path
|
|
1394
|
+
* @param {WatchOptions=} watchOptions watch options
|
|
1391
1395
|
*/
|
|
1392
|
-
watchFiles(
|
|
1396
|
+
watchFiles(
|
|
1397
|
+
watchPath: string | string[],
|
|
1398
|
+
watchOptions?: WatchOptions | undefined,
|
|
1399
|
+
): void;
|
|
1393
1400
|
/**
|
|
1394
|
-
* @param {import("webpack-dev-middleware").Callback}
|
|
1401
|
+
* @param {import("webpack-dev-middleware").Callback=} callback callback
|
|
1395
1402
|
*/
|
|
1396
|
-
invalidate(
|
|
1403
|
+
invalidate(
|
|
1404
|
+
callback?: import("webpack-dev-middleware").Callback | undefined,
|
|
1405
|
+
): void;
|
|
1397
1406
|
/**
|
|
1398
1407
|
* @returns {Promise<void>}
|
|
1399
1408
|
*/
|
|
1400
1409
|
start(): Promise<void>;
|
|
1401
1410
|
/**
|
|
1402
|
-
* @param {(err?: Error) => void}
|
|
1411
|
+
* @param {((err?: Error) => void)=} callback callback
|
|
1403
1412
|
*/
|
|
1404
|
-
startCallback(callback?: (err?: Error) => void): void;
|
|
1413
|
+
startCallback(callback?: ((err?: Error) => void) | undefined): void;
|
|
1405
1414
|
/**
|
|
1406
1415
|
* @returns {Promise<void>}
|
|
1407
1416
|
*/
|
|
1408
1417
|
stop(): Promise<void>;
|
|
1409
1418
|
/**
|
|
1410
|
-
* @param {(err?: Error) => void}
|
|
1419
|
+
* @param {((err?: Error) => void)=} callback callback
|
|
1411
1420
|
*/
|
|
1412
|
-
stopCallback(callback?: (err?: Error) => void): void;
|
|
1421
|
+
stopCallback(callback?: ((err?: Error) => void) | undefined): void;
|
|
1413
1422
|
}
|
|
1414
1423
|
declare namespace Server {
|
|
1415
1424
|
export {
|
|
1416
|
-
DEFAULT_STATS,
|
|
1417
1425
|
Schema,
|
|
1418
1426
|
Compiler,
|
|
1419
1427
|
MultiCompiler,
|
|
@@ -1445,6 +1453,7 @@ declare namespace Server {
|
|
|
1445
1453
|
ExpressErrorRequestHandler,
|
|
1446
1454
|
ExpressRequest,
|
|
1447
1455
|
ExpressResponse,
|
|
1456
|
+
EXPECTED_ANY,
|
|
1448
1457
|
NextFunction,
|
|
1449
1458
|
SimpleHandleFunction,
|
|
1450
1459
|
NextHandleFunction,
|
|
@@ -1481,12 +1490,10 @@ declare namespace Server {
|
|
|
1481
1490
|
Middleware,
|
|
1482
1491
|
BasicServer,
|
|
1483
1492
|
Configuration,
|
|
1493
|
+
FunctionReturning,
|
|
1484
1494
|
BasicApplication,
|
|
1485
1495
|
};
|
|
1486
1496
|
}
|
|
1487
|
-
declare class DEFAULT_STATS {
|
|
1488
|
-
private constructor();
|
|
1489
|
-
}
|
|
1490
1497
|
type Schema = import("schema-utils/declarations/validate").Schema;
|
|
1491
1498
|
type Compiler = import("webpack").Compiler;
|
|
1492
1499
|
type MultiCompiler = import("webpack").MultiCompiler;
|
|
@@ -1519,7 +1526,8 @@ type ExpressRequestHandler = import("express").RequestHandler;
|
|
|
1519
1526
|
type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
|
|
1520
1527
|
type ExpressRequest = import("express").Request;
|
|
1521
1528
|
type ExpressResponse = import("express").Response;
|
|
1522
|
-
type
|
|
1529
|
+
type EXPECTED_ANY = any;
|
|
1530
|
+
type NextFunction = (err?: EXPECTED_ANY) => void;
|
|
1523
1531
|
type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
|
|
1524
1532
|
type NextHandleFunction = (
|
|
1525
1533
|
req: IncomingMessage,
|
|
@@ -1527,7 +1535,7 @@ type NextHandleFunction = (
|
|
|
1527
1535
|
next: NextFunction,
|
|
1528
1536
|
) => void;
|
|
1529
1537
|
type ErrorHandleFunction = (
|
|
1530
|
-
err:
|
|
1538
|
+
err: EXPECTED_ANY,
|
|
1531
1539
|
req: IncomingMessage,
|
|
1532
1540
|
res: ServerResponse,
|
|
1533
1541
|
next: NextFunction,
|
|
@@ -1560,9 +1568,15 @@ type DevMiddlewareContext<
|
|
|
1560
1568
|
type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string;
|
|
1561
1569
|
type Port = number | string | "auto";
|
|
1562
1570
|
type WatchFiles = {
|
|
1571
|
+
/**
|
|
1572
|
+
* paths
|
|
1573
|
+
*/
|
|
1563
1574
|
paths: string | string[];
|
|
1575
|
+
/**
|
|
1576
|
+
* options
|
|
1577
|
+
*/
|
|
1564
1578
|
options?:
|
|
1565
|
-
| (
|
|
1579
|
+
| (WatchOptions & {
|
|
1566
1580
|
aggregateTimeout?: number;
|
|
1567
1581
|
ignored?: WatchOptions["ignored"];
|
|
1568
1582
|
poll?: number | boolean;
|
|
@@ -1570,21 +1584,34 @@ type WatchFiles = {
|
|
|
1570
1584
|
| undefined;
|
|
1571
1585
|
};
|
|
1572
1586
|
type Static = {
|
|
1587
|
+
/**
|
|
1588
|
+
* directory
|
|
1589
|
+
*/
|
|
1573
1590
|
directory?: string | undefined;
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
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
|
+
*/
|
|
1581
1606
|
watch?:
|
|
1582
|
-
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1607
|
+
| (
|
|
1608
|
+
| boolean
|
|
1609
|
+
| (WatchOptions & {
|
|
1610
|
+
aggregateTimeout?: number;
|
|
1611
|
+
ignored?: WatchOptions["ignored"];
|
|
1612
|
+
poll?: number | boolean;
|
|
1613
|
+
})
|
|
1614
|
+
)
|
|
1588
1615
|
| undefined;
|
|
1589
1616
|
};
|
|
1590
1617
|
type NormalizedStatic = {
|
|
@@ -1606,7 +1633,7 @@ type ServerType<
|
|
|
1606
1633
|
| "spdy"
|
|
1607
1634
|
| "http2"
|
|
1608
1635
|
| string
|
|
1609
|
-
| ((
|
|
1636
|
+
| ((serverOptions: ServerOptions, application: A) => S);
|
|
1610
1637
|
type ServerConfiguration<
|
|
1611
1638
|
A extends BasicApplication = import("express").Application,
|
|
1612
1639
|
S extends BasicServer = import("http").Server<
|
|
@@ -1614,12 +1641,26 @@ type ServerConfiguration<
|
|
|
1614
1641
|
typeof import("http").ServerResponse
|
|
1615
1642
|
>,
|
|
1616
1643
|
> = {
|
|
1644
|
+
/**
|
|
1645
|
+
* type
|
|
1646
|
+
*/
|
|
1617
1647
|
type?: ServerType<A, S> | undefined;
|
|
1648
|
+
/**
|
|
1649
|
+
* options
|
|
1650
|
+
*/
|
|
1618
1651
|
options?: ServerOptions | undefined;
|
|
1619
1652
|
};
|
|
1620
1653
|
type WebSocketServerConfiguration = {
|
|
1621
|
-
|
|
1622
|
-
|
|
1654
|
+
/**
|
|
1655
|
+
* type
|
|
1656
|
+
*/
|
|
1657
|
+
type?:
|
|
1658
|
+
| ("sockjs" | "ws" | string | (() => WebSocketServerConfiguration))
|
|
1659
|
+
| undefined;
|
|
1660
|
+
/**
|
|
1661
|
+
* options
|
|
1662
|
+
*/
|
|
1663
|
+
options?: Record<string, EXPECTED_ANY> | undefined;
|
|
1623
1664
|
};
|
|
1624
1665
|
type ClientConnection = (
|
|
1625
1666
|
| import("ws").WebSocket
|
|
@@ -1664,36 +1705,79 @@ type OpenApp = {
|
|
|
1664
1705
|
arguments?: string[] | undefined;
|
|
1665
1706
|
};
|
|
1666
1707
|
type Open = {
|
|
1667
|
-
app?: string | string[] | OpenApp | undefined;
|
|
1668
|
-
|
|
1708
|
+
app?: (string | string[] | OpenApp) | undefined;
|
|
1709
|
+
/**
|
|
1710
|
+
* target
|
|
1711
|
+
*/
|
|
1712
|
+
target?: (string | string[]) | undefined;
|
|
1669
1713
|
};
|
|
1670
1714
|
type NormalizedOpen = {
|
|
1671
1715
|
target: string;
|
|
1672
1716
|
options: import("open").Options;
|
|
1673
1717
|
};
|
|
1674
1718
|
type WebSocketURL = {
|
|
1719
|
+
/**
|
|
1720
|
+
* hostname
|
|
1721
|
+
*/
|
|
1675
1722
|
hostname?: string | undefined;
|
|
1723
|
+
/**
|
|
1724
|
+
* password
|
|
1725
|
+
*/
|
|
1676
1726
|
password?: string | undefined;
|
|
1727
|
+
/**
|
|
1728
|
+
* pathname
|
|
1729
|
+
*/
|
|
1677
1730
|
pathname?: string | undefined;
|
|
1678
|
-
|
|
1731
|
+
/**
|
|
1732
|
+
* port
|
|
1733
|
+
*/
|
|
1734
|
+
port?: (number | string) | undefined;
|
|
1735
|
+
/**
|
|
1736
|
+
* protocol
|
|
1737
|
+
*/
|
|
1679
1738
|
protocol?: string | undefined;
|
|
1739
|
+
/**
|
|
1740
|
+
* username
|
|
1741
|
+
*/
|
|
1680
1742
|
username?: string | undefined;
|
|
1681
1743
|
};
|
|
1682
1744
|
type OverlayMessageOptions = boolean | ((error: Error) => void);
|
|
1683
1745
|
type ClientConfiguration = {
|
|
1684
|
-
|
|
1746
|
+
/**
|
|
1747
|
+
* logging
|
|
1748
|
+
*/
|
|
1749
|
+
logging?:
|
|
1750
|
+
| ("log" | "info" | "warn" | "error" | "none" | "verbose")
|
|
1751
|
+
| undefined;
|
|
1752
|
+
/**
|
|
1753
|
+
* overlay
|
|
1754
|
+
*/
|
|
1685
1755
|
overlay?:
|
|
1686
|
-
|
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1756
|
+
| (
|
|
1757
|
+
| boolean
|
|
1758
|
+
| {
|
|
1759
|
+
warnings?: OverlayMessageOptions;
|
|
1760
|
+
errors?: OverlayMessageOptions;
|
|
1761
|
+
runtimeErrors?: OverlayMessageOptions;
|
|
1762
|
+
}
|
|
1763
|
+
)
|
|
1692
1764
|
| undefined;
|
|
1765
|
+
/**
|
|
1766
|
+
* progress
|
|
1767
|
+
*/
|
|
1693
1768
|
progress?: boolean | undefined;
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
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;
|
|
1697
1781
|
};
|
|
1698
1782
|
type Headers =
|
|
1699
1783
|
| Array<{
|
|
@@ -1720,81 +1804,65 @@ type Configuration<
|
|
|
1720
1804
|
typeof import("http").ServerResponse
|
|
1721
1805
|
>,
|
|
1722
1806
|
> = {
|
|
1723
|
-
ipc?:
|
|
1724
|
-
host?:
|
|
1807
|
+
ipc?: (boolean | string) | undefined;
|
|
1808
|
+
host?: Host | undefined;
|
|
1725
1809
|
port?: Port | undefined;
|
|
1726
|
-
hot?: boolean | "only" | undefined;
|
|
1810
|
+
hot?: (boolean | "only") | undefined;
|
|
1727
1811
|
liveReload?: boolean | undefined;
|
|
1728
|
-
devMiddleware?:
|
|
1729
|
-
| DevMiddlewareOptions<
|
|
1730
|
-
import("express").Request<
|
|
1731
|
-
import("express-serve-static-core").ParamsDictionary,
|
|
1732
|
-
any,
|
|
1733
|
-
any,
|
|
1734
|
-
qs.ParsedQs,
|
|
1735
|
-
Record<string, any>
|
|
1736
|
-
>,
|
|
1737
|
-
import("express").Response<any, Record<string, any>>
|
|
1738
|
-
>
|
|
1739
|
-
| undefined;
|
|
1812
|
+
devMiddleware?: DevMiddlewareOptions<Request, Response> | undefined;
|
|
1740
1813
|
compress?: boolean | undefined;
|
|
1741
|
-
allowedHosts?: string | string[] | undefined;
|
|
1742
|
-
historyApiFallback?:
|
|
1743
|
-
|
|
1744
|
-
| import("connect-history-api-fallback").Options
|
|
1745
|
-
| undefined;
|
|
1746
|
-
bonjour?:
|
|
1747
|
-
| boolean
|
|
1748
|
-
| Record<string, never>
|
|
1749
|
-
| import("bonjour-service").Service
|
|
1750
|
-
| undefined;
|
|
1814
|
+
allowedHosts?: ("auto" | "all" | string | string[]) | undefined;
|
|
1815
|
+
historyApiFallback?: (boolean | ConnectHistoryApiFallbackOptions) | undefined;
|
|
1816
|
+
bonjour?: (boolean | Record<string, never> | BonjourOptions) | undefined;
|
|
1751
1817
|
watchFiles?:
|
|
1752
|
-
| string
|
|
1753
|
-
| string[]
|
|
1754
|
-
| WatchFiles
|
|
1755
|
-
| (string | WatchFiles)[]
|
|
1818
|
+
| (string | string[] | WatchFiles | Array<string | WatchFiles>)
|
|
1756
1819
|
| undefined;
|
|
1757
|
-
static?:
|
|
1758
|
-
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;
|
|
1759
1822
|
app?: (() => Promise<A>) | undefined;
|
|
1760
|
-
webSocketServer?:
|
|
1823
|
+
webSocketServer?:
|
|
1824
|
+
| (boolean | "sockjs" | "ws" | string | WebSocketServerConfiguration)
|
|
1825
|
+
| undefined;
|
|
1761
1826
|
proxy?: ProxyConfigArray | undefined;
|
|
1762
|
-
open?:
|
|
1827
|
+
open?: (boolean | string | Open | Array<string | Open>) | undefined;
|
|
1763
1828
|
setupExitSignals?: boolean | undefined;
|
|
1764
|
-
client?: boolean | ClientConfiguration | undefined;
|
|
1829
|
+
client?: (boolean | ClientConfiguration) | undefined;
|
|
1765
1830
|
headers?:
|
|
1766
|
-
|
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1831
|
+
| (
|
|
1832
|
+
| Headers
|
|
1833
|
+
| ((
|
|
1834
|
+
req: Request,
|
|
1835
|
+
res: Response,
|
|
1836
|
+
context: DevMiddlewareContext<Request, Response> | undefined,
|
|
1837
|
+
) => Headers)
|
|
1838
|
+
)
|
|
1772
1839
|
| undefined;
|
|
1773
1840
|
onListening?: ((devServer: Server<A, S>) => void) | undefined;
|
|
1774
1841
|
setupMiddlewares?:
|
|
1775
1842
|
| ((middlewares: Middleware[], devServer: Server<A, S>) => Middleware[])
|
|
1776
1843
|
| undefined;
|
|
1777
1844
|
};
|
|
1845
|
+
type FunctionReturning<T> = () => T;
|
|
1778
1846
|
type BasicApplication = {
|
|
1779
1847
|
use: typeof useFn;
|
|
1780
1848
|
};
|
|
1781
1849
|
/**
|
|
1782
1850
|
* @overload
|
|
1783
|
-
* @param {NextHandleFunction} fn
|
|
1784
|
-
* @returns {BasicApplication}
|
|
1851
|
+
* @param {NextHandleFunction} fn function
|
|
1852
|
+
* @returns {BasicApplication} application
|
|
1785
1853
|
*/
|
|
1786
1854
|
declare function useFn(fn: NextHandleFunction): BasicApplication;
|
|
1787
1855
|
/**
|
|
1788
1856
|
* @overload
|
|
1789
|
-
* @param {HandleFunction} fn
|
|
1790
|
-
* @returns {BasicApplication}
|
|
1857
|
+
* @param {HandleFunction} fn function
|
|
1858
|
+
* @returns {BasicApplication} application
|
|
1791
1859
|
*/
|
|
1792
1860
|
declare function useFn(fn: HandleFunction): BasicApplication;
|
|
1793
1861
|
/**
|
|
1794
1862
|
* @overload
|
|
1795
|
-
* @param {string} route
|
|
1796
|
-
* @param {NextHandleFunction} fn
|
|
1797
|
-
* @returns {BasicApplication}
|
|
1863
|
+
* @param {string} route route
|
|
1864
|
+
* @param {NextHandleFunction} fn function
|
|
1865
|
+
* @returns {BasicApplication} application
|
|
1798
1866
|
*/
|
|
1799
1867
|
declare function useFn(route: string, fn: NextHandleFunction): BasicApplication;
|
|
1800
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,
|