Rocky_Mountain_Vending/.pnpm-store/v10/files/c4/77b1fde8fdf304fd5f2f50d913bc07a811a0d89928b6890ace47eb074cffda9d87878e8faa56e0f19578dd41a1967da5643eed717a82d1aac4bbe3cf09d0d0
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
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>
2026-02-12 16:22:15 -07:00

1 line
No EOL
16 KiB
Text

{"version":3,"sources":["../../../src/server/app-render/walk-tree-with-flight-router-state.tsx"],"sourcesContent":["import type {\n FlightDataPath,\n FlightDataSegment,\n FlightRouterState,\n Segment,\n HeadData,\n} from '../../shared/lib/app-router-types'\nimport type { PreloadCallbacks } from './types'\nimport { matchSegment } from '../../client/components/match-segments'\nimport type { LoaderTree } from '../lib/app-dir-module'\nimport { getLinkAndScriptTags } from './get-css-inlined-link-tags'\nimport { getPreloadableFonts } from './get-preloadable-fonts'\nimport {\n createFlightRouterStateFromLoaderTree,\n createRouteTreePrefetch,\n} from './create-flight-router-state-from-loader-tree'\nimport type { AppRenderContext } from './app-render'\nimport { hasLoadingComponentInTree } from './has-loading-component-in-tree'\nimport { addSearchParamsIfPageSegment } from '../../shared/lib/segment'\nimport { createComponentTree } from './create-component-tree'\nimport { getSegmentParam } from '../../shared/lib/router/utils/get-segment-param'\n\n/**\n * Use router state to decide at what common layout to render the page.\n * This can either be the common layout between two pages or a specific place to start rendering from using the \"refetch\" marker in the tree.\n */\nexport async function walkTreeWithFlightRouterState({\n loaderTreeToFilter,\n parentParams,\n flightRouterState,\n parentIsInsideSharedLayout,\n rscHead,\n injectedCSS,\n injectedJS,\n injectedFontPreloadTags,\n rootLayoutIncluded,\n ctx,\n preloadCallbacks,\n MetadataOutlet,\n}: {\n loaderTreeToFilter: LoaderTree\n parentParams: { [key: string]: string | string[] }\n flightRouterState?: FlightRouterState\n rscHead: HeadData\n parentIsInsideSharedLayout?: boolean\n injectedCSS: Set<string>\n injectedJS: Set<string>\n injectedFontPreloadTags: Set<string>\n rootLayoutIncluded: boolean\n ctx: AppRenderContext\n preloadCallbacks: PreloadCallbacks\n MetadataOutlet: React.ComponentType\n}): Promise<FlightDataPath[]> {\n const {\n renderOpts: { nextFontManifest, experimental },\n query,\n isPrefetch,\n getDynamicParamFromSegment,\n parsedRequestHeaders,\n } = ctx\n\n const [segment, parallelRoutes, modules] = loaderTreeToFilter\n\n const parallelRoutesKeys = Object.keys(parallelRoutes)\n\n const { layout } = modules\n const isLayout = typeof layout !== 'undefined'\n\n /**\n * Checks if the current segment is a root layout.\n */\n const rootLayoutAtThisLevel = isLayout && !rootLayoutIncluded\n /**\n * Checks if the current segment or any level above it has a root layout.\n */\n const rootLayoutIncludedAtThisLevelOrAbove =\n rootLayoutIncluded || rootLayoutAtThisLevel\n\n // Because this function walks to a deeper point in the tree to start rendering we have to track the dynamic parameters up to the point where rendering starts\n const segmentParam = getDynamicParamFromSegment(segment)\n const currentParams =\n // Handle null case where dynamic param is optional\n segmentParam && segmentParam.value !== null\n ? {\n ...parentParams,\n [segmentParam.param]: segmentParam.value,\n }\n : parentParams\n const actualSegment: Segment = addSearchParamsIfPageSegment(\n segmentParam ? segmentParam.treeSegment : segment,\n query\n )\n\n /**\n * Decide if the current segment is where rendering has to start.\n */\n const renderComponentsOnThisLevel =\n // No further router state available\n !flightRouterState ||\n // Segment in router state does not match current segment\n !matchSegment(actualSegment, flightRouterState[0]) ||\n // Last item in the tree\n parallelRoutesKeys.length === 0 ||\n // Explicit refresh\n flightRouterState[3] === 'refetch'\n\n // Pre-PPR, the `loading` component signals to the router how deep to render the component tree\n // to ensure prefetches are quick and inexpensive. If there's no `loading` component anywhere in the tree being rendered,\n // the prefetch will be short-circuited to avoid requesting a potentially very expensive subtree. If there's a `loading`\n // somewhere in the tree, we'll recursively render the component tree up until we encounter that loading component, and then stop.\n\n // Check if we're inside the \"new\" part of the navigation — inside the\n // shared layout. In the case of a prefetch, this can be true even if the\n // segment matches, because the client might send a matching segment to\n // indicate that it already has the data in its cache. But in order to find\n // the correct loading boundary, we still need to track where the shared\n // layout begins.\n //\n // TODO: We should rethink the protocol for dynamic requests. It might not\n // make sense for the client to send a FlightRouterState, since that type is\n // overloaded with other concerns.\n const isInsideSharedLayout =\n renderComponentsOnThisLevel ||\n parentIsInsideSharedLayout ||\n flightRouterState[3] === 'inside-shared-layout'\n\n if (\n isInsideSharedLayout &&\n !experimental.isRoutePPREnabled &&\n // If PPR is disabled, and this is a request for the route tree, then we\n // never render any components. Only send the router state.\n (parsedRequestHeaders.isRouteTreePrefetchRequest ||\n // Otherwise, check for the presence of a `loading` component.\n (isPrefetch &&\n !Boolean(modules.loading) &&\n !hasLoadingComponentInTree(loaderTreeToFilter)))\n ) {\n // Send only the router state.\n // TODO: Even for a dynamic route, we should cache these responses,\n // because they do not contain any render data (neither segment data nor\n // the head). They can be made even more cacheable once we move the route\n // params into a separate data structure.\n const overriddenSegment =\n flightRouterState &&\n // TODO: Why does canSegmentBeOverridden exist? Why don't we always just\n // use `actualSegment`? Is it to avoid overwriting some state that's\n // tracked by the client? Dig deeper to see if we can simplify this.\n canSegmentBeOverridden(actualSegment, flightRouterState[0])\n ? flightRouterState[0]\n : actualSegment\n\n const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest\n ? // Route tree prefetch requests contain some extra information\n createRouteTreePrefetch(loaderTreeToFilter, getDynamicParamFromSegment)\n : createFlightRouterStateFromLoaderTree(\n loaderTreeToFilter,\n getDynamicParamFromSegment,\n query\n )\n\n return [\n [\n overriddenSegment,\n routerState,\n null,\n [null, null],\n true,\n ] satisfies FlightDataSegment,\n ]\n }\n\n // Similar to the previous branch. This flag is sent by the client to request\n // only the metadata for a page. No segment data.\n if (flightRouterState && flightRouterState[3] === 'metadata-only') {\n const overriddenSegment =\n flightRouterState &&\n canSegmentBeOverridden(actualSegment, flightRouterState[0])\n ? flightRouterState[0]\n : actualSegment\n const routerState = parsedRequestHeaders.isRouteTreePrefetchRequest\n ? createRouteTreePrefetch(loaderTreeToFilter, getDynamicParamFromSegment)\n : createFlightRouterStateFromLoaderTree(\n loaderTreeToFilter,\n getDynamicParamFromSegment,\n query\n )\n return [\n [\n overriddenSegment,\n routerState,\n null,\n rscHead,\n false,\n ] satisfies FlightDataSegment,\n ]\n }\n\n if (renderComponentsOnThisLevel) {\n const overriddenSegment =\n flightRouterState &&\n // TODO: Why does canSegmentBeOverridden exist? Why don't we always just\n // use `actualSegment`? Is it to avoid overwriting some state that's\n // tracked by the client? Dig deeper to see if we can simplify this.\n canSegmentBeOverridden(actualSegment, flightRouterState[0])\n ? flightRouterState[0]\n : actualSegment\n\n const routerState = createFlightRouterStateFromLoaderTree(\n // Create router state using the slice of the loaderTree\n loaderTreeToFilter,\n getDynamicParamFromSegment,\n query\n )\n\n // Create component tree using the slice of the loaderTree\n const seedData = await createComponentTree(\n // This ensures flightRouterPath is valid and filters down the tree\n {\n ctx,\n loaderTree: loaderTreeToFilter,\n parentParams: currentParams,\n injectedCSS,\n injectedJS,\n injectedFontPreloadTags,\n // This is intentionally not \"rootLayoutIncludedAtThisLevelOrAbove\" as createComponentTree starts at the current level and does a check for \"rootLayoutAtThisLevel\" too.\n rootLayoutIncluded,\n preloadCallbacks,\n authInterrupts: experimental.authInterrupts,\n MetadataOutlet,\n }\n )\n\n return [\n [\n overriddenSegment,\n routerState,\n seedData,\n rscHead,\n false,\n ] satisfies FlightDataSegment,\n ]\n }\n\n // If we are not rendering on this level we need to check if the current\n // segment has a layout. If so, we need to track all the used CSS to make\n // the result consistent.\n const layoutPath = layout?.[1]\n const injectedCSSWithCurrentLayout = new Set(injectedCSS)\n const injectedJSWithCurrentLayout = new Set(injectedJS)\n const injectedFontPreloadTagsWithCurrentLayout = new Set(\n injectedFontPreloadTags\n )\n if (layoutPath) {\n getLinkAndScriptTags(\n ctx.clientReferenceManifest,\n layoutPath,\n injectedCSSWithCurrentLayout,\n injectedJSWithCurrentLayout,\n true\n )\n getPreloadableFonts(\n nextFontManifest,\n layoutPath,\n injectedFontPreloadTagsWithCurrentLayout\n )\n }\n\n const paths: FlightDataPath[] = []\n\n // Walk through all parallel routes.\n for (const parallelRouteKey of parallelRoutesKeys) {\n const parallelRoute = parallelRoutes[parallelRouteKey]\n\n const subPaths = await walkTreeWithFlightRouterState({\n ctx,\n loaderTreeToFilter: parallelRoute,\n parentParams: currentParams,\n flightRouterState:\n flightRouterState && flightRouterState[1][parallelRouteKey],\n parentIsInsideSharedLayout: isInsideSharedLayout,\n rscHead,\n injectedCSS: injectedCSSWithCurrentLayout,\n injectedJS: injectedJSWithCurrentLayout,\n injectedFontPreloadTags: injectedFontPreloadTagsWithCurrentLayout,\n rootLayoutIncluded: rootLayoutIncludedAtThisLevelOrAbove,\n preloadCallbacks,\n MetadataOutlet,\n })\n\n for (const subPath of subPaths) {\n paths.push([actualSegment, parallelRouteKey, ...subPath])\n }\n }\n\n return paths\n}\n\n/*\n * This function is used to determine if an existing segment can be overridden\n * by the incoming segment.\n */\nconst canSegmentBeOverridden = (\n existingSegment: Segment,\n segment: Segment\n): boolean => {\n if (Array.isArray(existingSegment) || !Array.isArray(segment)) {\n return false\n }\n\n return getSegmentParam(existingSegment)?.param === segment[0]\n}\n"],"names":["matchSegment","getLinkAndScriptTags","getPreloadableFonts","createFlightRouterStateFromLoaderTree","createRouteTreePrefetch","hasLoadingComponentInTree","addSearchParamsIfPageSegment","createComponentTree","getSegmentParam","walkTreeWithFlightRouterState","loaderTreeToFilter","parentParams","flightRouterState","parentIsInsideSharedLayout","rscHead","injectedCSS","injectedJS","injectedFontPreloadTags","rootLayoutIncluded","ctx","preloadCallbacks","MetadataOutlet","renderOpts","nextFontManifest","experimental","query","isPrefetch","getDynamicParamFromSegment","parsedRequestHeaders","segment","parallelRoutes","modules","parallelRoutesKeys","Object","keys","layout","isLayout","rootLayoutAtThisLevel","rootLayoutIncludedAtThisLevelOrAbove","segmentParam","currentParams","value","param","actualSegment","treeSegment","renderComponentsOnThisLevel","length","isInsideSharedLayout","isRoutePPREnabled","isRouteTreePrefetchRequest","Boolean","loading","overriddenSegment","canSegmentBeOverridden","routerState","seedData","loaderTree","authInterrupts","layoutPath","injectedCSSWithCurrentLayout","Set","injectedJSWithCurrentLayout","injectedFontPreloadTagsWithCurrentLayout","clientReferenceManifest","paths","parallelRouteKey","parallelRoute","subPaths","subPath","push","existingSegment","Array","isArray"],"mappings":"AAQA,SAASA,YAAY,QAAQ,yCAAwC;AAErE,SAASC,oBAAoB,QAAQ,8BAA6B;AAClE,SAASC,mBAAmB,QAAQ,0BAAyB;AAC7D,SACEC,qCAAqC,EACrCC,uBAAuB,QAClB,gDAA+C;AAEtD,SAASC,yBAAyB,QAAQ,kCAAiC;AAC3E,SAASC,4BAA4B,QAAQ,2BAA0B;AACvE,SAASC,mBAAmB,QAAQ,0BAAyB;AAC7D,SAASC,eAAe,QAAQ,kDAAiD;AAEjF;;;CAGC,GACD,OAAO,eAAeC,8BAA8B,EAClDC,kBAAkB,EAClBC,YAAY,EACZC,iBAAiB,EACjBC,0BAA0B,EAC1BC,OAAO,EACPC,WAAW,EACXC,UAAU,EACVC,uBAAuB,EACvBC,kBAAkB,EAClBC,GAAG,EACHC,gBAAgB,EAChBC,cAAc,EAcf;IACC,MAAM,EACJC,YAAY,EAAEC,gBAAgB,EAAEC,YAAY,EAAE,EAC9CC,KAAK,EACLC,UAAU,EACVC,0BAA0B,EAC1BC,oBAAoB,EACrB,GAAGT;IAEJ,MAAM,CAACU,SAASC,gBAAgBC,QAAQ,GAAGrB;IAE3C,MAAMsB,qBAAqBC,OAAOC,IAAI,CAACJ;IAEvC,MAAM,EAAEK,MAAM,EAAE,GAAGJ;IACnB,MAAMK,WAAW,OAAOD,WAAW;IAEnC;;GAEC,GACD,MAAME,wBAAwBD,YAAY,CAAClB;IAC3C;;GAEC,GACD,MAAMoB,uCACJpB,sBAAsBmB;IAExB,8JAA8J;IAC9J,M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