Skip to content

Commit

Permalink
chore(deps): update all non-major dependencies (#1911)
Browse files Browse the repository at this point in the history
  • Loading branch information
renovate[bot] authored Nov 14, 2023
1 parent 55bb3b4 commit a94e394
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 56 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@
"semver": "^7.5.4",
"serve-placeholder": "^2.0.1",
"serve-static": "^1.15.0",
"std-env": "^3.4.3",
"std-env": "^3.5.0",
"ufo": "^1.3.1",
"uncrypto": "^0.1.3",
"unctx": "^2.3.1",
Expand Down Expand Up @@ -143,7 +143,7 @@
"firebase-functions": "^4.5.0",
"get-port-please": "^3.1.1",
"miniflare": "^2.14.1",
"prettier": "^3.0.3",
"prettier": "^3.1.0",
"typescript": "^5.2.2",
"unbuild": "^2.0.0",
"undici": "^5.27.2",
Expand All @@ -158,7 +158,7 @@
"optional": true
}
},
"packageManager": "[email protected].3",
"packageManager": "[email protected].4",
"engines": {
"node": "^16.11.0 || >=17.0.0"
},
Expand Down
24 changes: 12 additions & 12 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 14 additions & 14 deletions src/types/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ export type TypedInternalResponse<
? // Allow user overrides
Default
: Route extends string
? MiddlewareOf<Route, Method> extends never
? MiddlewareOf<Route, "default"> extends never
? // Bail if only types are Error or void (for example, from middleware)
Default
: MiddlewareOf<Route, "default">
: MiddlewareOf<Route, Method>
: Default;
? MiddlewareOf<Route, Method> extends never
? MiddlewareOf<Route, "default"> extends never
? // Bail if only types are Error or void (for example, from middleware)
Default
: MiddlewareOf<Route, "default">
: MiddlewareOf<Route, Method>
: Default;

// Extracts the available http methods based on the route.
// Defaults to all methods if there aren't any methods available or if there is a catch-all route.
Expand All @@ -42,11 +42,11 @@ export type AvailableRouterMethod<R extends NitroFetchRequest> =
? keyof InternalApi[MatchedRoutes<R>] extends undefined
? RouterMethod
: Extract<
keyof InternalApi[MatchedRoutes<R>],
"default"
> extends undefined
? Extract<RouterMethod, keyof InternalApi[MatchedRoutes<R>]>
: RouterMethod
keyof InternalApi[MatchedRoutes<R>],
"default"
> extends undefined
? Extract<RouterMethod, keyof InternalApi[MatchedRoutes<R>]>
: RouterMethod
: RouterMethod;

// Argumented fetch options to include the correct request methods.
Expand All @@ -65,8 +65,8 @@ export type ExtractedRouteMethod<
> = O extends undefined
? "get"
: Lowercase<O["method"]> extends RouterMethod
? Lowercase<O["method"]>
: "get";
? Lowercase<O["method"]>
: "get";

export interface $Fetch<
DefaultT = unknown,
Expand Down
58 changes: 31 additions & 27 deletions src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,18 @@ type CalcMatchScore<
TupleIfDiff<Key, Route, ["", ""]>
>
: `${Route}/` extends `${infer RouteSeg}/${infer RouteRest}`
? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}`
? RouteSegWithoutQuery extends KeySeg
? CalcMatchScore<KeyRest, RouteRest, [...Score, "", ""]> // exact match
: KeySeg extends `:${string}`
? RouteSegWithoutQuery extends ""
? never
: CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> // param match
: KeySeg extends RouteSegWithoutQuery
? CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> // match by ${string}
? `${RouteSeg}?` extends `${infer RouteSegWithoutQuery}?${string}`
? RouteSegWithoutQuery extends KeySeg
? CalcMatchScore<KeyRest, RouteRest, [...Score, "", ""]> // exact match
: KeySeg extends `:${string}`
? RouteSegWithoutQuery extends ""
? never
: CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> // param match
: KeySeg extends RouteSegWithoutQuery
? CalcMatchScore<KeyRest, RouteRest, [...Score, ""]> // match by ${string}
: never
: never
: never
: never
: never;

type _MatchedRoutes<
Expand All @@ -66,16 +66,20 @@ type _MatchedRoutes<
? Route extends MatchedKeys
? MatchResult<MatchedKeys, true> // exact match
: MatchedKeys extends `${infer Root}/**${string}`
? MatchedKeys extends `${string}/**`
? Route extends `${Root}/${string}`
? MatchResult<MatchedKeys, false, [], true>
: never // catchAll match
: MatchResult<MatchedKeys, false, CalcMatchScore<Root, Route, [], true>> // glob match
: MatchResult<
MatchedKeys,
false,
CalcMatchScore<MatchedKeys, Route, [], true>
> // partial match
? MatchedKeys extends `${string}/**`
? Route extends `${Root}/${string}`
? MatchResult<MatchedKeys, false, [], true>
: never // catchAll match
: MatchResult<
MatchedKeys,
false,
CalcMatchScore<Root, Route, [], true>
> // glob match
: MatchResult<
MatchedKeys,
false,
CalcMatchScore<MatchedKeys, Route, [], true>
> // partial match
: never
: never;

Expand All @@ -91,13 +95,13 @@ export type MatchedRoutes<
> = Route extends "/"
? keyof InternalApi // root middleware
: Extract<Matches, { exact: true }> extends never
?
| Extract<
Exclude<Matches, { score: never }>,
{ score: MaxTuple<Matches["score"]> }
>["key"]
| Extract<Matches, { catchAll: true }>["key"] // partial, glob and catchAll matches
: Extract<Matches, { exact: true }>["key"]; // exact matches
?
| Extract<
Exclude<Matches, { score: never }>,
{ score: MaxTuple<Matches["score"]> }
>["key"]
| Extract<Matches, { catchAll: true }>["key"] // partial, glob and catchAll matches
: Extract<Matches, { exact: true }>["key"]; // exact matches

export type KebabCase<
T extends string,
Expand Down

0 comments on commit a94e394

Please sign in to comment.