UNPKG

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