Skip to content

Commit 4914bee

Browse files
authored
Merge pull request #79 from mjackson/pedro/route-pattern
Route pattern rewrite + enums
2 parents 1053eb6 + 1fa56ef commit 4914bee

File tree

15 files changed

+1072
-314
lines changed

15 files changed

+1072
-314
lines changed

packages/route-pattern/README.md

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,27 +60,18 @@ pattern.match('https://remix.run/assets/styles/main.css');
6060

6161
```ts
6262
class RoutePattern {
63+
readonly source: string;
6364
constructor(source: string);
6465
match(url: string | URL): Match | null;
65-
static matcher(patterns: Array<string | RoutePattern>): Matcher;
6666
}
6767
```
6868

6969
**Match**
7070

7171
```ts
7272
type Match = {
73-
params: Record<string, string>;
74-
}
75-
```
76-
77-
**Matcher**
78-
79-
```ts
80-
type Matcher = {
81-
match(url: string | URL): Match | null;
82-
matchAll(url: string | URL): Array<Match>;
83-
}
73+
params: Record<string, string | undefined>;
74+
};
8475
```
8576

8677
## Concepts
@@ -196,4 +187,4 @@ let pattern = new RoutePattern('files/:filename.{jpg,png,gif}');
196187

197188
pattern.match('https://remix.run/files/logo.png');
198189
// { params: { filename: 'logo' } }
199-
```
190+
```

packages/route-pattern/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@mjackson/route-pattern",
3-
"version": "0.1.0",
3+
"version": "0.2.0",
44
"description": "Route patterns are strings that describe the structure of URLs you want to match",
55
"author": "Michael Jackson <[email protected]>",
66
"license": "MIT",

packages/route-pattern/src/lib/ast.ts

Lines changed: 0 additions & 6 deletions
This file was deleted.

packages/route-pattern/src/lib/lex.test.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

packages/route-pattern/src/lib/lex.ts

Lines changed: 0 additions & 65 deletions
This file was deleted.

packages/route-pattern/src/lib/match.test.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/route-pattern/src/lib/match.ts

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)