@vaadin/hilla-file-router 24.7.0-alpha9 → 24.7.0-beta3
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/package.json +10 -34
- package/runtime/RouterConfigurationBuilder.d.ts +65 -66
- package/runtime/RouterConfigurationBuilder.js +293 -339
- package/runtime/RouterConfigurationBuilder.js.map +1 -7
- package/runtime/createMenuItems.d.ts +10 -23
- package/runtime/createMenuItems.js +45 -35
- package/runtime/createMenuItems.js.map +1 -7
- package/runtime/createRoute.d.ts +16 -17
- package/runtime/createRoute.js +29 -25
- package/runtime/createRoute.js.map +1 -7
- package/runtime/useViewConfig.d.ts +3 -4
- package/runtime/useViewConfig.js +7 -7
- package/runtime/useViewConfig.js.map +1 -7
- package/runtime.d.ts +4 -5
- package/runtime.js +1 -1
- package/runtime.js.map +1 -7
- package/shared/convertComponentNameToTitle.d.ts +6 -7
- package/shared/convertComponentNameToTitle.js +16 -12
- package/shared/convertComponentNameToTitle.js.map +1 -7
- package/shared/internal.d.ts +11 -16
- package/shared/routeParamType.d.ts +5 -6
- package/shared/routeParamType.js +10 -10
- package/shared/routeParamType.js.map +1 -7
- package/shared/transformTree.d.ts +5 -2
- package/shared/transformTree.js +3 -6
- package/shared/transformTree.js.map +1 -7
- package/types.d.ts +73 -88
- package/vite-plugin/applyLayouts.d.ts +10 -11
- package/vite-plugin/applyLayouts.js +32 -25
- package/vite-plugin/applyLayouts.js.map +1 -7
- package/vite-plugin/collectRoutesFromFS.d.ts +34 -35
- package/vite-plugin/collectRoutesFromFS.js +96 -87
- package/vite-plugin/collectRoutesFromFS.js.map +1 -7
- package/vite-plugin/createRoutesFromMeta.d.ts +2 -3
- package/vite-plugin/createRoutesFromMeta.js +81 -95
- package/vite-plugin/createRoutesFromMeta.js.map +1 -7
- package/vite-plugin/createViewConfigJson.d.ts +6 -7
- package/vite-plugin/createViewConfigJson.js +71 -76
- package/vite-plugin/createViewConfigJson.js.map +1 -7
- package/vite-plugin/generateRuntimeFiles.d.ts +24 -25
- package/vite-plugin/generateRuntimeFiles.js +66 -47
- package/vite-plugin/generateRuntimeFiles.js.map +1 -7
- package/vite-plugin/utils.d.ts +21 -22
- package/vite-plugin/utils.js +57 -46
- package/vite-plugin/utils.js.map +1 -7
- package/vite-plugin.d.ts +41 -42
- package/vite-plugin.js +78 -85
- package/vite-plugin.js.map +1 -7
- package/runtime/RouterConfigurationBuilder.d.ts.map +0 -1
- package/runtime/createMenuItems.d.ts.map +0 -1
- package/runtime/createRoute.d.ts.map +0 -1
- package/runtime/useViewConfig.d.ts.map +0 -1
- package/runtime.d.ts.map +0 -1
- package/shared/convertComponentNameToTitle.d.ts.map +0 -1
- package/shared/routeParamType.d.ts.map +0 -1
- package/shared/transformTree.d.ts.map +0 -1
- package/vite-plugin/applyLayouts.d.ts.map +0 -1
- package/vite-plugin/collectRoutesFromFS.d.ts.map +0 -1
- package/vite-plugin/createRoutesFromMeta.d.ts.map +0 -1
- package/vite-plugin/createViewConfigJson.d.ts.map +0 -1
- package/vite-plugin/generateRuntimeFiles.d.ts.map +0 -1
- package/vite-plugin/utils.d.ts.map +0 -1
- package/vite-plugin.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/hilla-file-router",
|
|
3
|
-
"version": "24.7.0-
|
|
3
|
+
"version": "24.7.0-beta3",
|
|
4
4
|
"description": "Hilla file-based router",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"module": "index.js",
|
|
@@ -20,14 +20,13 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"clean:build": "git clean -fx . -e .vite -e node_modules",
|
|
23
|
-
"build": "
|
|
24
|
-
"build:esbuild": "tsx ../../../scripts/build.ts",
|
|
25
|
-
"build:dts": "tsc --isolatedModules -p tsconfig.build.json",
|
|
26
|
-
"build:copy": "cd src && copyfiles *.d.ts **/*.d.ts ..",
|
|
23
|
+
"build": "tsx ../../../scripts/fast-build.ts",
|
|
27
24
|
"lint": "eslint src test",
|
|
28
25
|
"lint:fix": "eslint src test --fix",
|
|
29
|
-
"test": "
|
|
30
|
-
"test:coverage": "
|
|
26
|
+
"test": "vitest --run",
|
|
27
|
+
"test:coverage": "vitest --run --coverage",
|
|
28
|
+
"test:react": "npm run test",
|
|
29
|
+
"test:watch": "vitest",
|
|
31
30
|
"typecheck": "tsc --noEmit"
|
|
32
31
|
},
|
|
33
32
|
"exports": {
|
|
@@ -59,35 +58,12 @@
|
|
|
59
58
|
"peerDependencies": {
|
|
60
59
|
"react": "18 || 19",
|
|
61
60
|
"react-dom": "18 || 19",
|
|
62
|
-
"react-router": "
|
|
63
|
-
},
|
|
64
|
-
"devDependencies": {
|
|
65
|
-
"@types/chai-as-promised": "^7.1.8",
|
|
66
|
-
"@types/chai-fs": "^2.0.5",
|
|
67
|
-
"@types/chai-like": "^1.1.3",
|
|
68
|
-
"@types/deep-equal-in-any-order": "^1.0.4",
|
|
69
|
-
"@types/mocha": "^10.0.10",
|
|
70
|
-
"@types/sinon": "^10.0.20",
|
|
71
|
-
"@types/sinon-chai": "^3.2.12",
|
|
72
|
-
"chai": "^5.1.2",
|
|
73
|
-
"chai-as-promised": "^7.1.2",
|
|
74
|
-
"chai-deep-equal-ignore-undefined": "^1.1.1",
|
|
75
|
-
"chai-fs": "^2.0.0",
|
|
76
|
-
"chai-like": "^1.1.3",
|
|
77
|
-
"deep-equal-in-any-order": "^2.0.6",
|
|
78
|
-
"mocha": "^11.1.0",
|
|
79
|
-
"sinon": "^16.1.3",
|
|
80
|
-
"sinon-chai": "^3.7.0",
|
|
81
|
-
"type-fest": "^4.32.0"
|
|
61
|
+
"react-router": "7"
|
|
82
62
|
},
|
|
83
63
|
"dependencies": {
|
|
84
|
-
"@
|
|
85
|
-
"@vaadin/hilla-
|
|
86
|
-
"@vaadin/hilla-react-
|
|
87
|
-
"@vaadin/hilla-react-signals": "24.7.0-alpha9",
|
|
88
|
-
"c8": "^10.1.3",
|
|
89
|
-
"react": "^18.3.1",
|
|
90
|
-
"rollup": "^4.21.0",
|
|
64
|
+
"@vaadin/hilla-generator-utils": "24.7.0-beta3",
|
|
65
|
+
"@vaadin/hilla-react-auth": "24.7.0-beta3",
|
|
66
|
+
"@vaadin/hilla-react-signals": "24.7.0-beta3",
|
|
91
67
|
"typescript": "5.7.3"
|
|
92
68
|
}
|
|
93
69
|
}
|
|
@@ -1,77 +1,76 @@
|
|
|
1
|
-
import { type ComponentType } from
|
|
2
|
-
import { type RouteObject } from
|
|
3
|
-
import type { AgnosticRoute, RouterBuildOptions, RouterConfiguration, ViewConfig } from
|
|
1
|
+
import { type ComponentType } from "react";
|
|
2
|
+
import { type RouteObject } from "react-router";
|
|
3
|
+
import type { AgnosticRoute, RouterBuildOptions, RouterConfiguration, ViewConfig } from "../types.js";
|
|
4
4
|
interface RouteBase {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
path?: string;
|
|
6
|
+
children?: readonly this[];
|
|
7
7
|
}
|
|
8
8
|
export type RouteList = readonly RouteObject[];
|
|
9
9
|
export type WritableRouteList = RouteObject[];
|
|
10
10
|
export type RouteTransformerOptions<T> = Readonly<{
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
children?: RouteList
|
|
12
|
+
original?: RouteObject
|
|
13
|
+
overriding?: T
|
|
14
|
+
dupe: boolean
|
|
15
15
|
}>;
|
|
16
16
|
export type RouteTransformer<T> = (opts: RouteTransformerOptions<T>) => RouteObject | undefined;
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
* A builder for creating a Vaadin-specific router for React with
|
|
19
|
+
* authentication and server routes support.
|
|
20
|
+
*/
|
|
21
21
|
export declare class RouterConfigurationBuilder {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
22
|
+
#private;
|
|
23
|
+
/**
|
|
24
|
+
* Adds the given routes to the current list of routes. All the routes are
|
|
25
|
+
* deeply merged to preserve the path uniqueness.
|
|
26
|
+
*
|
|
27
|
+
* @param routes - A list of routes to add to the current list.
|
|
28
|
+
*/
|
|
29
|
+
withReactRoutes(routes: RouteList): this;
|
|
30
|
+
/**
|
|
31
|
+
* Adds the given file routes to the current list of routes. All the routes
|
|
32
|
+
* are transformed to React RouterObjects and deeply merged to preserve the
|
|
33
|
+
* path uniqueness.
|
|
34
|
+
*
|
|
35
|
+
* @param routes - A list of routes to add to the current list.
|
|
36
|
+
*/
|
|
37
|
+
withFileRoutes(routes: readonly AgnosticRoute[]): this;
|
|
38
|
+
/**
|
|
39
|
+
* Adds the given server route element to each branch of the current list of
|
|
40
|
+
* routes.
|
|
41
|
+
*
|
|
42
|
+
* @param component - The React component to add to each branch of the
|
|
43
|
+
* current list of routes.
|
|
44
|
+
* @param config - An optional configuration that will be applied to
|
|
45
|
+
* each fallback component.
|
|
46
|
+
*/
|
|
47
|
+
withFallback(component: ComponentType, config?: ViewConfig): this;
|
|
48
|
+
/**
|
|
49
|
+
* Adds the layoutComponent as the parent layout to views with the flowLayouts ViewConfiguration set.
|
|
50
|
+
*
|
|
51
|
+
* @param layoutComponent - layout component to use, usually Flow
|
|
52
|
+
*/
|
|
53
|
+
withLayout(layoutComponent: ComponentType): this;
|
|
54
|
+
/**
|
|
55
|
+
* Protects all the routes that require authentication. For more details see
|
|
56
|
+
* {@link @vaadin/hilla-react-auth#protectRoutes} function.
|
|
57
|
+
*
|
|
58
|
+
* @param redirectPath - the path to redirect to if the route is protected
|
|
59
|
+
* and the user is not authenticated.
|
|
60
|
+
*/
|
|
61
|
+
protect(redirectPath?: string): this;
|
|
62
|
+
/**
|
|
63
|
+
* Deeply updates the current list of routes with the given routes merging
|
|
64
|
+
* them in process.
|
|
65
|
+
*
|
|
66
|
+
* @param routes - A list of routes to merge with the current list.
|
|
67
|
+
* @param callback - A callback to transform the routes during the merge.
|
|
68
|
+
*/
|
|
69
|
+
update(routes: undefined, callback: RouteTransformer<undefined>): this;
|
|
70
|
+
update<T extends RouteBase>(routes: readonly T[], callback?: RouteTransformer<T>): this;
|
|
71
|
+
/**
|
|
72
|
+
* Builds the router with the current list of routes.
|
|
73
|
+
*/
|
|
74
|
+
build(options?: RouterBuildOptions): RouterConfiguration;
|
|
75
75
|
}
|
|
76
76
|
export {};
|
|
77
|
-
//# sourceMappingURL=RouterConfigurationBuilder.d.ts.map
|