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
9.4 KiB
Text
1 line
No EOL
9.4 KiB
Text
{"version":3,"sources":["../../../src/server/request/root-params.ts"],"sourcesContent":["import { InvariantError } from '../../shared/lib/invariant-error'\nimport {\n postponeWithTracking,\n throwToInterruptStaticGeneration,\n} from '../app-render/dynamic-rendering'\nimport {\n workAsyncStorage,\n type WorkStore,\n} from '../app-render/work-async-storage.external'\nimport {\n workUnitAsyncStorage,\n type PrerenderStoreLegacy,\n type PrerenderStorePPR,\n type StaticPrerenderStore,\n} from '../app-render/work-unit-async-storage.external'\nimport { makeHangingPromise } from '../dynamic-rendering-utils'\nimport type { ParamValue } from './params'\nimport { describeStringPropertyAccess } from '../../shared/lib/utils/reflect-utils'\nimport { actionAsyncStorage } from '../app-render/action-async-storage.external'\n\n/**\n * Used for the compiler-generated `next/root-params` module.\n * @internal\n */\nexport function getRootParam(paramName: string): Promise<ParamValue> {\n const apiName = `\\`import('next/root-params').${paramName}()\\``\n\n const workStore = workAsyncStorage.getStore()\n if (!workStore) {\n throw new InvariantError(`Missing workStore in ${apiName}`)\n }\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n if (!workUnitStore) {\n throw new Error(\n `Route ${workStore.route} used ${apiName} outside of a Server Component. This is not allowed.`\n )\n }\n\n const actionStore = actionAsyncStorage.getStore()\n if (actionStore) {\n if (actionStore.isAppRoute) {\n // TODO(root-params): add support for route handlers\n throw new Error(\n `Route ${workStore.route} used ${apiName} inside a Route Handler. Support for this API in Route Handlers is planned for a future version of Next.js.`\n )\n }\n if (actionStore.isAction && workUnitStore.phase === 'action') {\n // Actions are not fundamentally tied to a route (even if they're always submitted from some page),\n // so root params would be inconsistent if an action is called from multiple roots.\n // Make sure we check if the phase is \"action\" - we should not error in the rerender\n // after an action revalidates or updates cookies (which will still have `actionStore.isAction === true`)\n throw new Error(\n `${apiName} was used inside a Server Action. This is not supported. Functions from 'next/root-params' can only be called in the context of a route.`\n )\n }\n }\n\n switch (workUnitStore.type) {\n case 'unstable-cache':\n case 'cache': {\n throw new Error(\n `Route ${workStore.route} used ${apiName} inside \\`\"use cache\"\\` or \\`unstable_cache\\`. Support for this API inside cache scopes is planned for a future version of Next.js.`\n )\n }\n case 'prerender':\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy': {\n return createPrerenderRootParamPromise(\n paramName,\n workStore,\n workUnitStore,\n apiName\n )\n }\n case 'private-cache':\n case 'prerender-runtime':\n case 'request': {\n break\n }\n default: {\n workUnitStore satisfies never\n }\n }\n return Promise.resolve(workUnitStore.rootParams[paramName])\n}\n\nfunction createPrerenderRootParamPromise(\n paramName: string,\n workStore: WorkStore,\n prerenderStore: StaticPrerenderStore,\n apiName: string\n): Promise<ParamValue> {\n switch (prerenderStore.type) {\n case 'prerender-client': {\n throw new InvariantError(\n `${apiName} must not be used within a client component. Next.js should be preventing ${apiName} from being included in client components statically, but did not in this case.`\n )\n }\n case 'prerender':\n case 'prerender-legacy':\n case 'prerender-ppr':\n default:\n }\n\n const underlyingParams = prerenderStore.rootParams\n\n switch (prerenderStore.type) {\n case 'prerender': {\n // We are in a cacheComponents prerender.\n // The param is a fallback, so it should be treated as dynamic.\n if (\n prerenderStore.fallbackRouteParams &&\n prerenderStore.fallbackRouteParams.has(paramName)\n ) {\n return makeHangingPromise<ParamValue>(\n prerenderStore.renderSignal,\n workStore.route,\n apiName\n )\n }\n break\n }\n case 'prerender-ppr': {\n // We aren't in a cacheComponents prerender, but the param is a fallback,\n // so we need to make an erroring params object which will postpone/error if you access it\n if (\n prerenderStore.fallbackRouteParams &&\n prerenderStore.fallbackRouteParams.has(paramName)\n ) {\n return makeErroringRootParamPromise(\n paramName,\n workStore,\n prerenderStore,\n apiName\n )\n }\n break\n }\n case 'prerender-legacy': {\n // legacy prerenders can't have fallback params\n break\n }\n default: {\n prerenderStore satisfies never\n }\n }\n\n // If the param is not a fallback param, we just return the statically available value.\n return Promise.resolve(underlyingParams[paramName])\n}\n\n/** Deliberately async -- we want to create a rejected promise, not error synchronously. */\nasync function makeErroringRootParamPromise(\n paramName: string,\n workStore: WorkStore,\n prerenderStore: PrerenderStorePPR | PrerenderStoreLegacy,\n apiName: string\n): Promise<ParamValue> {\n const expression = describeStringPropertyAccess(apiName, paramName)\n // In most dynamic APIs, we also throw if `dynamic = \"error\"`.\n // However, root params are only dynamic when we're generating a fallback shell,\n // and even with `dynamic = \"error\"` we still support generating dynamic fallback shells.\n // TODO: remove this comment when cacheComponents is the default since there will be no `dynamic = \"error\"`\n switch (prerenderStore.type) {\n case 'prerender-ppr': {\n return postponeWithTracking(\n workStore.route,\n expression,\n prerenderStore.dynamicTracking\n )\n }\n case 'prerender-legacy': {\n return throwToInterruptStaticGeneration(\n expression,\n workStore,\n prerenderStore\n )\n }\n default: {\n prerenderStore satisfies never\n }\n }\n}\n"],"names":["InvariantError","postponeWithTracking","throwToInterruptStaticGeneration","workAsyncStorage","workUnitAsyncStorage","makeHangingPromise","describeStringPropertyAccess","actionAsyncStorage","getRootParam","paramName","apiName","workStore","getStore","workUnitStore","Error","route","actionStore","isAppRoute","isAction","phase","type","createPrerenderRootParamPromise","Promise","resolve","rootParams","prerenderStore","underlyingParams","fallbackRouteParams","has","renderSignal","makeErroringRootParamPromise","expression","dynamicTracking"],"mappings":"AAAA,SAASA,cAAc,QAAQ,mCAAkC;AACjE,SACEC,oBAAoB,EACpBC,gCAAgC,QAC3B,kCAAiC;AACxC,SACEC,gBAAgB,QAEX,4CAA2C;AAClD,SACEC,oBAAoB,QAIf,iDAAgD;AACvD,SAASC,kBAAkB,QAAQ,6BAA4B;AAE/D,SAASC,4BAA4B,QAAQ,uCAAsC;AACnF,SAASC,kBAAkB,QAAQ,8CAA6C;AAEhF;;;CAGC,GACD,OAAO,SAASC,aAAaC,SAAiB;IAC5C,MAAMC,UAAU,CAAC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