From fd4089434624a4e56775bf2c48db1af4b5e8d63d Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 12 Mar 2026 15:48:26 +0800 Subject: [PATCH 1/3] refactor: move @types/connect-history-api-fallback to devDependencies --- package.json | 2 +- pnpm-lock.yaml | 6 +++--- src/types.ts | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 619064a..abc5c4e 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,6 @@ ] }, "dependencies": { - "@types/connect-history-api-fallback": "^1.5.4", "@types/ws": "^8.18.1", "chokidar": "^5.0.0", "connect-history-api-fallback": "^2.0.0", @@ -65,6 +64,7 @@ "@rstest/core": "^0.9.2", "@types/mime-types": "3.0.1", "@types/node": "^24.12.0", + "@types/connect-history-api-fallback": "^1.5.4", "@types/node-forge": "^1.3.14", "@types/serve-static": "^2.2.0", "@types/trusted-types": "^2.0.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 99056ed..8211351 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,9 +8,6 @@ importers: .: dependencies: - '@types/connect-history-api-fallback': - specifier: ^1.5.4 - version: 1.5.4 '@types/ws': specifier: ^8.18.1 version: 8.18.1 @@ -57,6 +54,9 @@ importers: '@rstest/core': specifier: ^0.9.2 version: 0.9.2(@module-federation/runtime-tools@2.1.0)(core-js@3.47.0) + '@types/connect-history-api-fallback': + specifier: ^1.5.4 + version: 1.5.4 '@types/mime-types': specifier: 3.0.1 version: 3.0.1 diff --git a/src/types.ts b/src/types.ts index 4aa826e..8c48463 100644 --- a/src/types.ts +++ b/src/types.ts @@ -5,12 +5,12 @@ import type { } from 'node:http'; import type { ServerOptions } from 'node:https'; import type { + DevServer, DevServerMiddlewareHandler, DevServerOpenOptions, DevServerStaticItem, } from '@rspack/core'; import type { FSWatcher, ChokidarOptions as WatchOptions } from 'chokidar'; -import type { Options as ConnectHistoryApiFallbackOptions } from 'connect-history-api-fallback'; import type { Server as ConnectApplication, IncomingMessage as ConnectIncomingMessage, @@ -29,7 +29,6 @@ export type { ServerOptions, IncomingMessage, ConnectApplication, - ConnectHistoryApiFallbackOptions, }; export type { IPv6 } from 'ipaddr.js'; export type { Socket } from 'node:net'; @@ -53,6 +52,11 @@ type BasicServer = import('node:net').Server | import('node:tls').Server; /** https://github.com/microsoft/TypeScript/issues/29729 */ export type LiteralUnion = T | (U & Record); +export type ConnectHistoryApiFallbackOptions = Exclude< + NonNullable, + boolean +>; + // type-level helpers, inferred as util types export type Request = T extends ConnectApplication ? ConnectIncomingMessage : IncomingMessage; From cffa2512def0ba6d20874eab8e50ddb6b88c4614 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 12 Mar 2026 15:59:16 +0800 Subject: [PATCH 2/3] fix: clean up --- package.json | 3 --- pnpm-lock.yaml | 62 -------------------------------------------------- 2 files changed, 65 deletions(-) diff --git a/package.json b/package.json index abc5c4e..a4776c0 100644 --- a/package.json +++ b/package.json @@ -64,10 +64,7 @@ "@rstest/core": "^0.9.2", "@types/mime-types": "3.0.1", "@types/node": "^24.12.0", - "@types/connect-history-api-fallback": "^1.5.4", - "@types/node-forge": "^1.3.14", "@types/serve-static": "^2.2.0", - "@types/trusted-types": "^2.0.7", "@types/ws": "8.18.1", "cross-env": "^10.1.0", "css-loader": "^7.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8211351..deeb5f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -54,24 +54,15 @@ importers: '@rstest/core': specifier: ^0.9.2 version: 0.9.2(@module-federation/runtime-tools@2.1.0)(core-js@3.47.0) - '@types/connect-history-api-fallback': - specifier: ^1.5.4 - version: 1.5.4 '@types/mime-types': specifier: 3.0.1 version: 3.0.1 '@types/node': specifier: ^24.12.0 version: 24.12.0 - '@types/node-forge': - specifier: ^1.3.14 - version: 1.3.14 '@types/serve-static': specifier: ^2.2.0 version: 2.2.0 - '@types/trusted-types': - specifier: ^2.0.7 - version: 2.0.7 cross-env: specifier: ^10.1.0 version: 10.1.0 @@ -638,9 +629,6 @@ packages: '@types/chai@5.2.3': resolution: {integrity: sha512-Mw558oeA9fFbv65/y4mHtXDs9bPnFMZAL/jxdPFUpOHHIXX91mcgEHbS5Lahr+pwZFR8A7GQleRWeI6cGFC2UA==} - '@types/connect-history-api-fallback@1.5.4': - resolution: {integrity: sha512-n6Cr2xS1h4uAulPRdlw6Jl6s1oG8KrVilPN2yUITEs+K48EzMJJ3W1xy8K5eWuFvjp3R74AOIGSmp2UfBJ8HFw==} - '@types/deep-eql@4.0.2': resolution: {integrity: sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==} @@ -653,9 +641,6 @@ packages: '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} - '@types/express-serve-static-core@4.19.8': - resolution: {integrity: sha512-02S5fmqeoKzVZCHPZid4b8JH2eM5HzQLZWN2FohQEy/0eXTq8VXZfSN6Pcr3F6N9R/vNrj7cpgbhjie6m/1tCA==} - '@types/http-errors@2.0.4': resolution: {integrity: sha512-D0CFMMtydbJAegzOyHjtiKPLlvnm3iTZyZRSZoLq2mRhDdmLfIWOCYPfQJ4cu2erKghU++QvjcUjp/5h7hESpA==} @@ -668,30 +653,12 @@ packages: '@types/mime-types@3.0.1': resolution: {integrity: sha512-xRMsfuQbnRq1Ef+C+RKaENOxXX87Ygl38W1vDfPHRku02TgQr+Qd8iivLtAMcR0KF5/29xlnFihkTlbqFrGOVQ==} - '@types/mime@1.3.5': - resolution: {integrity: sha512-/pyBZWSLD2n0dcHE3hq8s8ZvcETHtEuF+3E7XVt0Ig2nvsVQXdghHVcEkIWjy9A0wKfTn97a/PSDYohKIlnP/w==} - - '@types/node-forge@1.3.14': - resolution: {integrity: sha512-mhVF2BnD4BO+jtOp7z1CdzaK4mbuK0LLQYAvdOLqHTavxFNq4zA1EmYkpnFjP8HOUzedfQkRnp0E2ulSAYSzAw==} - '@types/node@24.12.0': resolution: {integrity: sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==} - '@types/qs@6.9.16': - resolution: {integrity: sha512-7i+zxXdPD0T4cKDuxCUXJ4wHcsJLwENa6Z3dCu8cfCK743OGy5Nu1RmAGqDPsoTDINVEcdXKRvR/zre+P2Ku1A==} - - '@types/range-parser@1.2.7': - resolution: {integrity: sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==} - - '@types/send@0.17.4': - resolution: {integrity: sha512-x2EM6TJOybec7c52BX0ZspPodMsQUd5L6PRwOunVyVUhXiBSKf3AezDL8Dgvgt5o0UfKNfuA0eMLr2wLT4AiBA==} - '@types/serve-static@2.2.0': resolution: {integrity: sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==} - '@types/trusted-types@2.0.7': - resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} - '@types/ws@8.18.1': resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} @@ -2492,11 +2459,6 @@ snapshots: '@types/deep-eql': 4.0.2 assertion-error: 2.0.1 - '@types/connect-history-api-fallback@1.5.4': - dependencies: - '@types/express-serve-static-core': 4.19.8 - '@types/node': 24.12.0 - '@types/deep-eql@4.0.2': {} '@types/eslint-scope@3.7.7': @@ -2511,13 +2473,6 @@ snapshots: '@types/estree@1.0.8': {} - '@types/express-serve-static-core@4.19.8': - dependencies: - '@types/node': 24.12.0 - '@types/qs': 6.9.16 - '@types/range-parser': 1.2.7 - '@types/send': 0.17.4 - '@types/http-errors@2.0.4': {} '@types/http-proxy@1.17.17': @@ -2528,32 +2483,15 @@ snapshots: '@types/mime-types@3.0.1': {} - '@types/mime@1.3.5': {} - - '@types/node-forge@1.3.14': - dependencies: - '@types/node': 24.12.0 - '@types/node@24.12.0': dependencies: undici-types: 7.16.0 - '@types/qs@6.9.16': {} - - '@types/range-parser@1.2.7': {} - - '@types/send@0.17.4': - dependencies: - '@types/mime': 1.3.5 - '@types/node': 24.12.0 - '@types/serve-static@2.2.0': dependencies: '@types/http-errors': 2.0.4 '@types/node': 24.12.0 - '@types/trusted-types@2.0.7': {} - '@types/ws@8.18.1': dependencies: '@types/node': 24.12.0 From 25bb7b25dd3879969dad8bd6bfb4f48c7e9efe34 Mon Sep 17 00:00:00 2001 From: neverland Date: Thu, 12 Mar 2026 16:01:35 +0800 Subject: [PATCH 3/3] fix --- package.json | 1 + pnpm-lock.yaml | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/package.json b/package.json index a4776c0..7c492b5 100644 --- a/package.json +++ b/package.json @@ -65,6 +65,7 @@ "@types/mime-types": "3.0.1", "@types/node": "^24.12.0", "@types/serve-static": "^2.2.0", + "@types/trusted-types": "^2.0.7", "@types/ws": "8.18.1", "cross-env": "^10.1.0", "css-loader": "^7.1.4", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index deeb5f2..c067edf 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -63,6 +63,9 @@ importers: '@types/serve-static': specifier: ^2.2.0 version: 2.2.0 + '@types/trusted-types': + specifier: ^2.0.7 + version: 2.0.7 cross-env: specifier: ^10.1.0 version: 10.1.0 @@ -659,6 +662,9 @@ packages: '@types/serve-static@2.2.0': resolution: {integrity: sha512-8mam4H1NHLtu7nmtalF7eyBH14QyOASmcxHhSfEoRyr0nP/YdoesEtU+uSRvMe96TW/HPTtkoKqQLl53N7UXMQ==} + '@types/trusted-types@2.0.7': + resolution: {integrity: sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==} + '@types/ws@8.18.1': resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==} @@ -2492,6 +2498,8 @@ snapshots: '@types/http-errors': 2.0.4 '@types/node': 24.12.0 + '@types/trusted-types@2.0.7': {} + '@types/ws@8.18.1': dependencies: '@types/node': 24.12.0