@tanstack/router-core 1.132.0-alpha.8 → 1.132.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.
- package/dist/cjs/Matches.cjs +2 -1
- package/dist/cjs/Matches.cjs.map +1 -1
- package/dist/cjs/fileRoute.d.cts +3 -3
- package/dist/cjs/index.cjs +7 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/index.d.cts +8 -4
- package/dist/cjs/load-matches.cjs +5 -3
- package/dist/cjs/load-matches.cjs.map +1 -1
- package/dist/cjs/location.d.cts +38 -0
- package/dist/cjs/path.cjs +27 -64
- package/dist/cjs/path.cjs.map +1 -1
- package/dist/cjs/path.d.cts +6 -7
- package/dist/cjs/process-route-tree.cjs +144 -0
- package/dist/cjs/process-route-tree.cjs.map +1 -0
- package/dist/cjs/process-route-tree.d.cts +10 -0
- package/dist/cjs/redirect.cjs +1 -1
- package/dist/cjs/redirect.cjs.map +1 -1
- package/dist/cjs/rewrite.cjs +63 -0
- package/dist/cjs/rewrite.cjs.map +1 -0
- package/dist/cjs/rewrite.d.cts +22 -0
- package/dist/cjs/route.cjs.map +1 -1
- package/dist/cjs/route.d.cts +55 -42
- package/dist/cjs/router.cjs +77 -184
- package/dist/cjs/router.cjs.map +1 -1
- package/dist/cjs/router.d.cts +68 -37
- package/dist/cjs/scroll-restoration.cjs.map +1 -1
- package/dist/cjs/scroll-restoration.d.cts +9 -0
- package/dist/cjs/ssr/createRequestHandler.cjs +4 -1
- package/dist/cjs/ssr/createRequestHandler.cjs.map +1 -1
- package/dist/cjs/ssr/serializer/transformer.cjs.map +1 -1
- package/dist/cjs/ssr/serializer/transformer.d.cts +10 -8
- package/dist/cjs/ssr/server.d.cts +0 -5
- package/dist/cjs/ssr/ssr-server.cjs +5 -2
- package/dist/cjs/ssr/ssr-server.cjs.map +1 -1
- package/dist/cjs/ssr/ssr-server.d.cts +4 -1
- package/dist/cjs/utils.cjs +68 -46
- package/dist/cjs/utils.cjs.map +1 -1
- package/dist/esm/Matches.js +2 -1
- package/dist/esm/Matches.js.map +1 -1
- package/dist/esm/fileRoute.d.ts +3 -3
- package/dist/esm/index.d.ts +8 -4
- package/dist/esm/index.js +8 -3
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/load-matches.js +5 -3
- package/dist/esm/load-matches.js.map +1 -1
- package/dist/esm/location.d.ts +38 -0
- package/dist/esm/path.d.ts +6 -7
- package/dist/esm/path.js +27 -64
- package/dist/esm/path.js.map +1 -1
- package/dist/esm/process-route-tree.d.ts +10 -0
- package/dist/esm/process-route-tree.js +144 -0
- package/dist/esm/process-route-tree.js.map +1 -0
- package/dist/esm/redirect.js +1 -1
- package/dist/esm/redirect.js.map +1 -1
- package/dist/esm/rewrite.d.ts +22 -0
- package/dist/esm/rewrite.js +63 -0
- package/dist/esm/rewrite.js.map +1 -0
- package/dist/esm/route.d.ts +55 -42
- package/dist/esm/route.js.map +1 -1
- package/dist/esm/router.d.ts +68 -37
- package/dist/esm/router.js +79 -186
- package/dist/esm/router.js.map +1 -1
- package/dist/esm/scroll-restoration.d.ts +9 -0
- package/dist/esm/scroll-restoration.js.map +1 -1
- package/dist/esm/ssr/createRequestHandler.js +4 -1
- package/dist/esm/ssr/createRequestHandler.js.map +1 -1
- package/dist/esm/ssr/serializer/transformer.d.ts +10 -8
- package/dist/esm/ssr/serializer/transformer.js.map +1 -1
- package/dist/esm/ssr/server.d.ts +0 -5
- package/dist/esm/ssr/ssr-server.d.ts +4 -1
- package/dist/esm/ssr/ssr-server.js +5 -2
- package/dist/esm/ssr/ssr-server.js.map +1 -1
- package/dist/esm/utils.js +68 -46
- package/dist/esm/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/Matches.ts +2 -1
- package/src/fileRoute.ts +16 -6
- package/src/index.ts +11 -6
- package/src/load-matches.ts +29 -19
- package/src/location.ts +38 -0
- package/src/path.ts +44 -82
- package/src/process-route-tree.ts +233 -0
- package/src/redirect.ts +1 -1
- package/src/rewrite.ts +70 -0
- package/src/route.ts +214 -80
- package/src/router.ts +208 -329
- package/src/scroll-restoration.ts +1 -1
- package/src/ssr/createRequestHandler.ts +4 -1
- package/src/ssr/serializer/transformer.ts +17 -17
- package/src/ssr/server.ts +5 -5
- package/src/ssr/ssr-server.ts +8 -5
- package/src/utils.ts +83 -61
package/src/route.ts
CHANGED
|
@@ -378,6 +378,7 @@ export type MakeRemountDepsOptionsUnion<
|
|
|
378
378
|
: never
|
|
379
379
|
|
|
380
380
|
export interface RouteTypes<
|
|
381
|
+
in out TRegister,
|
|
381
382
|
in out TParentRoute extends AnyRoute,
|
|
382
383
|
in out TPath extends string,
|
|
383
384
|
in out TFullPath extends string,
|
|
@@ -393,6 +394,8 @@ export interface RouteTypes<
|
|
|
393
394
|
in out TChildren,
|
|
394
395
|
in out TFileRouteTypes,
|
|
395
396
|
in out TSSR,
|
|
397
|
+
in out TServerMiddlewares,
|
|
398
|
+
in out THandlers,
|
|
396
399
|
> {
|
|
397
400
|
parentRoute: TParentRoute
|
|
398
401
|
path: TPath
|
|
@@ -457,7 +460,7 @@ export type RouteLazyFn<TRoute extends AnyRoute> = (
|
|
|
457
460
|
) => TRoute
|
|
458
461
|
|
|
459
462
|
export type RouteAddChildrenFn<
|
|
460
|
-
in out TRegister
|
|
463
|
+
in out TRegister,
|
|
461
464
|
in out TParentRoute extends AnyRoute,
|
|
462
465
|
in out TPath extends string,
|
|
463
466
|
in out TFullPath extends string,
|
|
@@ -472,6 +475,8 @@ export type RouteAddChildrenFn<
|
|
|
472
475
|
in out TLoaderFn,
|
|
473
476
|
in out TFileRouteTypes,
|
|
474
477
|
in out TSSR,
|
|
478
|
+
in out TServerMiddlewares,
|
|
479
|
+
in out THandlers,
|
|
475
480
|
> = <const TNewChildren>(
|
|
476
481
|
children: Constrain<
|
|
477
482
|
TNewChildren,
|
|
@@ -493,11 +498,13 @@ export type RouteAddChildrenFn<
|
|
|
493
498
|
TLoaderFn,
|
|
494
499
|
TNewChildren,
|
|
495
500
|
TFileRouteTypes,
|
|
496
|
-
TSSR
|
|
501
|
+
TSSR,
|
|
502
|
+
TServerMiddlewares,
|
|
503
|
+
THandlers
|
|
497
504
|
>
|
|
498
505
|
|
|
499
506
|
export type RouteAddFileChildrenFn<
|
|
500
|
-
in out TRegister
|
|
507
|
+
in out TRegister,
|
|
501
508
|
in out TParentRoute extends AnyRoute,
|
|
502
509
|
in out TPath extends string,
|
|
503
510
|
in out TFullPath extends string,
|
|
@@ -512,6 +519,8 @@ export type RouteAddFileChildrenFn<
|
|
|
512
519
|
in out TLoaderFn,
|
|
513
520
|
in out TFileRouteTypes,
|
|
514
521
|
in out TSSR,
|
|
522
|
+
in out TServerMiddlewares,
|
|
523
|
+
in out THandlers,
|
|
515
524
|
> = <const TNewChildren>(
|
|
516
525
|
children: TNewChildren,
|
|
517
526
|
) => Route<
|
|
@@ -530,11 +539,13 @@ export type RouteAddFileChildrenFn<
|
|
|
530
539
|
TLoaderFn,
|
|
531
540
|
TNewChildren,
|
|
532
541
|
TFileRouteTypes,
|
|
533
|
-
TSSR
|
|
542
|
+
TSSR,
|
|
543
|
+
TServerMiddlewares,
|
|
544
|
+
THandlers
|
|
534
545
|
>
|
|
535
546
|
|
|
536
547
|
export type RouteAddFileTypesFn<
|
|
537
|
-
TRegister
|
|
548
|
+
TRegister,
|
|
538
549
|
TParentRoute extends AnyRoute,
|
|
539
550
|
TPath extends string,
|
|
540
551
|
TFullPath extends string,
|
|
@@ -549,6 +560,8 @@ export type RouteAddFileTypesFn<
|
|
|
549
560
|
TLoaderFn,
|
|
550
561
|
TChildren,
|
|
551
562
|
TSSR,
|
|
563
|
+
TServerMiddlewares,
|
|
564
|
+
THandlers,
|
|
552
565
|
> = <TNewFileRouteTypes>() => Route<
|
|
553
566
|
TRegister,
|
|
554
567
|
TParentRoute,
|
|
@@ -565,11 +578,13 @@ export type RouteAddFileTypesFn<
|
|
|
565
578
|
TLoaderFn,
|
|
566
579
|
TChildren,
|
|
567
580
|
TNewFileRouteTypes,
|
|
568
|
-
TSSR
|
|
581
|
+
TSSR,
|
|
582
|
+
TServerMiddlewares,
|
|
583
|
+
THandlers
|
|
569
584
|
>
|
|
570
585
|
|
|
571
586
|
export interface Route<
|
|
572
|
-
in out TRegister
|
|
587
|
+
in out TRegister,
|
|
573
588
|
in out TParentRoute extends AnyRoute,
|
|
574
589
|
in out TPath extends string,
|
|
575
590
|
in out TFullPath extends string,
|
|
@@ -585,11 +600,14 @@ export interface Route<
|
|
|
585
600
|
in out TChildren,
|
|
586
601
|
in out TFileRouteTypes,
|
|
587
602
|
in out TSSR,
|
|
603
|
+
in out TServerMiddlewares,
|
|
604
|
+
in out THandlers,
|
|
588
605
|
> extends RouteExtensions<TId, TFullPath> {
|
|
589
606
|
path: TPath
|
|
590
607
|
parentRoute: TParentRoute
|
|
591
608
|
children?: TChildren
|
|
592
609
|
types: RouteTypes<
|
|
610
|
+
TRegister,
|
|
593
611
|
TParentRoute,
|
|
594
612
|
TPath,
|
|
595
613
|
TFullPath,
|
|
@@ -604,7 +622,9 @@ export interface Route<
|
|
|
604
622
|
TLoaderFn,
|
|
605
623
|
TChildren,
|
|
606
624
|
TFileRouteTypes,
|
|
607
|
-
TSSR
|
|
625
|
+
TSSR,
|
|
626
|
+
TServerMiddlewares,
|
|
627
|
+
THandlers
|
|
608
628
|
>
|
|
609
629
|
options: RouteOptions<
|
|
610
630
|
TRegister,
|
|
@@ -620,7 +640,9 @@ export interface Route<
|
|
|
620
640
|
TRouterContext,
|
|
621
641
|
TRouteContextFn,
|
|
622
642
|
TBeforeLoadFn,
|
|
623
|
-
TSSR
|
|
643
|
+
TSSR,
|
|
644
|
+
TServerMiddlewares,
|
|
645
|
+
THandlers
|
|
624
646
|
>
|
|
625
647
|
isRoot: TParentRoute extends AnyRoute ? true : false
|
|
626
648
|
/** @internal */
|
|
@@ -645,7 +667,9 @@ export interface Route<
|
|
|
645
667
|
TLoaderFn,
|
|
646
668
|
TChildren,
|
|
647
669
|
TFileRouteTypes,
|
|
648
|
-
TSSR
|
|
670
|
+
TSSR,
|
|
671
|
+
TServerMiddlewares,
|
|
672
|
+
THandlers
|
|
649
673
|
>
|
|
650
674
|
>
|
|
651
675
|
>
|
|
@@ -687,7 +711,9 @@ export interface Route<
|
|
|
687
711
|
TLoaderFn,
|
|
688
712
|
TChildren,
|
|
689
713
|
TFileRouteTypes,
|
|
690
|
-
TSSR
|
|
714
|
+
TSSR,
|
|
715
|
+
TServerMiddlewares,
|
|
716
|
+
THandlers
|
|
691
717
|
>
|
|
692
718
|
>
|
|
693
719
|
addChildren: RouteAddChildrenFn<
|
|
@@ -705,7 +731,9 @@ export interface Route<
|
|
|
705
731
|
TLoaderDeps,
|
|
706
732
|
TLoaderFn,
|
|
707
733
|
TFileRouteTypes,
|
|
708
|
-
TSSR
|
|
734
|
+
TSSR,
|
|
735
|
+
TServerMiddlewares,
|
|
736
|
+
THandlers
|
|
709
737
|
>
|
|
710
738
|
_addFileChildren: RouteAddFileChildrenFn<
|
|
711
739
|
TRegister,
|
|
@@ -722,7 +750,9 @@ export interface Route<
|
|
|
722
750
|
TLoaderDeps,
|
|
723
751
|
TLoaderFn,
|
|
724
752
|
TFileRouteTypes,
|
|
725
|
-
TSSR
|
|
753
|
+
TSSR,
|
|
754
|
+
TServerMiddlewares,
|
|
755
|
+
THandlers
|
|
726
756
|
>
|
|
727
757
|
_addFileTypes: RouteAddFileTypesFn<
|
|
728
758
|
TRegister,
|
|
@@ -739,7 +769,9 @@ export interface Route<
|
|
|
739
769
|
TLoaderDeps,
|
|
740
770
|
TLoaderFn,
|
|
741
771
|
TChildren,
|
|
742
|
-
TSSR
|
|
772
|
+
TSSR,
|
|
773
|
+
TServerMiddlewares,
|
|
774
|
+
THandlers
|
|
743
775
|
>
|
|
744
776
|
}
|
|
745
777
|
|
|
@@ -759,6 +791,8 @@ export type AnyRoute = Route<
|
|
|
759
791
|
any,
|
|
760
792
|
any,
|
|
761
793
|
any,
|
|
794
|
+
any,
|
|
795
|
+
any,
|
|
762
796
|
any
|
|
763
797
|
>
|
|
764
798
|
|
|
@@ -767,7 +801,7 @@ export type AnyRouteWithContext<TContext> = AnyRoute & {
|
|
|
767
801
|
}
|
|
768
802
|
|
|
769
803
|
export type RouteOptions<
|
|
770
|
-
TRegister
|
|
804
|
+
TRegister,
|
|
771
805
|
TParentRoute extends AnyRoute = AnyRoute,
|
|
772
806
|
TId extends string = string,
|
|
773
807
|
TCustomId extends string = string,
|
|
@@ -781,6 +815,8 @@ export type RouteOptions<
|
|
|
781
815
|
TRouteContextFn = AnyContext,
|
|
782
816
|
TBeforeLoadFn = AnyContext,
|
|
783
817
|
TSSR = unknown,
|
|
818
|
+
TServerMiddlewares = unknown,
|
|
819
|
+
THandlers = undefined,
|
|
784
820
|
> = BaseRouteOptions<
|
|
785
821
|
TRegister,
|
|
786
822
|
TParentRoute,
|
|
@@ -794,7 +830,9 @@ export type RouteOptions<
|
|
|
794
830
|
TRouterContext,
|
|
795
831
|
TRouteContextFn,
|
|
796
832
|
TBeforeLoadFn,
|
|
797
|
-
TSSR
|
|
833
|
+
TSSR,
|
|
834
|
+
TServerMiddlewares,
|
|
835
|
+
THandlers
|
|
798
836
|
> &
|
|
799
837
|
UpdatableRouteOptions<
|
|
800
838
|
NoInfer<TParentRoute>,
|
|
@@ -823,24 +861,43 @@ export type RouteContextFn<
|
|
|
823
861
|
>,
|
|
824
862
|
) => any
|
|
825
863
|
|
|
826
|
-
export type
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
864
|
+
export type FileBaseRouteOptions<
|
|
865
|
+
TRegister,
|
|
866
|
+
TParentRoute extends AnyRoute = AnyRoute,
|
|
867
|
+
TId extends string = string,
|
|
868
|
+
TPath extends string = string,
|
|
869
|
+
TSearchValidator = undefined,
|
|
870
|
+
TParams = {},
|
|
871
|
+
TLoaderDeps extends Record<string, any> = {},
|
|
872
|
+
TLoaderFn = undefined,
|
|
873
|
+
TRouterContext = {},
|
|
874
|
+
TRouteContextFn = AnyContext,
|
|
875
|
+
TBeforeLoadFn = AnyContext,
|
|
876
|
+
TRemountDepsFn = AnyContext,
|
|
877
|
+
TSSR = unknown,
|
|
878
|
+
TServerMiddlewares = unknown,
|
|
879
|
+
THandlers = undefined,
|
|
880
|
+
> = ParamsOptions<TPath, TParams> &
|
|
881
|
+
FilebaseRouteOptionsInterface<
|
|
882
|
+
TRegister,
|
|
834
883
|
TParentRoute,
|
|
884
|
+
TId,
|
|
885
|
+
TPath,
|
|
835
886
|
TSearchValidator,
|
|
836
887
|
TParams,
|
|
888
|
+
TLoaderDeps,
|
|
889
|
+
TLoaderFn,
|
|
837
890
|
TRouterContext,
|
|
838
|
-
TRouteContextFn
|
|
839
|
-
|
|
840
|
-
|
|
891
|
+
TRouteContextFn,
|
|
892
|
+
TBeforeLoadFn,
|
|
893
|
+
TRemountDepsFn,
|
|
894
|
+
TSSR,
|
|
895
|
+
TServerMiddlewares,
|
|
896
|
+
THandlers
|
|
897
|
+
>
|
|
841
898
|
|
|
842
|
-
export
|
|
843
|
-
TRegister
|
|
899
|
+
export interface FilebaseRouteOptionsInterface<
|
|
900
|
+
TRegister,
|
|
844
901
|
TParentRoute extends AnyRoute = AnyRoute,
|
|
845
902
|
TId extends string = string,
|
|
846
903
|
TPath extends string = string,
|
|
@@ -853,20 +910,25 @@ export type FileBaseRouteOptions<
|
|
|
853
910
|
TBeforeLoadFn = AnyContext,
|
|
854
911
|
TRemountDepsFn = AnyContext,
|
|
855
912
|
TSSR = unknown,
|
|
856
|
-
|
|
913
|
+
TServerMiddlewares = unknown,
|
|
914
|
+
THandlers = undefined,
|
|
915
|
+
> {
|
|
857
916
|
validateSearch?: Constrain<TSearchValidator, AnyValidator, DefaultValidator>
|
|
858
917
|
|
|
859
918
|
shouldReload?:
|
|
860
919
|
| boolean
|
|
861
920
|
| ((
|
|
862
921
|
match: LoaderFnContext<
|
|
922
|
+
TRegister,
|
|
863
923
|
TParentRoute,
|
|
864
924
|
TId,
|
|
865
925
|
TParams,
|
|
866
926
|
TLoaderDeps,
|
|
867
927
|
TRouterContext,
|
|
868
928
|
TRouteContextFn,
|
|
869
|
-
TBeforeLoadFn
|
|
929
|
+
TBeforeLoadFn,
|
|
930
|
+
TServerMiddlewares,
|
|
931
|
+
THandlers
|
|
870
932
|
>,
|
|
871
933
|
) => any)
|
|
872
934
|
|
|
@@ -899,11 +961,14 @@ export type FileBaseRouteOptions<
|
|
|
899
961
|
TBeforeLoadFn,
|
|
900
962
|
(
|
|
901
963
|
ctx: BeforeLoadContextOptions<
|
|
964
|
+
TRegister,
|
|
902
965
|
TParentRoute,
|
|
903
966
|
TSearchValidator,
|
|
904
967
|
TParams,
|
|
905
968
|
TRouterContext,
|
|
906
|
-
TRouteContextFn
|
|
969
|
+
TRouteContextFn,
|
|
970
|
+
TServerMiddlewares,
|
|
971
|
+
THandlers
|
|
907
972
|
>,
|
|
908
973
|
) => ValidateSerializableLifecycleResult<
|
|
909
974
|
TRegister,
|
|
@@ -933,13 +998,16 @@ export type FileBaseRouteOptions<
|
|
|
933
998
|
TLoaderFn,
|
|
934
999
|
(
|
|
935
1000
|
ctx: LoaderFnContext<
|
|
1001
|
+
TRegister,
|
|
936
1002
|
TParentRoute,
|
|
937
1003
|
TId,
|
|
938
1004
|
TParams,
|
|
939
1005
|
TLoaderDeps,
|
|
940
1006
|
TRouterContext,
|
|
941
1007
|
TRouteContextFn,
|
|
942
|
-
TBeforeLoadFn
|
|
1008
|
+
TBeforeLoadFn,
|
|
1009
|
+
TServerMiddlewares,
|
|
1010
|
+
THandlers
|
|
943
1011
|
>,
|
|
944
1012
|
) => ValidateSerializableLifecycleResult<
|
|
945
1013
|
TRegister,
|
|
@@ -951,7 +1019,7 @@ export type FileBaseRouteOptions<
|
|
|
951
1019
|
}
|
|
952
1020
|
|
|
953
1021
|
export type BaseRouteOptions<
|
|
954
|
-
TRegister
|
|
1022
|
+
TRegister,
|
|
955
1023
|
TParentRoute extends AnyRoute = AnyRoute,
|
|
956
1024
|
TId extends string = string,
|
|
957
1025
|
TCustomId extends string = string,
|
|
@@ -964,6 +1032,8 @@ export type BaseRouteOptions<
|
|
|
964
1032
|
TRouteContextFn = AnyContext,
|
|
965
1033
|
TBeforeLoadFn = AnyContext,
|
|
966
1034
|
TSSR = unknown,
|
|
1035
|
+
TServerMiddlewares = unknown,
|
|
1036
|
+
THandlers = undefined,
|
|
967
1037
|
> = RoutePathOptions<TCustomId, TPath> &
|
|
968
1038
|
FileBaseRouteOptions<
|
|
969
1039
|
TRegister,
|
|
@@ -978,7 +1048,9 @@ export type BaseRouteOptions<
|
|
|
978
1048
|
TRouteContextFn,
|
|
979
1049
|
TBeforeLoadFn,
|
|
980
1050
|
AnyContext,
|
|
981
|
-
TSSR
|
|
1051
|
+
TSSR,
|
|
1052
|
+
TServerMiddlewares,
|
|
1053
|
+
THandlers
|
|
982
1054
|
> & {
|
|
983
1055
|
getParentRoute: () => TParentRoute
|
|
984
1056
|
}
|
|
@@ -1032,11 +1104,14 @@ export interface SsrContextOptions<
|
|
|
1032
1104
|
}
|
|
1033
1105
|
|
|
1034
1106
|
export interface BeforeLoadContextOptions<
|
|
1107
|
+
in out TRegister,
|
|
1035
1108
|
in out TParentRoute extends AnyRoute,
|
|
1036
1109
|
in out TSearchValidator,
|
|
1037
1110
|
in out TParams,
|
|
1038
1111
|
in out TRouterContext,
|
|
1039
1112
|
in out TRouteContextFn,
|
|
1113
|
+
in out TServerMiddlewares,
|
|
1114
|
+
in out THandlers,
|
|
1040
1115
|
> extends ContextOptions<TParentRoute, TParams>,
|
|
1041
1116
|
FullSearchSchemaOption<TParentRoute, TSearchValidator> {
|
|
1042
1117
|
context: Expand<
|
|
@@ -1256,6 +1331,7 @@ export interface UpdatableRouteOptions<
|
|
|
1256
1331
|
}
|
|
1257
1332
|
|
|
1258
1333
|
export type RouteLoaderFn<
|
|
1334
|
+
in out TRegister,
|
|
1259
1335
|
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1260
1336
|
in out TId extends string = string,
|
|
1261
1337
|
in out TParams = {},
|
|
@@ -1263,19 +1339,25 @@ export type RouteLoaderFn<
|
|
|
1263
1339
|
in out TRouterContext = {},
|
|
1264
1340
|
in out TRouteContextFn = AnyContext,
|
|
1265
1341
|
in out TBeforeLoadFn = AnyContext,
|
|
1342
|
+
in out TServerMiddlewares = unknown,
|
|
1343
|
+
in out THandlers = undefined,
|
|
1266
1344
|
> = (
|
|
1267
1345
|
match: LoaderFnContext<
|
|
1346
|
+
TRegister,
|
|
1268
1347
|
TParentRoute,
|
|
1269
1348
|
TId,
|
|
1270
1349
|
TParams,
|
|
1271
1350
|
TLoaderDeps,
|
|
1272
1351
|
TRouterContext,
|
|
1273
1352
|
TRouteContextFn,
|
|
1274
|
-
TBeforeLoadFn
|
|
1353
|
+
TBeforeLoadFn,
|
|
1354
|
+
TServerMiddlewares,
|
|
1355
|
+
THandlers
|
|
1275
1356
|
>,
|
|
1276
1357
|
) => any
|
|
1277
1358
|
|
|
1278
1359
|
export interface LoaderFnContext<
|
|
1360
|
+
in out TRegister = unknown,
|
|
1279
1361
|
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1280
1362
|
in out TId extends string = string,
|
|
1281
1363
|
in out TParams = {},
|
|
@@ -1283,6 +1365,8 @@ export interface LoaderFnContext<
|
|
|
1283
1365
|
in out TRouterContext = {},
|
|
1284
1366
|
in out TRouteContextFn = AnyContext,
|
|
1285
1367
|
in out TBeforeLoadFn = AnyContext,
|
|
1368
|
+
in out TServerMiddlewares = unknown,
|
|
1369
|
+
in out THandlers = undefined,
|
|
1286
1370
|
> {
|
|
1287
1371
|
abortController: AbortController
|
|
1288
1372
|
preload: boolean
|
|
@@ -1316,8 +1400,8 @@ export interface DefaultRootRouteOptionsExtensions {
|
|
|
1316
1400
|
export interface RootRouteOptionsExtensions
|
|
1317
1401
|
extends DefaultRootRouteOptionsExtensions {}
|
|
1318
1402
|
|
|
1319
|
-
export
|
|
1320
|
-
TRegister
|
|
1403
|
+
export interface RootRouteOptions<
|
|
1404
|
+
TRegister = unknown,
|
|
1321
1405
|
TSearchValidator = undefined,
|
|
1322
1406
|
TRouterContext = {},
|
|
1323
1407
|
TRouteContextFn = AnyContext,
|
|
@@ -1325,32 +1409,36 @@ export type RootRouteOptions<
|
|
|
1325
1409
|
TLoaderDeps extends Record<string, any> = {},
|
|
1326
1410
|
TLoaderFn = undefined,
|
|
1327
1411
|
TSSR = unknown,
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1412
|
+
TServerMiddlewares = unknown,
|
|
1413
|
+
THandlers = undefined,
|
|
1414
|
+
> extends Omit<
|
|
1415
|
+
RouteOptions<
|
|
1416
|
+
TRegister,
|
|
1417
|
+
any, // TParentRoute
|
|
1418
|
+
RootRouteId, // TId
|
|
1419
|
+
RootRouteId, // TCustomId
|
|
1420
|
+
'', // TFullPath
|
|
1421
|
+
'', // TPath
|
|
1422
|
+
TSearchValidator,
|
|
1423
|
+
{}, // TParams
|
|
1424
|
+
TLoaderDeps,
|
|
1425
|
+
TLoaderFn,
|
|
1426
|
+
TRouterContext,
|
|
1427
|
+
TRouteContextFn,
|
|
1428
|
+
TBeforeLoadFn,
|
|
1429
|
+
TSSR,
|
|
1430
|
+
TServerMiddlewares,
|
|
1431
|
+
THandlers
|
|
1432
|
+
>,
|
|
1433
|
+
| 'path'
|
|
1434
|
+
| 'id'
|
|
1435
|
+
| 'getParentRoute'
|
|
1436
|
+
| 'caseSensitive'
|
|
1437
|
+
| 'parseParams'
|
|
1438
|
+
| 'stringifyParams'
|
|
1439
|
+
| 'params'
|
|
1440
|
+
>,
|
|
1441
|
+
RootRouteOptionsExtensions {}
|
|
1354
1442
|
|
|
1355
1443
|
export type RouteConstraints = {
|
|
1356
1444
|
TParentRoute: AnyRoute
|
|
@@ -1406,7 +1494,7 @@ export type NotFoundRouteProps = {
|
|
|
1406
1494
|
}
|
|
1407
1495
|
|
|
1408
1496
|
export class BaseRoute<
|
|
1409
|
-
in out TRegister
|
|
1497
|
+
in out TRegister = Register,
|
|
1410
1498
|
in out TParentRoute extends AnyRoute = AnyRoute,
|
|
1411
1499
|
in out TPath extends string = '/',
|
|
1412
1500
|
in out TFullPath extends string = ResolveFullPath<TParentRoute, TPath>,
|
|
@@ -1422,6 +1510,8 @@ export class BaseRoute<
|
|
|
1422
1510
|
in out TChildren = unknown,
|
|
1423
1511
|
in out TFileRouteTypes = unknown,
|
|
1424
1512
|
in out TSSR = unknown,
|
|
1513
|
+
in out TServerMiddlewares = unknown,
|
|
1514
|
+
in out THandlers = undefined,
|
|
1425
1515
|
> {
|
|
1426
1516
|
isRoot: TParentRoute extends AnyRoute ? true : false
|
|
1427
1517
|
options: RouteOptions<
|
|
@@ -1438,7 +1528,9 @@ export class BaseRoute<
|
|
|
1438
1528
|
TRouterContext,
|
|
1439
1529
|
TRouteContextFn,
|
|
1440
1530
|
TBeforeLoadFn,
|
|
1441
|
-
TSSR
|
|
1531
|
+
TSSR,
|
|
1532
|
+
TServerMiddlewares,
|
|
1533
|
+
THandlers
|
|
1442
1534
|
>
|
|
1443
1535
|
|
|
1444
1536
|
// The following properties are set up in this.init()
|
|
@@ -1486,7 +1578,9 @@ export class BaseRoute<
|
|
|
1486
1578
|
TLoaderFn,
|
|
1487
1579
|
TChildren,
|
|
1488
1580
|
TFileRouteTypes,
|
|
1489
|
-
TSSR
|
|
1581
|
+
TSSR,
|
|
1582
|
+
TServerMiddlewares,
|
|
1583
|
+
THandlers
|
|
1490
1584
|
>
|
|
1491
1585
|
>
|
|
1492
1586
|
>
|
|
@@ -1510,7 +1604,9 @@ export class BaseRoute<
|
|
|
1510
1604
|
TRouterContext,
|
|
1511
1605
|
TRouteContextFn,
|
|
1512
1606
|
TBeforeLoadFn,
|
|
1513
|
-
TSSR
|
|
1607
|
+
TSSR,
|
|
1608
|
+
TServerMiddlewares,
|
|
1609
|
+
THandlers
|
|
1514
1610
|
>,
|
|
1515
1611
|
) {
|
|
1516
1612
|
this.options = (options as any) || {}
|
|
@@ -1522,6 +1618,7 @@ export class BaseRoute<
|
|
|
1522
1618
|
}
|
|
1523
1619
|
|
|
1524
1620
|
types!: RouteTypes<
|
|
1621
|
+
TRegister,
|
|
1525
1622
|
TParentRoute,
|
|
1526
1623
|
TPath,
|
|
1527
1624
|
TFullPath,
|
|
@@ -1536,7 +1633,9 @@ export class BaseRoute<
|
|
|
1536
1633
|
TLoaderFn,
|
|
1537
1634
|
TChildren,
|
|
1538
1635
|
TFileRouteTypes,
|
|
1539
|
-
TSSR
|
|
1636
|
+
TSSR,
|
|
1637
|
+
TServerMiddlewares,
|
|
1638
|
+
THandlers
|
|
1540
1639
|
>
|
|
1541
1640
|
|
|
1542
1641
|
init = (opts: { originalIndex: number }): void => {
|
|
@@ -1557,7 +1656,8 @@ export class BaseRoute<
|
|
|
1557
1656
|
TRouterContext,
|
|
1558
1657
|
TRouteContextFn,
|
|
1559
1658
|
TBeforeLoadFn,
|
|
1560
|
-
TSSR
|
|
1659
|
+
TSSR,
|
|
1660
|
+
TServerMiddlewares
|
|
1561
1661
|
> &
|
|
1562
1662
|
RoutePathOptionsIntersection<TCustomId, TPath>)
|
|
1563
1663
|
| undefined
|
|
@@ -1633,7 +1733,9 @@ export class BaseRoute<
|
|
|
1633
1733
|
TLoaderDeps,
|
|
1634
1734
|
TLoaderFn,
|
|
1635
1735
|
TFileRouteTypes,
|
|
1636
|
-
TSSR
|
|
1736
|
+
TSSR,
|
|
1737
|
+
TServerMiddlewares,
|
|
1738
|
+
THandlers
|
|
1637
1739
|
> = (children) => {
|
|
1638
1740
|
return this._addFileChildren(children) as any
|
|
1639
1741
|
}
|
|
@@ -1653,7 +1755,9 @@ export class BaseRoute<
|
|
|
1653
1755
|
TLoaderDeps,
|
|
1654
1756
|
TLoaderFn,
|
|
1655
1757
|
TFileRouteTypes,
|
|
1656
|
-
TSSR
|
|
1758
|
+
TSSR,
|
|
1759
|
+
TServerMiddlewares,
|
|
1760
|
+
THandlers
|
|
1657
1761
|
> = (children) => {
|
|
1658
1762
|
if (Array.isArray(children)) {
|
|
1659
1763
|
this.children = children as TChildren
|
|
@@ -1681,7 +1785,9 @@ export class BaseRoute<
|
|
|
1681
1785
|
TLoaderDeps,
|
|
1682
1786
|
TLoaderFn,
|
|
1683
1787
|
TChildren,
|
|
1684
|
-
TSSR
|
|
1788
|
+
TSSR,
|
|
1789
|
+
TServerMiddlewares,
|
|
1790
|
+
THandlers
|
|
1685
1791
|
> = () => {
|
|
1686
1792
|
return this as any
|
|
1687
1793
|
}
|
|
@@ -1690,6 +1796,7 @@ export class BaseRoute<
|
|
|
1690
1796
|
loader: Constrain<
|
|
1691
1797
|
TNewLoaderFn,
|
|
1692
1798
|
RouteLoaderFn<
|
|
1799
|
+
TRegister,
|
|
1693
1800
|
TParentRoute,
|
|
1694
1801
|
TCustomId,
|
|
1695
1802
|
TParams,
|
|
@@ -1717,7 +1824,9 @@ export class BaseRoute<
|
|
|
1717
1824
|
TNewLoaderFn,
|
|
1718
1825
|
TChildren,
|
|
1719
1826
|
TFileRouteTypes,
|
|
1720
|
-
TSSR
|
|
1827
|
+
TSSR,
|
|
1828
|
+
TServerMiddlewares,
|
|
1829
|
+
THandlers
|
|
1721
1830
|
>
|
|
1722
1831
|
}
|
|
1723
1832
|
|
|
@@ -1756,7 +1865,9 @@ export class BaseRoute<
|
|
|
1756
1865
|
TLoaderFn,
|
|
1757
1866
|
TChildren,
|
|
1758
1867
|
TFileRouteTypes,
|
|
1759
|
-
TSSR
|
|
1868
|
+
TSSR,
|
|
1869
|
+
TServerMiddlewares,
|
|
1870
|
+
THandlers
|
|
1760
1871
|
>
|
|
1761
1872
|
> = (lazyFn) => {
|
|
1762
1873
|
this.lazyFn = lazyFn
|
|
@@ -1777,7 +1888,7 @@ export class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
|
|
|
1777
1888
|
}
|
|
1778
1889
|
|
|
1779
1890
|
export interface RootRoute<
|
|
1780
|
-
in out TRegister
|
|
1891
|
+
in out TRegister,
|
|
1781
1892
|
in out TSearchValidator = undefined,
|
|
1782
1893
|
in out TRouterContext = {},
|
|
1783
1894
|
in out TRouteContextFn = AnyContext,
|
|
@@ -1787,6 +1898,8 @@ export interface RootRoute<
|
|
|
1787
1898
|
in out TChildren = unknown,
|
|
1788
1899
|
in out TFileRouteTypes = unknown,
|
|
1789
1900
|
in out TSSR = unknown,
|
|
1901
|
+
in out TServerMiddlewares = unknown,
|
|
1902
|
+
in out THandlers = undefined,
|
|
1790
1903
|
> extends Route<
|
|
1791
1904
|
TRegister,
|
|
1792
1905
|
any, // TParentRoute
|
|
@@ -1803,11 +1916,13 @@ export interface RootRoute<
|
|
|
1803
1916
|
TLoaderFn,
|
|
1804
1917
|
TChildren, // TChildren
|
|
1805
1918
|
TFileRouteTypes,
|
|
1806
|
-
TSSR
|
|
1919
|
+
TSSR,
|
|
1920
|
+
TServerMiddlewares,
|
|
1921
|
+
THandlers
|
|
1807
1922
|
> {}
|
|
1808
1923
|
|
|
1809
1924
|
export class BaseRootRoute<
|
|
1810
|
-
in out TRegister
|
|
1925
|
+
in out TRegister = Register,
|
|
1811
1926
|
in out TSearchValidator = undefined,
|
|
1812
1927
|
in out TRouterContext = {},
|
|
1813
1928
|
in out TRouteContextFn = AnyContext,
|
|
@@ -1817,6 +1932,8 @@ export class BaseRootRoute<
|
|
|
1817
1932
|
in out TChildren = unknown,
|
|
1818
1933
|
in out TFileRouteTypes = unknown,
|
|
1819
1934
|
in out TSSR = unknown,
|
|
1935
|
+
in out TServerMiddlewares = unknown,
|
|
1936
|
+
in out THandlers = undefined,
|
|
1820
1937
|
> extends BaseRoute<
|
|
1821
1938
|
TRegister,
|
|
1822
1939
|
any, // TParentRoute
|
|
@@ -1833,7 +1950,9 @@ export class BaseRootRoute<
|
|
|
1833
1950
|
TLoaderFn,
|
|
1834
1951
|
TChildren, // TChildren
|
|
1835
1952
|
TFileRouteTypes,
|
|
1836
|
-
TSSR
|
|
1953
|
+
TSSR,
|
|
1954
|
+
TServerMiddlewares,
|
|
1955
|
+
THandlers
|
|
1837
1956
|
> {
|
|
1838
1957
|
constructor(
|
|
1839
1958
|
options?: RootRouteOptions<
|
|
@@ -1844,7 +1963,9 @@ export class BaseRootRoute<
|
|
|
1844
1963
|
TBeforeLoadFn,
|
|
1845
1964
|
TLoaderDeps,
|
|
1846
1965
|
TLoaderFn,
|
|
1847
|
-
TSSR
|
|
1966
|
+
TSSR,
|
|
1967
|
+
TServerMiddlewares,
|
|
1968
|
+
THandlers
|
|
1848
1969
|
>,
|
|
1849
1970
|
) {
|
|
1850
1971
|
super(options as any)
|
|
@@ -1852,3 +1973,16 @@ export class BaseRootRoute<
|
|
|
1852
1973
|
}
|
|
1853
1974
|
|
|
1854
1975
|
//
|
|
1976
|
+
|
|
1977
|
+
export interface RouteLike {
|
|
1978
|
+
id: string
|
|
1979
|
+
isRoot?: boolean
|
|
1980
|
+
path?: string
|
|
1981
|
+
fullPath: string
|
|
1982
|
+
rank?: number
|
|
1983
|
+
parentRoute?: RouteLike
|
|
1984
|
+
children?: Array<RouteLike>
|
|
1985
|
+
options?: {
|
|
1986
|
+
caseSensitive?: boolean
|
|
1987
|
+
}
|
|
1988
|
+
}
|