Next.js website for Rocky Mountain Vending company featuring: - Product catalog with Stripe integration - Service areas and parts pages - Admin dashboard with Clerk authentication - SEO optimized pages with JSON-LD structured data Co-authored-by: Cursor <cursoragent@cursor.com>
1 line
No EOL
5.8 KiB
Text
1 line
No EOL
5.8 KiB
Text
{"version":3,"sources":["../../../../src/client/components/router-reducer/create-initial-router-state.ts"],"sourcesContent":["import type {\n CacheNode,\n FlightDataPath,\n} from '../../../shared/lib/app-router-types'\n\nimport { createHrefFromUrl } from './create-href-from-url'\nimport { fillLazyItemsTillLeafWithHead } from './fill-lazy-items-till-leaf-with-head'\nimport { extractPathFromFlightRouterState } from './compute-changed-path'\n\nimport type { AppRouterState } from './router-reducer-types'\nimport { addRefreshMarkerToActiveParallelSegments } from './refetch-inactive-parallel-segments'\nimport { getFlightDataPartsFromPath } from '../../flight-data-helpers'\n\nexport interface InitialRouterStateParameters {\n navigatedAt: number\n initialCanonicalUrlParts: string[]\n initialRenderedSearch: string\n initialParallelRoutes: CacheNode['parallelRoutes']\n initialFlightData: FlightDataPath[]\n location: Location | null\n}\n\nexport function createInitialRouterState({\n navigatedAt,\n initialFlightData,\n initialCanonicalUrlParts,\n initialRenderedSearch,\n initialParallelRoutes,\n location,\n}: InitialRouterStateParameters): AppRouterState {\n // When initialized on the server, the canonical URL is provided as an array of parts.\n // This is to ensure that when the RSC payload streamed to the client, crawlers don't interpret it\n // as a URL that should be crawled.\n const initialCanonicalUrl = initialCanonicalUrlParts.join('/')\n\n const normalizedFlightData = getFlightDataPartsFromPath(initialFlightData[0])\n const {\n tree: initialTree,\n seedData: initialSeedData,\n head: initialHead,\n } = normalizedFlightData\n // For the SSR render, seed data should always be available (we only send back a `null` response\n // in the case of a `loading` segment, pre-PPR.)\n const rsc = initialSeedData?.[0]\n const loading = initialSeedData?.[2] ?? null\n\n const cache: CacheNode = {\n lazyData: null,\n rsc,\n prefetchRsc: null,\n head: null,\n prefetchHead: null,\n // The cache gets seeded during the first render. `initialParallelRoutes` ensures the cache from the first render is there during the second render.\n parallelRoutes: initialParallelRoutes,\n loading,\n navigatedAt,\n }\n\n const canonicalUrl =\n // location.href is read as the initial value for canonicalUrl in the browser\n // This is safe to do as canonicalUrl can't be rendered, it's only used to control the history updates in the useEffect further down in this file.\n location\n ? // window.location does not have the same type as URL but has all the fields createHrefFromUrl needs.\n createHrefFromUrl(location)\n : initialCanonicalUrl\n\n addRefreshMarkerToActiveParallelSegments(initialTree, canonicalUrl)\n\n // When the cache hasn't been seeded yet we fill the cache with the head.\n if (initialParallelRoutes === null || initialParallelRoutes.size === 0) {\n fillLazyItemsTillLeafWithHead(\n navigatedAt,\n cache,\n undefined,\n initialTree,\n initialSeedData,\n initialHead\n )\n }\n\n const initialState = {\n tree: initialTree,\n cache,\n pushRef: {\n pendingPush: false,\n mpaNavigation: false,\n // First render needs to preserve the previous window.history.state\n // to avoid it being overwritten on navigation back/forward with MPA Navigation.\n preserveCustomHistoryState: true,\n },\n focusAndScrollRef: {\n apply: false,\n onlyHashChange: false,\n hashFragment: null,\n segmentPaths: [],\n },\n canonicalUrl,\n renderedSearch: initialRenderedSearch,\n nextUrl:\n // the || operator is intentional, the pathname can be an empty string\n (extractPathFromFlightRouterState(initialTree) || location?.pathname) ??\n null,\n previousNextUrl: null,\n debugInfo: null,\n }\n\n return initialState\n}\n"],"names":["createInitialRouterState","navigatedAt","initialFlightData","initialCanonicalUrlParts","initialRenderedSearch","initialParallelRoutes","location","initialCanonicalUrl","join","normalizedFlightData","getFlightDataPartsFromPath","tree","initialTree","seedData","initialSeedData","head","initialHead","rsc","loading","cache","lazyData","prefetchRsc","prefetchHead","parallelRoutes","canonicalUrl","createHrefFromUrl","addRefreshMarkerToActiveParallelSegments","size","fillLazyItemsTillLeafWithHead","undefined","initialState","pushRef","pendingPush","mpaNavigation","preserveCustomHistoryState","focusAndScrollRef","apply","onlyHashChange","hashFragment","segmentPaths","renderedSearch","nextUrl","extractPathFromFlightRouterState","pathname","previousNextUrl","debugInfo"],"mappings":";;;;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