@vaadin/hilla-file-router 24.4.0-alpha21 → 24.4.0-alpha22
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 +3 -3
- package/runtime/RouterConfigurationBuilder.d.ts +14 -4
- package/runtime/RouterConfigurationBuilder.d.ts.map +1 -1
- package/runtime/RouterConfigurationBuilder.js +86 -55
- package/runtime/RouterConfigurationBuilder.js.map +2 -2
- package/runtime/createMenuItems.d.ts +3 -1
- package/runtime/createMenuItems.d.ts.map +1 -1
- package/runtime/createMenuItems.js +7 -2
- package/runtime/createMenuItems.js.map +2 -2
- package/runtime.d.ts +0 -1
- package/runtime.d.ts.map +1 -1
- package/runtime.js +0 -1
- package/runtime.js.map +2 -2
- package/shared/convertComponentNameToTitle.d.ts +1 -1
- package/shared/convertComponentNameToTitle.d.ts.map +1 -1
- package/shared/convertComponentNameToTitle.js +4 -7
- package/shared/convertComponentNameToTitle.js.map +2 -2
- package/shared/transformTree.d.ts +1 -11
- package/shared/transformTree.d.ts.map +1 -1
- package/shared/transformTree.js +3 -15
- package/shared/transformTree.js.map +2 -2
- package/types.d.ts +3 -3
- package/vite-plugin/collectRoutesFromFS.d.ts +3 -3
- package/vite-plugin/collectRoutesFromFS.d.ts.map +1 -1
- package/vite-plugin/collectRoutesFromFS.js +46 -34
- package/vite-plugin/collectRoutesFromFS.js.map +2 -2
- package/vite-plugin/createRoutesFromMeta.d.ts +1 -1
- package/vite-plugin/createRoutesFromMeta.d.ts.map +1 -1
- package/vite-plugin/createRoutesFromMeta.js +30 -25
- package/vite-plugin/createRoutesFromMeta.js.map +2 -2
- package/vite-plugin/createViewConfigJson.d.ts +1 -1
- package/vite-plugin/createViewConfigJson.d.ts.map +1 -1
- package/vite-plugin/createViewConfigJson.js +51 -38
- package/vite-plugin/createViewConfigJson.js.map +2 -2
- package/vite-plugin/generateRuntimeFiles.d.ts.map +1 -1
- package/vite-plugin/generateRuntimeFiles.js +0 -5
- package/vite-plugin/generateRuntimeFiles.js.map +2 -2
- package/vite-plugin.d.ts.map +1 -1
- package/vite-plugin.js +17 -6
- package/vite-plugin.js.map +2 -2
- package/runtime/toReactRouter.d.ts +0 -11
- package/runtime/toReactRouter.d.ts.map +0 -1
- package/runtime/toReactRouter.js +0 -31
- package/runtime/toReactRouter.js.map +0 -7
package/runtime/toReactRouter.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createElement } from "react";
|
|
2
|
-
import { convertComponentNameToTitle } from "../shared/convertComponentNameToTitle.js";
|
|
3
|
-
import { transformTreeSync } from "../shared/transformTree.js";
|
|
4
|
-
function isReactRouteModule(module) {
|
|
5
|
-
return module ? "default" in module && typeof module.default === "function" : true;
|
|
6
|
-
}
|
|
7
|
-
function toReactRouter(routes) {
|
|
8
|
-
return transformTreeSync(
|
|
9
|
-
routes,
|
|
10
|
-
(route) => route.children?.values(),
|
|
11
|
-
({ path, module }, children) => {
|
|
12
|
-
if (!isReactRouteModule(module)) {
|
|
13
|
-
throw new Error(`The module for the "${path}" section doesn't have the React component exported by default`);
|
|
14
|
-
}
|
|
15
|
-
const title = module?.config?.title ?? convertComponentNameToTitle(module?.default);
|
|
16
|
-
return {
|
|
17
|
-
path: module?.config?.route ?? path,
|
|
18
|
-
element: module?.default ? createElement(module.default) : void 0,
|
|
19
|
-
children: children && children.length > 0 ? children : void 0,
|
|
20
|
-
handle: {
|
|
21
|
-
...module?.config,
|
|
22
|
-
title
|
|
23
|
-
}
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
toReactRouter
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=toReactRouter.js.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../src/runtime/toReactRouter.ts"],
|
|
4
|
-
"sourcesContent": ["import { type ComponentType, createElement } from 'react';\nimport type { RouteObject as ReactRouteObject } from 'react-router-dom';\nimport { convertComponentNameToTitle } from '../shared/convertComponentNameToTitle.js';\nimport { transformTreeSync } from '../shared/transformTree.js';\nimport type { AgnosticRoute, Module, RouteModule } from '../types.js';\n\nfunction isReactRouteModule(module?: Module): module is RouteModule<ComponentType> | undefined {\n return module ? 'default' in module && typeof module.default === 'function' : true;\n}\n\n/**\n * Transforms framework-agnostic route tree into a format that can be used by React Router.\n *\n * @param routes - Generated routes\n *\n * @returns The React Router tree.\n */\nexport function toReactRouter(routes: AgnosticRoute): ReactRouteObject {\n return transformTreeSync(\n routes,\n (route) => route.children?.values(),\n ({ path, module }, children) => {\n if (!isReactRouteModule(module)) {\n throw new Error(`The module for the \"${path}\" section doesn't have the React component exported by default`);\n }\n\n const title = module?.config?.title ?? convertComponentNameToTitle(module?.default);\n\n return {\n path: module?.config?.route ?? path,\n element: module?.default ? createElement(module.default) : undefined,\n children: children && children.length > 0 ? (children as ReactRouteObject[]) : undefined,\n handle: {\n ...module?.config,\n title,\n },\n } satisfies ReactRouteObject;\n },\n );\n}\n"],
|
|
5
|
-
"mappings": "AAAA,SAA6B,qBAAqB;AAElD,SAAS,mCAAmC;AAC5C,SAAS,yBAAyB;AAGlC,SAAS,mBAAmB,QAAmE;AAC7F,SAAO,SAAS,aAAa,UAAU,OAAO,OAAO,YAAY,aAAa;AAChF;AASO,SAAS,cAAc,QAAyC;AACrE,SAAO;AAAA,IACL;AAAA,IACA,CAAC,UAAU,MAAM,UAAU,OAAO;AAAA,IAClC,CAAC,EAAE,MAAM,OAAO,GAAG,aAAa;AAC9B,UAAI,CAAC,mBAAmB,MAAM,GAAG;AAC/B,cAAM,IAAI,MAAM,uBAAuB,IAAI,gEAAgE;AAAA,MAC7G;AAEA,YAAM,QAAQ,QAAQ,QAAQ,SAAS,4BAA4B,QAAQ,OAAO;AAElF,aAAO;AAAA,QACL,MAAM,QAAQ,QAAQ,SAAS;AAAA,QAC/B,SAAS,QAAQ,UAAU,cAAc,OAAO,OAAO,IAAI;AAAA,QAC3D,UAAU,YAAY,SAAS,SAAS,IAAK,WAAkC;AAAA,QAC/E,QAAQ;AAAA,UACN,GAAG,QAAQ;AAAA,UACX;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;",
|
|
6
|
-
"names": []
|
|
7
|
-
}
|