File tree Expand file tree Collapse file tree 6 files changed +581
-34
lines changed Expand file tree Collapse file tree 6 files changed +581
-34
lines changed Original file line number Diff line number Diff line change 68
68
"sanitize-filename" : " ^1.6.3" ,
69
69
"stream-template" : " ^0.0.10" ,
70
70
"vite" : " ^2.9.15" ,
71
- "wouter" : " ^2.7.5 "
71
+ "wouter" : " ^2.12.1 "
72
72
},
73
73
"peerDependencies" : {
74
74
"fastify" : " ^4.24.2" ,
Original file line number Diff line number Diff line change 1
1
import { Key , pathToRegexp } from 'path-to-regexp'
2
- import { MatcherFn } from 'wouter'
2
+ import type { Match , Path } from 'wouter'
3
+
4
+ export type MatcherFn = ( pattern : Path , path : Path ) => Match
3
5
4
6
/*
5
7
* This function specifies how strings like /app/:users/:items* are transformed into regular expressions to pass into path-to-regexp.
Original file line number Diff line number Diff line change 1
1
import 'wouter'
2
2
3
3
declare module 'wouter' {
4
- export interface RouterProps {
4
+ export interface RouterObject {
5
5
navigationHistory ?: NavigationHistory
6
6
}
7
7
Original file line number Diff line number Diff line change @@ -20,22 +20,6 @@ export interface ReactRendererOptions {
20
20
mode : 'sync' | 'streaming'
21
21
}
22
22
23
- const staticLocationHook = ( path = '/' , { record = false } = { } ) => {
24
- // eslint-disable-next-line prefer-const
25
- let hook
26
- const navigate = ( to , { replace } : { replace ?: boolean } = { } ) => {
27
- if ( record ) {
28
- if ( replace ) {
29
- hook . history . pop ( )
30
- }
31
- hook . history . push ( to )
32
- }
33
- }
34
- hook = ( ) => [ path , navigate ]
35
- hook . history = [ path ]
36
- return hook
37
- }
38
-
39
23
export class ReactRenderer implements Renderer {
40
24
static ROUTE_TABLE_ID = '/@fstr!route-table.js'
41
25
@@ -99,7 +83,7 @@ export class ReactRenderer implements Renderer {
99
83
Router ,
100
84
{
101
85
base : render . base ,
102
- hook : staticLocationHook ( destination ) ,
86
+ ssrPath : destination ,
103
87
} ,
104
88
React . createElement (
105
89
Layout ,
Original file line number Diff line number Diff line change 13
13
"fastify-renderer" : " *" ,
14
14
"react" : " *" ,
15
15
"react-dom" : " *" ,
16
- "wouter" : " ^2.7.5 " ,
16
+ "wouter" : " ^2.12.1 " ,
17
17
"path-to-regexp" : " ^6.2.1"
18
18
},
19
19
"devDependencies" : {
You can’t perform that action at this time.
0 commit comments