From 10f6ef51e74158aa5592b5b4be3069094762a152 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 1 Jul 2024 16:07:55 +0000 Subject: [PATCH 1/4] Bump path-to-regexp from 6.2.2 to 7.0.0 Bumps [path-to-regexp](https://github.com/pillarjs/path-to-regexp) from 6.2.2 to 7.0.0. - [Release notes](https://github.com/pillarjs/path-to-regexp/releases) - [Changelog](https://github.com/pillarjs/path-to-regexp/blob/master/History.md) - [Commits](https://github.com/pillarjs/path-to-regexp/compare/v6.2.2...v7.0.0) --- updated-dependencies: - dependency-name: path-to-regexp dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 17 +++++++++++++---- packages/router/package.json | 2 +- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b5f088..3abdad8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5304,6 +5304,12 @@ "path-to-regexp": "^6.2.1" } }, + "node_modules/nise/node_modules/path-to-regexp": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", + "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", + "dev": true + }, "node_modules/node-fetch": { "version": "2.6.7", "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", @@ -6018,9 +6024,12 @@ } }, "node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==" + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-7.0.0.tgz", + "integrity": "sha512-58Y94bQqF3zBIASFNiufRPH1NfgZth1qwZ35radL87sg8pgbVqr6uikAhqZtFD+w65MGH6SWnY/ly3GbrM4fbg==", + "engines": { + "node": ">=16" + } }, "node_modules/path-type": { "version": "4.0.0", @@ -7901,7 +7910,7 @@ "license": "MIT", "dependencies": { "@toisu/middleware-runner": "^4.0.0", - "path-to-regexp": "^6.2.1" + "path-to-regexp": "^7.0.0" }, "devDependencies": { "@toisu/toisu": "^5.0.0" diff --git a/packages/router/package.json b/packages/router/package.json index ea791e4..b604bc9 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@toisu/middleware-runner": "^4.0.0", - "path-to-regexp": "^6.2.1" + "path-to-regexp": "^7.0.0" }, "publishConfig": { "access": "public" From 60d52cf1ec97a5d5fc93bdaedadfc5cd1821edd7 Mon Sep 17 00:00:00 2001 From: "Mark S. Everitt" Date: Tue, 2 Jul 2024 04:33:40 +0100 Subject: [PATCH 2/4] Fixes path-to-regexp use after undocumented breaking change there. --- packages/router/lib/router.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/router/lib/router.js b/packages/router/lib/router.js index 6dfbbe9..1a1e703 100644 --- a/packages/router/lib/router.js +++ b/packages/router/lib/router.js @@ -7,8 +7,7 @@ function makeRoute(path, preNormalizedHandlers, options) { const handlers = normalizeHandlers(preNormalizedHandlers); const allowedMethods = Object.keys(handlers); const allow = allowedMethods.sort().join(', '); - const keys = []; - const regex = pathToRegexp(path, keys, options); + const regex = pathToRegexp(path, options); function notAllowed(_req, res) { res.writeHead(405, { allow }).end(); @@ -20,7 +19,7 @@ function makeRoute(path, preNormalizedHandlers, options) { if (paramList) { return { - params: makeParams(keys, paramList), + params: makeParams(regex.keys, paramList), middlewares: handlers[req.method] || [notAllowed] }; } From 8f3f6a90b4c441d93eb93dd611243b39c6154aea Mon Sep 17 00:00:00 2001 From: "Mark S. Everitt" Date: Tue, 2 Jul 2024 04:34:00 +0100 Subject: [PATCH 3/4] Adds Node 22 to the test matrix. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c3b7633..be58fc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - node_version: [18, 20] + node_version: [18, 20, 22] steps: - name: checkout uses: actions/checkout@main From 0c4311e7304c6a7df519896b3644c35c3d341dd8 Mon Sep 17 00:00:00 2001 From: "Mark S. Everitt" Date: Mon, 16 Sep 2024 21:10:05 +0100 Subject: [PATCH 4/4] Bumps path-to-regexp and fixes breakage. --- package-lock.json | 44 +++++++++++++++++++++-------------- packages/router/lib/router.js | 6 ++--- packages/router/package.json | 2 +- 3 files changed, 30 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3abdad8..f2616d0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2644,9 +2644,9 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encodeurl": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", - "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", "engines": { "node": ">= 0.8" } @@ -5305,9 +5305,9 @@ } }, "node_modules/nise/node_modules/path-to-regexp": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.2.2.tgz", - "integrity": "sha512-GQX3SSMokngb36+whdpRXE+3f9V8UzyAorlYvOGx87ufGHehNTn5lCxrKtLyZ4Yl/wEKnNnr98ZzOwwDZV5ogw==", + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-6.3.0.tgz", + "integrity": "sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==", "dev": true }, "node_modules/node-fetch": { @@ -6024,9 +6024,9 @@ } }, "node_modules/path-to-regexp": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-7.0.0.tgz", - "integrity": "sha512-58Y94bQqF3zBIASFNiufRPH1NfgZth1qwZ35radL87sg8pgbVqr6uikAhqZtFD+w65MGH6SWnY/ly3GbrM4fbg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.1.0.tgz", + "integrity": "sha512-Bqn3vc8CMHty6zuD+tG23s6v2kwxslHEhTj4eYaVKGIEB+YX/2wd0/rgXLFD9G9id9KCtbVy/3ZgmvZjpa0UdQ==", "engines": { "node": ">=16" } @@ -6776,9 +6776,9 @@ } }, "node_modules/send": { - "version": "0.18.0", - "resolved": "https://registry.npmjs.org/send/-/send-0.18.0.tgz", - "integrity": "sha512-qqWzuOjSFOuqPjFe4NOsMLafToQQwBSOEpS+FwEt3A2V3vKubTquT3vmLTQpFgMXp8AlFWFuP1qKaJZOtPpVXg==", + "version": "0.19.0", + "resolved": "https://registry.npmjs.org/send/-/send-0.19.0.tgz", + "integrity": "sha512-dW41u5VfLXu8SJh5bwRmyYUbAoSB3c9uQh6L8h/KtsFREPWpbX1lrljJo186Jc4nmci/sGUZ9a0a0J2zgfq2hw==", "dependencies": { "debug": "2.6.9", "depd": "2.0.0", @@ -6811,6 +6811,14 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, + "node_modules/send/node_modules/encodeurl": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz", + "integrity": "sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w==", + "engines": { + "node": ">= 0.8" + } + }, "node_modules/send/node_modules/mime": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz", @@ -6828,14 +6836,14 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, "node_modules/serve-static": { - "version": "1.16.0", - "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.0.tgz", - "integrity": "sha512-pDLK8zwl2eKaYrs8mrPZBJua4hMplRWJ1tIFksVC3FtBEBnl8dxgeHtsaMS8DhS9i4fLObaon6ABoc4/hQGdPA==", + "version": "1.16.2", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.16.2.tgz", + "integrity": "sha512-VqpjJZKadQB/PEbEwvFdO43Ax5dFBZ2UECszz8bQ7pi7wt//PWe1P6MN7eCnjsatYtBT6EuiClbjSWP2WrIoTw==", "dependencies": { - "encodeurl": "~1.0.2", + "encodeurl": "~2.0.0", "escape-html": "~1.0.3", "parseurl": "~1.3.3", - "send": "0.18.0" + "send": "0.19.0" }, "engines": { "node": ">= 0.8.0" @@ -7910,7 +7918,7 @@ "license": "MIT", "dependencies": { "@toisu/middleware-runner": "^4.0.0", - "path-to-regexp": "^7.0.0" + "path-to-regexp": "^8.1.0" }, "devDependencies": { "@toisu/toisu": "^5.0.0" diff --git a/packages/router/lib/router.js b/packages/router/lib/router.js index 1a1e703..9ce77b6 100644 --- a/packages/router/lib/router.js +++ b/packages/router/lib/router.js @@ -7,7 +7,7 @@ function makeRoute(path, preNormalizedHandlers, options) { const handlers = normalizeHandlers(preNormalizedHandlers); const allowedMethods = Object.keys(handlers); const allow = allowedMethods.sort().join(', '); - const regex = pathToRegexp(path, options); + const { keys, regexp } = pathToRegexp(path, options); function notAllowed(_req, res) { res.writeHead(405, { allow }).end(); @@ -15,11 +15,11 @@ function makeRoute(path, preNormalizedHandlers, options) { return function match(req) { const { pathname } = new URL(req.url, 'http://none'); - const paramList = regex.exec(pathname); + const paramList = regexp.exec(pathname); if (paramList) { return { - params: makeParams(regex.keys, paramList), + params: makeParams(keys, paramList), middlewares: handlers[req.method] || [notAllowed] }; } diff --git a/packages/router/package.json b/packages/router/package.json index b604bc9..086afce 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@toisu/middleware-runner": "^4.0.0", - "path-to-regexp": "^7.0.0" + "path-to-regexp": "^8.1.0" }, "publishConfig": { "access": "public"