diff --git a/package.json b/package.json index 2606e06..7f450eb 100644 --- a/package.json +++ b/package.json @@ -111,7 +111,6 @@ "selfsigned": "^2.4.1", "serve-index": "^1.9.2", "sockjs": "^0.3.24", - "spdy": "^4.0.2", "webpack-dev-middleware": "^7.4.5", "ws": "^8.19.0" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c3ee10e..8a043de 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -59,9 +59,6 @@ importers: sockjs: specifier: ^0.3.24 version: 0.3.24 - spdy: - specifier: ^4.0.2 - version: 4.0.2 webpack-dev-middleware: specifier: ^7.4.5 version: 7.4.5(tslib@2.8.1)(webpack@5.105.3) @@ -989,9 +986,6 @@ packages: core-js@3.47.0: resolution: {integrity: sha512-c3Q2VVkGAUyupsjRnaNX6u8Dq2vAdzm9iuPj5FW0fRxzlxgq9Q39MDq10IvmQSpLgHQNyQzQmOo6bgGHmH3NNg==} - core-util-is@1.0.3: - resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} - cosmiconfig@9.0.0: resolution: {integrity: sha512-itvL5h8RETACmOTFc4UfIyB2RfEHi71Ax6E/PivVxq9NseKbOWpeyHEOIbmAw1rs8Ak0VursQNww7lf7YtUwzg==} engines: {node: '>=14'} @@ -1080,9 +1074,6 @@ packages: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} engines: {node: '>= 0.8'} - detect-node@2.1.0: - resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==} - devtools-protocol@0.0.1566079: resolution: {integrity: sha512-MJfAEA1UfVhSs7fbSQOG4czavUp1ajfg6prlAN0+cmfa2zNjaIbvq8VneP7do1WAQQIvgNJWSMeP6UyI90gIlQ==} @@ -1312,9 +1303,6 @@ packages: graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - handle-thing@2.0.1: - resolution: {integrity: sha512-9Qn4yBxelxoh2Ow62nP+Ka/kMnOXRi8BXnRaUwezLNhqelnN49xKz4F/dPP8OYLxLxq6JDtZb2i9XznUQbNPTg==} - has-flag@3.0.0: resolution: {integrity: sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==} engines: {node: '>=4'} @@ -1335,15 +1323,9 @@ packages: resolution: {integrity: sha512-SFsVSjp8sj5UumXOOFlkZOG6XS9SJDKw0TbwFeV+AJ8xlST8kxK5Z/5EYa111UY8732lK2S/xB653ceuaoGwpg==} engines: {node: '>=16.9.0'} - hpack.js@2.1.6: - resolution: {integrity: sha512-zJxVehUdMGIKsRaNt7apO2Gqp0BdqW5yaiGHXXmbpvxgBYVZnAql+BJb4RO5ad2MgpbZKn5G6nMnegrH1FcNYQ==} - html-entities@2.6.0: resolution: {integrity: sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==} - http-deceiver@1.2.7: - resolution: {integrity: sha512-LmpOGxTfbpgtGVxJrj5k7asXHCgNZp5nLfp+hWc8QQRqtb7fUy6kRY3BO1h9ddF6yIPYUARgxGOwB42DnxIaNw==} - http-errors@1.8.1: resolution: {integrity: sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==} engines: {node: '>= 0.6'} @@ -1460,9 +1442,6 @@ packages: resolution: {integrity: sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==} engines: {node: '>=16'} - isarray@1.0.0: - resolution: {integrity: sha512-VLghIWNM6ELQzo7zwmcg0NmTVyWKYjvIeM83yjp0wRDTmUnrM678fQbcKBo6n2CJEF0szoG//ytg+TKla89ALQ==} - isexe@2.0.0: resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} @@ -1555,9 +1534,6 @@ packages: resolution: {integrity: sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==} engines: {node: '>=18'} - minimalistic-assert@1.0.1: - resolution: {integrity: sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==} - mitt@3.0.1: resolution: {integrity: sha512-vKivATfr97l2/QBCYAkXYDbrIWPM2IIKEl7YPhjCvKlG3kE2gm+uBo6nEXK3M5/Ffh/FLpKExzOQ3JJoJGFKBw==} @@ -1611,9 +1587,6 @@ packages: resolution: {integrity: sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==} engines: {node: '>= 0.4'} - obuf@1.1.2: - resolution: {integrity: sha512-PX1wu0AmAdPqOL1mWhqmlOd8kOIZQwGZw6rh7uby9fTc5lhaOWFLX3I6R1hrF9k3zUY40e6igsLGkDXK92LJNg==} - on-finished@2.3.0: resolution: {integrity: sha512-ikqdkGAAyf/X/gPhXGvfgAytDZtDbr+bkNUJ0N9h5MI/dmdgCs3l6hoHrcUv41sRKew3jIwrp4qQDXiK99Utww==} engines: {node: '>= 0.8'} @@ -1718,9 +1691,6 @@ packages: engines: {node: '>=14'} hasBin: true - process-nextick-args@2.0.1: - resolution: {integrity: sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==} - progress@2.0.3: resolution: {integrity: sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==} engines: {node: '>=0.4.0'} @@ -1770,13 +1740,6 @@ packages: resolution: {integrity: sha512-QgT5//D3jfjJb6Gsjxv0Slpj23ip+HtOpnNgnb2S5zU3CB26G/IDPGoy4RJB42wzFE46DRsstbW6tKHoKbhAxw==} engines: {node: '>=0.10.0'} - readable-stream@2.3.8: - resolution: {integrity: sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==} - - readable-stream@3.6.2: - resolution: {integrity: sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==} - engines: {node: '>= 6'} - readdirp@3.6.0: resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} engines: {node: '>=8.10.0'} @@ -1804,9 +1767,6 @@ packages: resolution: {integrity: sha512-9by4Ij99JUr/MCFBUkDKLWK3G9HVXmabKz9U5MlIAIuvuzkiOicRYs8XJLxX+xahD+mLiiCYDqF9dKAgtzKP1A==} engines: {node: '>=18'} - safe-buffer@5.1.2: - resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} - safe-buffer@5.2.1: resolution: {integrity: sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==} @@ -1817,9 +1777,6 @@ packages: resolution: {integrity: sha512-eflK8wEtyOE6+hsaRVPxvUKYCpRgzLqDTb8krvAsRIwOGlHoSgYLgBXoubGgLd2fT41/OUYdb48v4k4WWHQurA==} engines: {node: '>= 10.13.0'} - select-hose@2.0.0: - resolution: {integrity: sha512-mEugaLK+YfkijB4fx0e6kImuJdCIt2LxCRcbEYPqRGCs4F2ogyfZU5IAZRdjCP8JPq2AtdNoC/Dux63d9Kiryg==} - selfsigned@2.4.1: resolution: {integrity: sha512-th5B4L2U+eGLq1TVh7zNRGBapioSORUeymIydxgFpwww9d2qyKvtuPU2jJuHvYAwwqi2Y596QBL3eEqcPEYL8Q==} engines: {node: '>=10'} @@ -1918,13 +1875,6 @@ packages: resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} engines: {node: '>=0.10.0'} - spdy-transport@3.0.0: - resolution: {integrity: sha512-hsLVFE5SjA6TCisWeJXFKniGGOpBgMLmerfO2aCyCU5s7nJ/rpAepqmFifv/GCbSbueEeAJJnmSQ2rKC/g8Fcw==} - - spdy@4.0.2: - resolution: {integrity: sha512-r46gZQZQV+Kl9oItvl1JZZqJKGr+oEkB08A6BzkiR7593/7IbtuncXHd2YoYeTsG4157ZssMu9KYvUHLcjcDoA==} - engines: {node: '>=6.0.0'} - sprintf-js@1.1.3: resolution: {integrity: sha512-Oo+0REFV59/rz3gfJNKQiBlwfHaSESl1pcGyABQsnnIfWOFt6JNj5gCog2U6MLZ//IGYD+nA8nI+mTShREReaA==} @@ -1946,12 +1896,6 @@ packages: resolution: {integrity: sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==} engines: {node: '>=8'} - string_decoder@1.1.1: - resolution: {integrity: sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==} - - string_decoder@1.3.0: - resolution: {integrity: sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==} - strip-ansi@6.0.1: resolution: {integrity: sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==} engines: {node: '>=8'} @@ -2085,9 +2029,6 @@ packages: resolution: {integrity: sha512-Zn5uXdcFNIA1+1Ei5McRd+iRzfhENPCe7LeABkJtNulSxjma+l7ltNx55BWZkRlwRnpOgHqxnjyaDgJnNXnqzg==} engines: {node: '>=10.13.0'} - wbuf@1.7.3: - resolution: {integrity: sha512-O84QOnr0icsbFGLS0O3bI5FswxzRr8/gHwWkDlQFskhSPryQXvrTMxjxGP4+iWYoauLoBvfDpkrOauZ+0iZpDA==} - webdriver-bidi-protocol@0.4.1: resolution: {integrity: sha512-ARrjNjtWRRs2w4Tk7nqrf2gBI0QXWuOmMCx2hU+1jUt6d00MjMxURrhxhGbrsoiZKJrhTSTzbIrc554iKI10qw==} @@ -3023,8 +2964,6 @@ snapshots: core-js@3.47.0: {} - core-util-is@1.0.3: {} - cosmiconfig@9.0.0(typescript@5.9.3): dependencies: env-paths: 2.2.1 @@ -3094,8 +3033,6 @@ snapshots: depd@2.0.0: {} - detect-node@2.1.0: {} - devtools-protocol@0.0.1566079: {} dunder-proto@1.0.1: @@ -3342,8 +3279,6 @@ snapshots: graceful-fs@4.2.11: {} - handle-thing@2.0.1: {} - has-flag@3.0.0: {} has-flag@4.0.0: {} @@ -3356,17 +3291,8 @@ snapshots: hono@4.12.3: {} - hpack.js@2.1.6: - dependencies: - inherits: 2.0.4 - obuf: 1.1.2 - readable-stream: 2.3.8 - wbuf: 1.7.3 - html-entities@2.6.0: {} - http-deceiver@1.2.7: {} - http-errors@1.8.1: dependencies: depd: 1.1.2 @@ -3482,8 +3408,6 @@ snapshots: dependencies: is-inside-container: 1.0.0 - isarray@1.0.0: {} - isexe@2.0.0: {} isobject@3.0.1: {} @@ -3569,8 +3493,6 @@ snapshots: dependencies: mime-db: 1.54.0 - minimalistic-assert@1.0.1: {} - mitt@3.0.1: {} ms@2.0.0: {} @@ -3601,8 +3523,6 @@ snapshots: object-inspect@1.13.4: {} - obuf@1.1.2: {} - on-finished@2.3.0: dependencies: ee-first: 1.1.1 @@ -3709,8 +3629,6 @@ snapshots: prettier@3.8.1: {} - process-nextick-args@2.0.1: {} - progress@2.0.3: {} proxy-addr@2.0.7: @@ -3791,22 +3709,6 @@ snapshots: react-refresh@0.18.0: {} - readable-stream@2.3.8: - dependencies: - core-util-is: 1.0.3 - inherits: 2.0.4 - isarray: 1.0.0 - process-nextick-args: 2.0.1 - safe-buffer: 5.1.2 - string_decoder: 1.1.1 - util-deprecate: 1.0.2 - - readable-stream@3.6.2: - dependencies: - inherits: 2.0.4 - string_decoder: 1.3.0 - util-deprecate: 1.0.2 - readdirp@3.6.0: dependencies: picomatch: 2.3.1 @@ -3831,8 +3733,6 @@ snapshots: run-applescript@7.0.0: {} - safe-buffer@5.1.2: {} - safe-buffer@5.2.1: {} safer-buffer@2.1.2: {} @@ -3844,8 +3744,6 @@ snapshots: ajv-formats: 2.1.1(ajv@8.18.0) ajv-keywords: 5.1.0(ajv@8.18.0) - select-hose@2.0.0: {} - selfsigned@2.4.1: dependencies: '@types/node-forge': 1.3.14 @@ -3980,27 +3878,6 @@ snapshots: source-map@0.6.1: {} - spdy-transport@3.0.0: - dependencies: - debug: 4.4.3 - detect-node: 2.1.0 - hpack.js: 2.1.6 - obuf: 1.1.2 - readable-stream: 3.6.2 - wbuf: 1.7.3 - transitivePeerDependencies: - - supports-color - - spdy@4.0.2: - dependencies: - debug: 4.4.3 - handle-thing: 2.0.1 - http-deceiver: 1.2.7 - select-hose: 2.0.0 - spdy-transport: 3.0.0 - transitivePeerDependencies: - - supports-color - sprintf-js@1.1.3: {} stackframe@1.3.4: {} @@ -4023,14 +3900,6 @@ snapshots: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 - string_decoder@1.1.1: - dependencies: - safe-buffer: 5.1.2 - - string_decoder@1.3.0: - dependencies: - safe-buffer: 5.2.1 - strip-ansi@6.0.1: dependencies: ansi-regex: 5.0.1 @@ -4148,10 +4017,6 @@ snapshots: glob-to-regexp: 0.4.1 graceful-fs: 4.2.11 - wbuf@1.7.3: - dependencies: - minimalistic-assert: 1.0.1 - webdriver-bidi-protocol@0.4.1: {} webpack-dev-middleware@7.4.5(tslib@2.8.1)(webpack@5.105.3): diff --git a/src/server.ts b/src/server.ts index 9edec85..b5b47c8 100644 --- a/src/server.ts +++ b/src/server.ts @@ -893,18 +893,7 @@ class Server< const serverOptions = options.server.options as ServerOptions; - if ( - options.server.type === 'spdy' && - typeof serverOptions.spdy === 'undefined' - ) { - serverOptions.spdy = { protocols: ['h2', 'http/1.1'] }; - } - - if ( - options.server.type === 'https' || - options.server.type === 'http2' || - options.server.type === 'spdy' - ) { + if (options.server.type === 'https' || options.server.type === 'http2') { if (typeof serverOptions.requestCert === 'undefined') { serverOptions.requestCert = false; } diff --git a/src/types.ts b/src/types.ts index 553de3e..3740856 100644 --- a/src/types.ts +++ b/src/types.ts @@ -64,15 +64,7 @@ export type HandleFunction = | NextHandleFunction | ErrorHandleFunction; -export type ServerOptions = import('https').ServerOptions & { - spdy?: { - plain?: boolean; - ssl?: boolean; - 'x-forwarded-for'?: string; - protocol?: string; - protocols?: string[]; - }; -}; +export type ServerOptions = import('https').ServerOptions; // type-level helpers, inferred as util types export type Request = @@ -129,7 +121,6 @@ export type ServerType< > = | 'http' | 'https' - | 'spdy' | 'http2' | string | ((serverOptions: ServerOptions, application: A) => S); diff --git a/tests/e2e/__snapshots__/app.test.js.snap b/tests/e2e/__snapshots__/app.test.js.snap index dfc200f..4192861 100644 --- a/tests/e2e/__snapshots__/app.test.js.snap +++ b/tests/e2e/__snapshots__/app.test.js.snap @@ -112,34 +112,6 @@ exports[`app option > should work using "connect" application and "https" server " `; -exports[`app option > should work using "connect" application and "spdy" server > should handle GET request to index route (/) > console messages 1`] = ` -[ - "[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`app option > should work using "connect" application and "spdy" server > should handle GET request to index route (/) > page errors 1`] = `[]`; - -exports[`app option > should work using "connect" application and "spdy" server > should handle GET request to index route (/) > response status 1`] = `200`; - -exports[`app option > should work using "connect" application and "spdy" server > should handle GET request to index route (/) > response text 1`] = ` -" - - - - - webpack-dev-server - - -

webpack-dev-server is running...

- - - -" -`; - exports[`app option > should work using "express" application and "http" server > should handle GET request to index route (/) > console messages 1`] = ` [ "[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", @@ -196,34 +168,6 @@ exports[`app option > should work using "express" application and "https" server " `; -exports[`app option > should work using "express" application and "spdy" server > should handle GET request to index route (/) > console messages 1`] = ` -[ - "[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", - "[HMR] Waiting for update signal from WDS...", - "Hey.", -] -`; - -exports[`app option > should work using "express" application and "spdy" server > should handle GET request to index route (/) > page errors 1`] = `[]`; - -exports[`app option > should work using "express" application and "spdy" server > should handle GET request to index route (/) > response status 1`] = `200`; - -exports[`app option > should work using "express" application and "spdy" server > should handle GET request to index route (/) > response text 1`] = ` -" - - - - - webpack-dev-server - - -

webpack-dev-server is running...

- - - -" -`; - exports[`app option > should work using "hono" application and "[object Object]" server > should handle GET request to index route (/) > console messages 1`] = ` [ "[rspack-dev-server] Server started: Hot Module Replacement enabled, Live Reloading enabled, Progress disabled, Overlay enabled.", diff --git a/tests/e2e/__snapshots__/server.test.js.snap b/tests/e2e/__snapshots__/server.test.js.snap index cf4691e..ded64ba 100644 --- a/tests/e2e/__snapshots__/server.test.js.snap +++ b/tests/e2e/__snapshots__/server.test.js.snap @@ -523,42 +523,6 @@ exports[`server option > as object > should support the "requestCert" option > s } `; -exports[`server option > as object > spdy server with options > should handle GET request to index route (/) > console messages 1`] = `[]`; - -exports[`server option > as object > spdy server with options > should handle GET request to index route (/) > https options 1`] = ` -{ - "ca": [ - "", - ], - "cert": [ - "", - ], - "key": [ - "", - ], - "passphrase": "webpack-dev-server", - "pfx": [ - "", - ], - "requestCert": false, - "spdy": { - "protocols": [ - "h2", - "http/1.1", - ], - }, -} -`; - -exports[`server option > as object > spdy server with options > should handle GET request to index route (/) > page errors 1`] = `[]`; - -exports[`server option > as object > spdy server with options > should handle GET request to index route (/) > response status 1`] = `200`; - -exports[`server option > as object > spdy server with options > should handle GET request to index route (/) > response text 1`] = ` -"Heyo. -" -`; - exports[`server option > as string > custom-http > should handle GET request to index route (/) > console messages 1`] = `[]`; exports[`server option > as string > custom-http > should handle GET request to index route (/) > page errors 1`] = `[]`; @@ -591,14 +555,3 @@ exports[`server option > as string > https > should handle GET request to index "Heyo. " `; - -exports[`server option > as string > spdy > should handle GET request to index route (/) > console messages 1`] = `[]`; - -exports[`server option > as string > spdy > should handle GET request to index route (/) > page errors 1`] = `[]`; - -exports[`server option > as string > spdy > should handle GET request to index route (/) > response status 1`] = `200`; - -exports[`server option > as string > spdy > should handle GET request to index route (/) > response text 1`] = ` -"Heyo. -" -`; diff --git a/tests/e2e/app.test.js b/tests/e2e/app.test.js index d74f351..14a5dd7 100644 --- a/tests/e2e/app.test.js +++ b/tests/e2e/app.test.js @@ -15,10 +15,8 @@ const staticDirectory = path.resolve( const apps = [ ['express', () => require('express')(), 'http'], ['express', () => require('express')(), 'https'], - ['express', () => require('express')(), 'spdy'], ['connect', () => require('connect')(), 'http'], ['connect', () => require('connect')(), 'https'], - ['connect', () => require('connect')(), 'spdy'], ['connect', () => require('connect')(), 'http2'], ['connect (async)', () => require('connect')(), 'http'], [ @@ -157,11 +155,7 @@ describe('app option', () => { () => performance.getEntries()[0].nextHopProtocol, ); - if ( - server === 'spdy' || - server === 'http2' || - server.options?.allowHTTP1 - ) { + if (server === 'http2' || server.options?.allowHTTP1) { expect(HTTPVersion).toEqual('h2'); } else { expect(HTTPVersion).toEqual('http/1.1'); diff --git a/tests/e2e/server.test.js b/tests/e2e/server.test.js index 3834021..b756db9 100644 --- a/tests/e2e/server.test.js +++ b/tests/e2e/server.test.js @@ -1,7 +1,6 @@ const https = require('node:https'); const path = require('node:path'); const fs = require('node:fs'); -const spdy = require('spdy'); const { rspack } = require('@rspack/core'); const { RspackDevServer: Server } = require('@rspack/dev-server'); const config = require('../fixtures/static-config/webpack.config'); @@ -210,66 +209,6 @@ describe('server option', () => { expect(pageErrors).toMatchSnapshot('page errors'); }); }); - - describe('spdy', () => { - beforeEach(async () => { - compiler = rspack(config); - - server = new Server( - { - static: { - directory: staticDirectory, - watch: false, - }, - server: 'spdy', - port, - }, - compiler, - ); - - await server.start(); - - ({ page, browser } = await runBrowser()); - - pageErrors = []; - consoleMessages = []; - }); - - afterEach(async () => { - await browser.close(); - await server.stop(); - }); - - it('should handle GET request to index route (/)', async () => { - page - .on('console', (message) => { - consoleMessages.push(message); - }) - .on('pageerror', (error) => { - pageErrors.push(error); - }); - - const response = await page.goto(`https://127.0.0.1:${port}/`, { - waitUntil: 'networkidle0', - }); - - const HTTPVersion = await page.evaluate( - () => performance.getEntries()[0].nextHopProtocol, - ); - - expect(HTTPVersion).toEqual('h2'); - - expect(response.status()).toMatchSnapshot('response status'); - - expect(await response.text()).toMatchSnapshot('response text'); - - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot('console messages'); - - expect(pageErrors).toMatchSnapshot('page errors'); - }); - }); }); describe('as object', () => { @@ -1279,87 +1218,6 @@ describe('server option', () => { }); }); - describe('spdy server with options', () => { - let compiler; - let server; - let createServerSpy; - let page; - let browser; - let pageErrors; - let consoleMessages; - - beforeEach(async () => { - compiler = rspack(config); - - createServerSpy = rs.spyOn(spdy, 'createServer'); - - server = new Server( - { - static: { - directory: staticDirectory, - watch: false, - }, - server: { - type: 'spdy', - options: { - requestCert: false, - ca: [path.join(httpsCertificateDirectory, 'ca.pem')], - pfx: [path.join(httpsCertificateDirectory, 'server.pfx')], - key: [path.join(httpsCertificateDirectory, 'server.key')], - cert: [path.join(httpsCertificateDirectory, 'server.crt')], - passphrase: 'webpack-dev-server', - }, - }, - port, - }, - compiler, - ); - - await server.start(); - - ({ page, browser } = await runBrowser()); - - pageErrors = []; - consoleMessages = []; - }); - - afterEach(async () => { - createServerSpy.mockRestore(); - - await browser.close(); - await server.stop(); - }); - - it('should handle GET request to index route (/)', async () => { - page - .on('console', (message) => { - consoleMessages.push(message); - }) - .on('pageerror', (error) => { - pageErrors.push(error); - }); - - const response = await page.goto(`https://127.0.0.1:${port}/`, { - waitUntil: 'networkidle0', - }); - - const HTTPVersion = await page.evaluate( - () => performance.getEntries()[0].nextHopProtocol, - ); - - expect(HTTPVersion).toEqual('h2'); - expect( - normalizeOptions(createServerSpy.mock.calls[0][0]), - ).toMatchSnapshot('https options'); - expect(response.status()).toMatchSnapshot('response status'); - expect(await response.text()).toMatchSnapshot('response text'); - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot('console messages'); - expect(pageErrors).toMatchSnapshot('page errors'); - }); - }); - describe('custom server with options', () => { let compiler; let server; diff --git a/tests/e2e/web-socket-server-url.test.js b/tests/e2e/web-socket-server-url.test.js index 3736362..14a17f0 100644 --- a/tests/e2e/web-socket-server-url.test.js +++ b/tests/e2e/web-socket-server-url.test.js @@ -2284,82 +2284,6 @@ describe('web socket server URL', () => { } }); - it(`should work with "server: 'spdy'" option ("${webSocketServer}")`, async () => { - const hostname = '127.0.0.1'; - const compiler = rspack(config); - const devServerOptions = { - webSocketServer, - port: port1, - server: 'spdy', - }; - const server = new Server(devServerOptions, compiler); - - await server.start(); - - const { page, browser } = await runBrowser(); - - try { - const pageErrors = []; - const consoleMessages = []; - - page - .on('console', (message) => { - consoleMessages.push(message); - }) - .on('pageerror', (error) => { - pageErrors.push(error); - }); - - const webSocketRequests = []; - - if (webSocketServer === 'ws') { - const session = await page.target().createCDPSession(); - - session.on('Network.webSocketCreated', (test) => { - webSocketRequests.push(test); - }); - - await session.send('Target.setAutoAttach', { - autoAttach: true, - flatten: true, - waitForDebuggerOnStart: true, - }); - - sessionSubscribe(session); - } else { - page.on('request', (request) => { - if (/\/ws\//.test(request.url())) { - webSocketRequests.push({ url: request.url() }); - } - }); - } - - await page.goto(`https://${hostname}:${port1}/`, { - waitUntil: 'networkidle0', - }); - - const webSocketRequest = webSocketRequests[0]; - - if (webSocketServer === 'ws') { - expect(webSocketRequest.url).toContain( - `wss://${hostname}:${port1}/ws`, - ); - } else { - expect(webSocketRequest.url).toContain( - `https://${hostname}:${port1}/ws`, - ); - } - - expect( - consoleMessages.map((message) => message.text()), - ).toMatchSnapshot('console messages'); - expect(pageErrors).toMatchSnapshot('page errors'); - } finally { - await browser.close(); - await server.stop(); - } - }); - it(`should work when "port" option is "auto" ("${webSocketServer}")`, async () => { process.env.RSPACK_DEV_SERVER_BASE_PORT = 50000;