chore(): Fix dependencies (#13932)
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user