heliumts 0.9.5 → 0.9.7
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/README.md +7 -3
- package/dist/bin/helium.js +61 -53
- package/dist/bin/helium.js.map +1 -1
- package/dist/client/Router.d.ts +2 -2
- package/dist/client/Router.d.ts.map +1 -1
- package/dist/client/Router.js +32 -29
- package/dist/client/Router.js.map +1 -1
- package/dist/client/cache.d.ts.map +1 -1
- package/dist/client/cache.js +13 -13
- package/dist/client/cache.js.map +1 -1
- package/dist/client/callMethod.d.ts +13 -0
- package/dist/client/callMethod.d.ts.map +1 -0
- package/dist/client/callMethod.js +10 -0
- package/dist/client/callMethod.js.map +1 -0
- package/dist/client/env.js.map +1 -1
- package/dist/client/index.d.ts +2 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/routerManifest.d.ts.map +1 -1
- package/dist/client/routerManifest.js +18 -29
- package/dist/client/routerManifest.js.map +1 -1
- package/dist/client/rpcClient.d.ts +7 -3
- package/dist/client/rpcClient.d.ts.map +1 -1
- package/dist/client/rpcClient.js +80 -78
- package/dist/client/rpcClient.js.map +1 -1
- package/dist/client/transitions.d.ts +1 -1
- package/dist/client/transitions.d.ts.map +1 -1
- package/dist/client/useCall.d.ts.map +1 -1
- package/dist/client/useCall.js +4 -1
- package/dist/client/useCall.js.map +1 -1
- package/dist/client/useFetch.d.ts.map +1 -1
- package/dist/client/useFetch.js +48 -92
- package/dist/client/useFetch.js.map +1 -1
- package/dist/runtime/routeOrder.d.ts +3 -0
- package/dist/runtime/routeOrder.d.ts.map +1 -0
- package/dist/runtime/routeOrder.js +15 -0
- package/dist/runtime/routeOrder.js.map +1 -0
- package/dist/server/config.d.ts.map +1 -1
- package/dist/server/config.js +51 -26
- package/dist/server/config.js.map +1 -1
- package/dist/server/defineHTTPRequest.d.ts +1 -1
- package/dist/server/defineHTTPRequest.d.ts.map +1 -1
- package/dist/server/defineHTTPRequest.js.map +1 -1
- package/dist/server/defineWorker.d.ts.map +1 -1
- package/dist/server/defineWorker.js +68 -37
- package/dist/server/defineWorker.js.map +1 -1
- package/dist/server/devServer.d.ts.map +1 -1
- package/dist/server/devServer.js +70 -40
- package/dist/server/devServer.js.map +1 -1
- package/dist/server/httpCompression.d.ts +8 -0
- package/dist/server/httpCompression.d.ts.map +1 -0
- package/dist/server/httpCompression.js +58 -0
- package/dist/server/httpCompression.js.map +1 -0
- package/dist/server/httpRouter.d.ts.map +1 -1
- package/dist/server/httpRouter.js +138 -43
- package/dist/server/httpRouter.js.map +1 -1
- package/dist/server/meta.d.ts.map +1 -1
- package/dist/server/meta.js +23 -15
- package/dist/server/meta.js.map +1 -1
- package/dist/server/prodServer.d.ts.map +1 -1
- package/dist/server/prodServer.js +87 -46
- package/dist/server/prodServer.js.map +1 -1
- package/dist/server/rateLimiter.d.ts +9 -0
- package/dist/server/rateLimiter.d.ts.map +1 -1
- package/dist/server/rateLimiter.js +46 -0
- package/dist/server/rateLimiter.js.map +1 -1
- package/dist/server/requestHandler.d.ts +4 -0
- package/dist/server/requestHandler.d.ts.map +1 -0
- package/dist/server/requestHandler.js +20 -0
- package/dist/server/requestHandler.js.map +1 -0
- package/dist/server/rpcRegistry.d.ts +4 -0
- package/dist/server/rpcRegistry.d.ts.map +1 -1
- package/dist/server/rpcRegistry.js +60 -15
- package/dist/server/rpcRegistry.js.map +1 -1
- package/dist/server/security.d.ts.map +1 -1
- package/dist/server/security.js +3 -2
- package/dist/server/security.js.map +1 -1
- package/dist/server/serializer.js +17 -6
- package/dist/server/serializer.js.map +1 -1
- package/dist/server/ssr.d.ts +2 -1
- package/dist/server/ssr.d.ts.map +1 -1
- package/dist/server/ssr.js +29 -32
- package/dist/server/ssr.js.map +1 -1
- package/dist/utils/envLoader.js +1 -1
- package/dist/utils/envLoader.js.map +1 -1
- package/dist/utils/html.d.ts +7 -0
- package/dist/utils/html.d.ts.map +1 -0
- package/dist/utils/html.js +197 -0
- package/dist/utils/html.js.map +1 -0
- package/dist/utils/ipExtractor.d.ts +6 -52
- package/dist/utils/ipExtractor.d.ts.map +1 -1
- package/dist/utils/ipExtractor.js +21 -118
- package/dist/utils/ipExtractor.js.map +1 -1
- package/dist/vite/heliumPlugin.d.ts.map +1 -1
- package/dist/vite/heliumPlugin.js +75 -83
- package/dist/vite/heliumPlugin.js.map +1 -1
- package/dist/vite/scanner.d.ts +3 -0
- package/dist/vite/scanner.d.ts.map +1 -1
- package/dist/vite/scanner.js +89 -18
- package/dist/vite/scanner.js.map +1 -1
- package/dist/vite/ssg.d.ts +4 -0
- package/dist/vite/ssg.d.ts.map +1 -1
- package/dist/vite/ssg.js +66 -39
- package/dist/vite/ssg.js.map +1 -1
- package/dist/vite/virtualServerModule.d.ts +1 -1
- package/dist/vite/virtualServerModule.d.ts.map +1 -1
- package/dist/vite/virtualServerModule.js +28 -16
- package/dist/vite/virtualServerModule.js.map +1 -1
- package/package.json +12 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/client/Router.tsx"],"names":[],"mappings":";AACA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAE,yBAAyB,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AA0BlG,SAAS,sBAAsB;IAC3B,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;QAChC,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,YAAY,GAAG,MAEpB,CAAC;IAEF,MAAM,OAAO,GAAG,YAAY,CAAC,mBAAmB,CA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AAE,CAAC;QAC7D,MAAM,QAAQ,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;QAErE,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,SAAS;QACb,CAAC;QAED,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["import type { ComponentType } from \"react\";\nimport React, { useMemo, useSyncExternalStore, useTransition } from \"react\";\n\nimport { SEO_METADATA_RPC_METHOD } from \"../runtime/internalMethods.js\";\nimport { isDevEnvironment } from \"./env.js\";\nimport type { RouteEntry } from \"./routerManifest.js\";\nimport { buildRoutes } from \"./routerManifest.js\";\nimport { isAutoHttpOnMobileEnabled, isMobileRpcDevice, rpcCallWithOptions } from \"./rpcClient.js\";\n\ntype HeliumSSRBootstrap = {\n path: string;\n props: Record<string, unknown>;\n};\n\ntype SSRRedirectPayload = {\n destination: string;\n statusCode?: 301 | 302 | 303 | 307 | 308;\n replace?: boolean;\n};\n\ntype SSRPagePropsPayload =\n | {\n kind: \"props\";\n props: Record<string, unknown>;\n }\n | {\n kind: \"redirect\";\n redirect: SSRRedirectPayload;\n }\n | {\n kind: \"none\";\n };\n\nfunction getInitialSSRBootstrap(): HeliumSSRBootstrap | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const globalWindow = window as typeof window & {\n __HELIUM_SSR_DATA__?: HeliumSSRBootstrap;\n };\n\n const payload = globalWindow.__HELIUM_SSR_DATA__;\n if (!payload || typeof payload !== \"object\" || typeof payload.path !== \"string\" || typeof payload.props !== \"object\" || payload.props === null) {\n return null;\n }\n\n return payload;\n}\n\nasync function fetchSSRPageProps(path: string): Promise<SSRPagePropsPayload> {\n try {\n const response = await fetch(`/__helium__/page-props?path=${encodeURIComponent(path)}`, {\n method: \"GET\",\n headers: {\n Accept: \"application/json\",\n },\n });\n\n if (!response.ok) {\n return { kind: \"none\" };\n }\n\n const payload = (await response.json()) as {\n ssr?: boolean;\n props?: Record<string, unknown> | null;\n redirect?: SSRRedirectPayload;\n };\n\n if (!payload.ssr) {\n return { kind: \"none\" };\n }\n\n if (payload.redirect && typeof payload.redirect.destination === \"string\" && payload.redirect.destination.length > 0) {\n return {\n kind: \"redirect\",\n redirect: payload.redirect,\n };\n }\n\n if (!payload.props) {\n return { kind: \"none\" };\n }\n\n return {\n kind: \"props\",\n props: payload.props,\n };\n } catch {\n return { kind: \"none\" };\n }\n}\n\n// Event emitter for router events\ntype RouterEvent = \"navigation\" | \"before-navigation\";\ntype EventListener = (event: { from: string; to: string; preventDefault?: () => void }) => void;\n\nclass RouterEventEmitter {\n private listeners: Map<RouterEvent, Set<EventListener>> = new Map();\n\n on(event: RouterEvent, listener: EventListener): () => void {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(listener);\n\n // Return unsubscribe function\n return () => {\n this.listeners.get(event)?.delete(listener);\n };\n }\n\n emit(event: RouterEvent, data: { from: string; to: string }): boolean {\n const eventListeners = this.listeners.get(event);\n if (!eventListeners || eventListeners.size === 0) {\n return true;\n }\n\n let prevented = false;\n const preventDefault = () => {\n prevented = true;\n };\n\n const eventData = event === \"before-navigation\" ? { ...data, preventDefault } : data;\n\n eventListeners.forEach((listener) => {\n listener(eventData);\n });\n\n return !prevented;\n }\n\n // Clear all listeners - useful for HMR\n clear() {\n this.listeners.clear();\n }\n}\n\n// Use a singleton that survives HMR by attaching to window in dev mode\nlet routerEventEmitter: RouterEventEmitter;\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n // In dev mode, reuse the same emitter instance across HMR\n const globalWindow = window as typeof window & { __heliumRouterEmitter?: RouterEventEmitter };\n if (!globalWindow.__heliumRouterEmitter) {\n globalWindow.__heliumRouterEmitter = new RouterEventEmitter();\n }\n routerEventEmitter = globalWindow.__heliumRouterEmitter;\n} else {\n routerEventEmitter = new RouterEventEmitter();\n}\n\ntype RouterState = {\n path: string;\n searchParams: URLSearchParams;\n isNavigating: boolean;\n};\n\nfunction getLocation(): RouterState {\n const { pathname, search } = window.location;\n return {\n path: pathname,\n searchParams: new URLSearchParams(search),\n isNavigating: false,\n };\n}\n\nfunction matchRoute(path: string, routes: RouteEntry[]) {\n for (const r of routes) {\n const m = r.matcher(path);\n if (m) {\n return { params: m.params, route: r };\n }\n }\n return null;\n}\n\n// Location store for useSyncExternalStore\n// Preserve across HMR by attaching to window in dev mode\nlet currentLocation: RouterState;\nlet locationListeners: Set<() => void>;\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & {\n __heliumCurrentLocation?: RouterState;\n __heliumLocationListeners?: Set<() => void>;\n };\n if (!globalWindow.__heliumCurrentLocation) {\n globalWindow.__heliumCurrentLocation = getLocation();\n }\n if (!globalWindow.__heliumLocationListeners) {\n globalWindow.__heliumLocationListeners = new Set();\n }\n currentLocation = globalWindow.__heliumCurrentLocation;\n locationListeners = globalWindow.__heliumLocationListeners;\n} else if (typeof window !== \"undefined\") {\n currentLocation = getLocation();\n locationListeners = new Set();\n} else {\n currentLocation = { path: \"/\", searchParams: new URLSearchParams(), isNavigating: false };\n locationListeners = new Set();\n}\n\n// Helper to re-extract params from path using stored routes during HMR\nfunction extractParamsFromPath(path: string): Record<string, string | string[]> {\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n const routes = globalWindow.__heliumGlobalRoutes;\n if (routes && routes.length > 0) {\n const match = matchRoute(path, routes);\n if (match) {\n return match.params;\n }\n }\n }\n return {};\n}\n\nfunction subscribeToLocation(callback: () => void) {\n locationListeners.add(callback);\n return () => locationListeners.delete(callback);\n}\n\nfunction getLocationSnapshot() {\n return currentLocation;\n}\n\nconst SERVER_SNAPSHOT: RouterState = { path: \"/\", searchParams: new URLSearchParams(), isNavigating: false };\nfunction getServerSnapshot() {\n return SERVER_SNAPSHOT;\n}\n\nfunction updateLocation(isNavigating = false) {\n const newLocation = { ...getLocation(), isNavigating };\n currentLocation = newLocation;\n // Update the global reference in dev mode\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n (window as typeof window & { __heliumCurrentLocation?: RouterState }).__heliumCurrentLocation = newLocation;\n }\n locationListeners.forEach((listener) => listener());\n}\n\n// Set up global listeners once\nif (typeof window !== \"undefined\") {\n // Only set up once, survives HMR\n const globalWindow = window as typeof window & { __heliumLocationListenerSetup?: boolean };\n if (!globalWindow.__heliumLocationListenerSetup) {\n globalWindow.__heliumLocationListenerSetup = true;\n\n window.addEventListener(\"popstate\", () => updateLocation(false));\n\n // Also listen to navigation events from the emitter\n routerEventEmitter.on(\"navigation\", () => updateLocation(false));\n }\n}\n\n/** Options for push/replace navigation methods */\nexport interface RouterNavigationOptions {\n /** Scroll to top after navigation (default: true) */\n scrollToTop?: boolean;\n}\n\n// Context for useRouter hook\ntype RouterContext = {\n path: string;\n params: Record<string, string | string[]>;\n searchParams: URLSearchParams;\n push: (href: string, options?: RouterNavigationOptions) => void;\n replace: (href: string, options?: RouterNavigationOptions) => void;\n on: (event: RouterEvent, listener: EventListener) => () => void;\n status: 200 | 404;\n isNavigating: boolean;\n /** Indicates content is stale (old content shown while new content renders) - React 18+ concurrent feature */\n isPending: boolean;\n};\n\nexport const RouterContext = React.createContext<RouterContext | null>(null);\n\n/**\n * Access router context inside a component tree managed by <AppRouter />.\n *\n * Provides current path, route params, URL search params and navigation helpers\n * (\\`push\\`, \\`replace\\`) as well as an \\`on\\` method to subscribe to navigation events.\n * The \\`isNavigating\\` property indicates when a navigation is in progress.\n * The \\`isPending\\` property indicates when content is stale (React concurrent features).\n * Throws when used outside of an <AppRouter /> provider.\n */\nexport function useRouter() {\n const ctx = React.useContext(RouterContext);\n if (!ctx) {\n // During HMR in development, context might be temporarily unavailable\n // Provide a temporary fallback to prevent white screen of death\n // Re-extract params from current path using stored routes\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n const currentPath = window.location.pathname;\n return {\n path: currentPath,\n params: extractParamsFromPath(currentPath),\n searchParams: new URLSearchParams(window.location.search),\n push: (href: string, options?: RouterNavigationOptions) => {\n window.history.pushState({}, \"\", href);\n if (options?.scrollToTop !== false) {\n window.scrollTo({ top: 0, left: 0, behavior: \"smooth\" });\n }\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n },\n replace: (href: string, options?: RouterNavigationOptions) => {\n window.history.replaceState({}, \"\", href);\n if (options?.scrollToTop !== false) {\n window.scrollTo({ top: 0, left: 0, behavior: \"smooth\" });\n }\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n },\n on: () => () => {},\n status: 200 as const,\n isNavigating: false,\n isPending: false,\n };\n }\n throw new Error(\"useRouter must be used inside <AppRouter>\");\n }\n return ctx;\n}\n\n/**\n * Redirect component for declarative navigation.\n * Use this instead of calling router.push() during render.\n *\n * @example\n * \\`\\`\\`tsx\n * export default function Docs() {\n * return <Redirect to=\"/docs/getting-started\" />;\n * }\n * \\`\\`\\`\n */\nexport function Redirect({ to, replace = false }: { to: string; replace?: boolean }) {\n const hasRedirected = React.useRef(false);\n\n // Use useLayoutEffect to redirect before paint\n React.useLayoutEffect(() => {\n const targetPath = to.split(\"?\")[0];\n if (!hasRedirected.current && window.location.pathname !== targetPath) {\n hasRedirected.current = true;\n\n // Perform navigation\n if (replace) {\n window.history.replaceState(null, \"\", to);\n } else {\n window.history.pushState(null, \"\", to);\n }\n\n // Emit navigation event to update router state\n routerEventEmitter.emit(\"navigation\", {\n from: window.location.pathname,\n to: targetPath,\n });\n }\n }, [to, replace]);\n\n return null;\n}\n\n/** Options for navigation */\ninterface NavigateOptions {\n replace?: boolean;\n scrollToTop?: boolean;\n}\n\n// Navigation helper\nfunction navigate(href: string, options: NavigateOptions = {}) {\n const { replace = false, scrollToTop = true } = options;\n const from = window.location.pathname;\n const to = href.split(\"?\")[0]; // Extract pathname from href\n\n // Emit before-navigation event (can be prevented)\n const canNavigate = routerEventEmitter.emit(\"before-navigation\", { from, to });\n if (!canNavigate) {\n return; // Navigation was prevented\n }\n\n // Set navigating state to true before navigation\n currentLocation = { ...currentLocation, isNavigating: true };\n locationListeners.forEach((listener) => listener());\n\n if (replace) {\n window.history.replaceState(null, \"\", href);\n } else {\n window.history.pushState(null, \"\", href);\n }\n\n // Scroll to top immediately after pushState, before React re-renders.\n // Using instant scroll avoids race conditions where smooth scrolling\n // gets interrupted by React DOM updates, especially on Safari mobile.\n if (scrollToTop) {\n window.scrollTo({ top: 0, left: 0, behavior: \"instant\" });\n }\n\n // Update location state synchronously so there is no stale-state window\n // between pushState and the next render.\n updateLocation(false);\n\n // Emit navigation event after state is consistent\n routerEventEmitter.emit(\"navigation\", { from, to });\n}\n\nexport type LinkProps = React.PropsWithChildren<\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> & {\n href: string;\n replace?: boolean;\n /** Disable prefetching on hover (default: false - prefetch is enabled) */\n prefetch?: boolean;\n /** Scroll to top after navigation (default: true) */\n scrollToTop?: boolean;\n }\n>;\n\n/**\n * Check if a URL is external (different origin).\n */\nfunction isExternalUrl(href: string): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n const url = new URL(href, window.location.origin);\n return url.origin !== window.location.origin;\n } catch {\n return false;\n }\n}\n\n// Store routes globally for prefetching (set by AppRouter)\n// Preserve across HMR in dev mode\nlet globalRoutes: RouteEntry[];\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n if (!globalWindow.__heliumGlobalRoutes) {\n globalWindow.__heliumGlobalRoutes = [];\n }\n globalRoutes = globalWindow.__heliumGlobalRoutes;\n} else {\n globalRoutes = [];\n}\n\n/**\n * Client-side navigation link.\n *\n * Intercepts left-clicks and uses the router's navigation helpers for SPA\n * navigation. Keeps normal anchor behaviour when modifier keys are used,\n * when the link is external, or when `target` / `download` attributes\n * are present.\n *\n * Automatically prefetches page chunks on hover for faster navigation.\n */\nexport function Link(props: LinkProps) {\n const {\n children,\n href,\n className,\n prefetch: prefetchProp = true,\n scrollToTop = true,\n replace: replaceProp,\n target,\n download,\n onClick: userOnClick,\n onMouseEnter: userOnMouseEnter,\n onFocus: userOnFocus,\n ...restProps\n } = props;\n\n const onClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Let user's onClick run first so they can call e.preventDefault()\n userOnClick?.(e);\n\n if (\n e.defaultPrevented ||\n e.button !== 0 || // only left click\n e.metaKey ||\n e.ctrlKey ||\n e.shiftKey ||\n e.altKey ||\n target || // let browser handle target=\"_blank\" etc.\n download != null || // let browser handle downloads\n isExternalUrl(href) // let browser handle external links\n ) {\n return;\n }\n e.preventDefault();\n navigate(href, { replace: replaceProp, scrollToTop });\n };\n\n const onMouseEnter = async (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Prefetch the route on hover if enabled and not external (lazy-load prefetch logic)\n if (prefetchProp && !isExternalUrl(href) && globalRoutes.length > 0) {\n const { prefetchRoute } = await import(\"./prefetch.js\");\n prefetchRoute(href, globalRoutes);\n }\n userOnMouseEnter?.(e);\n };\n\n const onFocus = async (e: React.FocusEvent<HTMLAnchorElement>) => {\n // Also prefetch on focus (keyboard navigation)\n if (prefetchProp && !isExternalUrl(href) && globalRoutes.length > 0) {\n const { prefetchRoute } = await import(\"./prefetch.js\");\n prefetchRoute(href, globalRoutes);\n }\n userOnFocus?.(e);\n };\n\n return (\n <a {...restProps} href={href} target={target} download={download} onClick={onClick} onMouseEnter={onMouseEnter} onFocus={onFocus} className={className}>\n {children}\n </a>\n );\n}\n\n// AppShell props type\n/**\n * Props passed to an optional \\`AppShell\\` wrapper component used by <AppRouter />.\n *\n * \\`Component\\` — the page component to render. \\`pageProps\\` — props provided to the page.\n */\nexport type AppShellProps<TPageProps extends Record<string, unknown> = Record<string, unknown>> = {\n Component: ComponentType<TPageProps>;\n pageProps: TPageProps;\n children?: React.ReactNode;\n};\n\n// Main router component\nexport function AppRouter({ AppShell }: { AppShell?: ComponentType<AppShellProps> }) {\n // useTransition for concurrent rendering - allows React to keep UI responsive during navigation\n const [isPending, startTransition] = useTransition();\n\n // Build routes once on mount (client-side only)\n const { routes, NotFound } = useMemo(() => {\n if (typeof window === \"undefined\") {\n return { routes: [], NotFound: undefined };\n }\n const result = buildRoutes();\n // Store routes globally for Link prefetching\n // In dev mode, also update the global reference to survive HMR\n if (isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n globalWindow.__heliumGlobalRoutes = result.routes;\n // Update the module-level reference as well\n globalRoutes.length = 0;\n globalRoutes.push(...result.routes);\n } else {\n globalRoutes = result.routes;\n }\n return result;\n }, []);\n\n // Use useSyncExternalStore to subscribe to location changes\n // This ensures synchronous updates when location changes\n const state = useSyncExternalStore(subscribeToLocation, getLocationSnapshot, getServerSnapshot);\n const [runtimeSSRProps, setRuntimeSSRProps] = React.useState<Record<string, unknown>>(() => {\n const payload = getInitialSSRBootstrap();\n if (!payload) {\n return {};\n }\n\n if (payload.path === window.location.pathname) {\n return payload.props;\n }\n\n return {};\n });\n const [hydrationDone, setHydrationDone] = React.useState(false);\n\n const match = useMemo(() => matchRoute(state.path, routes), [state.path, routes]);\n\n // Use matched params, or fall back to re-extracting from path using global routes during HMR\n const currentParams = match?.params ?? (isDevEnvironment() ? extractParamsFromPath(state.path) : {});\n\n // In dev mode, always read fresh searchParams from URL to handle HMR edge cases\n const currentSearchParams = isDevEnvironment() ? new URLSearchParams(window.location.search) : state.searchParams;\n\n const routerValue: RouterContext = {\n path: state.path,\n params: currentParams,\n searchParams: currentSearchParams,\n push: (href, options) => {\n // Wrap navigation in startTransition for smoother updates\n startTransition(() => {\n navigate(href, { scrollToTop: options?.scrollToTop });\n });\n },\n replace: (href, options) => {\n startTransition(() => {\n navigate(href, { replace: true, scrollToTop: options?.scrollToTop });\n });\n },\n on: (event, listener) => routerEventEmitter.on(event, listener),\n status: match ? 200 : 404,\n isNavigating: state.isNavigating,\n isPending,\n };\n\n React.useEffect(() => {\n const targetPath = `${state.path}${window.location.search || \"\"}`;\n\n // On first client render, if SSR payload already exists for this path, keep it.\n if (!hydrationDone) {\n const bootstrap = getInitialSSRBootstrap();\n if (bootstrap && bootstrap.path === state.path) {\n setHydrationDone(true);\n return;\n }\n setHydrationDone(true);\n }\n\n let cancelled = false;\n\n const load = async () => {\n const ssrPayload = await fetchSSRPageProps(targetPath);\n if (cancelled) {\n return;\n }\n\n if (ssrPayload.kind === \"redirect\") {\n const destination = ssrPayload.redirect.destination;\n\n if (isExternalUrl(destination)) {\n window.location.assign(destination);\n return;\n }\n\n navigate(destination, {\n replace: ssrPayload.redirect.replace ?? true,\n scrollToTop: true,\n });\n return;\n }\n\n if (ssrPayload.kind === \"props\") {\n setRuntimeSSRProps(ssrPayload.props);\n return;\n }\n\n setRuntimeSSRProps({});\n };\n\n void load();\n\n return () => {\n cancelled = true;\n };\n }, [state.path, currentSearchParams.toString(), hydrationDone]);\n\n React.useEffect(() => {\n const controller = new AbortController();\n const targetPath = `${state.path}${window.location.search || \"\"}`;\n\n const syncMetadata = async () => {\n try {\n if (controller.signal.aborted) {\n return;\n }\n\n const result = await rpcCallWithOptions<ClientSocialMeta | null, { path: string }>(\n SEO_METADATA_RPC_METHOD,\n { path: targetPath },\n {\n forceHttp: isAutoHttpOnMobileEnabled() && isMobileRpcDevice(),\n }\n );\n\n if (controller.signal.aborted) {\n return;\n }\n\n applyRouteMetadata(result.data ?? null);\n } catch (error) {\n if ((error as { name?: string })?.name === \"AbortError\") {\n return;\n }\n }\n };\n\n syncMetadata();\n\n return () => controller.abort();\n }, [state.path, currentSearchParams.toString()]);\n\n if (!match) {\n const NotFoundComp = NotFound ?? (() => <div>Not found</div>);\n const content = <NotFoundComp />;\n\n return <RouterContext.Provider value={routerValue}>{AppShell ? <AppShell Component={NotFoundComp} pageProps={{}} /> : content}</RouterContext.Provider>;\n }\n\n const Page = match.route.Component as ComponentType<{ params: Record<string, string | string[]>; searchParams: URLSearchParams }>;\n const pageProps = {\n ...runtimeSSRProps,\n params: match.params,\n searchParams: currentSearchParams,\n };\n\n // Create a wrapped component that includes all layouts\n const WrappedPage = () => {\n let content = <Page {...pageProps} />;\n // Wrap page with layouts (from outer to inner)\n for (let i = match.route.layouts.length - 1; i >= 0; i--) {\n const Layout = match.route.layouts[i];\n content = <Layout>{content}</Layout>;\n }\n return content;\n };\n\n const finalContent = AppShell ? (\n <AppShell Component={WrappedPage} pageProps={pageProps}>\n <WrappedPage />\n </AppShell>\n ) : (\n <WrappedPage />\n );\n\n return <RouterContext.Provider value={routerValue}>{finalContent}</RouterContext.Provider>;\n}\n\ntype ClientSocialMeta = {\n title: string;\n description?: string;\n image?: string;\n canonicalUrl?: string;\n siteName?: string;\n type?: string;\n robots?: string;\n twitterCard?: \"summary\" | \"summary_large_image\" | \"app\" | \"player\";\n twitterSite?: string;\n twitterCreator?: string;\n};\n\nfunction applyRouteMetadata(meta: ClientSocialMeta | null) {\n if (typeof document === \"undefined\") {\n return;\n }\n\n removeExistingSeoTags();\n\n if (!meta) {\n return;\n }\n\n document.title = meta.title;\n\n const entries: Array<{ tag: \"meta\" | \"link\"; attrs: Record<string, string> }> = [];\n\n entries.push({ tag: \"meta\", attrs: { property: \"og:title\", content: meta.title } });\n entries.push({ tag: \"meta\", attrs: { property: \"og:type\", content: meta.type ?? \"website\" } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:card\", content: meta.twitterCard ?? \"summary_large_image\" } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:title\", content: meta.title } });\n\n if (meta.description) {\n entries.push({ tag: \"meta\", attrs: { name: \"description\", content: meta.description } });\n entries.push({ tag: \"meta\", attrs: { property: \"og:description\", content: meta.description } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:description\", content: meta.description } });\n }\n\n if (meta.image) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:image\", content: meta.image } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:image\", content: meta.image } });\n }\n\n if (meta.canonicalUrl) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:url\", content: meta.canonicalUrl } });\n entries.push({ tag: \"link\", attrs: { rel: \"canonical\", href: meta.canonicalUrl } });\n }\n\n if (meta.siteName) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:site_name\", content: meta.siteName } });\n }\n\n if (meta.robots) {\n entries.push({ tag: \"meta\", attrs: { name: \"robots\", content: meta.robots } });\n }\n\n if (meta.twitterSite) {\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:site\", content: meta.twitterSite } });\n }\n\n if (meta.twitterCreator) {\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:creator\", content: meta.twitterCreator } });\n }\n\n for (const entry of entries) {\n const node = document.createElement(entry.tag);\n for (const [key, value] of Object.entries(entry.attrs)) {\n node.setAttribute(key, value);\n }\n node.setAttribute(\"data-helium-seo\", \"true\");\n document.head.appendChild(node);\n }\n}\n\nfunction removeExistingSeoTags() {\n const headNodes = Array.from(document.head.querySelectorAll(\"meta, link\"));\n\n for (const node of headNodes) {\n if (node.getAttribute(\"data-helium-seo\") === \"true\") {\n node.remove();\n continue;\n }\n\n if (node.tagName.toLowerCase() === \"link\") {\n const rel = (node.getAttribute(\"rel\") || \"\").toLowerCase();\n if (rel === \"canonical\") {\n node.remove();\n }\n continue;\n }\n\n const name = (node.getAttribute(\"name\") || \"\").toLowerCase();\n const property = (node.getAttribute(\"property\") || \"\").toLowerCase();\n\n if (name === \"description\" || name === \"robots\" || name.startsWith(\"twitter:\")) {\n node.remove();\n continue;\n }\n\n if (property.startsWith(\"og:\")) {\n node.remove();\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Router.js","sourceRoot":"","sources":["../../src/client/Router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AC,WAAW,EAAE,CAAC;QAErE,IAAI,IAAI,KAAK,aAAa,IAAI,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;YAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,SAAS;QACb,CAAC;QAED,IAAI,QAAQ,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;QAClB,CAAC;IACL,CAAC;AACL,CAAC","sourcesContent":["import type { ComponentType } from \"react\";\nimport React, { useMemo, useSyncExternalStore, useTransition } from \"react\";\n\nimport { SEO_METADATA_RPC_METHOD } from \"../runtime/internalMethods.js\";\nimport { isDevEnvironment } from \"./env.js\";\nimport type { RouteEntry } from \"./routerManifest.js\";\nimport { buildRoutes } from \"./routerManifest.js\";\nimport { isAutoHttpOnMobileEnabled, isMobileRpcDevice, rpcCallWithOptions } from \"./rpcClient.js\";\n\ntype HeliumSSRBootstrap = {\n path: string;\n search?: string;\n props: Record<string, unknown>;\n};\n\ntype SSRRedirectPayload = {\n destination: string;\n statusCode?: 301 | 302 | 303 | 307 | 308;\n replace?: boolean;\n};\n\ntype SSRPagePropsPayload =\n | {\n kind: \"props\";\n props: Record<string, unknown>;\n }\n | {\n kind: \"redirect\";\n redirect: SSRRedirectPayload;\n }\n | {\n kind: \"none\";\n };\n\nfunction getInitialSSRBootstrap(): HeliumSSRBootstrap | null {\n if (typeof window === \"undefined\") {\n return null;\n }\n\n const globalWindow = window as typeof window & {\n __HELIUM_SSR_DATA__?: HeliumSSRBootstrap;\n };\n\n const payload = globalWindow.__HELIUM_SSR_DATA__;\n if (!payload || typeof payload !== \"object\" || typeof payload.path !== \"string\" || typeof payload.props !== \"object\" || payload.props === null) {\n return null;\n }\n\n return payload;\n}\n\nasync function fetchSSRPageProps(path: string): Promise<SSRPagePropsPayload> {\n try {\n const response = await fetch(`/__helium__/page-props?path=${encodeURIComponent(path)}`, {\n method: \"GET\",\n headers: {\n Accept: \"application/json\",\n },\n });\n\n if (!response.ok) {\n return { kind: \"none\" };\n }\n\n const payload = (await response.json()) as {\n ssr?: boolean;\n props?: Record<string, unknown> | null;\n redirect?: SSRRedirectPayload;\n };\n\n if (!payload.ssr) {\n return { kind: \"none\" };\n }\n\n if (payload.redirect && typeof payload.redirect.destination === \"string\" && payload.redirect.destination.length > 0) {\n return {\n kind: \"redirect\",\n redirect: payload.redirect,\n };\n }\n\n if (!payload.props) {\n return { kind: \"none\" };\n }\n\n return {\n kind: \"props\",\n props: payload.props,\n };\n } catch {\n return { kind: \"none\" };\n }\n}\n\n// Event emitter for router events\ntype RouterEvent = \"navigation\" | \"before-navigation\";\ntype EventListener = (event: { from: string; to: string; preventDefault?: () => void }) => void;\n\nclass RouterEventEmitter {\n private listeners: Map<RouterEvent, Set<EventListener>> = new Map();\n\n on(event: RouterEvent, listener: EventListener): () => void {\n if (!this.listeners.has(event)) {\n this.listeners.set(event, new Set());\n }\n this.listeners.get(event)!.add(listener);\n\n // Return unsubscribe function\n return () => {\n this.listeners.get(event)?.delete(listener);\n };\n }\n\n emit(event: RouterEvent, data: { from: string; to: string }): boolean {\n const eventListeners = this.listeners.get(event);\n if (!eventListeners || eventListeners.size === 0) {\n return true;\n }\n\n let prevented = false;\n const preventDefault = () => {\n prevented = true;\n };\n\n const eventData = event === \"before-navigation\" ? { ...data, preventDefault } : data;\n\n eventListeners.forEach((listener) => {\n listener(eventData);\n });\n\n return !prevented;\n }\n\n // Clear all listeners - useful for HMR\n clear() {\n this.listeners.clear();\n }\n}\n\n// Use a singleton that survives HMR by attaching to window in dev mode\nlet routerEventEmitter: RouterEventEmitter;\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n // In dev mode, reuse the same emitter instance across HMR\n const globalWindow = window as typeof window & { __heliumRouterEmitter?: RouterEventEmitter };\n if (!globalWindow.__heliumRouterEmitter) {\n globalWindow.__heliumRouterEmitter = new RouterEventEmitter();\n }\n routerEventEmitter = globalWindow.__heliumRouterEmitter;\n} else {\n routerEventEmitter = new RouterEventEmitter();\n}\n\ntype RouterState = {\n path: string;\n searchParams: URLSearchParams;\n isNavigating: boolean;\n};\n\nfunction getLocation(): RouterState {\n const { pathname, search } = window.location;\n return {\n path: pathname,\n searchParams: new URLSearchParams(search),\n isNavigating: false,\n };\n}\n\nfunction matchRoute(path: string, routes: RouteEntry[]) {\n for (const r of routes) {\n const m = r.matcher(path);\n if (m) {\n return { params: m.params, route: r };\n }\n }\n return null;\n}\n\n// Location store for useSyncExternalStore\n// Preserve across HMR by attaching to window in dev mode\nlet currentLocation: RouterState;\nlet locationListeners: Set<() => void>;\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & {\n __heliumCurrentLocation?: RouterState;\n __heliumLocationListeners?: Set<() => void>;\n };\n if (!globalWindow.__heliumCurrentLocation) {\n globalWindow.__heliumCurrentLocation = getLocation();\n }\n if (!globalWindow.__heliumLocationListeners) {\n globalWindow.__heliumLocationListeners = new Set();\n }\n currentLocation = globalWindow.__heliumCurrentLocation;\n locationListeners = globalWindow.__heliumLocationListeners;\n} else if (typeof window !== \"undefined\") {\n currentLocation = getLocation();\n locationListeners = new Set();\n} else {\n currentLocation = { path: \"/\", searchParams: new URLSearchParams(), isNavigating: false };\n locationListeners = new Set();\n}\n\n// Helper to re-extract params from path using stored routes during HMR\nfunction extractParamsFromPath(path: string): Record<string, string | string[]> {\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n const routes = globalWindow.__heliumGlobalRoutes;\n if (routes && routes.length > 0) {\n const match = matchRoute(path, routes);\n if (match) {\n return match.params;\n }\n }\n }\n return {};\n}\n\nfunction subscribeToLocation(callback: () => void) {\n locationListeners.add(callback);\n return () => locationListeners.delete(callback);\n}\n\nfunction getLocationSnapshot() {\n return currentLocation;\n}\n\nconst SERVER_SNAPSHOT: RouterState = { path: \"/\", searchParams: new URLSearchParams(), isNavigating: false };\nfunction getServerSnapshot() {\n return SERVER_SNAPSHOT;\n}\n\nfunction updateLocation(isNavigating = false) {\n const newLocation = { ...getLocation(), isNavigating };\n currentLocation = newLocation;\n // Update the global reference in dev mode\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n (window as typeof window & { __heliumCurrentLocation?: RouterState }).__heliumCurrentLocation = newLocation;\n }\n locationListeners.forEach((listener) => listener());\n}\n\n// Set up global listeners once\nif (typeof window !== \"undefined\") {\n // Only set up once, survives HMR\n const globalWindow = window as typeof window & { __heliumLocationListenerSetup?: boolean };\n if (!globalWindow.__heliumLocationListenerSetup) {\n globalWindow.__heliumLocationListenerSetup = true;\n\n window.addEventListener(\"popstate\", () => updateLocation(false));\n\n // Also listen to navigation events from the emitter\n routerEventEmitter.on(\"navigation\", () => updateLocation(false));\n }\n}\n\n/** Options for push/replace navigation methods */\nexport interface RouterNavigationOptions {\n /** Scroll to top after navigation (default: true) */\n scrollToTop?: boolean;\n}\n\n// Context for useRouter hook\ntype RouterContext = {\n path: string;\n params: Record<string, string | string[]>;\n searchParams: URLSearchParams;\n push: (href: string, options?: RouterNavigationOptions) => void;\n replace: (href: string, options?: RouterNavigationOptions) => void;\n on: (event: RouterEvent, listener: EventListener) => () => void;\n status: 200 | 404;\n isNavigating: boolean;\n /** Indicates content is stale (old content shown while new content renders) - React 18+ concurrent feature */\n isPending: boolean;\n};\n\nexport const RouterContext = React.createContext<RouterContext | null>(null);\n\n/**\n * Access router context inside a component tree managed by <AppRouter />.\n *\n * Provides current path, route params, URL search params and navigation helpers\n * (\\`push\\`, \\`replace\\`) as well as an \\`on\\` method to subscribe to navigation events.\n * The \\`isNavigating\\` property indicates when a navigation is in progress.\n * The \\`isPending\\` property indicates when content is stale (React concurrent features).\n * Throws when used outside of an <AppRouter /> provider.\n */\nexport function useRouter() {\n const ctx = React.useContext(RouterContext);\n if (!ctx) {\n // During HMR in development, context might be temporarily unavailable\n // Provide a temporary fallback to prevent white screen of death\n // Re-extract params from current path using stored routes\n if (typeof window !== \"undefined\" && isDevEnvironment()) {\n const currentPath = window.location.pathname;\n return {\n path: currentPath,\n params: extractParamsFromPath(currentPath),\n searchParams: new URLSearchParams(window.location.search),\n push: (href: string, options?: RouterNavigationOptions) => {\n window.history.pushState({}, \"\", href);\n if (options?.scrollToTop !== false) {\n window.scrollTo({ top: 0, left: 0, behavior: \"smooth\" });\n }\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n },\n replace: (href: string, options?: RouterNavigationOptions) => {\n window.history.replaceState({}, \"\", href);\n if (options?.scrollToTop !== false) {\n window.scrollTo({ top: 0, left: 0, behavior: \"smooth\" });\n }\n window.dispatchEvent(new PopStateEvent(\"popstate\"));\n },\n on: () => () => {},\n status: 200 as const,\n isNavigating: false,\n isPending: false,\n };\n }\n throw new Error(\"useRouter must be used inside <AppRouter>\");\n }\n return ctx;\n}\n\n/**\n * Redirect component for declarative navigation.\n * Use this instead of calling router.push() during render.\n *\n * @example\n * \\`\\`\\`tsx\n * export default function Docs() {\n * return <Redirect to=\"/docs/getting-started\" />;\n * }\n * \\`\\`\\`\n */\nexport function Redirect({ to, replace = false }: { to: string; replace?: boolean }) {\n const hasRedirected = React.useRef(false);\n\n // Use useLayoutEffect to redirect before paint\n React.useLayoutEffect(() => {\n const targetPath = to.split(\"?\")[0];\n if (!hasRedirected.current && window.location.pathname !== targetPath) {\n hasRedirected.current = true;\n\n // Perform navigation\n if (replace) {\n window.history.replaceState(null, \"\", to);\n } else {\n window.history.pushState(null, \"\", to);\n }\n\n // Emit navigation event to update router state\n routerEventEmitter.emit(\"navigation\", {\n from: window.location.pathname,\n to: targetPath,\n });\n }\n }, [to, replace]);\n\n return null;\n}\n\n/** Options for navigation */\ninterface NavigateOptions {\n replace?: boolean;\n scrollToTop?: boolean;\n}\n\n// Navigation helper\nfunction navigate(href: string, options: NavigateOptions = {}) {\n const { replace = false, scrollToTop = true } = options;\n const from = window.location.pathname;\n const to = href.split(\"?\")[0]; // Extract pathname from href\n\n // Emit before-navigation event (can be prevented)\n const canNavigate = routerEventEmitter.emit(\"before-navigation\", { from, to });\n if (!canNavigate) {\n return; // Navigation was prevented\n }\n\n // Set navigating state to true before navigation\n currentLocation = { ...currentLocation, isNavigating: true };\n locationListeners.forEach((listener) => listener());\n\n if (replace) {\n window.history.replaceState(null, \"\", href);\n } else {\n window.history.pushState(null, \"\", href);\n }\n\n // Scroll to top immediately after pushState, before React re-renders.\n // Using instant scroll avoids race conditions where smooth scrolling\n // gets interrupted by React DOM updates, especially on Safari mobile.\n if (scrollToTop) {\n window.scrollTo({ top: 0, left: 0, behavior: \"instant\" });\n }\n\n // Update location state synchronously so there is no stale-state window\n // between pushState and the next render.\n updateLocation(false);\n\n // Emit navigation event after state is consistent\n routerEventEmitter.emit(\"navigation\", { from, to });\n}\n\nexport type LinkProps = React.PropsWithChildren<\n Omit<React.AnchorHTMLAttributes<HTMLAnchorElement>, \"href\"> & {\n href: string;\n replace?: boolean;\n /** Disable prefetching on hover (default: false - prefetch is enabled) */\n prefetch?: boolean;\n /** Scroll to top after navigation (default: true) */\n scrollToTop?: boolean;\n }\n>;\n\n/**\n * Check if a URL is external (different origin).\n */\nfunction isExternalUrl(href: string): boolean {\n if (typeof window === \"undefined\") {\n return false;\n }\n try {\n const url = new URL(href, window.location.origin);\n return url.origin !== window.location.origin;\n } catch {\n return false;\n }\n}\n\n// Store routes globally for prefetching (set by AppRouter)\n// Preserve across HMR in dev mode\nlet globalRoutes: RouteEntry[];\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n if (!globalWindow.__heliumGlobalRoutes) {\n globalWindow.__heliumGlobalRoutes = [];\n }\n globalRoutes = globalWindow.__heliumGlobalRoutes;\n} else {\n globalRoutes = [];\n}\n\n/**\n * Client-side navigation link.\n *\n * Intercepts left-clicks and uses the router's navigation helpers for SPA\n * navigation. Keeps normal anchor behaviour when modifier keys are used,\n * when the link is external, or when `target` / `download` attributes\n * are present.\n *\n * Automatically prefetches page chunks on hover for faster navigation.\n */\nexport function Link(props: LinkProps) {\n const {\n children,\n href,\n className,\n prefetch: prefetchProp = true,\n scrollToTop = true,\n replace: replaceProp,\n target,\n download,\n onClick: userOnClick,\n onMouseEnter: userOnMouseEnter,\n onFocus: userOnFocus,\n ...restProps\n } = props;\n\n const onClick = (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Let user's onClick run first so they can call e.preventDefault()\n userOnClick?.(e);\n\n if (\n e.defaultPrevented ||\n e.button !== 0 || // only left click\n e.metaKey ||\n e.ctrlKey ||\n e.shiftKey ||\n e.altKey ||\n target || // let browser handle target=\"_blank\" etc.\n download != null || // let browser handle downloads\n isExternalUrl(href) // let browser handle external links\n ) {\n return;\n }\n e.preventDefault();\n navigate(href, { replace: replaceProp, scrollToTop });\n };\n\n const onMouseEnter = async (e: React.MouseEvent<HTMLAnchorElement>) => {\n // Prefetch the route on hover if enabled and not external (lazy-load prefetch logic)\n if (prefetchProp && !isExternalUrl(href) && globalRoutes.length > 0) {\n const { prefetchRoute } = await import(\"./prefetch.js\");\n prefetchRoute(href, globalRoutes);\n }\n userOnMouseEnter?.(e);\n };\n\n const onFocus = async (e: React.FocusEvent<HTMLAnchorElement>) => {\n // Also prefetch on focus (keyboard navigation)\n if (prefetchProp && !isExternalUrl(href) && globalRoutes.length > 0) {\n const { prefetchRoute } = await import(\"./prefetch.js\");\n prefetchRoute(href, globalRoutes);\n }\n userOnFocus?.(e);\n };\n\n return (\n <a {...restProps} href={href} target={target} download={download} onClick={onClick} onMouseEnter={onMouseEnter} onFocus={onFocus} className={className}>\n {children}\n </a>\n );\n}\n\n// AppShell props type\n/**\n * Props passed to an optional \\`AppShell\\` wrapper component used by <AppRouter />.\n *\n * \\`Component\\` — the page component to render. \\`pageProps\\` — props provided to the page.\n */\nexport type AppShellProps<TPageProps extends Record<string, unknown> = Record<string, unknown>> = {\n Component: ComponentType<TPageProps>;\n pageProps: TPageProps;\n children?: React.ReactNode;\n};\n\n// Keep the component type and shared layout positions stable across router\n// updates, so loading page props or navigating does not discard local state.\nconst PageRouteContext = React.createContext<RouteEntry | null>(null);\n\nfunction RoutedPage(pageProps: Record<string, unknown>) {\n const route = React.useContext(PageRouteContext);\n if (!route) {\n return null;\n }\n const Page = route.Component as ComponentType<Record<string, unknown>>;\n let content = <Page {...pageProps} />;\n for (let i = route.layouts.length - 1; i >= 0; i--) {\n const Layout = route.layouts[i];\n content = <Layout>{content}</Layout>;\n }\n return content;\n}\n\n// Main router component\nexport function AppRouter({ AppShell }: { AppShell?: ComponentType<AppShellProps> }) {\n // useTransition for concurrent rendering - allows React to keep UI responsive during navigation\n const [isPending, startTransition] = useTransition();\n\n // Build routes once on mount (client-side only)\n const { routes, NotFound } = useMemo(() => {\n if (typeof window === \"undefined\") {\n return { routes: [], NotFound: undefined };\n }\n const result = buildRoutes();\n // Store routes globally for Link prefetching\n // In dev mode, also update the global reference to survive HMR\n if (isDevEnvironment()) {\n const globalWindow = window as typeof window & { __heliumGlobalRoutes?: RouteEntry[] };\n globalWindow.__heliumGlobalRoutes = result.routes;\n // Update the module-level reference as well\n globalRoutes.length = 0;\n globalRoutes.push(...result.routes);\n } else {\n globalRoutes = result.routes;\n }\n return result;\n }, []);\n\n // Use useSyncExternalStore to subscribe to location changes\n // This ensures synchronous updates when location changes\n const state = useSyncExternalStore(subscribeToLocation, getLocationSnapshot, getServerSnapshot);\n const targetPath = `${state.path}${typeof window !== \"undefined\" ? window.location.search : \"\"}`;\n const [runtimeSSRProps, setRuntimeSSRProps] = React.useState<{ path: string; props: Record<string, unknown> }>(() => {\n const payload = getInitialSSRBootstrap();\n if (!payload) {\n return { path: targetPath, props: {} };\n }\n\n const bootstrapPath = `${payload.path}${payload.search ?? window.location.search}`;\n return { path: bootstrapPath, props: payload.props };\n });\n const hydrationDoneRef = React.useRef(false);\n\n const match = useMemo(() => matchRoute(state.path, routes), [state.path, routes]);\n // Use matched params, or fall back to re-extracting from path using global routes during HMR\n const currentParams = match?.params ?? (isDevEnvironment() ? extractParamsFromPath(state.path) : {});\n\n // In dev mode, always read fresh searchParams from URL to handle HMR edge cases\n const currentSearchParams = isDevEnvironment() ? new URLSearchParams(window.location.search) : state.searchParams;\n\n const routerValue: RouterContext = {\n path: state.path,\n params: currentParams,\n searchParams: currentSearchParams,\n push: (href, options) => {\n // Wrap navigation in startTransition for smoother updates\n startTransition(() => {\n navigate(href, { scrollToTop: options?.scrollToTop });\n });\n },\n replace: (href, options) => {\n startTransition(() => {\n navigate(href, { replace: true, scrollToTop: options?.scrollToTop });\n });\n },\n on: (event, listener) => routerEventEmitter.on(event, listener),\n status: match ? 200 : 404,\n isNavigating: state.isNavigating,\n isPending,\n };\n\n React.useEffect(() => {\n // On first client render, keep the matching SSR payload. A ref avoids\n // restarting this effect and remounting content just to mark hydration.\n if (!hydrationDoneRef.current) {\n hydrationDoneRef.current = true;\n const bootstrap = getInitialSSRBootstrap();\n if (bootstrap && `${bootstrap.path}${bootstrap.search ?? window.location.search}` === targetPath) {\n return;\n }\n }\n\n let cancelled = false;\n\n const load = async () => {\n const ssrPayload = await fetchSSRPageProps(targetPath);\n if (cancelled) {\n return;\n }\n\n if (ssrPayload.kind === \"redirect\") {\n const destination = ssrPayload.redirect.destination;\n\n if (isExternalUrl(destination)) {\n window.location.assign(destination);\n return;\n }\n\n navigate(destination, {\n replace: ssrPayload.redirect.replace ?? true,\n scrollToTop: true,\n });\n return;\n }\n\n if (ssrPayload.kind === \"props\") {\n setRuntimeSSRProps({ path: targetPath, props: ssrPayload.props });\n return;\n }\n\n setRuntimeSSRProps({ path: targetPath, props: {} });\n };\n\n void load();\n\n return () => {\n cancelled = true;\n };\n }, [targetPath]);\n\n React.useEffect(() => {\n const controller = new AbortController();\n const targetPath = `${state.path}${window.location.search || \"\"}`;\n\n const syncMetadata = async () => {\n try {\n if (controller.signal.aborted) {\n return;\n }\n\n const result = await rpcCallWithOptions<ClientSocialMeta | null, { path: string }>(\n SEO_METADATA_RPC_METHOD,\n { path: targetPath },\n {\n forceHttp: isAutoHttpOnMobileEnabled() && isMobileRpcDevice(),\n }\n );\n\n if (controller.signal.aborted) {\n return;\n }\n\n applyRouteMetadata(result.data ?? null);\n } catch (error) {\n if ((error as { name?: string })?.name === \"AbortError\") {\n return;\n }\n }\n };\n\n syncMetadata();\n\n return () => controller.abort();\n }, [state.path, currentSearchParams.toString()]);\n\n if (!match) {\n const NotFoundComp = NotFound ?? (() => <div>Not found</div>);\n const content = <NotFoundComp />;\n\n return <RouterContext.Provider value={routerValue}>{AppShell ? <AppShell Component={NotFoundComp} pageProps={{}} /> : content}</RouterContext.Provider>;\n }\n\n const pageProps = {\n ...(runtimeSSRProps.path === targetPath ? runtimeSSRProps.props : {}),\n params: match.params,\n searchParams: currentSearchParams,\n };\n\n const finalContent = AppShell ? (\n <AppShell Component={RoutedPage} pageProps={pageProps}>\n <RoutedPage {...pageProps} />\n </AppShell>\n ) : (\n <RoutedPage {...pageProps} />\n );\n\n return (\n <RouterContext.Provider value={routerValue}>\n <PageRouteContext.Provider value={match.route}>{finalContent}</PageRouteContext.Provider>\n </RouterContext.Provider>\n );\n}\n\ntype ClientSocialMeta = {\n title: string;\n description?: string;\n image?: string;\n canonicalUrl?: string;\n siteName?: string;\n type?: string;\n robots?: string;\n twitterCard?: \"summary\" | \"summary_large_image\" | \"app\" | \"player\";\n twitterSite?: string;\n twitterCreator?: string;\n};\n\nfunction applyRouteMetadata(meta: ClientSocialMeta | null) {\n if (typeof document === \"undefined\") {\n return;\n }\n\n removeExistingSeoTags();\n\n if (!meta) {\n return;\n }\n\n document.title = meta.title;\n\n const entries: Array<{ tag: \"meta\" | \"link\"; attrs: Record<string, string> }> = [];\n\n entries.push({ tag: \"meta\", attrs: { property: \"og:title\", content: meta.title } });\n entries.push({ tag: \"meta\", attrs: { property: \"og:type\", content: meta.type ?? \"website\" } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:card\", content: meta.twitterCard ?? \"summary_large_image\" } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:title\", content: meta.title } });\n\n if (meta.description) {\n entries.push({ tag: \"meta\", attrs: { name: \"description\", content: meta.description } });\n entries.push({ tag: \"meta\", attrs: { property: \"og:description\", content: meta.description } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:description\", content: meta.description } });\n }\n\n if (meta.image) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:image\", content: meta.image } });\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:image\", content: meta.image } });\n }\n\n if (meta.canonicalUrl) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:url\", content: meta.canonicalUrl } });\n entries.push({ tag: \"link\", attrs: { rel: \"canonical\", href: meta.canonicalUrl } });\n }\n\n if (meta.siteName) {\n entries.push({ tag: \"meta\", attrs: { property: \"og:site_name\", content: meta.siteName } });\n }\n\n if (meta.robots) {\n entries.push({ tag: \"meta\", attrs: { name: \"robots\", content: meta.robots } });\n }\n\n if (meta.twitterSite) {\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:site\", content: meta.twitterSite } });\n }\n\n if (meta.twitterCreator) {\n entries.push({ tag: \"meta\", attrs: { name: \"twitter:creator\", content: meta.twitterCreator } });\n }\n\n for (const entry of entries) {\n const node = document.createElement(entry.tag);\n for (const [key, value] of Object.entries(entry.attrs)) {\n node.setAttribute(key, value);\n }\n node.setAttribute(\"data-helium-seo\", \"true\");\n document.head.appendChild(node);\n }\n}\n\nfunction removeExistingSeoTags() {\n const headNodes = Array.from(document.head.querySelectorAll(\"meta, link\"));\n\n for (const node of headNodes) {\n if (node.getAttribute(\"data-helium-seo\") === \"true\") {\n node.remove();\n continue;\n }\n\n if (node.tagName.toLowerCase() === \"link\") {\n const rel = (node.getAttribute(\"rel\") || \"\").toLowerCase();\n if (rel === \"canonical\") {\n node.remove();\n }\n continue;\n }\n\n const name = (node.getAttribute(\"name\") || \"\").toLowerCase();\n const property = (node.getAttribute(\"property\") || \"\").toLowerCase();\n\n if (name === \"description\" || name === \"robots\" || name.startsWith(\"twitter:\")) {\n node.remove();\n continue;\n }\n\n if (property.startsWith(\"og:\")) {\n node.remove();\n }\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/client/cache.ts"],"names":[],"mappings":"AAuCA,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhE;AAsBD,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAYjD;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,QAM5D;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAYxC;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,QAqBlD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,cAK1E;AAED,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/client/cache.ts"],"names":[],"mappings":"AAuCA,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,MAAM,CAEhE;AAsBD,wBAAgB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAYjD;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,QAM5D;AAED,wBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAYxC;AAED,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,QAqBlD;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,cAK1E;AAED,wBAAgB,aAAa,SAe5B;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE9C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,GAAG,SAAS,CAEtE;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAe/E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAEnD"}
|
package/dist/client/cache.js
CHANGED
|
@@ -103,18 +103,14 @@ export function subscribeInvalidations(listener) {
|
|
|
103
103
|
}
|
|
104
104
|
export function invalidateAll() {
|
|
105
105
|
const methodIds = new Set();
|
|
106
|
-
for (const key of store.keys()) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
methodIds.add(parsed[0]);
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
catch {
|
|
114
|
-
// Ignore malformed keys
|
|
106
|
+
for (const key of [...store.keys(), ...pendingFetches.keys()]) {
|
|
107
|
+
const methodId = methodIdFromKey(key);
|
|
108
|
+
if (methodId !== undefined) {
|
|
109
|
+
methodIds.add(methodId);
|
|
115
110
|
}
|
|
116
111
|
}
|
|
117
112
|
store.clear();
|
|
113
|
+
pendingFetches.clear();
|
|
118
114
|
for (const methodId of methodIds) {
|
|
119
115
|
for (const listener of listeners) {
|
|
120
116
|
listener(methodId);
|
|
@@ -143,10 +139,14 @@ export function setPendingFetch(key, promise) {
|
|
|
143
139
|
return existing;
|
|
144
140
|
}
|
|
145
141
|
pendingFetches.set(key, promise);
|
|
146
|
-
//
|
|
147
|
-
promise.
|
|
148
|
-
|
|
149
|
-
|
|
142
|
+
// Do not let an invalidated request remove its replacement. Handle both
|
|
143
|
+
// outcomes so cleanup does not create an unhandled rejected promise.
|
|
144
|
+
const cleanup = () => {
|
|
145
|
+
if (pendingFetches.get(key) === promise) {
|
|
146
|
+
pendingFetches.delete(key);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
void promise.then(cleanup, cleanup);
|
|
150
150
|
return promise;
|
|
151
151
|
}
|
|
152
152
|
/**
|
package/dist/client/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/client/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQ5C,+DAA+D;AAC/D,IAAI,KAA8B,CAAC;AACnC,IAAI,SAA0C,CAAC;AAC/C,IAAI,cAA6C,CAAC;AAElD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,gBAAgB,EAAE,EAAE,CAAC;IACtD,MAAM,YAAY,GAAG,MAIpB,CAAC;IACF,IAAI,CAAC,YAAY,CAAC,kBAAkB,EAAE,CAAC;QACnC,YAAY,CAAC,kBAAkB,GAAG,IAAI,GAAG,EAAE,CAAC;IAChD,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,CAAC;QACvC,YAAY,CAAC,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;IACpD,CAAC;IACD,IAAI,CAAC,YAAY,CAAC,sBAAsB,EAAE,CAAC;QACvC,YAAY,CAAC,sBAAsB,GAAG,IAAI,GAAG,EAAE,CAAC;IACpD,CAAC;IACD,KAAK,GAAG,YAAY,CAAC,kBAAkB,CAAC;IACxC,SAAS,GAAG,YAAY,CAAC,sBAAsB,CAAC;IAChD,cAAc,GAAG,YAAY,CAAC,sBAAsB,CAAC;AACzD,CAAC;KAAM,CAAC;IACJ,KAAK,GAAG,IAAI,GAAG,EAAE,CAAC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AEG;AACH,MAAM,UAAU,eAAe,CAAI,GAAW;IAC1C,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAA2B,CAAC;AAC7D,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAI,GAAW,EAAE,OAAmB;IAC/D,MAAM,QAAQ,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,QAAQ,EAAE,CAAC;QACX,OAAO,QAAsB,CAAC;IAClC,CAAC;IACD,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACjC,wEAAwE;IACxE,qEAAqE;IACrE,MAAM,OAAO,GAAG,GAAG,EAAE;QACjB,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,OAAO,EAAE,CAAC;YACtC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;IACL,CAAC,CAAC;IACF,KAAK,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,OAAO,CAAC;AACnB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,GAAW;IACzC,cAAc,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["import { isDevEnvironment } from \"./env.js\";\n\ninterface CacheEntry {\n value: unknown;\n timestamp: number;\n ttl?: number; // TTL in milliseconds\n}\n\n// Preserve cache across HMR by attaching to window in dev mode\nlet store: Map<string, CacheEntry>;\nlet listeners: Set<(methodId: string) => void>;\nlet pendingFetches: Map<string, Promise<unknown>>;\n\nif (typeof window !== \"undefined\" && isDevEnvironment()) {\n const globalWindow = window as typeof window & {\n __heliumCacheStore?: Map<string, CacheEntry>;\n __heliumCacheListeners?: Set<(methodId: string) => void>;\n __heliumPendingFetches?: Map<string, Promise<unknown>>;\n };\n if (!globalWindow.__heliumCacheStore) {\n globalWindow.__heliumCacheStore = new Map();\n }\n if (!globalWindow.__heliumCacheListeners) {\n globalWindow.__heliumCacheListeners = new Set();\n }\n if (!globalWindow.__heliumPendingFetches) {\n globalWindow.__heliumPendingFetches = new Map();\n }\n store = globalWindow.__heliumCacheStore;\n listeners = globalWindow.__heliumCacheListeners;\n pendingFetches = globalWindow.__heliumPendingFetches;\n} else {\n store = new Map();\n listeners = new Set();\n pendingFetches = new Map();\n}\n\nconst DEFAULT_TTL = 5 * 60 * 1000; // 5 minutes\n\nexport function cacheKey(methodId: string, args: unknown): string {\n return JSON.stringify([methodId, args ?? null]);\n}\n\nfunction methodIdFromKey(key: string): string | undefined {\n try {\n const parsed = JSON.parse(key);\n if (!Array.isArray(parsed) || parsed.length < 1) {\n return undefined;\n }\n const [methodId] = parsed;\n return typeof methodId === \"string\" ? methodId : undefined;\n } catch {\n return undefined;\n }\n}\n\nfunction isExpired(entry: CacheEntry): boolean {\n if (!entry.ttl) {\n return false;\n }\n return Date.now() - entry.timestamp > entry.ttl;\n}\n\nexport function get<T>(key: string): T | undefined {\n const entry = store.get(key);\n if (!entry) {\n return undefined;\n }\n\n if (isExpired(entry)) {\n store.delete(key);\n return undefined;\n }\n\n return entry.value as T | undefined;\n}\n\nexport function set(key: string, value: unknown, ttl?: number) {\n store.set(key, {\n value,\n timestamp: Date.now(),\n ttl: ttl ?? DEFAULT_TTL,\n });\n}\n\nexport function has(key: string): boolean {\n const entry = store.get(key);\n if (!entry) {\n return false;\n }\n\n if (isExpired(entry)) {\n store.delete(key);\n return false;\n }\n\n return true;\n}\n\nexport function invalidateByMethod(methodId: string) {\n let invalidated = false;\n for (const key of store.keys()) {\n if (methodIdFromKey(key) === methodId) {\n store.delete(key);\n invalidated = true;\n }\n }\n\n for (const key of pendingFetches.keys()) {\n if (methodIdFromKey(key) === methodId) {\n pendingFetches.delete(key);\n invalidated = true;\n }\n }\n\n if (invalidated || listeners.size) {\n for (const listener of listeners) {\n listener(methodId);\n }\n }\n}\n\nexport function subscribeInvalidations(listener: (methodId: string) => void) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n}\n\nexport function invalidateAll() {\n const methodIds = new Set<string>();\n for (const key of [...store.keys(), ...pendingFetches.keys()]) {\n const methodId = methodIdFromKey(key);\n if (methodId !== undefined) {\n methodIds.add(methodId);\n }\n }\n store.clear();\n pendingFetches.clear();\n for (const methodId of methodIds) {\n for (const listener of listeners) {\n listener(methodId);\n }\n }\n}\n\n/**\n * Check if a fetch is currently pending for a given cache key.\n */\nexport function isPending(key: string): boolean {\n return pendingFetches.has(key);\n}\n\n/**\n * Get an existing pending fetch promise, or undefined if none.\n */\nexport function getPendingFetch<T>(key: string): Promise<T> | undefined {\n return pendingFetches.get(key) as Promise<T> | undefined;\n}\n\n/**\n * Register a pending fetch. Returns the promise.\n * If a fetch for this key is already pending, returns the existing promise.\n */\nexport function setPendingFetch<T>(key: string, promise: Promise<T>): Promise<T> {\n const existing = pendingFetches.get(key);\n if (existing) {\n return existing as Promise<T>;\n }\n pendingFetches.set(key, promise);\n // Do not let an invalidated request remove its replacement. Handle both\n // outcomes so cleanup does not create an unhandled rejected promise.\n const cleanup = () => {\n if (pendingFetches.get(key) === promise) {\n pendingFetches.delete(key);\n }\n };\n void promise.then(cleanup, cleanup);\n return promise;\n}\n\n/**\n * Clear a pending fetch (if you need to cancel/reset).\n */\nexport function clearPendingFetch(key: string): void {\n pendingFetches.delete(key);\n}\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { type RpcResult } from "./rpcClient.js";
|
|
2
|
+
import type { MethodStub } from "./types.js";
|
|
3
|
+
export type CallMethodOptions = {
|
|
4
|
+
/** Use a specific transport without automatic fallback to another transport. */
|
|
5
|
+
transport?: "http" | "websocket";
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Call a typed server method outside React hooks. Does not update hook state or
|
|
9
|
+
* invalidate cached queries. Omit transport to use the configured selection and
|
|
10
|
+
* fallback behavior; the result reports the transport used for the response.
|
|
11
|
+
*/
|
|
12
|
+
export declare function callMethod<TArgs, TResult>(method: MethodStub<TArgs, TResult>, args: TArgs, options?: CallMethodOptions): Promise<RpcResult<TResult>>;
|
|
13
|
+
//# sourceMappingURL=callMethod.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callMethod.d.ts","sourceRoot":"","sources":["../../src/client/callMethod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AACpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG;IAC5B,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACpC,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,GAAE,iBAAsB,GAAG,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAExJ"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { rpcCallWithOptions } from "./rpcClient.js";
|
|
2
|
+
/**
|
|
3
|
+
* Call a typed server method outside React hooks. Does not update hook state or
|
|
4
|
+
* invalidate cached queries. Omit transport to use the configured selection and
|
|
5
|
+
* fallback behavior; the result reports the transport used for the response.
|
|
6
|
+
*/
|
|
7
|
+
export function callMethod(method, args, options = {}) {
|
|
8
|
+
return rpcCallWithOptions(method.__id, args, options);
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=callMethod.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callMethod.js","sourceRoot":"","sources":["../../src/client/callMethod.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAkB,MAAM,gBAAgB,CAAC;AAQpE;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAiB,MAAkC,EAAE,IAAW,EAAE,UAA6B,EAAE;IACvH,OAAO,kBAAkB,CAAiB,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { rpcCallWithOptions, type RpcResult } from \"./rpcClient.js\";\nimport type { MethodStub } from \"./types.js\";\n\nexport type CallMethodOptions = {\n /** Use a specific transport without automatic fallback to another transport. */\n transport?: \"http\" | \"websocket\";\n};\n\n/**\n * Call a typed server method outside React hooks. Does not update hook state or\n * invalidate cached queries. Omit transport to use the configured selection and\n * fallback behavior; the result reports the transport used for the response.\n */\nexport function callMethod<TArgs, TResult>(method: MethodStub<TArgs, TResult>, args: TArgs, options: CallMethodOptions = {}): Promise<RpcResult<TResult>> {\n return rpcCallWithOptions<TResult, TArgs>(method.__id, args, options);\n}\n"]}
|
package/dist/client/env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/client/env.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC5B,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;QACxC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAI,UAAgC,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC;IACzE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,OAAO,KAAK,YAAY,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IACxB,OAAO,CAAE,UAAgC,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,CAAc,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IACzC,OAAO,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["declare const __HELIUM_DEV__: boolean;\n\nexport type PublicEnv = Record<string, string>;\n\ntype GlobalWithProcess = typeof globalThis & {\n process?: {\n env?: {\n NODE_ENV?: string;\n };\n };\n __HELIUM__?: {\n env?: PublicEnv;\n };\n};\n\n/**\n * Detect development mode without relying on Vite-specific client env APIs.\n */\nexport function isDevEnvironment(): boolean {\n if (typeof __HELIUM_DEV__ !== \"undefined\") {\n return __HELIUM_DEV__;\n }\n\n const nodeEnv = (globalThis as GlobalWithProcess).process?.env?.NODE_ENV;\n if (typeof nodeEnv === \"string\") {\n return nodeEnv !== \"production\";\n }\n\n return false;\n}\n\n/**\n * Reads browser-exposed public env vars from window.__HELIUM__.env.\n */\nexport function getPublicEnv(): PublicEnv {\n return ((globalThis as GlobalWithProcess).__HELIUM__?.env ?? {}) as PublicEnv;\n}\n\nexport function getPublicEnvValue(key: string): string | undefined {\n return getPublicEnv()[key];\n}"]}
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/client/env.ts"],"names":[],"mappings":"AAeA;;GAEG;AACH,MAAM,UAAU,gBAAgB;IAC5B,IAAI,OAAO,cAAc,KAAK,WAAW,EAAE,CAAC;QACxC,OAAO,cAAc,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAI,UAAgC,CAAC,OAAO,EAAE,GAAG,EAAE,QAAQ,CAAC;IACzE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,OAAO,KAAK,YAAY,CAAC;IACpC,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IACxB,OAAO,CAAE,UAAgC,CAAC,UAAU,EAAE,GAAG,IAAI,EAAE,CAAc,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,GAAW;IACzC,OAAO,YAAY,EAAE,CAAC,GAAG,CAAC,CAAC;AAC/B,CAAC","sourcesContent":["declare const __HELIUM_DEV__: boolean;\n\nexport type PublicEnv = Record<string, string>;\n\ntype GlobalWithProcess = typeof globalThis & {\n process?: {\n env?: {\n NODE_ENV?: string;\n };\n };\n __HELIUM__?: {\n env?: PublicEnv;\n };\n};\n\n/**\n * Detect development mode without relying on Vite-specific client env APIs.\n */\nexport function isDevEnvironment(): boolean {\n if (typeof __HELIUM_DEV__ !== \"undefined\") {\n return __HELIUM_DEV__;\n }\n\n const nodeEnv = (globalThis as GlobalWithProcess).process?.env?.NODE_ENV;\n if (typeof nodeEnv === \"string\") {\n return nodeEnv !== \"production\";\n }\n\n return false;\n}\n\n/**\n * Reads browser-exposed public env vars from window.__HELIUM__.env.\n */\nexport function getPublicEnv(): PublicEnv {\n return ((globalThis as GlobalWithProcess).__HELIUM__?.env ?? {}) as PublicEnv;\n}\n\nexport function getPublicEnvValue(key: string): string | undefined {\n return getPublicEnv()[key];\n}\n"]}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export type { AppShellProps, LinkProps, RouterNavigationOptions } from "./Router
|
|
|
3
3
|
export { AppRouter, Link, Redirect, RouterContext, useRouter } from "./Router.js";
|
|
4
4
|
export type { LayoutProps } from "./routerManifest.js";
|
|
5
5
|
export type { PageTransitionProps } from "./transitions.js";
|
|
6
|
+
export { callMethod, type CallMethodOptions } from "./callMethod.js";
|
|
6
7
|
export * from "./useCall.js";
|
|
7
8
|
export * from "./useFetch.js";
|
|
8
9
|
export { RpcError } from "./RpcError.js";
|
|
@@ -12,7 +13,7 @@ export { RpcError } from "./RpcError.js";
|
|
|
12
13
|
* while still rendering providers and structural content for SSR.
|
|
13
14
|
*/
|
|
14
15
|
export declare function isSSR(): boolean;
|
|
15
|
-
export type { RpcTransport } from "./rpcClient.js";
|
|
16
|
+
export type { RpcResult, RpcTransport } from "./rpcClient.js";
|
|
16
17
|
export { getRpcTransport, isAutoHttpOnMobileEnabled, preconnect } from "./rpcClient.js";
|
|
17
18
|
export * from "./types.js";
|
|
18
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK7E,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAClF,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAIvD,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAG5D,OAAO,EAAE,UAAU,EAAE,KAAK,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACrE,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAG9B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;GAIG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAGD,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGxF,cAAc,YAAY,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export { getPublicEnv, getPublicEnvValue, isDevEnvironment } from "./env.js";
|
|
|
3
3
|
installStaleClientRecovery();
|
|
4
4
|
export { AppRouter, Link, Redirect, RouterContext, useRouter } from "./Router.js";
|
|
5
5
|
// RPC hooks for data fetching and mutations
|
|
6
|
+
export { callMethod } from "./callMethod.js";
|
|
6
7
|
export * from "./useCall.js";
|
|
7
8
|
export * from "./useFetch.js";
|
|
8
9
|
// RPC error type
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AAEhE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAE7E,0BAA0B,EAAE,CAAC;AAI7B,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAOlF,4CAA4C;AAC5C,OAAO,EAAE,UAAU,EAA0B,MAAM,iBAAiB,CAAC;AACrE,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAE9B,iBAAiB;AACjB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,KAAK;IACjB,OAAO,OAAO,MAAM,KAAK,WAAW,CAAC;AACzC,CAAC;AAID,OAAO,EAAE,eAAe,EAAE,yBAAyB,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAExF,mBAAmB;AACnB,cAAc,YAAY,CAAC;AAE3B,yEAAyE","sourcesContent":["import { installStaleClientRecovery } from \"./staleRecovery.js\";\n\nexport { getPublicEnv, getPublicEnvValue, isDevEnvironment } from \"./env.js\";\n\ninstallStaleClientRecovery();\n\n// Router components and hooks\nexport type { AppShellProps, LinkProps, RouterNavigationOptions } from \"./Router.js\";\nexport { AppRouter, Link, Redirect, RouterContext, useRouter } from \"./Router.js\";\nexport type { LayoutProps } from \"./routerManifest.js\";\n\n// React 18+ page transitions (separate module for better tree-shaking)\n// Import from \"heliumts/client/transitions\" to ensure they're only bundled when used\nexport type { PageTransitionProps } from \"./transitions.js\";\n\n// RPC hooks for data fetching and mutations\nexport { callMethod, type CallMethodOptions } from \"./callMethod.js\";\nexport * from \"./useCall.js\";\nexport * from \"./useFetch.js\";\n\n// RPC error type\nexport { RpcError } from \"./RpcError.js\";\n\n/**\n * Returns `true` when the current code is executing during server-side rendering.\n * Use this in layouts or components to skip browser-only logic (e.g. auth guards)\n * while still rendering providers and structural content for SSR.\n */\nexport function isSSR(): boolean {\n return typeof window === \"undefined\";\n}\n\n// RPC transport info (configured via helium.config.js)\nexport type { RpcResult, RpcTransport } from \"./rpcClient.js\";\nexport { getRpcTransport, isAutoHttpOnMobileEnabled, preconnect } from \"./rpcClient.js\";\n\n// Type definitions\nexport * from \"./types.js\";\n\n// Internal - rpcClient and cache are used by hooks, not exposed to users\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routerManifest.d.ts","sourceRoot":"","sources":["../../src/client/routerManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"routerManifest.d.ts","sourceRoot":"","sources":["../../src/client/routerManifest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAChE,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,MAAM,MAAM,WAAW,GAAG;IACtB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK;QAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;IAChF,SAAS,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC,aAAa,EAAE,mBAAmB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC;IAC3D,OAAO,EAAE,aAAa,CAAC,WAAW,CAAC,EAAE,CAAC;IACtC,OAAO,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC,CAAC;CAC/D,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAqBjD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,IAUjC,MAAM,MAAM;;SAqEvB;AAcD;;;;GAIG;AACH,wBAAgB,WAAW,IAAI;IAC3B,MAAM,EAAE,UAAU,EAAE,CAAC;IACrB,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;CACrC,CAoIA"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { compareRoutePatterns } from "../runtime/routeOrder.js";
|
|
2
3
|
import { log } from "../utils/logger.js";
|
|
3
4
|
/**
|
|
4
5
|
* Convert a file path to a route pattern
|
|
@@ -38,6 +39,14 @@ export function pathFromFile(file) {
|
|
|
38
39
|
* @internal Exported for testing
|
|
39
40
|
*/
|
|
40
41
|
export function createMatcher(pattern) {
|
|
42
|
+
const decodeSegment = (value) => {
|
|
43
|
+
try {
|
|
44
|
+
return decodeURIComponent(value);
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
41
50
|
const segments = pattern.split("/").filter(Boolean);
|
|
42
51
|
return (path) => {
|
|
43
52
|
// Remove query string and hash
|
|
@@ -66,7 +75,7 @@ export function createMatcher(pattern) {
|
|
|
66
75
|
return null;
|
|
67
76
|
} // Not enough path segments
|
|
68
77
|
if (seg.startsWith(":")) {
|
|
69
|
-
params[seg.slice(1)] =
|
|
78
|
+
params[seg.slice(1)] = decodeSegment(value);
|
|
70
79
|
}
|
|
71
80
|
else if (seg !== value) {
|
|
72
81
|
return null; // Static segment must match
|
|
@@ -74,7 +83,7 @@ export function createMatcher(pattern) {
|
|
|
74
83
|
}
|
|
75
84
|
// Collect remaining path segments into catch-all param as an array
|
|
76
85
|
const remainingSegments = pathSegments.slice(catchAllIndex);
|
|
77
|
-
params[catchAllParam] = remainingSegments.map(
|
|
86
|
+
params[catchAllParam] = remainingSegments.map(decodeSegment);
|
|
78
87
|
return { params };
|
|
79
88
|
}
|
|
80
89
|
// Regular matching (no catch-all)
|
|
@@ -87,7 +96,7 @@ export function createMatcher(pattern) {
|
|
|
87
96
|
const value = pathSegments[i];
|
|
88
97
|
if (seg.startsWith(":")) {
|
|
89
98
|
// Dynamic segment
|
|
90
|
-
params[seg.slice(1)] =
|
|
99
|
+
params[seg.slice(1)] = decodeSegment(value);
|
|
91
100
|
}
|
|
92
101
|
else if (seg !== value) {
|
|
93
102
|
// Static segment must match exactly
|
|
@@ -120,12 +129,13 @@ export function buildRoutes() {
|
|
|
120
129
|
}
|
|
121
130
|
// Eagerly load all page components (for initial render and layouts)
|
|
122
131
|
// Exclude .server.* sidecar files — they contain server-only code (e.g. DB access)
|
|
123
|
-
// and must never be bundled into the client.
|
|
124
|
-
|
|
132
|
+
// and must never be bundled into the client. App shells are loaded by the
|
|
133
|
+
// generated entry and are not routable pages; declarations have no runtime.
|
|
134
|
+
const eagerPages = import.meta.glob(["/src/pages/**/*.{tsx,jsx,ts,js}", "!**/*.server.*", "!**/*.d.ts", "!**/_app.*"], {
|
|
125
135
|
eager: true,
|
|
126
136
|
});
|
|
127
137
|
// Lazy load all page components (for Suspense support)
|
|
128
|
-
const lazyPages = import.meta.glob(["/src/pages/**/*.{tsx,jsx,ts,js}", "!**/*.server.*"]);
|
|
138
|
+
const lazyPages = import.meta.glob(["/src/pages/**/*.{tsx,jsx,ts,js}", "!**/*.server.*", "!**/*.d.ts", "!**/_app.*"]);
|
|
129
139
|
// Debug mode: set localStorage.setItem('helium_debug_routes', 'true') to enable
|
|
130
140
|
const debugRoutes = typeof localStorage !== "undefined" && localStorage.getItem("helium_debug_routes") === "true";
|
|
131
141
|
if (debugRoutes) {
|
|
@@ -211,29 +221,8 @@ export function buildRoutes() {
|
|
|
211
221
|
preload: lazyLoader,
|
|
212
222
|
});
|
|
213
223
|
}
|
|
214
|
-
//
|
|
215
|
-
routes.sort((a, b) =>
|
|
216
|
-
const aHasCatchAll = a.pathPattern.includes("*");
|
|
217
|
-
const bHasCatchAll = b.pathPattern.includes("*");
|
|
218
|
-
const aHasDynamic = a.pathPattern.includes(":");
|
|
219
|
-
const bHasDynamic = b.pathPattern.includes(":");
|
|
220
|
-
// Catch-all routes should be last (least specific)
|
|
221
|
-
if (aHasCatchAll && !bHasCatchAll) {
|
|
222
|
-
return 1;
|
|
223
|
-
}
|
|
224
|
-
if (!aHasCatchAll && bHasCatchAll) {
|
|
225
|
-
return -1;
|
|
226
|
-
}
|
|
227
|
-
// Dynamic routes come after static routes
|
|
228
|
-
if (aHasDynamic && !bHasDynamic) {
|
|
229
|
-
return 1;
|
|
230
|
-
}
|
|
231
|
-
if (!aHasDynamic && bHasDynamic) {
|
|
232
|
-
return -1;
|
|
233
|
-
}
|
|
234
|
-
// Longer paths first (more specific)
|
|
235
|
-
return b.pathPattern.length - a.pathPattern.length;
|
|
236
|
-
});
|
|
224
|
+
// Compare specificity segment by segment so /users/:id beats /:section/edit.
|
|
225
|
+
routes.sort((a, b) => compareRoutePatterns(a.pathPattern, b.pathPattern));
|
|
237
226
|
if (debugRoutes) {
|
|
238
227
|
console.group("[Helium Router] Final route order:");
|
|
239
228
|
for (const route of routes) {
|