react-router 6.2.2 → 6.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,120 @@
1
+ /// <reference types="react" />
2
+ import type { Location, Path, To } from "history";
3
+ export declare function invariant(cond: any, message: string): asserts cond;
4
+ export declare function warning(cond: any, message: string): void;
5
+ export declare function warningOnce(key: string, cond: boolean, message: string): void;
6
+ declare type ParamParseFailed = {
7
+ failed: true;
8
+ };
9
+ declare type ParamParseSegment<Segment extends string> = Segment extends `${infer LeftSegment}/${infer RightSegment}` ? ParamParseSegment<LeftSegment> extends infer LeftResult ? ParamParseSegment<RightSegment> extends infer RightResult ? LeftResult extends string ? RightResult extends string ? LeftResult | RightResult : LeftResult : RightResult extends string ? RightResult : ParamParseFailed : ParamParseFailed : ParamParseSegment<RightSegment> extends infer RightResult ? RightResult extends string ? RightResult : ParamParseFailed : ParamParseFailed : Segment extends `:${infer Remaining}` ? Remaining : ParamParseFailed;
10
+ export declare type ParamParseKey<Segment extends string> = ParamParseSegment<Segment> extends string ? ParamParseSegment<Segment> : string;
11
+ /**
12
+ * The parameters that were parsed from the URL path.
13
+ */
14
+ export declare type Params<Key extends string = string> = {
15
+ readonly [key in Key]: string | undefined;
16
+ };
17
+ /**
18
+ * A route object represents a logical route, with (optionally) its child
19
+ * routes organized in a tree-like structure.
20
+ */
21
+ export interface RouteObject {
22
+ caseSensitive?: boolean;
23
+ children?: RouteObject[];
24
+ element?: React.ReactNode;
25
+ index?: boolean;
26
+ path?: string;
27
+ }
28
+ /**
29
+ * Returns a path with params interpolated.
30
+ *
31
+ * @see https://reactrouter.com/docs/en/v6/api#generatepath
32
+ */
33
+ export declare function generatePath(path: string, params?: Params): string;
34
+ /**
35
+ * A RouteMatch contains info about how a route matched a URL.
36
+ */
37
+ export interface RouteMatch<ParamKey extends string = string> {
38
+ /**
39
+ * The names and values of dynamic parameters in the URL.
40
+ */
41
+ params: Params<ParamKey>;
42
+ /**
43
+ * The portion of the URL pathname that was matched.
44
+ */
45
+ pathname: string;
46
+ /**
47
+ * The portion of the URL pathname that was matched before child routes.
48
+ */
49
+ pathnameBase: string;
50
+ /**
51
+ * The route object that was used to match.
52
+ */
53
+ route: RouteObject;
54
+ }
55
+ /**
56
+ * Matches the given routes to a location and returns the match data.
57
+ *
58
+ * @see https://reactrouter.com/docs/en/v6/api#matchroutes
59
+ */
60
+ export declare function matchRoutes(routes: RouteObject[], locationArg: Partial<Location> | string, basename?: string): RouteMatch[] | null;
61
+ /**
62
+ * A PathPattern is used to match on some portion of a URL pathname.
63
+ */
64
+ export interface PathPattern<Path extends string = string> {
65
+ /**
66
+ * A string to match against a URL pathname. May contain `:id`-style segments
67
+ * to indicate placeholders for dynamic parameters. May also end with `/*` to
68
+ * indicate matching the rest of the URL pathname.
69
+ */
70
+ path: Path;
71
+ /**
72
+ * Should be `true` if the static portions of the `path` should be matched in
73
+ * the same case.
74
+ */
75
+ caseSensitive?: boolean;
76
+ /**
77
+ * Should be `true` if this pattern should match the entire URL pathname.
78
+ */
79
+ end?: boolean;
80
+ }
81
+ /**
82
+ * A PathMatch contains info about how a PathPattern matched on a URL pathname.
83
+ */
84
+ export interface PathMatch<ParamKey extends string = string> {
85
+ /**
86
+ * The names and values of dynamic parameters in the URL.
87
+ */
88
+ params: Params<ParamKey>;
89
+ /**
90
+ * The portion of the URL pathname that was matched.
91
+ */
92
+ pathname: string;
93
+ /**
94
+ * The portion of the URL pathname that was matched before child routes.
95
+ */
96
+ pathnameBase: string;
97
+ /**
98
+ * The pattern that was used to match.
99
+ */
100
+ pattern: PathPattern;
101
+ }
102
+ /**
103
+ * Performs pattern matching on a URL pathname and returns information about
104
+ * the match.
105
+ *
106
+ * @see https://reactrouter.com/docs/en/v6/api#matchpath
107
+ */
108
+ export declare function matchPath<ParamKey extends ParamParseKey<Path>, Path extends string>(pattern: PathPattern<Path> | Path, pathname: string): PathMatch<ParamKey> | null;
109
+ /**
110
+ * Returns a resolved path object relative to the given pathname.
111
+ *
112
+ * @see https://reactrouter.com/docs/en/v6/api#resolvepath
113
+ */
114
+ export declare function resolvePath(to: To, fromPathname?: string): Path;
115
+ export declare function resolveTo(toArg: To, routePathnames: string[], locationPathname: string): Path;
116
+ export declare function getToPathname(to: To): string | undefined;
117
+ export declare function stripBasename(pathname: string, basename: string): string | null;
118
+ export declare const joinPaths: (paths: string[]) => string;
119
+ export declare const normalizePathname: (pathname: string) => string;
120
+ export {};
package/main.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * React Router v6.2.2
2
+ * React Router v6.3.0
3
3
  *
4
4
  * Copyright (c) Remix Software Inc.
5
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-router",
3
- "version": "6.2.2",
3
+ "version": "6.3.0",
4
4
  "author": "Remix Software <hello@remix.run>",
5
5
  "description": "Declarative routing for React",
6
6
  "repository": {