olova-router 1.0.13 → 1.0.14

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -406,9 +406,9 @@ function generateRouteTree(routes, notFoundPages, layouts, srcDir) {
406
406
  if (route.hasMetadata && !hasInlineMetadata || route.hasRoute) {
407
407
  return "import * as " + moduleName + " from '" + relativePath + "';";
408
408
  } else if (route.hasDefault) {
409
- return "const " + importName + " = lazy(() => import('" + relativePath + "'));";
409
+ return "import " + importName + " from '" + relativePath + "';";
410
410
  } else if (route.namedExport) {
411
- return "const " + importName + " = lazy(() => import('" + relativePath + "').then(module => ({ default: module." + route.namedExport + " })));";
411
+ return "import { " + route.namedExport + " as " + importName + " } from '" + relativePath + "';";
412
412
  } else {
413
413
  return "import " + importName + " from '" + relativePath + "';";
414
414
  }
@@ -470,7 +470,7 @@ function generateRouteTree(routes, notFoundPages, layouts, srcDir) {
470
470
  }).join(",\n");
471
471
  const routePaths = routes.length > 0 ? routes.map((r) => "'" + r.path + "'").join(" | ") : "never";
472
472
  const allImports = [routeImports, notFoundImports, layoutImports].filter(Boolean).join("\n");
473
- return "// Auto-generated by olova-router - DO NOT EDIT\n// This file is auto-updated when you add/remove route folders\n\nimport { createLink, OlovaRouter, useRouter, useParams, useSearchParams, usePathname, Outlet } from 'olova-router/router';\nimport { lazy } from 'react';\n" + allImports + "\n\nexport const routes = [\n" + (routeObjects || "") + "\n];\n\nexport const notFoundPages = [\n" + (notFoundObjects || "") + "\n];\n\nexport const layouts = [\n" + (layoutObjects || "") + "\n];\n\nexport type RoutePaths = " + routePaths + ";\n\nexport const Link = createLink<RoutePaths>();\nexport { OlovaRouter, useRouter, useParams, useSearchParams, usePathname, Outlet };\nexport type { NotFoundPageConfig, SearchParams, SetSearchParamsOptions, LayoutRoute, Metadata } from 'olova-router/router';\n";
473
+ return "// Auto-generated by olova-router - DO NOT EDIT\n// This file is auto-updated when you add/remove route folders\n\nimport { createLink, OlovaRouter, useRouter, useParams, useSearchParams, usePathname, Outlet } from 'olova-router/router';\n" + allImports + "\n\nexport const routes = [\n" + (routeObjects || "") + "\n];\n\nexport const notFoundPages = [\n" + (notFoundObjects || "") + "\n];\n\nexport const layouts = [\n" + (layoutObjects || "") + "\n];\n\nexport type RoutePaths = " + routePaths + ";\n\nexport const Link = createLink<RoutePaths>();\nexport { OlovaRouter, useRouter, useParams, useSearchParams, usePathname, Outlet };\nexport type { NotFoundPageConfig, SearchParams, SetSearchParamsOptions, LayoutRoute, Metadata } from 'olova-router/router';\n";
474
474
  }
475
475
  function scanDirectory(dir, rootDir, extensions, routes, notFoundPages, layouts, isRoot = false) {
476
476
  if (!fs3.existsSync(dir)) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "olova-router",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "A client-first folder-based routing for React + Vite applications",
5
5
  "author": "",
6
6
  "license": "MIT",