chore(): Fix dependencies (#13932)

This commit is contained in:
Adrien de Peretti
2025-11-02 17:46:46 +01:00
committed by GitHub
parent 990691e78a
commit 37563987b8
23 changed files with 854 additions and 508 deletions
@@ -1,5 +1,6 @@
import pathToRegexp from "path-to-regexp"
import { pathToRegexp } from "path-to-regexp"
import type { MiddlewareVerb, RouteVerb } from "./types"
import { isString } from "@medusajs/utils"
export class RoutesFinder<
T extends
@@ -35,9 +36,17 @@ export class RoutesFinder<
* Register route for lookup
*/
add(route: T) {
// Doing a replacement for backwards compatibility with the old path-to-regexp with express 4
let normalizedPath = route.matcher
if (isString(route.matcher)) {
// Replace /* with {*splat} (wildcard matches zero or more path segments)
normalizedPath = normalizedPath.replace(/\/\*/g, "{*splat}")
// Replace /path* (no slash before asterisk) with /path{*splat}
normalizedPath = normalizedPath.replace(/(\w)\*/g, "$1{*splat}")
}
this.#routes.push({
...route,
matchRegex: pathToRegexp(route.matcher),
matchRegex: pathToRegexp(normalizedPath).regexp,
})
}
@@ -24,7 +24,7 @@ export function shouldCompressResponse(
}
// fallback to standard filter function
return compression.filter(req, res)
return compression.filter(req as any, res as any)
}
export function compressionOptions(