Skip to content

Commit 43f22c4

Browse files
chore: deps update (#2252)
1 parent b084618 commit 43f22c4

9 files changed

Lines changed: 1917 additions & 1311 deletions

File tree

package-lock.json

Lines changed: 1893 additions & 1286 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,34 +58,23 @@
5858
"@babel/cli": "^7.16.7",
5959
"@babel/core": "^7.16.7",
6060
"@babel/preset-env": "^7.16.7",
61-
"@eslint/js": "^9.28.0",
62-
"@eslint/markdown": "^7.1.0",
6361
"@commitlint/cli": "^20.2.0",
6462
"@commitlint/config-conventional": "^20.2.0",
6563
"@fastify/express": "^4.0.2",
6664
"@hapi/hapi": "^21.3.7",
6765
"@hono/node-server": "^1.12.0",
68-
"@stylistic/eslint-plugin": "^5.3.1",
6966
"@types/connect": "^3.4.35",
7067
"@types/express": "^5.0.2",
7168
"@types/mime-types": "^3.0.1",
7269
"@types/node": "^22.3.0",
7370
"@types/on-finished": "^2.3.4",
7471
"babel-jest": "^30.1.2",
7572
"connect": "^3.7.0",
76-
"cspell": "^8.3.2",
73+
"cspell": "^9.6.2",
7774
"deepmerge": "^4.2.2",
7875
"del-cli": "^6.0.0",
79-
"globals": "^16.2.0",
8076
"eslint": "^9.28.0",
8177
"eslint-config-webpack": "^4.5.0",
82-
"eslint-config-prettier": "^10.1.5",
83-
"eslint-plugin-import": "^2.31.0",
84-
"eslint-plugin-jest": "^29.0.1",
85-
"eslint-plugin-jsdoc": "^61.5.0",
86-
"eslint-plugin-n": "^17.19.0",
87-
"eslint-plugin-prettier": "^5.4.1",
88-
"eslint-plugin-unicorn": "^62.0.0",
8978
"execa": "^5.1.1",
9079
"express-4": "npm:express@^4",
9180
"express": "^5.1.0",
@@ -96,7 +85,7 @@
9685
"husky": "^9.1.3",
9786
"jest": "^30.1.3",
9887
"koa": "^3.0.0",
99-
"lint-staged": "^15.2.0",
88+
"lint-staged": "^16.2.7",
10089
"npm-run-all": "^4.1.5",
10190
"prettier": "^3.6.0",
10291
"router": "^2.2.0",

src/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,12 @@ const noop = () => {};
9898
* @typedef {WithoutUndefined<Context<RequestInternal, ResponseInternal>, "watching">} FilledContext
9999
*/
100100

101-
/** @typedef {Record<string, string | number> | Array<{ key: string, value: number | string }>} NormalizedHeaders */
101+
/** @typedef {Record<string, string | number> | { key: string, value: number | string }[]} NormalizedHeaders */
102102

103103
/**
104104
* @template {IncomingMessage} [RequestInternal=IncomingMessage]
105105
* @template {ServerResponse} [ResponseInternal=ServerResponse]
106-
* @typedef {NormalizedHeaders | ((req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal>) => void | undefined | NormalizedHeaders) | undefined} Headers
106+
* @typedef {NormalizedHeaders | ((req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal>) => void | undefined | NormalizedHeaders) | undefined} Headers
107107
*/
108108

109109
/**
@@ -401,7 +401,7 @@ function koaWrapper(compiler, options) {
401401
const devMiddleware = wdm(compiler, options);
402402

403403
/**
404-
* @param {{req: RequestInternal, res: ResponseInternal & import("./utils/compatibleAPI").ExpectedServerResponse, status: number, body: string | Buffer | import("fs").ReadStream | {message: string}, state: object}} ctx context
404+
* @param {{ req: RequestInternal, res: ResponseInternal & import("./utils/compatibleAPI").ExpectedServerResponse, status: number, body: string | Buffer | import("fs").ReadStream | { message: string }, state: object }} ctx context
405405
* @param {EXPECTED_FUNCTION} next next
406406
* @returns {Promise<void>}
407407
*/

src/middleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ function wrapper(context) {
547547
}
548548

549549
/**
550-
* @type {{key: string, value: string | number}[]}
550+
* @type {{ key: string, value: string | number }[]}
551551
*/
552552
const allHeaders = [];
553553

src/utils/compatibleAPI.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* @property {((name: string) => string | string[] | undefined)=} getHeader get header extra method
99
* @property {(() => string | undefined)=} getMethod get method extra method
1010
* @property {(() => string | undefined)=} getURL get URL extra method
11+
* @property {string=} originalUrl an extra option for `fastify` (and `@fastify/express`) to get original URL
1112
*/
1213

1314
/**
@@ -65,6 +66,10 @@ function getRequestURL(req) {
6566
if (typeof req.getURL === "function") {
6667
return req.getURL();
6768
}
69+
// Fastify decodes URI by default, Our logic is based on encoded URI
70+
else if (typeof req.originalUrl !== "undefined") {
71+
return req.originalUrl;
72+
}
6873

6974
return req.url;
7075
}

test/middleware.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5366,10 +5366,10 @@ describe.each([
53665366

53675367
isDirectory = jest
53685368
.spyOn(instance.context.outputFileSystem, "statSync")
5369-
.mockImplementation(() => ({
5369+
.mockReturnValue({
53705370
isFile: () => false,
53715371
isDirectory: () => false,
5372-
}));
5372+
});
53735373
});
53745374

53755375
afterAll(async () => {

test/utils/setupOutputFileSystem.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import setupOutputFileSystem from "../../src/utils/setupOutputFileSystem";
44

55
const createFsFromVolume = jest.spyOn(memfs, "createFsFromVolume");
66

7-
createFsFromVolume.mockImplementation(() => ({
7+
createFsFromVolume.mockReturnValue({
88
testFs: true,
9-
}));
9+
});
1010

1111
describe("setupOutputFileSystem", () => {
1212
afterEach(() => {

types/index.d.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ export = wdm;
6969
* @template {ServerResponse} [ResponseInternal=ServerResponse]
7070
* @typedef {WithoutUndefined<Context<RequestInternal, ResponseInternal>, "watching">} FilledContext
7171
*/
72-
/** @typedef {Record<string, string | number> | Array<{ key: string, value: number | string }>} NormalizedHeaders */
72+
/** @typedef {Record<string, string | number> | { key: string, value: number | string }[]} NormalizedHeaders */
7373
/**
7474
* @template {IncomingMessage} [RequestInternal=IncomingMessage]
7575
* @template {ServerResponse} [ResponseInternal=ServerResponse]
76-
* @typedef {NormalizedHeaders | ((req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal>) => void | undefined | NormalizedHeaders) | undefined} Headers
76+
* @typedef {NormalizedHeaders | ((req: RequestInternal, res: ResponseInternal, context: Context<RequestInternal, ResponseInternal>) => void | undefined | NormalizedHeaders) | undefined} Headers
7777
*/
7878
/**
7979
* @template {IncomingMessage} [RequestInternal = IncomingMessage]
@@ -355,10 +355,10 @@ type FilledContext<
355355
> = WithoutUndefined<Context<RequestInternal, ResponseInternal>, "watching">;
356356
type NormalizedHeaders =
357357
| Record<string, string | number>
358-
| Array<{
358+
| {
359359
key: string;
360360
value: number | string;
361-
}>;
361+
}[];
362362
type Headers<
363363
RequestInternal extends IncomingMessage = import("http").IncomingMessage,
364364
ResponseInternal extends ServerResponse = ServerResponse,

types/utils/compatibleAPI.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export type ExpectedIncomingMessage = {
1515
* get URL extra method
1616
*/
1717
getURL?: (() => string | undefined) | undefined;
18+
/**
19+
* an extra option for `fastify` (and `@fastify/express`) to get original URL
20+
*/
21+
originalUrl?: string | undefined;
1822
};
1923
export type ExpectedServerResponse = {
2024
/**
@@ -120,6 +124,7 @@ export function getOutgoing<
120124
* @property {((name: string) => string | string[] | undefined)=} getHeader get header extra method
121125
* @property {(() => string | undefined)=} getMethod get method extra method
122126
* @property {(() => string | undefined)=} getURL get URL extra method
127+
* @property {string=} originalUrl an extra option for `fastify` (and `@fastify/express`) to get original URL
123128
*/
124129
/**
125130
* @typedef {object} ExpectedServerResponse

0 commit comments

Comments
 (0)