UNPKG

45.9 kBTypeScriptView Raw
1export = Server;
2/**
3 * @typedef {Object} BasicApplication
4 * @property {typeof useFn} use
5 */
6/**
7 * @template {BasicApplication} [A=ExpressApplication]
8 * @template {BasicServer} [S=HTTPServer]
9 */
10declare class Server<
11 A extends BasicApplication = import("express").Application,
12 S extends BasicServer = import("http").Server<
13 typeof import("http").IncomingMessage,
14 typeof import("http").ServerResponse
15 >,
16> {
17 static get schema(): {
18 title: string;
19 type: string;
20 definitions: {
21 App: {
22 instanceof: string;
23 description: string;
24 link: string;
25 };
26 AllowedHosts: {
27 anyOf: (
28 | {
29 type: string;
30 minItems: number;
31 items: {
32 $ref: string;
33 };
34 enum?: undefined;
35 $ref?: undefined;
36 }
37 | {
38 enum: string[];
39 type?: undefined;
40 minItems?: undefined;
41 items?: undefined;
42 $ref?: undefined;
43 }
44 | {
45 $ref: string;
46 type?: undefined;
47 minItems?: undefined;
48 items?: undefined;
49 enum?: undefined;
50 }
51 )[];
52 description: string;
53 link: string;
54 };
55 AllowedHostsItem: {
56 type: string;
57 minLength: number;
58 };
59 Bonjour: {
60 anyOf: (
61 | {
62 type: string;
63 cli: {
64 negatedDescription: string;
65 };
66 description?: undefined;
67 link?: undefined;
68 }
69 | {
70 type: string;
71 description: string;
72 link: string;
73 cli?: undefined;
74 }
75 )[];
76 description: string;
77 link: string;
78 };
79 Client: {
80 description: string;
81 link: string;
82 anyOf: (
83 | {
84 enum: boolean[];
85 cli: {
86 negatedDescription: string;
87 };
88 type?: undefined;
89 additionalProperties?: undefined;
90 properties?: undefined;
91 }
92 | {
93 type: string;
94 additionalProperties: boolean;
95 properties: {
96 logging: {
97 $ref: string;
98 };
99 overlay: {
100 $ref: string;
101 };
102 progress: {
103 $ref: string;
104 };
105 reconnect: {
106 $ref: string;
107 };
108 webSocketTransport: {
109 $ref: string;
110 };
111 webSocketURL: {
112 $ref: string;
113 };
114 };
115 enum?: undefined;
116 cli?: undefined;
117 }
118 )[];
119 };
120 ClientLogging: {
121 enum: string[];
122 description: string;
123 link: string;
124 };
125 ClientOverlay: {
126 anyOf: (
127 | {
128 description: string;
129 link: string;
130 type: string;
131 cli: {
132 negatedDescription: string;
133 };
134 additionalProperties?: undefined;
135 properties?: undefined;
136 }
137 | {
138 type: string;
139 additionalProperties: boolean;
140 properties: {
141 errors: {
142 anyOf: (
143 | {
144 description: string;
145 type: string;
146 cli: {
147 negatedDescription: string;
148 };
149 instanceof?: undefined;
150 }
151 | {
152 instanceof: string;
153 description: string;
154 type?: undefined;
155 cli?: undefined;
156 }
157 )[];
158 };
159 warnings: {
160 anyOf: (
161 | {
162 description: string;
163 type: string;
164 cli: {
165 negatedDescription: string;
166 };
167 instanceof?: undefined;
168 }
169 | {
170 instanceof: string;
171 description: string;
172 type?: undefined;
173 cli?: undefined;
174 }
175 )[];
176 };
177 runtimeErrors: {
178 anyOf: (
179 | {
180 description: string;
181 type: string;
182 cli: {
183 negatedDescription: string;
184 };
185 instanceof?: undefined;
186 }
187 | {
188 instanceof: string;
189 description: string;
190 type?: undefined;
191 cli?: undefined;
192 }
193 )[];
194 };
195 trustedTypesPolicyName: {
196 description: string;
197 type: string;
198 };
199 };
200 description?: undefined;
201 link?: undefined;
202 cli?: undefined;
203 }
204 )[];
205 };
206 ClientProgress: {
207 description: string;
208 link: string;
209 type: string[];
210 enum: (string | boolean)[];
211 cli: {
212 negatedDescription: string;
213 };
214 };
215 ClientReconnect: {
216 description: string;
217 link: string;
218 anyOf: (
219 | {
220 type: string;
221 cli: {
222 negatedDescription: string;
223 };
224 minimum?: undefined;
225 }
226 | {
227 type: string;
228 minimum: number;
229 cli?: undefined;
230 }
231 )[];
232 };
233 ClientWebSocketTransport: {
234 anyOf: {
235 $ref: string;
236 }[];
237 description: string;
238 link: string;
239 };
240 ClientWebSocketTransportEnum: {
241 enum: string[];
242 };
243 ClientWebSocketTransportString: {
244 type: string;
245 minLength: number;
246 };
247 ClientWebSocketURL: {
248 description: string;
249 link: string;
250 anyOf: (
251 | {
252 type: string;
253 minLength: number;
254 additionalProperties?: undefined;
255 properties?: undefined;
256 }
257 | {
258 type: string;
259 additionalProperties: boolean;
260 properties: {
261 hostname: {
262 description: string;
263 type: string;
264 minLength: number;
265 };
266 pathname: {
267 description: string;
268 type: string;
269 };
270 password: {
271 description: string;
272 type: string;
273 };
274 port: {
275 description: string;
276 anyOf: (
277 | {
278 type: string;
279 minLength?: undefined;
280 }
281 | {
282 type: string;
283 minLength: number;
284 }
285 )[];
286 };
287 protocol: {
288 description: string;
289 anyOf: (
290 | {
291 enum: string[];
292 type?: undefined;
293 minLength?: undefined;
294 }
295 | {
296 type: string;
297 minLength: number;
298 enum?: undefined;
299 }
300 )[];
301 };
302 username: {
303 description: string;
304 type: string;
305 };
306 };
307 minLength?: undefined;
308 }
309 )[];
310 };
311 Compress: {
312 type: string;
313 description: string;
314 link: string;
315 cli: {
316 negatedDescription: string;
317 };
318 };
319 DevMiddleware: {
320 description: string;
321 link: string;
322 type: string;
323 additionalProperties: boolean;
324 };
325 HeaderObject: {
326 type: string;
327 additionalProperties: boolean;
328 properties: {
329 key: {
330 description: string;
331 type: string;
332 };
333 value: {
334 description: string;
335 type: string;
336 };
337 };
338 cli: {
339 exclude: boolean;
340 };
341 };
342 Headers: {
343 anyOf: (
344 | {
345 type: string;
346 items: {
347 $ref: string;
348 };
349 minItems: number;
350 instanceof?: undefined;
351 }
352 | {
353 type: string;
354 items?: undefined;
355 minItems?: undefined;
356 instanceof?: undefined;
357 }
358 | {
359 instanceof: string;
360 type?: undefined;
361 items?: undefined;
362 minItems?: undefined;
363 }
364 )[];
365 description: string;
366 link: string;
367 };
368 HistoryApiFallback: {
369 anyOf: (
370 | {
371 type: string;
372 cli: {
373 negatedDescription: string;
374 };
375 description?: undefined;
376 link?: undefined;
377 }
378 | {
379 type: string;
380 description: string;
381 link: string;
382 cli?: undefined;
383 }
384 )[];
385 description: string;
386 link: string;
387 };
388 Host: {
389 description: string;
390 link: string;
391 anyOf: (
392 | {
393 enum: string[];
394 type?: undefined;
395 minLength?: undefined;
396 }
397 | {
398 type: string;
399 minLength: number;
400 enum?: undefined;
401 }
402 )[];
403 };
404 Hot: {
405 anyOf: (
406 | {
407 type: string;
408 cli: {
409 negatedDescription: string;
410 };
411 enum?: undefined;
412 }
413 | {
414 enum: string[];
415 type?: undefined;
416 cli?: undefined;
417 }
418 )[];
419 description: string;
420 link: string;
421 };
422 IPC: {
423 anyOf: (
424 | {
425 type: string;
426 minLength: number;
427 enum?: undefined;
428 }
429 | {
430 type: string;
431 enum: boolean[];
432 minLength?: undefined;
433 }
434 )[];
435 description: string;
436 link: string;
437 };
438 LiveReload: {
439 type: string;
440 description: string;
441 cli: {
442 negatedDescription: string;
443 };
444 link: string;
445 };
446 OnListening: {
447 instanceof: string;
448 description: string;
449 link: string;
450 };
451 Open: {
452 anyOf: (
453 | {
454 type: string;
455 items: {
456 anyOf: {
457 $ref: string;
458 }[];
459 };
460 $ref?: undefined;
461 }
462 | {
463 $ref: string;
464 type?: undefined;
465 items?: undefined;
466 }
467 )[];
468 description: string;
469 link: string;
470 };
471 OpenBoolean: {
472 type: string;
473 cli: {
474 negatedDescription: string;
475 };
476 };
477 OpenObject: {
478 type: string;
479 additionalProperties: boolean;
480 properties: {
481 target: {
482 anyOf: (
483 | {
484 type: string;
485 items: {
486 type: string;
487 };
488 }
489 | {
490 type: string;
491 items?: undefined;
492 }
493 )[];
494 description: string;
495 };
496 app: {
497 anyOf: (
498 | {
499 type: string;
500 additionalProperties: boolean;
501 properties: {
502 name: {
503 anyOf: (
504 | {
505 type: string;
506 items: {
507 type: string;
508 minLength: number;
509 };
510 minItems: number;
511 minLength?: undefined;
512 }
513 | {
514 type: string;
515 minLength: number;
516 items?: undefined;
517 minItems?: undefined;
518 }
519 )[];
520 };
521 arguments: {
522 items: {
523 type: string;
524 minLength: number;
525 };
526 };
527 };
528 minLength?: undefined;
529 description?: undefined;
530 cli?: undefined;
531 }
532 | {
533 type: string;
534 minLength: number;
535 description: string;
536 cli: {
537 exclude: boolean;
538 };
539 additionalProperties?: undefined;
540 properties?: undefined;
541 }
542 )[];
543 description: string;
544 };
545 };
546 };
547 OpenString: {
548 type: string;
549 minLength: number;
550 };
551 Port: {
552 anyOf: (
553 | {
554 type: string;
555 minimum: number;
556 maximum: number;
557 minLength?: undefined;
558 enum?: undefined;
559 }
560 | {
561 type: string;
562 minLength: number;
563 minimum?: undefined;
564 maximum?: undefined;
565 enum?: undefined;
566 }
567 | {
568 enum: string[];
569 type?: undefined;
570 minimum?: undefined;
571 maximum?: undefined;
572 minLength?: undefined;
573 }
574 )[];
575 description: string;
576 link: string;
577 };
578 Proxy: {
579 type: string;
580 items: {
581 anyOf: (
582 | {
583 type: string;
584 instanceof?: undefined;
585 }
586 | {
587 instanceof: string;
588 type?: undefined;
589 }
590 )[];
591 };
592 description: string;
593 link: string;
594 };
595 Server: {
596 anyOf: {
597 $ref: string;
598 }[];
599 link: string;
600 description: string;
601 };
602 ServerType: {
603 enum: string[];
604 };
605 ServerFn: {
606 instanceof: string;
607 };
608 ServerEnum: {
609 enum: string[];
610 cli: {
611 exclude: boolean;
612 };
613 };
614 ServerString: {
615 type: string;
616 minLength: number;
617 cli: {
618 exclude: boolean;
619 };
620 };
621 ServerObject: {
622 type: string;
623 properties: {
624 type: {
625 anyOf: {
626 $ref: string;
627 }[];
628 };
629 options: {
630 $ref: string;
631 };
632 };
633 additionalProperties: boolean;
634 };
635 ServerOptions: {
636 type: string;
637 additionalProperties: boolean;
638 properties: {
639 passphrase: {
640 type: string;
641 description: string;
642 };
643 requestCert: {
644 type: string;
645 description: string;
646 cli: {
647 negatedDescription: string;
648 };
649 };
650 ca: {
651 anyOf: (
652 | {
653 type: string;
654 items: {
655 anyOf: (
656 | {
657 type: string;
658 instanceof?: undefined;
659 }
660 | {
661 instanceof: string;
662 type?: undefined;
663 }
664 )[];
665 };
666 instanceof?: undefined;
667 }
668 | {
669 type: string;
670 items?: undefined;
671 instanceof?: undefined;
672 }
673 | {
674 instanceof: string;
675 type?: undefined;
676 items?: undefined;
677 }
678 )[];
679 description: string;
680 };
681 cert: {
682 anyOf: (
683 | {
684 type: string;
685 items: {
686 anyOf: (
687 | {
688 type: string;
689 instanceof?: undefined;
690 }
691 | {
692 instanceof: string;
693 type?: undefined;
694 }
695 )[];
696 };
697 instanceof?: undefined;
698 }
699 | {
700 type: string;
701 items?: undefined;
702 instanceof?: undefined;
703 }
704 | {
705 instanceof: string;
706 type?: undefined;
707 items?: undefined;
708 }
709 )[];
710 description: string;
711 };
712 crl: {
713 anyOf: (
714 | {
715 type: string;
716 items: {
717 anyOf: (
718 | {
719 type: string;
720 instanceof?: undefined;
721 }
722 | {
723 instanceof: string;
724 type?: undefined;
725 }
726 )[];
727 };
728 instanceof?: undefined;
729 }
730 | {
731 type: string;
732 items?: undefined;
733 instanceof?: undefined;
734 }
735 | {
736 instanceof: string;
737 type?: undefined;
738 items?: undefined;
739 }
740 )[];
741 description: string;
742 };
743 key: {
744 anyOf: (
745 | {
746 type: string;
747 items: {
748 anyOf: (
749 | {
750 type: string;
751 instanceof?: undefined;
752 additionalProperties?: undefined;
753 }
754 | {
755 instanceof: string;
756 type?: undefined;
757 additionalProperties?: undefined;
758 }
759 | {
760 type: string;
761 additionalProperties: boolean;
762 instanceof?: undefined;
763 }
764 )[];
765 };
766 instanceof?: undefined;
767 }
768 | {
769 type: string;
770 items?: undefined;
771 instanceof?: undefined;
772 }
773 | {
774 instanceof: string;
775 type?: undefined;
776 items?: undefined;
777 }
778 )[];
779 description: string;
780 };
781 pfx: {
782 anyOf: (
783 | {
784 type: string;
785 items: {
786 anyOf: (
787 | {
788 type: string;
789 instanceof?: undefined;
790 additionalProperties?: undefined;
791 }
792 | {
793 instanceof: string;
794 type?: undefined;
795 additionalProperties?: undefined;
796 }
797 | {
798 type: string;
799 additionalProperties: boolean;
800 instanceof?: undefined;
801 }
802 )[];
803 };
804 instanceof?: undefined;
805 }
806 | {
807 type: string;
808 items?: undefined;
809 instanceof?: undefined;
810 }
811 | {
812 instanceof: string;
813 type?: undefined;
814 items?: undefined;
815 }
816 )[];
817 description: string;
818 };
819 };
820 };
821 SetupExitSignals: {
822 type: string;
823 description: string;
824 link: string;
825 cli: {
826 exclude: boolean;
827 };
828 };
829 SetupMiddlewares: {
830 instanceof: string;
831 description: string;
832 link: string;
833 };
834 Static: {
835 anyOf: (
836 | {
837 type: string;
838 items: {
839 anyOf: {
840 $ref: string;
841 }[];
842 };
843 cli?: undefined;
844 $ref?: undefined;
845 }
846 | {
847 type: string;
848 cli: {
849 negatedDescription: string;
850 };
851 items?: undefined;
852 $ref?: undefined;
853 }
854 | {
855 $ref: string;
856 type?: undefined;
857 items?: undefined;
858 cli?: undefined;
859 }
860 )[];
861 description: string;
862 link: string;
863 };
864 StaticObject: {
865 type: string;
866 additionalProperties: boolean;
867 properties: {
868 directory: {
869 type: string;
870 minLength: number;
871 description: string;
872 link: string;
873 };
874 staticOptions: {
875 type: string;
876 link: string;
877 additionalProperties: boolean;
878 };
879 publicPath: {
880 anyOf: (
881 | {
882 type: string;
883 items: {
884 type: string;
885 };
886 minItems: number;
887 }
888 | {
889 type: string;
890 items?: undefined;
891 minItems?: undefined;
892 }
893 )[];
894 description: string;
895 link: string;
896 };
897 serveIndex: {
898 anyOf: (
899 | {
900 type: string;
901 cli: {
902 negatedDescription: string;
903 };
904 additionalProperties?: undefined;
905 }
906 | {
907 type: string;
908 additionalProperties: boolean;
909 cli?: undefined;
910 }
911 )[];
912 description: string;
913 link: string;
914 };
915 watch: {
916 anyOf: (
917 | {
918 type: string;
919 cli: {
920 negatedDescription: string;
921 };
922 description?: undefined;
923 link?: undefined;
924 }
925 | {
926 type: string;
927 description: string;
928 link: string;
929 cli?: undefined;
930 }
931 )[];
932 description: string;
933 link: string;
934 };
935 };
936 };
937 StaticString: {
938 type: string;
939 minLength: number;
940 };
941 WatchFiles: {
942 anyOf: (
943 | {
944 type: string;
945 items: {
946 anyOf: {
947 $ref: string;
948 }[];
949 };
950 $ref?: undefined;
951 }
952 | {
953 $ref: string;
954 type?: undefined;
955 items?: undefined;
956 }
957 )[];
958 description: string;
959 link: string;
960 };
961 WatchFilesObject: {
962 cli: {
963 exclude: boolean;
964 };
965 type: string;
966 properties: {
967 paths: {
968 anyOf: (
969 | {
970 type: string;
971 items: {
972 type: string;
973 minLength: number;
974 };
975 minLength?: undefined;
976 }
977 | {
978 type: string;
979 minLength: number;
980 items?: undefined;
981 }
982 )[];
983 description: string;
984 };
985 options: {
986 type: string;
987 description: string;
988 link: string;
989 additionalProperties: boolean;
990 };
991 };
992 additionalProperties: boolean;
993 };
994 WatchFilesString: {
995 type: string;
996 minLength: number;
997 };
998 WebSocketServer: {
999 anyOf: {
1000 $ref: string;
1001 }[];
1002 description: string;
1003 link: string;
1004 };
1005 WebSocketServerType: {
1006 enum: string[];
1007 };
1008 WebSocketServerEnum: {
1009 anyOf: (
1010 | {
1011 enum: boolean[];
1012 cli: {
1013 negatedDescription: string;
1014 exclude?: undefined;
1015 };
1016 }
1017 | {
1018 enum: string[];
1019 cli: {
1020 exclude: boolean;
1021 negatedDescription?: undefined;
1022 };
1023 }
1024 )[];
1025 };
1026 WebSocketServerFunction: {
1027 instanceof: string;
1028 };
1029 WebSocketServerObject: {
1030 type: string;
1031 properties: {
1032 type: {
1033 anyOf: {
1034 $ref: string;
1035 }[];
1036 };
1037 options: {
1038 type: string;
1039 additionalProperties: boolean;
1040 cli: {
1041 exclude: boolean;
1042 };
1043 };
1044 };
1045 additionalProperties: boolean;
1046 };
1047 WebSocketServerString: {
1048 type: string;
1049 minLength: number;
1050 cli: {
1051 exclude: boolean;
1052 };
1053 };
1054 };
1055 additionalProperties: boolean;
1056 properties: {
1057 allowedHosts: {
1058 $ref: string;
1059 };
1060 bonjour: {
1061 $ref: string;
1062 };
1063 client: {
1064 $ref: string;
1065 };
1066 compress: {
1067 $ref: string;
1068 };
1069 devMiddleware: {
1070 $ref: string;
1071 };
1072 headers: {
1073 $ref: string;
1074 };
1075 historyApiFallback: {
1076 $ref: string;
1077 };
1078 host: {
1079 $ref: string;
1080 };
1081 hot: {
1082 $ref: string;
1083 };
1084 ipc: {
1085 $ref: string;
1086 };
1087 liveReload: {
1088 $ref: string;
1089 };
1090 onListening: {
1091 $ref: string;
1092 };
1093 open: {
1094 $ref: string;
1095 };
1096 port: {
1097 $ref: string;
1098 };
1099 proxy: {
1100 $ref: string;
1101 };
1102 server: {
1103 $ref: string;
1104 };
1105 app: {
1106 $ref: string;
1107 };
1108 setupExitSignals: {
1109 $ref: string;
1110 };
1111 setupMiddlewares: {
1112 $ref: string;
1113 };
1114 static: {
1115 $ref: string;
1116 };
1117 watchFiles: {
1118 $ref: string;
1119 };
1120 webSocketServer: {
1121 $ref: string;
1122 };
1123 };
1124 };
1125 /**
1126 * @param {string} URL
1127 * @returns {boolean}
1128 */
1129 static isAbsoluteURL(URL: string): boolean;
1130 /**
1131 * @param {string} gatewayOrFamily or family
1132 * @param {boolean} [isInternal] ip should be internal
1133 * @returns {string | undefined}
1134 */
1135 static findIp(
1136 gatewayOrFamily: string,
1137 isInternal?: boolean | undefined,
1138 ): string | undefined;
1139 /**
1140 * @param {"v4" | "v6"} family
1141 * @returns {Promise<string | undefined>}
1142 */
1143 static internalIP(family: "v4" | "v6"): Promise<string | undefined>;
1144 /**
1145 * @param {"v4" | "v6"} family
1146 * @returns {string | undefined}
1147 */
1148 static internalIPSync(family: "v4" | "v6"): string | undefined;
1149 /**
1150 * @param {Host} hostname
1151 * @returns {Promise<string>}
1152 */
1153 static getHostname(hostname: Host): Promise<string>;
1154 /**
1155 * @param {Port} port
1156 * @param {string} host
1157 * @returns {Promise<number | string>}
1158 */
1159 static getFreePort(port: Port, host: string): Promise<number | string>;
1160 /**
1161 * @returns {string}
1162 */
1163 static findCacheDir(): string;
1164 /**
1165 * @private
1166 * @param {Compiler} compiler
1167 * @returns bool
1168 */
1169 private static isWebTarget;
1170 /**
1171 * @param {Configuration<A, S>} options
1172 * @param {Compiler | MultiCompiler} compiler
1173 */
1174 constructor(
1175 options: Configuration<A, S> | undefined,
1176 compiler: Compiler | MultiCompiler,
1177 );
1178 compiler: import("webpack").Compiler | import("webpack").MultiCompiler;
1179 /**
1180 * @type {ReturnType<Compiler["getInfrastructureLogger"]>}
1181 * */
1182 logger: ReturnType<Compiler["getInfrastructureLogger"]>;
1183 options: Configuration<A, S>;
1184 /**
1185 * @type {FSWatcher[]}
1186 */
1187 staticWatchers: FSWatcher[];
1188 /**
1189 * @private
1190 * @type {{ name: string | symbol, listener: (...args: any[]) => void}[] }}
1191 */
1192 private listeners;
1193 /**
1194 * @private
1195 * @type {RequestHandler[]}
1196 */
1197 private webSocketProxies;
1198 /**
1199 * @type {Socket[]}
1200 */
1201 sockets: Socket[];
1202 /**
1203 * @private
1204 * @type {string | undefined}
1205 */
1206 private currentHash;
1207 /**
1208 * @private
1209 * @param {Compiler} compiler
1210 */
1211 private addAdditionalEntries;
1212 /**
1213 * @private
1214 * @returns {Compiler["options"]}
1215 */
1216 private getCompilerOptions;
1217 /**
1218 * @private
1219 * @returns {Promise<void>}
1220 */
1221 private normalizeOptions;
1222 /**
1223 * @private
1224 * @returns {string}
1225 */
1226 private getClientTransport;
1227 /**
1228 * @template T
1229 * @private
1230 * @returns {T}
1231 */
1232 private getServerTransport;
1233 /**
1234 * @private
1235 * @returns {void}
1236 */
1237 private setupProgressPlugin;
1238 /**
1239 * @private
1240 * @returns {Promise<void>}
1241 */
1242 private initialize;
1243 /**
1244 * @private
1245 * @returns {Promise<void>}
1246 */
1247 private setupApp;
1248 /** @type {A | undefined}*/
1249 app: A | undefined;
1250 /**
1251 * @private
1252 * @param {Stats | MultiStats} statsObj
1253 * @returns {StatsCompilation}
1254 */
1255 private getStats;
1256 /**
1257 * @private
1258 * @returns {void}
1259 */
1260 private setupHooks;
1261 /**
1262 * @private
1263 * @type {Stats | MultiStats}
1264 */
1265 private stats;
1266 /**
1267 * @private
1268 * @returns {void}
1269 */
1270 private setupWatchStaticFiles;
1271 /**
1272 * @private
1273 * @returns {void}
1274 */
1275 private setupWatchFiles;
1276 /**
1277 * @private
1278 * @returns {void}
1279 */
1280 private setupMiddlewares;
1281 /** @type {import("webpack-dev-middleware").API<Request, Response>} */
1282 middleware:
1283 | import("webpack-dev-middleware").API<
1284 import("express").Request<
1285 import("express-serve-static-core").ParamsDictionary,
1286 any,
1287 any,
1288 qs.ParsedQs,
1289 Record<string, any>
1290 >,
1291 import("express").Response<any, Record<string, any>>
1292 >
1293 | undefined;
1294 /**
1295 * @private
1296 * @returns {Promise<void>}
1297 */
1298 private createServer;
1299 /** @type {S | undefined}*/
1300 server: S | undefined;
1301 isTlsServer: boolean | undefined;
1302 /**
1303 * @private
1304 * @returns {void}
1305 */
1306 private createWebSocketServer;
1307 /** @type {WebSocketServerImplementation | undefined | null} */
1308 webSocketServer: WebSocketServerImplementation | undefined | null;
1309 /**
1310 * @private
1311 * @param {string} defaultOpenTarget
1312 * @returns {Promise<void>}
1313 */
1314 private openBrowser;
1315 /**
1316 * @private
1317 * @returns {void}
1318 */
1319 private runBonjour;
1320 /**
1321 * @private
1322 * @type {Bonjour | undefined}
1323 */
1324 private bonjour;
1325 /**
1326 * @private
1327 * @returns {void}
1328 */
1329 private stopBonjour;
1330 /**
1331 * @private
1332 * @returns {Promise<void>}
1333 */
1334 private logStatus;
1335 /**
1336 * @private
1337 * @param {Request} req
1338 * @param {Response} res
1339 * @param {NextFunction} next
1340 */
1341 private setHeaders;
1342 /**
1343 * @private
1344 * @param {{ [key: string]: string | undefined }} headers
1345 * @param {string} headerToCheck
1346 * @returns {boolean}
1347 */
1348 private checkHeader;
1349 /**
1350 * @param {ClientConnection[]} clients
1351 * @param {string} type
1352 * @param {any} [data]
1353 * @param {any} [params]
1354 */
1355 sendMessage(
1356 clients: ClientConnection[],
1357 type: string,
1358 data?: any,
1359 params?: any,
1360 ): void;
1361 /**
1362 * @private
1363 * @param {ClientConnection[]} clients
1364 * @param {StatsCompilation} stats
1365 * @param {boolean} [force]
1366 */
1367 private sendStats;
1368 /**
1369 * @param {string | string[]} watchPath
1370 * @param {WatchOptions} [watchOptions]
1371 */
1372 watchFiles(
1373 watchPath: string | string[],
1374 watchOptions?: import("chokidar").WatchOptions | undefined,
1375 ): void;
1376 /**
1377 * @param {import("webpack-dev-middleware").Callback} [callback]
1378 */
1379 invalidate(
1380 callback?: import("webpack-dev-middleware").Callback | undefined,
1381 ): void;
1382 /**
1383 * @returns {Promise<void>}
1384 */
1385 start(): Promise<void>;
1386 /**
1387 * @param {(err?: Error) => void} [callback]
1388 */
1389 startCallback(callback?: ((err?: Error) => void) | undefined): void;
1390 /**
1391 * @returns {Promise<void>}
1392 */
1393 stop(): Promise<void>;
1394 /**
1395 * @param {(err?: Error) => void} [callback]
1396 */
1397 stopCallback(callback?: ((err?: Error) => void) | undefined): void;
1398}
1399declare namespace Server {
1400 export {
1401 DEFAULT_STATS,
1402 Schema,
1403 Compiler,
1404 MultiCompiler,
1405 WebpackConfiguration,
1406 StatsOptions,
1407 StatsCompilation,
1408 Stats,
1409 MultiStats,
1410 NetworkInterfaceInfo,
1411 WatchOptions,
1412 FSWatcher,
1413 ConnectHistoryApiFallbackOptions,
1414 Bonjour,
1415 BonjourOptions,
1416 RequestHandler,
1417 HttpProxyMiddlewareOptions,
1418 HttpProxyMiddlewareOptionsFilter,
1419 ServeIndexOptions,
1420 ServeStaticOptions,
1421 IPv4,
1422 IPv6,
1423 Socket,
1424 HTTPServer,
1425 IncomingMessage,
1426 ServerResponse,
1427 OpenOptions,
1428 ExpressApplication,
1429 ExpressRequestHandler,
1430 ExpressErrorRequestHandler,
1431 ExpressRequest,
1432 ExpressResponse,
1433 NextFunction,
1434 SimpleHandleFunction,
1435 NextHandleFunction,
1436 ErrorHandleFunction,
1437 HandleFunction,
1438 ServerOptions,
1439 Request,
1440 Response,
1441 DevMiddlewareOptions,
1442 DevMiddlewareContext,
1443 Host,
1444 Port,
1445 WatchFiles,
1446 Static,
1447 NormalizedStatic,
1448 ServerType,
1449 ServerConfiguration,
1450 WebSocketServerConfiguration,
1451 ClientConnection,
1452 WebSocketServer,
1453 WebSocketServerImplementation,
1454 ByPass,
1455 ProxyConfigArrayItem,
1456 ProxyConfigArray,
1457 OpenApp,
1458 Open,
1459 NormalizedOpen,
1460 WebSocketURL,
1461 OverlayMessageOptions,
1462 ClientConfiguration,
1463 Headers,
1464 MiddlewareHandler,
1465 MiddlewareObject,
1466 Middleware,
1467 BasicServer,
1468 Configuration,
1469 BasicApplication,
1470 };
1471}
1472declare class DEFAULT_STATS {
1473 private constructor();
1474}
1475type Schema = import("schema-utils/declarations/validate").Schema;
1476type Compiler = import("webpack").Compiler;
1477type MultiCompiler = import("webpack").MultiCompiler;
1478type WebpackConfiguration = import("webpack").Configuration;
1479type StatsOptions = import("webpack").StatsOptions;
1480type StatsCompilation = import("webpack").StatsCompilation;
1481type Stats = import("webpack").Stats;
1482type MultiStats = import("webpack").MultiStats;
1483type NetworkInterfaceInfo = import("os").NetworkInterfaceInfo;
1484type WatchOptions = import("chokidar").WatchOptions;
1485type FSWatcher = import("chokidar").FSWatcher;
1486type ConnectHistoryApiFallbackOptions =
1487 import("connect-history-api-fallback").Options;
1488type Bonjour = import("bonjour-service").Bonjour;
1489type BonjourOptions = import("bonjour-service").Service;
1490type RequestHandler = import("http-proxy-middleware").RequestHandler;
1491type HttpProxyMiddlewareOptions = import("http-proxy-middleware").Options;
1492type HttpProxyMiddlewareOptionsFilter = import("http-proxy-middleware").Filter;
1493type ServeIndexOptions = import("serve-index").Options;
1494type ServeStaticOptions = import("serve-static").ServeStaticOptions;
1495type IPv4 = import("ipaddr.js").IPv4;
1496type IPv6 = import("ipaddr.js").IPv6;
1497type Socket = import("net").Socket;
1498type HTTPServer = import("http").Server;
1499type IncomingMessage = import("http").IncomingMessage;
1500type ServerResponse = import("http").ServerResponse;
1501type OpenOptions = import("open").Options;
1502type ExpressApplication = import("express").Application;
1503type ExpressRequestHandler = import("express").RequestHandler;
1504type ExpressErrorRequestHandler = import("express").ErrorRequestHandler;
1505type ExpressRequest = import("express").Request;
1506type ExpressResponse = import("express").Response;
1507type NextFunction = (err?: any) => void;
1508type SimpleHandleFunction = (req: IncomingMessage, res: ServerResponse) => void;
1509type NextHandleFunction = (
1510 req: IncomingMessage,
1511 res: ServerResponse,
1512 next: NextFunction,
1513) => void;
1514type ErrorHandleFunction = (
1515 err: any,
1516 req: IncomingMessage,
1517 res: ServerResponse,
1518 next: NextFunction,
1519) => void;
1520type HandleFunction =
1521 | SimpleHandleFunction
1522 | NextHandleFunction
1523 | ErrorHandleFunction;
1524type ServerOptions = import("https").ServerOptions & {
1525 spdy?: {
1526 plain?: boolean | undefined;
1527 ssl?: boolean | undefined;
1528 "x-forwarded-for"?: string | undefined;
1529 protocol?: string | undefined;
1530 protocols?: string[] | undefined;
1531 };
1532};
1533type Request<T extends BasicApplication = import("express").Application> =
1534 T extends ExpressApplication ? ExpressRequest : IncomingMessage;
1535type Response<T extends BasicApplication = import("express").Application> =
1536 T extends ExpressApplication ? ExpressResponse : ServerResponse;
1537type DevMiddlewareOptions<
1538 T extends Request,
1539 U extends Response,
1540> = import("webpack-dev-middleware").Options<T, U>;
1541type DevMiddlewareContext<
1542 T extends Request,
1543 U extends Response,
1544> = import("webpack-dev-middleware").Context<T, U>;
1545type Host = "local-ip" | "local-ipv4" | "local-ipv6" | string;
1546type Port = number | string | "auto";
1547type WatchFiles = {
1548 paths: string | string[];
1549 options?:
1550 | (import("chokidar").WatchOptions & {
1551 aggregateTimeout?: number;
1552 ignored?: WatchOptions["ignored"];
1553 poll?: number | boolean;
1554 })
1555 | undefined;
1556};
1557type Static = {
1558 directory?: string | undefined;
1559 publicPath?: string | string[] | undefined;
1560 serveIndex?: boolean | import("serve-index").Options | undefined;
1561 staticOptions?:
1562 | import("serve-static").ServeStaticOptions<
1563 import("http").ServerResponse<import("http").IncomingMessage>
1564 >
1565 | undefined;
1566 watch?:
1567 | boolean
1568 | (import("chokidar").WatchOptions & {
1569 aggregateTimeout?: number;
1570 ignored?: WatchOptions["ignored"];
1571 poll?: number | boolean;
1572 })
1573 | undefined;
1574};
1575type NormalizedStatic = {
1576 directory: string;
1577 publicPath: string[];
1578 serveIndex: false | ServeIndexOptions;
1579 staticOptions: ServeStaticOptions;
1580 watch: false | WatchOptions;
1581};
1582type ServerType<
1583 A extends BasicApplication = import("express").Application,
1584 S extends BasicServer = import("http").Server<
1585 typeof import("http").IncomingMessage,
1586 typeof import("http").ServerResponse
1587 >,
1588> =
1589 | "http"
1590 | "https"
1591 | "spdy"
1592 | "http2"
1593 | string
1594 | ((arg0: ServerOptions, arg1: A) => S);
1595type ServerConfiguration<
1596 A extends BasicApplication = import("express").Application,
1597 S extends BasicServer = import("http").Server<
1598 typeof import("http").IncomingMessage,
1599 typeof import("http").ServerResponse
1600 >,
1601> = {
1602 type?: ServerType<A, S> | undefined;
1603 options?: ServerOptions | undefined;
1604};
1605type WebSocketServerConfiguration = {
1606 type?: string | Function | undefined;
1607 options?: Record<string, any> | undefined;
1608};
1609type ClientConnection = (
1610 | import("ws").WebSocket
1611 | (import("sockjs").Connection & {
1612 send: import("ws").WebSocket["send"];
1613 terminate: import("ws").WebSocket["terminate"];
1614 ping: import("ws").WebSocket["ping"];
1615 })
1616) & {
1617 isAlive?: boolean;
1618};
1619type WebSocketServer =
1620 | import("ws").WebSocketServer
1621 | (import("sockjs").Server & {
1622 close: import("ws").WebSocketServer["close"];
1623 });
1624type WebSocketServerImplementation = {
1625 implementation: WebSocketServer;
1626 clients: ClientConnection[];
1627};
1628type ByPass = (
1629 req: Request,
1630 res: Response,
1631 proxyConfig: ProxyConfigArrayItem,
1632) => any;
1633type ProxyConfigArrayItem = {
1634 path?: HttpProxyMiddlewareOptionsFilter | undefined;
1635 context?: HttpProxyMiddlewareOptionsFilter | undefined;
1636} & {
1637 bypass?: ByPass;
1638} & HttpProxyMiddlewareOptions;
1639type ProxyConfigArray = (
1640 | ProxyConfigArrayItem
1641 | ((
1642 req?: Request | undefined,
1643 res?: Response | undefined,
1644 next?: NextFunction | undefined,
1645 ) => ProxyConfigArrayItem)
1646)[];
1647type OpenApp = {
1648 name?: string | undefined;
1649 arguments?: string[] | undefined;
1650};
1651type Open = {
1652 app?: string | string[] | OpenApp | undefined;
1653 target?: string | string[] | undefined;
1654};
1655type NormalizedOpen = {
1656 target: string;
1657 options: import("open").Options;
1658};
1659type WebSocketURL = {
1660 hostname?: string | undefined;
1661 password?: string | undefined;
1662 pathname?: string | undefined;
1663 port?: string | number | undefined;
1664 protocol?: string | undefined;
1665 username?: string | undefined;
1666};
1667type OverlayMessageOptions = boolean | ((error: Error) => void);
1668type ClientConfiguration = {
1669 logging?: "none" | "error" | "warn" | "info" | "log" | "verbose" | undefined;
1670 overlay?:
1671 | boolean
1672 | {
1673 warnings?: OverlayMessageOptions;
1674 errors?: OverlayMessageOptions;
1675 runtimeErrors?: OverlayMessageOptions;
1676 }
1677 | undefined;
1678 progress?: boolean | undefined;
1679 reconnect?: number | boolean | undefined;
1680 webSocketTransport?: string | undefined;
1681 webSocketURL?: string | WebSocketURL | undefined;
1682};
1683type Headers =
1684 | Array<{
1685 key: string;
1686 value: string;
1687 }>
1688 | Record<string, string | string[]>;
1689type MiddlewareHandler<
1690 T extends BasicApplication = import("express").Application,
1691> = T extends ExpressApplication
1692 ? ExpressRequestHandler | ExpressErrorRequestHandler
1693 : HandleFunction;
1694type MiddlewareObject = {
1695 name?: string;
1696 path?: string;
1697 middleware: MiddlewareHandler;
1698};
1699type Middleware = MiddlewareObject | MiddlewareHandler;
1700type BasicServer = import("net").Server | import("tls").Server;
1701type Configuration<
1702 A extends BasicApplication = import("express").Application,
1703 S extends BasicServer = import("http").Server<
1704 typeof import("http").IncomingMessage,
1705 typeof import("http").ServerResponse
1706 >,
1707> = {
1708 ipc?: string | boolean | undefined;
1709 host?: string | undefined;
1710 port?: Port | undefined;
1711 hot?: boolean | "only" | undefined;
1712 liveReload?: boolean | undefined;
1713 devMiddleware?:
1714 | DevMiddlewareOptions<
1715 import("express").Request<
1716 import("express-serve-static-core").ParamsDictionary,
1717 any,
1718 any,
1719 qs.ParsedQs,
1720 Record<string, any>
1721 >,
1722 import("express").Response<any, Record<string, any>>
1723 >
1724 | undefined;
1725 compress?: boolean | undefined;
1726 allowedHosts?: string | string[] | undefined;
1727 historyApiFallback?:
1728 | boolean
1729 | import("connect-history-api-fallback").Options
1730 | undefined;
1731 bonjour?:
1732 | boolean
1733 | Record<string, never>
1734 | import("bonjour-service").Service
1735 | undefined;
1736 watchFiles?:
1737 | string
1738 | string[]
1739 | WatchFiles
1740 | (string | WatchFiles)[]
1741 | undefined;
1742 static?: string | boolean | Static | (string | Static)[] | undefined;
1743 server?: ServerType<A, S> | ServerConfiguration<A, S> | undefined;
1744 app?: (() => Promise<A>) | undefined;
1745 webSocketServer?: string | boolean | WebSocketServerConfiguration | undefined;
1746 proxy?: ProxyConfigArray | undefined;
1747 open?: string | boolean | Open | (string | Open)[] | undefined;
1748 setupExitSignals?: boolean | undefined;
1749 client?: boolean | ClientConfiguration | undefined;
1750 headers?:
1751 | Headers
1752 | ((
1753 req: Request,
1754 res: Response,
1755 context: DevMiddlewareContext<Request, Response> | undefined,
1756 ) => Headers)
1757 | undefined;
1758 onListening?: ((devServer: Server<A, S>) => void) | undefined;
1759 setupMiddlewares?:
1760 | ((middlewares: Middleware[], devServer: Server<A, S>) => Middleware[])
1761 | undefined;
1762};
1763type BasicApplication = {
1764 use: typeof useFn;
1765};
1766/**
1767 * @overload
1768 * @param {NextHandleFunction} fn
1769 * @returns {BasicApplication}
1770 */
1771declare function useFn(fn: NextHandleFunction): BasicApplication;
1772/**
1773 * @overload
1774 * @param {HandleFunction} fn
1775 * @returns {BasicApplication}
1776 */
1777declare function useFn(fn: HandleFunction): BasicApplication;
1778/**
1779 * @overload
1780 * @param {string} route
1781 * @param {NextHandleFunction} fn
1782 * @returns {BasicApplication}
1783 */
1784declare function useFn(route: string, fn: NextHandleFunction): BasicApplication;
1785
1786// DO NOT REMOVE THIS!
1787type DevServerConfiguration = Configuration;
1788declare module "webpack" {
1789 interface Configuration {
1790 /**
1791 * Can be used to configure the behaviour of webpack-dev-server when
1792 * the webpack config is passed to webpack-dev-server CLI.
1793 */
1794 devServer?: DevServerConfiguration | undefined;
1795 }
1796}
1797
\No newline at end of file