Rocky_Mountain_Vending/.pnpm-store/v10/files/5c/bb60ab85255df40d5fbd51679defde8cbbe578bbf1ae0b116e3e57cf7a990d2009da0cad74850c233ea536c2cda8ca576372b3561c378664dc799b71221757
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
97 KiB
Text

{"version":3,"sources":["../../../src/server/use-cache/use-cache-wrapper.ts"],"sourcesContent":["import type { DeepReadonly } from '../../shared/lib/deep-readonly'\n/* eslint-disable import/no-extraneous-dependencies */\nimport {\n renderToReadableStream,\n decodeReply,\n decodeReplyFromAsyncIterable,\n createTemporaryReferenceSet as createServerTemporaryReferenceSet,\n} from 'react-server-dom-webpack/server'\nimport {\n createFromReadableStream,\n encodeReply,\n createTemporaryReferenceSet as createClientTemporaryReferenceSet,\n} from 'react-server-dom-webpack/client'\nimport { prerender } from 'react-server-dom-webpack/static'\n/* eslint-enable import/no-extraneous-dependencies */\n\nimport type { WorkStore } from '../app-render/work-async-storage.external'\nimport { workAsyncStorage } from '../app-render/work-async-storage.external'\nimport type {\n PrerenderStoreModernClient,\n PrerenderStoreModernRuntime,\n PrivateUseCacheStore,\n RequestStore,\n RevalidateStore,\n UseCacheStore,\n WorkUnitStore,\n} from '../app-render/work-unit-async-storage.external'\nimport {\n getHmrRefreshHash,\n getRenderResumeDataCache,\n getPrerenderResumeDataCache,\n workUnitAsyncStorage,\n getDraftModeProviderForCacheScope,\n getCacheSignal,\n isHmrRefresh,\n getServerComponentsHmrCache,\n getRuntimeStagePromise,\n} from '../app-render/work-unit-async-storage.external'\n\nimport {\n makeDevtoolsIOAwarePromise,\n makeHangingPromise,\n} from '../dynamic-rendering-utils'\n\nimport type { ClientReferenceManifestForRsc } from '../../build/webpack/plugins/flight-manifest-plugin'\n\nimport {\n getClientReferenceManifestForRsc,\n getServerModuleMap,\n} from '../app-render/encryption-utils'\nimport type { CacheEntry } from '../lib/cache-handlers/types'\nimport type { CacheSignal } from '../app-render/cache-signal'\nimport { decryptActionBoundArgs } from '../app-render/encryption'\nimport { InvariantError } from '../../shared/lib/invariant-error'\nimport { getDigestForWellKnownError } from '../app-render/create-error-handler'\nimport { DYNAMIC_EXPIRE, RUNTIME_PREFETCH_DYNAMIC_STALE } from './constants'\nimport { getCacheHandler } from './handlers'\nimport { UseCacheTimeoutError } from './use-cache-errors'\nimport {\n createHangingInputAbortSignal,\n postponeWithTracking,\n throwToInterruptStaticGeneration,\n} from '../app-render/dynamic-rendering'\nimport {\n makeErroringSearchParamsForUseCache,\n type SearchParams,\n} from '../request/search-params'\nimport type { Params } from '../request/params'\nimport React from 'react'\nimport { createLazyResult, isResolvedLazyResult } from '../lib/lazy-result'\nimport { dynamicAccessAsyncStorage } from '../app-render/dynamic-access-async-storage.external'\nimport { isReactLargeShellError } from '../app-render/react-large-shell-error'\nimport type { CacheLife } from './cache-life'\nimport { RenderStage } from '../app-render/staged-rendering'\n\ninterface PrivateCacheContext {\n readonly kind: 'private'\n readonly outerWorkUnitStore:\n | RequestStore\n | PrivateUseCacheStore\n | PrerenderStoreModernRuntime\n}\n\ninterface PublicCacheContext {\n readonly kind: 'public'\n // TODO: We should probably forbid nesting \"use cache\" inside unstable_cache.\n readonly outerWorkUnitStore:\n | Exclude<WorkUnitStore, PrerenderStoreModernClient>\n | undefined\n}\n\ntype CacheContext = PrivateCacheContext | PublicCacheContext\n\ntype CacheKeyParts =\n | [buildId: string, id: string, args: unknown[]]\n | [buildId: string, id: string, args: unknown[], hmrRefreshHash: string]\n\ninterface UseCachePageInnerProps {\n params: Promise<Params>\n searchParams?: Promise<SearchParams>\n}\n\nexport interface UseCachePageProps {\n params: Promise<Params>\n searchParams: Promise<SearchParams>\n $$isPage: true\n}\n\nexport type UseCacheLayoutProps = {\n params: Promise<Params>\n $$isLayout: true\n} & {\n // The value type should be React.ReactNode. But such an index signature would\n // be incompatible with the other two props.\n [slot: string]: any\n}\n\nconst isEdgeRuntime = process.env.NEXT_RUNTIME === 'edge'\n\nconst debug = process.env.NEXT_PRIVATE_DEBUG_CACHE\n ? console.debug.bind(console, 'use-cache:')\n : undefined\n\nconst filterStackFrame =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .filterStackFrameDEV\n : undefined\nconst findSourceMapURL =\n process.env.NODE_ENV !== 'production'\n ? (require('../lib/source-maps') as typeof import('../lib/source-maps'))\n .findSourceMapURLDEV\n : undefined\n\nfunction generateCacheEntry(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly<ClientReferenceManifestForRsc>,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise<unknown>,\n sharedErrorStack: string | undefined\n) {\n // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache\n // generation cannot read anything from the context we're currently executing which\n // might include request specific things like cookies() inside a React.cache().\n // Note: It is important that we await at least once before this because it lets us\n // pop out of any stack specific contexts as well - aka \"Sync\" Local Storage.\n return workStore.runInCleanSnapshot(\n generateCacheEntryWithRestoredWorkStore,\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedArguments,\n fn,\n sharedErrorStack\n )\n}\n\nfunction generateCacheEntryWithRestoredWorkStore(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly<ClientReferenceManifestForRsc>,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise<unknown>,\n sharedErrorStack: string | undefined\n) {\n // Since we cleared the AsyncLocalStorage we need to restore the workStore.\n // Note: We explicitly don't restore the RequestStore nor the PrerenderStore.\n // We don't want any request specific information leaking an we don't want to create a\n // bloated fake request mock for every cache call. So any feature that currently lives\n // in RequestStore but should be available to Caches need to move to WorkStore.\n // PrerenderStore is not needed inside the cache scope because the outer most one will\n // be the one to report its result to the outer Prerender.\n return workAsyncStorage.run(\n workStore,\n generateCacheEntryWithCacheContext,\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedArguments,\n fn,\n sharedErrorStack\n )\n}\n\nfunction createUseCacheStore(\n workStore: WorkStore,\n cacheContext: CacheContext,\n defaultCacheLife: Required<CacheLife>\n): UseCacheStore {\n if (cacheContext.kind === 'private') {\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n return {\n type: 'private-cache',\n phase: 'render',\n implicitTags: outerWorkUnitStore?.implicitTags,\n revalidate: defaultCacheLife.revalidate,\n expire: defaultCacheLife.expire,\n stale: defaultCacheLife.stale,\n explicitRevalidate: undefined,\n explicitExpire: undefined,\n explicitStale: undefined,\n tags: null,\n hmrRefreshHash: getHmrRefreshHash(workStore, outerWorkUnitStore),\n isHmrRefresh: isHmrRefresh(workStore, outerWorkUnitStore),\n serverComponentsHmrCache: getServerComponentsHmrCache(\n workStore,\n outerWorkUnitStore\n ),\n forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),\n runtimeStagePromise: getRuntimeStagePromise(outerWorkUnitStore),\n draftMode: getDraftModeProviderForCacheScope(\n workStore,\n outerWorkUnitStore\n ),\n rootParams: outerWorkUnitStore.rootParams,\n headers: outerWorkUnitStore.headers,\n cookies: outerWorkUnitStore.cookies,\n }\n } else {\n let useCacheOrRequestStore: RequestStore | UseCacheStore | undefined\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n if (outerWorkUnitStore) {\n switch (outerWorkUnitStore?.type) {\n case 'cache':\n case 'private-cache':\n case 'request':\n useCacheOrRequestStore = outerWorkUnitStore\n break\n case 'prerender-runtime':\n case 'prerender':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n break\n default:\n outerWorkUnitStore satisfies never\n }\n }\n\n return {\n type: 'cache',\n phase: 'render',\n implicitTags: outerWorkUnitStore?.implicitTags,\n revalidate: defaultCacheLife.revalidate,\n expire: defaultCacheLife.expire,\n stale: defaultCacheLife.stale,\n explicitRevalidate: undefined,\n explicitExpire: undefined,\n explicitStale: undefined,\n tags: null,\n hmrRefreshHash:\n outerWorkUnitStore && getHmrRefreshHash(workStore, outerWorkUnitStore),\n isHmrRefresh: useCacheOrRequestStore?.isHmrRefresh ?? false,\n serverComponentsHmrCache:\n useCacheOrRequestStore?.serverComponentsHmrCache,\n forceRevalidate: shouldForceRevalidate(workStore, outerWorkUnitStore),\n draftMode:\n outerWorkUnitStore &&\n getDraftModeProviderForCacheScope(workStore, outerWorkUnitStore),\n }\n }\n}\n\nfunction assertDefaultCacheLife(\n defaultCacheLife: CacheLife | undefined\n): asserts defaultCacheLife is Required<CacheLife> {\n if (\n !defaultCacheLife ||\n defaultCacheLife.revalidate == null ||\n defaultCacheLife.expire == null ||\n defaultCacheLife.stale == null\n ) {\n throw new InvariantError(\n 'A default cacheLife profile must always be provided.'\n )\n }\n}\n\nfunction generateCacheEntryWithCacheContext(\n workStore: WorkStore,\n cacheContext: CacheContext,\n clientReferenceManifest: DeepReadonly<ClientReferenceManifestForRsc>,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise<unknown>,\n sharedErrorStack: string | undefined\n) {\n if (!workStore.cacheLifeProfiles) {\n throw new InvariantError('cacheLifeProfiles should always be provided.')\n }\n const defaultCacheLife = workStore.cacheLifeProfiles['default']\n assertDefaultCacheLife(defaultCacheLife)\n\n // Initialize the Store for this Cache entry.\n const cacheStore = createUseCacheStore(\n workStore,\n cacheContext,\n defaultCacheLife\n )\n\n return workUnitAsyncStorage.run(cacheStore, () =>\n dynamicAccessAsyncStorage.run(\n { abortController: new AbortController() },\n generateCacheEntryImpl,\n workStore,\n cacheContext,\n cacheStore,\n clientReferenceManifest,\n encodedArguments,\n fn,\n sharedErrorStack\n )\n )\n}\n\nfunction propagateCacheLifeAndTagsToRevalidateStore(\n revalidateStore: RevalidateStore,\n entry: CacheEntry\n): void {\n const outerTags = (revalidateStore.tags ??= [])\n\n for (const tag of entry.tags) {\n if (!outerTags.includes(tag)) {\n outerTags.push(tag)\n }\n }\n\n if (revalidateStore.stale > entry.stale) {\n revalidateStore.stale = entry.stale\n }\n\n if (revalidateStore.revalidate > entry.revalidate) {\n revalidateStore.revalidate = entry.revalidate\n }\n\n if (revalidateStore.expire > entry.expire) {\n revalidateStore.expire = entry.expire\n }\n}\n\nfunction propagateCacheLifeAndTags(\n cacheContext: CacheContext,\n entry: CacheEntry\n): void {\n if (cacheContext.kind === 'private') {\n switch (cacheContext.outerWorkUnitStore.type) {\n case 'prerender-runtime':\n case 'private-cache':\n propagateCacheLifeAndTagsToRevalidateStore(\n cacheContext.outerWorkUnitStore,\n entry\n )\n break\n case 'request':\n case undefined:\n break\n default:\n cacheContext.outerWorkUnitStore satisfies never\n }\n } else {\n switch (cacheContext.outerWorkUnitStore?.type) {\n case 'cache':\n case 'private-cache':\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n propagateCacheLifeAndTagsToRevalidateStore(\n cacheContext.outerWorkUnitStore,\n entry\n )\n break\n case 'request':\n case 'unstable-cache':\n case undefined:\n break\n default:\n cacheContext.outerWorkUnitStore satisfies never\n }\n }\n}\n\nasync function collectResult(\n savedStream: ReadableStream<Uint8Array>,\n workStore: WorkStore,\n cacheContext: CacheContext,\n innerCacheStore: UseCacheStore,\n startTime: number,\n errors: Array<unknown> // This is a live array that gets pushed into.\n): Promise<CacheEntry> {\n // We create a buffered stream that collects all chunks until the end to\n // ensure that RSC has finished rendering and therefore we have collected\n // all tags. In the future the RSC API might allow for the equivalent of\n // the allReady Promise that exists on SSR streams.\n //\n // If something errored or rejected anywhere in the render, we close\n // the stream as errored. This lets a CacheHandler choose to save the\n // partial result up until that point for future hits for a while to avoid\n // unnecessary retries or not to retry. We use the end of the stream for\n // this to avoid another complicated side-channel. A receiver has to consider\n // that the stream might also error for other reasons anyway such as losing\n // connection.\n\n const buffer: Uint8Array[] = []\n const reader = savedStream.getReader()\n\n try {\n for (let entry; !(entry = await reader.read()).done; ) {\n buffer.push(entry.value)\n }\n } catch (error) {\n errors.push(error)\n }\n\n let idx = 0\n const bufferStream = new ReadableStream<Uint8Array>({\n pull(controller) {\n if (workStore.invalidDynamicUsageError) {\n controller.error(workStore.invalidDynamicUsageError)\n } else if (idx < buffer.length) {\n controller.enqueue(buffer[idx++])\n } else if (errors.length > 0) {\n // TODO: Should we use AggregateError here?\n controller.error(errors[0])\n } else {\n controller.close()\n }\n },\n })\n\n const collectedTags = innerCacheStore.tags\n // If cacheLife() was used to set an explicit revalidate time we use that.\n // Otherwise, we use the lowest of all inner fetch()/unstable_cache() or nested \"use cache\".\n // If they're lower than our default.\n const collectedRevalidate =\n innerCacheStore.explicitRevalidate !== undefined\n ? innerCacheStore.explicitRevalidate\n : innerCacheStore.revalidate\n const collectedExpire =\n innerCacheStore.explicitExpire !== undefined\n ? innerCacheStore.explicitExpire\n : innerCacheStore.expire\n const collectedStale =\n innerCacheStore.explicitStale !== undefined\n ? innerCacheStore.explicitStale\n : innerCacheStore.stale\n\n const entry: CacheEntry = {\n value: bufferStream,\n timestamp: startTime,\n revalidate: collectedRevalidate,\n expire: collectedExpire,\n stale: collectedStale,\n tags: collectedTags === null ? [] : collectedTags,\n }\n\n if (cacheContext.outerWorkUnitStore) {\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n // Propagate cache life & tags to the parent context if appropriate.\n switch (outerWorkUnitStore.type) {\n case 'prerender':\n case 'prerender-runtime': {\n // If we've just created a cache result, and we're filling caches for a\n // Cache Components prerender, then we don't want to propagate cache\n // life & tags yet, in case the entry ends up being omitted from the\n // final prerender due to short expire/stale times. If it is omitted,\n // then it shouldn't have any effects on the prerender. We'll decide\n // whether or not this cache should have its life & tags propagated when\n // we read the entry in the final prerender from the resume data cache.\n\n break\n }\n case 'request': {\n if (\n process.env.NODE_ENV === 'development' &&\n outerWorkUnitStore.cacheSignal\n ) {\n // If we're filling caches for a dev request, apply the same logic as prerenders do above,\n // and don't propagate cache life/tags yet.\n break\n }\n // fallthrough\n }\n\n case 'private-cache':\n case 'cache':\n case 'unstable-cache':\n case 'prerender-legacy':\n case 'prerender-ppr': {\n propagateCacheLifeAndTags(cacheContext, entry)\n break\n }\n default: {\n outerWorkUnitStore satisfies never\n }\n }\n\n const cacheSignal = getCacheSignal(outerWorkUnitStore)\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n }\n\n return entry\n}\n\ntype GenerateCacheEntryResult =\n | {\n readonly type: 'cached'\n readonly stream: ReadableStream\n readonly pendingCacheEntry: Promise<CacheEntry>\n }\n | {\n readonly type: 'prerender-dynamic'\n readonly hangingPromise: Promise<never>\n }\n\nasync function generateCacheEntryImpl(\n workStore: WorkStore,\n cacheContext: CacheContext,\n innerCacheStore: UseCacheStore,\n clientReferenceManifest: DeepReadonly<ClientReferenceManifestForRsc>,\n encodedArguments: FormData | string,\n fn: (...args: unknown[]) => Promise<unknown>,\n sharedErrorStack: string | undefined\n): Promise<GenerateCacheEntryResult> {\n const temporaryReferences = createServerTemporaryReferenceSet()\n const outerWorkUnitStore = cacheContext.outerWorkUnitStore\n\n const [, , args] =\n typeof encodedArguments === 'string'\n ? await decodeReply<CacheKeyParts>(\n encodedArguments,\n getServerModuleMap(),\n { temporaryReferences }\n )\n : await decodeReplyFromAsyncIterable<CacheKeyParts>(\n {\n async *[Symbol.asyncIterator]() {\n for (const entry of encodedArguments) {\n yield entry\n }\n\n if (outerWorkUnitStore) {\n switch (outerWorkUnitStore.type) {\n case 'prerender-runtime':\n case 'prerender':\n // The encoded arguments might contain hanging promises. In\n // this case we don't want to reject with \"Error: Connection\n // closed.\", so we intentionally keep the iterable alive.\n // This is similar to the halting trick that we do while\n // rendering.\n await new Promise<void>((resolve) => {\n if (outerWorkUnitStore.renderSignal.aborted) {\n resolve()\n } else {\n outerWorkUnitStore.renderSignal.addEventListener(\n 'abort',\n () => resolve(),\n { once: true }\n )\n }\n })\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n outerWorkUnitStore satisfies never\n }\n }\n },\n },\n getServerModuleMap(),\n { temporaryReferences }\n )\n\n // Track the timestamp when we started computing the result.\n const startTime = performance.timeOrigin + performance.now()\n\n // Invoke the inner function to load a new result. We delay the invocation\n // though, until React awaits the promise so that React's request store (ALS)\n // is available when the function is invoked. This allows us, for example, to\n // capture logs so that we can later replay them.\n const resultPromise = createLazyResult(() => fn.apply(null, args))\n\n let errors: Array<unknown> = []\n\n // In the \"Cache\" environment, we only need to make sure that the error\n // digests are handled correctly. Error formatting and reporting is not\n // necessary here; the errors are encoded in the stream, and will be reported\n // in the \"Server\" environment.\n const handleError = (error: unknown): string | undefined => {\n const digest = getDigestForWellKnownError(error)\n\n if (digest) {\n return digest\n }\n\n if (isReactLargeShellError(error)) {\n // TODO: Aggregate\n console.error(error)\n return undefined\n }\n\n if (process.env.NODE_ENV !== 'development') {\n // TODO: For now we're also reporting the error here, because in\n // production, the \"Server\" environment will only get the obfuscated\n // error (created by the Flight Client in the cache wrapper).\n console.error(error)\n }\n\n errors.push(error)\n }\n\n let stream: ReadableStream<Uint8Array>\n\n switch (outerWorkUnitStore?.type) {\n case 'prerender-runtime':\n case 'prerender':\n const timeoutAbortController = new AbortController()\n\n // If we're prerendering, we give you 50 seconds to fill a cache entry.\n // Otherwise we assume you stalled on hanging input and de-opt. This needs\n // to be lower than just the general timeout of 60 seconds.\n const timer = setTimeout(() => {\n const error = new UseCacheTimeoutError()\n if (sharedErrorStack) {\n error.stack = error.name + ': ' + error.message + sharedErrorStack\n }\n workStore.invalidDynamicUsageError = error\n timeoutAbortController.abort(error)\n }, 50000)\n\n const dynamicAccessAbortSignal =\n dynamicAccessAsyncStorage.getStore()?.abortController.signal\n\n const abortSignal = dynamicAccessAbortSignal\n ? AbortSignal.any([\n dynamicAccessAbortSignal,\n outerWorkUnitStore.renderSignal,\n timeoutAbortController.signal,\n ])\n : timeoutAbortController.signal\n\n const { prelude } = await prerender(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n signal: abortSignal,\n temporaryReferences,\n onError(error) {\n if (abortSignal.aborted && abortSignal.reason === error) {\n return undefined\n }\n\n return handleError(error)\n },\n }\n )\n\n clearTimeout(timer)\n\n if (timeoutAbortController.signal.aborted) {\n // When the timeout is reached we always error the stream. Even for\n // fallback shell prerenders we don't want to return a hanging promise,\n // which would allow the function to become a dynamic hole. Because that\n // would mean that a non-empty shell could be generated which would be\n // subject to revalidation, and we don't want to create long\n // revalidation times.\n stream = new ReadableStream({\n start(controller) {\n controller.error(timeoutAbortController.signal.reason)\n },\n })\n } else if (dynamicAccessAbortSignal?.aborted) {\n // If the prerender is aborted because of dynamic access (e.g. reading\n // fallback params), we return a hanging promise. This essentially makes\n // the \"use cache\" function dynamic.\n const hangingPromise = makeHangingPromise<never>(\n outerWorkUnitStore.renderSignal,\n workStore.route,\n abortSignal.reason\n )\n\n if (outerWorkUnitStore.cacheSignal) {\n outerWorkUnitStore.cacheSignal.endRead()\n }\n\n return { type: 'prerender-dynamic', hangingPromise }\n } else {\n stream = prelude\n }\n break\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case undefined:\n stream = renderToReadableStream(\n resultPromise,\n clientReferenceManifest.clientModules,\n {\n environmentName: 'Cache',\n filterStackFrame,\n temporaryReferences,\n onError: handleError,\n }\n )\n break\n default:\n return outerWorkUnitStore satisfies never\n }\n\n const [returnStream, savedStream] = stream.tee()\n\n const pendingCacheEntry = collectResult(\n savedStream,\n workStore,\n cacheContext,\n innerCacheStore,\n startTime,\n errors\n )\n\n if (process.env.NODE_ENV === 'development') {\n // Name the stream for React DevTools.\n // @ts-expect-error\n returnStream.name = 'use cache'\n }\n\n return {\n type: 'cached',\n // Return the stream as we're creating it. This means that if it ends up\n // erroring we cannot return a stale-if-error version but it allows\n // streaming back the result earlier.\n stream: returnStream,\n pendingCacheEntry,\n }\n}\n\nfunction cloneCacheEntry(entry: CacheEntry): [CacheEntry, CacheEntry] {\n const [streamA, streamB] = entry.value.tee()\n entry.value = streamA\n const clonedEntry: CacheEntry = {\n value: streamB,\n timestamp: entry.timestamp,\n revalidate: entry.revalidate,\n expire: entry.expire,\n stale: entry.stale,\n tags: entry.tags,\n }\n return [entry, clonedEntry]\n}\n\nasync function clonePendingCacheEntry(\n pendingCacheEntry: Promise<CacheEntry>\n): Promise<[CacheEntry, CacheEntry]> {\n const entry = await pendingCacheEntry\n return cloneCacheEntry(entry)\n}\n\nasync function getNthCacheEntry(\n split: Promise<[CacheEntry, CacheEntry]>,\n i: number\n): Promise<CacheEntry> {\n return (await split)[i]\n}\n\nasync function encodeFormData(formData: FormData): Promise<string> {\n let result = ''\n for (let [key, value] of formData) {\n // We don't need this key to be serializable but from a security perspective it should not be\n // possible to generate a string that looks the same from a different structure. To ensure this\n // we need a delimeter between fields but just using a delimeter is not enough since a string\n // might contain that delimeter. We use the length of each field as the delimeter to avoid\n // escaping the values.\n result += key.length.toString(16) + ':' + key\n let stringValue\n if (typeof value === 'string') {\n stringValue = value\n } else {\n // The FormData might contain binary data that is not valid UTF-8 so this cache\n // key may generate a UCS-2 string. Passing this to another service needs to be\n // aware that the key might not be compatible.\n const arrayBuffer = await value.arrayBuffer()\n if (arrayBuffer.byteLength % 2 === 0) {\n stringValue = String.fromCodePoint(...new Uint16Array(arrayBuffer))\n } else {\n stringValue =\n String.fromCodePoint(\n ...new Uint16Array(arrayBuffer, 0, (arrayBuffer.byteLength - 1) / 2)\n ) +\n String.fromCodePoint(\n new Uint8Array(arrayBuffer, arrayBuffer.byteLength - 1, 1)[0]\n )\n }\n }\n result += stringValue.length.toString(16) + ':' + stringValue\n }\n return result\n}\n\nfunction createTrackedReadableStream(\n stream: ReadableStream,\n cacheSignal: CacheSignal\n) {\n const reader = stream.getReader()\n return new ReadableStream({\n async pull(controller) {\n const { done, value } = await reader.read()\n if (done) {\n controller.close()\n cacheSignal.endRead()\n } else {\n controller.enqueue(value)\n }\n },\n })\n}\n\nfunction wrapAsInvalidDynamicUsageError(\n error: Error,\n sharedErrorStack: string | undefined,\n workStore: WorkStore\n) {\n if (sharedErrorStack) {\n error.stack = error.name + ': ' + error.message + sharedErrorStack\n }\n\n workStore.invalidDynamicUsageError ??= error\n\n return error\n}\n\nexport function cache(\n kind: string,\n id: string,\n boundArgsLength: number,\n originalFn: (...args: unknown[]) => Promise<unknown>\n) {\n const isPrivate = kind === 'private'\n\n // Private caches are currently only stored in the Resume Data Cache (RDC),\n // and not in cache handlers.\n const cacheHandler = isPrivate ? undefined : getCacheHandler(kind)\n\n if (!isPrivate && !cacheHandler) {\n throw new Error('Unknown cache handler: ' + kind)\n }\n\n // Capture a better error stack in this scope.\n const sharedError = new Error()\n Error.captureStackTrace(sharedError, cache)\n const sharedErrorStack = sharedError.stack?.slice(\n sharedError.stack.indexOf('\\n')\n )\n\n const name = originalFn.name\n const cachedFn = {\n [name]: async function (...args: any[]) {\n const workStore = workAsyncStorage.getStore()\n if (workStore === undefined) {\n throw new Error(\n '\"use cache\" cannot be used outside of App Router. Expected a WorkStore.'\n )\n }\n\n let fn = originalFn\n\n const workUnitStore = workUnitAsyncStorage.getStore()\n\n let cacheContext: CacheContext\n\n if (isPrivate) {\n const expression = '\"use cache: private\"'\n\n switch (workUnitStore?.type) {\n // \"use cache: private\" is dynamic in prerendering contexts.\n case 'prerender':\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n expression\n )\n case 'prerender-ppr':\n return postponeWithTracking(\n workStore.route,\n expression,\n workUnitStore.dynamicTracking\n )\n case 'prerender-legacy':\n return throwToInterruptStaticGeneration(\n expression,\n workStore,\n workUnitStore\n )\n case 'prerender-client':\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`\n )\n case 'unstable-cache': {\n throw wrapAsInvalidDynamicUsageError(\n new Error(\n // TODO: Add a link to an error documentation page when we have one.\n `${expression} must not be used within \\`unstable_cache()\\`.`\n ),\n sharedErrorStack,\n workStore\n )\n }\n case 'cache': {\n throw wrapAsInvalidDynamicUsageError(\n new Error(\n // TODO: Add a link to an error documentation page when we have one.\n `${expression} must not be used within \"use cache\". It can only be nested inside of another ${expression}.`\n ),\n sharedErrorStack,\n workStore\n )\n }\n case 'request':\n case 'prerender-runtime':\n case 'private-cache':\n cacheContext = {\n kind: 'private',\n outerWorkUnitStore: workUnitStore,\n }\n break\n case undefined:\n throw wrapAsInvalidDynamicUsageError(\n new Error(\n // TODO: Add a link to an error documentation page when we have one.\n `${expression} cannot be used outside of a request context.`\n ),\n sharedErrorStack,\n workStore\n )\n default:\n workUnitStore satisfies never\n // This is dead code, but without throwing an error here, TypeScript\n // will assume that cacheContext is used before being assigned.\n throw new InvariantError(`Unexpected work unit store.`)\n }\n } else {\n switch (workUnitStore?.type) {\n case 'prerender-client':\n const expression = '\"use cache\"'\n throw new InvariantError(\n `${expression} must not be used within a client component. Next.js should be preventing ${expression} from being allowed in client components statically, but did not in this case.`\n )\n case 'prerender':\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n // TODO: We should probably forbid nesting \"use cache\" inside\n // unstable_cache. (fallthrough)\n case 'unstable-cache':\n case undefined:\n cacheContext = {\n kind: 'public',\n outerWorkUnitStore: workUnitStore,\n }\n break\n default:\n workUnitStore satisfies never\n // This is dead code, but without throwing an error here, TypeScript\n // will assume that cacheContext is used before being assigned.\n throw new InvariantError(`Unexpected work unit store.`)\n }\n }\n\n // Get the clientReferenceManifest while we're still in the outer Context.\n // In case getClientReferenceManifestSingleton is implemented using AsyncLocalStorage.\n const clientReferenceManifest = getClientReferenceManifestForRsc()\n\n // Because the Action ID is not yet unique per implementation of that Action we can't\n // safely reuse the results across builds yet. In the meantime we add the buildId to the\n // arguments as a seed to ensure they're not reused. Remove this once Action IDs hash\n // the implementation.\n const buildId = workStore.buildId\n\n // In dev mode, when the HMR refresh hash is set, we include it in the\n // cache key. This ensures that cache entries are not reused when server\n // components have been edited. This is a very coarse approach. But it's\n // also only a temporary solution until Action IDs are unique per\n // implementation. Remove this once Action IDs hash the implementation.\n const hmrRefreshHash =\n workUnitStore && getHmrRefreshHash(workStore, workUnitStore)\n\n const hangingInputAbortSignal = workUnitStore\n ? createHangingInputAbortSignal(workUnitStore)\n : undefined\n\n if (cacheContext.kind === 'private') {\n const { outerWorkUnitStore } = cacheContext\n switch (outerWorkUnitStore.type) {\n case 'prerender-runtime': {\n // In a runtime prerender, we have to make sure that APIs that would hang during a static prerender\n // are resolved with a delay, in the runtime stage. Private caches are one of these.\n if (outerWorkUnitStore.runtimeStagePromise) {\n await outerWorkUnitStore.runtimeStagePromise\n }\n break\n }\n case 'request': {\n if (process.env.NODE_ENV === 'development') {\n // Similar to runtime prerenders, private caches should not resolve in the static stage\n // of a dev request, so we delay them.\n await makeDevtoolsIOAwarePromise(\n undefined,\n outerWorkUnitStore,\n RenderStage.Runtime\n )\n }\n break\n }\n case 'private-cache':\n break\n default: {\n outerWorkUnitStore satisfies never\n }\n }\n }\n\n let isPageOrLayoutSegmentFunction = false\n\n // For page and layout segment functions (i.e. the page/layout component,\n // or generateMetadata/generateViewport), the cache function is\n // overwritten, which allows us to apply special handling for params and\n // searchParams. For pages and layouts we're using the outer params prop,\n // and not the inner one that was serialized/deserialized. While it's not\n // generally true for \"use cache\" args, in the case of `params` the inner\n // and outer object are essentially equivalent, so this is safe to do\n // (including fallback params that are hanging promises). It allows us to\n // avoid waiting for the timeout, when prerendering a fallback shell of a\n // cached page or layout that awaits params.\n if (isPageSegmentFunction(args)) {\n isPageOrLayoutSegmentFunction = true\n\n const [\n { params: outerParams, searchParams: outerSearchParams },\n ...otherOuterArgs\n ] = args\n\n const props: UseCachePageInnerProps = {\n params: outerParams,\n // Omit searchParams and $$isPage.\n }\n\n if (isPrivate) {\n // Private caches allow accessing search params. We need to include\n // them in the serialized args and when generating the cache key.\n props.searchParams = outerSearchParams\n }\n\n args = [props, ...otherOuterArgs]\n\n fn = {\n [name]: async (\n {\n params: _innerParams,\n searchParams: innerSearchParams,\n }: UseCachePageInnerProps,\n ...otherInnerArgs: unknown[]\n ) =>\n originalFn.apply(null, [\n {\n params: outerParams,\n searchParams:\n innerSearchParams ??\n // For public caches, search params are omitted from the cache\n // key (and the serialized args) to avoid mismatches between\n // prerendering and resuming a cached page that does not\n // access search params. This is also the reason why we're not\n // using a hanging promise for search params. For cached pages\n // that do access them, which is an invalid dynamic usage, we\n // need to ensure that an error is shown.\n makeErroringSearchParamsForUseCache(workStore),\n },\n ...otherInnerArgs,\n ]),\n }[name] as (...args: unknown[]) => Promise<unknown>\n } else if (isLayoutSegmentFunction(args)) {\n isPageOrLayoutSegmentFunction = true\n\n const [\n { params: outerParams, $$isLayout, ...outerSlots },\n ...otherOuterArgs\n ] = args\n\n // Overwrite the props to omit $$isLayout. Note that slots are only\n // passed to the layout component (if any are defined), and not to\n // generateMetadata nor generateViewport. For those functions,\n // outerSlots/innerSlots is an empty object, which is fine because we're\n // just spreading it into the props.\n args = [{ params: outerParams, ...outerSlots }, ...otherOuterArgs]\n\n fn = {\n [name]: async (\n {\n params: _innerParams,\n ...innerSlots\n }: Omit<UseCacheLayoutProps, '$$isLayout'>,\n ...otherInnerArgs: unknown[]\n ) =>\n originalFn.apply(null, [\n { params: outerParams, ...innerSlots },\n ...otherInnerArgs,\n ]),\n }[name] as (...args: unknown[]) => Promise<unknown>\n }\n\n if (boundArgsLength > 0) {\n if (args.length === 0) {\n throw new InvariantError(\n `Expected the \"use cache\" function ${JSON.stringify(fn.name)} to receive its encrypted bound arguments as the first argument.`\n )\n }\n\n const encryptedBoundArgs = args.shift()\n const boundArgs = await decryptActionBoundArgs(id, encryptedBoundArgs)\n\n if (!Array.isArray(boundArgs)) {\n throw new InvariantError(\n `Expected the bound arguments of \"use cache\" function ${JSON.stringify(fn.name)} to deserialize into an array, got ${typeof boundArgs} instead.`\n )\n }\n\n if (boundArgsLength !== boundArgs.length) {\n throw new InvariantError(\n `Expected the \"use cache\" function ${JSON.stringify(fn.name)} to receive ${boundArgsLength} bound arguments, got ${boundArgs.length} instead.`\n )\n }\n\n args.unshift(boundArgs)\n }\n\n const temporaryReferences = createClientTemporaryReferenceSet()\n\n // For private caches, which are allowed to read cookies, we still don't\n // need to include the cookies in the cache key. This is because we don't\n // store the cache entries in a cache handler, but only in the Resume Data\n // Cache (RDC). Private caches are only used during dynamic requests and\n // runtime prefetches. For dynamic requests, the RDC is immutable, so it\n // does not include any private caches. For runtime prefetches, the RDC is\n // mutable, but only lives as long as the request, so the key does not\n // need to include cookies.\n const cacheKeyParts: CacheKeyParts = hmrRefreshHash\n ? [buildId, id, args, hmrRefreshHash]\n : [buildId, id, args]\n\n const encodeCacheKeyParts = () =>\n encodeReply(cacheKeyParts, {\n temporaryReferences,\n signal: hangingInputAbortSignal,\n })\n\n let encodedCacheKeyParts: FormData | string\n\n switch (workUnitStore?.type) {\n case 'prerender-runtime':\n // We're currently only using `dynamicAccessAsyncStorage` for params,\n // which are always available in a runtime prerender, so they will never hang,\n // effectively making the tracking below a no-op.\n // However, a runtime prerender shares a lot of the semantics with a static prerender,\n // and might need to follow this codepath in the future\n // if we start using `dynamicAccessAsyncStorage` for other APIs.\n //\n // fallthrough\n case 'prerender':\n if (!isPageOrLayoutSegmentFunction) {\n // If the \"use cache\" function is not a page or layout segment\n // function, we need to track dynamic access already when encoding\n // the arguments. If params are passed explicitly into a \"use cache\"\n // function (as opposed to receiving them automatically in a page or\n // layout), we assume that the params are also accessed. This allows\n // us to abort early, and treat the function as dynamic, instead of\n // waiting for the timeout to be reached.\n const dynamicAccessAbortController = new AbortController()\n\n encodedCacheKeyParts = await dynamicAccessAsyncStorage.run(\n { abortController: dynamicAccessAbortController },\n encodeCacheKeyParts\n )\n\n if (dynamicAccessAbortController.signal.aborted) {\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n dynamicAccessAbortController.signal.reason.message\n )\n }\n break\n }\n // fallthrough\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n // TODO(restart-on-cache-miss): We need to handle params/searchParams on page components.\n // the promises will be tasky, so `encodeCacheKeyParts` will not resolve in the static stage.\n // We have not started a cache read at this point, so we might just miss the cache completely.\n // fallthrough\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n case undefined:\n encodedCacheKeyParts = await encodeCacheKeyParts()\n break\n default:\n return workUnitStore satisfies never\n }\n\n const serializedCacheKey =\n typeof encodedCacheKeyParts === 'string'\n ? // Fast path for the simple case for simple inputs. We let the CacheHandler\n // Convert it to an ArrayBuffer if it wants to.\n encodedCacheKeyParts\n : await encodeFormData(encodedCacheKeyParts)\n\n let stream: undefined | ReadableStream = undefined\n\n // Get an immutable and mutable versions of the resume data cache.\n const prerenderResumeDataCache = workUnitStore\n ? getPrerenderResumeDataCache(workUnitStore)\n : null\n const renderResumeDataCache = workUnitStore\n ? getRenderResumeDataCache(workUnitStore)\n : null\n\n if (renderResumeDataCache) {\n const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n\n if (cacheSignal) {\n cacheSignal.beginRead()\n }\n const cachedEntry = renderResumeDataCache.cache.get(serializedCacheKey)\n if (cachedEntry !== undefined) {\n const existingEntry = await cachedEntry\n if (workUnitStore !== undefined && existingEntry !== undefined) {\n if (\n existingEntry.revalidate === 0 ||\n existingEntry.expire < DYNAMIC_EXPIRE\n ) {\n switch (workUnitStore.type) {\n case 'prerender':\n // In a Dynamic I/O prerender, if the cache entry has\n // revalidate: 0 or if the expire time is under 5 minutes,\n // then we consider this cache entry dynamic as it's not worth\n // generating static pages for such data. It's better to leave\n // a dynamic hole that can be filled in during the resume with\n // a potentially cached entry.\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n case 'prerender-runtime': {\n // In the final phase of a runtime prerender, we have to make\n // sure that APIs that would hang during a static prerender\n // are resolved with a delay, in the runtime stage.\n if (workUnitStore.runtimeStagePromise) {\n await workUnitStore.runtimeStagePromise\n }\n break\n }\n case 'request': {\n if (process.env.NODE_ENV === 'development') {\n // We delay the cache here so that it doesn't resolve in the static task --\n // in a regular static prerender, it'd be a hanging promise, and we need to reflect that,\n // so it has to resolve later.\n // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.\n // We don't end the cache read here, so this will always appear as a cache miss in the static stage,\n // and thus will cause a restart even if all caches are filled.\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n RenderStage.Runtime\n )\n }\n break\n }\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (existingEntry.stale < RUNTIME_PREFETCH_DYNAMIC_STALE) {\n switch (workUnitStore.type) {\n case 'prerender-runtime':\n // In a runtime prerender, if the cache entry will become\n // stale in less then 30 seconds, we consider this cache entry\n // dynamic as it's not worth prefetching. It's better to leave\n // a dynamic hole that can be filled during the navigation.\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n case 'request': {\n if (process.env.NODE_ENV === 'development') {\n // We delay the cache here so that it doesn't resolve in the runtime phase --\n // in a regular runtime prerender, it'd be a hanging promise, and we need to reflect that,\n // so it has to resolve later.\n // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.\n // We don't end the cache read here, so this will always appear as a cache miss in the runtime stage,\n // and thus will cause a restart even if all caches are filled.\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n RenderStage.Dynamic\n )\n }\n break\n }\n case 'prerender':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n }\n\n // We want to make sure we only propagate cache life & tags if the\n // entry was *not* omitted from the prerender. So we only do this\n // after the above early returns.\n propagateCacheLifeAndTags(cacheContext, existingEntry)\n\n const [streamA, streamB] = existingEntry.value.tee()\n existingEntry.value = streamB\n\n if (cacheSignal) {\n // When we have a cacheSignal we need to block on reading the cache\n // entry before ending the read.\n stream = createTrackedReadableStream(streamA, cacheSignal)\n } else {\n stream = streamA\n }\n } else {\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n // If `allowEmptyStaticShell` is true, and thus a prefilled\n // resume data cache was provided, then a cache miss means that\n // params were part of the cache key. In this case, we can make\n // this cache function a dynamic hole in the shell (or produce\n // an empty shell if there's no parent suspense boundary).\n // Currently, this also includes layouts and pages that don't\n // read params, which will be improved when we implement\n // NAR-136. Otherwise, we assume that if params are passed\n // explicitly into a \"use cache\" function, that the params are\n // also accessed. This allows us to abort early, and treat the\n // function as dynamic, instead of waiting for the timeout to be\n // reached. Compared to the instrumentation-based params bailout\n // we do here, this also covers the case where params are\n // transformed with an async function, before being passed into\n // the \"use cache\" function, which escapes the instrumentation.\n if (workUnitStore.allowEmptyStaticShell) {\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n }\n break\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n }\n }\n\n if (stream === undefined) {\n const cacheSignal = workUnitStore ? getCacheSignal(workUnitStore) : null\n if (cacheSignal) {\n // Either the cache handler or the generation can be using I/O at this point.\n // We need to track when they start and when they complete.\n cacheSignal.beginRead()\n }\n\n const lazyRefreshTags = workStore.refreshTagsByCacheKind.get(kind)\n\n if (lazyRefreshTags && !isResolvedLazyResult(lazyRefreshTags)) {\n await lazyRefreshTags\n }\n\n let entry: CacheEntry | undefined\n\n // We ignore existing cache entries when force revalidating.\n if (cacheHandler && !shouldForceRevalidate(workStore, workUnitStore)) {\n entry = await cacheHandler.get(\n serializedCacheKey,\n workUnitStore?.implicitTags?.tags ?? []\n )\n }\n\n if (entry) {\n const implicitTags = workUnitStore?.implicitTags?.tags ?? []\n let implicitTagsExpiration = 0\n\n if (workUnitStore?.implicitTags) {\n const lazyExpiration =\n workUnitStore.implicitTags.expirationsByCacheKind.get(kind)\n\n if (lazyExpiration) {\n const expiration = isResolvedLazyResult(lazyExpiration)\n ? lazyExpiration.value\n : await lazyExpiration\n\n // If a cache handler returns an expiration time of Infinity, it\n // signals to Next.js that it handles checking cache entries for\n // staleness based on the expiration of the implicit tags passed\n // into the `get` method. In this case, we keep the default of 0,\n // which means that the implicit tags are not considered expired.\n if (expiration < Infinity) {\n implicitTagsExpiration = expiration\n }\n }\n }\n\n if (\n shouldDiscardCacheEntry(\n entry,\n workStore,\n workUnitStore,\n implicitTags,\n implicitTagsExpiration\n )\n ) {\n debug?.('discarding expired entry', serializedCacheKey)\n entry = undefined\n }\n }\n\n const currentTime = performance.timeOrigin + performance.now()\n if (\n workUnitStore !== undefined &&\n entry !== undefined &&\n (entry.revalidate === 0 || entry.expire < DYNAMIC_EXPIRE)\n ) {\n switch (workUnitStore.type) {\n case 'prerender':\n // In a Dynamic I/O prerender, if the cache entry has revalidate:\n // 0 or if the expire time is under 5 minutes, then we consider\n // this cache entry dynamic as it's not worth generating static\n // pages for such data. It's better to leave a dynamic hole that\n // can be filled in during the resume with a potentially cached\n // entry.\n if (cacheSignal) {\n cacheSignal.endRead()\n }\n return makeHangingPromise(\n workUnitStore.renderSignal,\n workStore.route,\n 'dynamic \"use cache\"'\n )\n case 'request': {\n if (process.env.NODE_ENV === 'development') {\n // We delay the cache here so that it doesn't resolve in the static task --\n // in a regular static prerender, it'd be a hanging promise, and we need to reflect that,\n // so it has to resolve later.\n // TODO(restart-on-cache-miss): Optimize this to avoid unnecessary restarts.\n // We don't end the cache read here, so this will always appear as a cache miss in the static stage,\n // and thus will cause a restart even if all caches are filled.\n await makeDevtoolsIOAwarePromise(\n undefined,\n workUnitStore,\n RenderStage.Runtime\n )\n }\n break\n }\n case 'prerender-runtime':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n if (\n entry === undefined ||\n currentTime > entry.timestamp + entry.expire * 1000 ||\n (workStore.isStaticGeneration &&\n currentTime > entry.timestamp + entry.revalidate * 1000)\n ) {\n // Miss. Generate a new result.\n\n // If the cache entry is stale and we're prerendering, we don't want to use the\n // stale entry since it would unnecessarily need to shorten the lifetime of the\n // prerender. We're not time constrained here so we can re-generated it now.\n\n // We need to run this inside a clean AsyncLocalStorage snapshot so that the cache\n // generation cannot read anything from the context we're currently executing which\n // might include request specific things like cookies() inside a React.cache().\n // Note: It is important that we await at least once before this because it lets us\n // pop out of any stack specific contexts as well - aka \"Sync\" Local Storage.\n\n if (entry) {\n if (currentTime > entry.timestamp + entry.expire * 1000) {\n debug?.('entry is expired', serializedCacheKey)\n }\n\n if (\n workStore.isStaticGeneration &&\n currentTime > entry.timestamp + entry.revalidate * 1000\n ) {\n debug?.('static generation, entry is stale', serializedCacheKey)\n }\n }\n\n const result = await generateCacheEntry(\n workStore,\n cacheContext,\n clientReferenceManifest,\n encodedCacheKeyParts,\n fn,\n sharedErrorStack\n )\n\n if (result.type === 'prerender-dynamic') {\n return result.hangingPromise\n }\n\n const { stream: newStream, pendingCacheEntry } = result\n\n // When draft mode is enabled, we must not save the cache entry.\n if (!workStore.isDraftMode) {\n let savedCacheEntry\n\n if (prerenderResumeDataCache) {\n // Create a clone that goes into the cache scope memory cache.\n const split = clonePendingCacheEntry(pendingCacheEntry)\n savedCacheEntry = getNthCacheEntry(split, 0)\n prerenderResumeDataCache.cache.set(\n serializedCacheKey,\n getNthCacheEntry(split, 1)\n )\n } else {\n savedCacheEntry = pendingCacheEntry\n }\n\n if (cacheHandler) {\n const promise = cacheHandler.set(\n serializedCacheKey,\n savedCacheEntry\n )\n\n workStore.pendingRevalidateWrites ??= []\n workStore.pendingRevalidateWrites.push(promise)\n }\n }\n\n stream = newStream\n } else {\n // If we have an entry at this point, this can't be a private cache\n // entry.\n if (cacheContext.kind === 'private') {\n throw new InvariantError(\n `A private cache entry must not be retrieved from the cache handler.`\n )\n }\n\n propagateCacheLifeAndTags(cacheContext, entry)\n\n // We want to return this stream, even if it's stale.\n stream = entry.value\n\n // If we have a cache scope, we need to clone the entry and set it on\n // the inner cache scope.\n if (prerenderResumeDataCache) {\n const [entryLeft, entryRight] = cloneCacheEntry(entry)\n if (cacheSignal) {\n stream = createTrackedReadableStream(entryLeft.value, cacheSignal)\n } else {\n stream = entryLeft.value\n }\n\n prerenderResumeDataCache.cache.set(\n serializedCacheKey,\n Promise.resolve(entryRight)\n )\n } else {\n // If we're not regenerating we need to signal that we've finished\n // putting the entry into the cache scope at this point. Otherwise we do\n // that inside generateCacheEntry.\n cacheSignal?.endRead()\n }\n\n if (currentTime > entry.timestamp + entry.revalidate * 1000) {\n // If this is stale, and we're not in a prerender (i.e. this is\n // dynamic render), then we should warm up the cache with a fresh\n // revalidated entry.\n const result = await generateCacheEntry(\n workStore,\n // This is not running within the context of this unit.\n { kind: cacheContext.kind, outerWorkUnitStore: undefined },\n clientReferenceManifest,\n encodedCacheKeyParts,\n fn,\n sharedErrorStack\n )\n\n if (result.type === 'cached') {\n const { stream: ignoredStream, pendingCacheEntry } = result\n let savedCacheEntry: Promise<CacheEntry>\n\n if (prerenderResumeDataCache) {\n const split = clonePendingCacheEntry(pendingCacheEntry)\n savedCacheEntry = getNthCacheEntry(split, 0)\n prerenderResumeDataCache.cache.set(\n serializedCacheKey,\n getNthCacheEntry(split, 1)\n )\n } else {\n savedCacheEntry = pendingCacheEntry\n }\n\n if (cacheHandler) {\n const promise = cacheHandler.set(\n serializedCacheKey,\n savedCacheEntry\n )\n\n workStore.pendingRevalidateWrites ??= []\n workStore.pendingRevalidateWrites.push(promise)\n }\n\n await ignoredStream.cancel()\n }\n }\n }\n }\n\n // Logs are replayed even if it's a hit - to ensure we see them on the client eventually.\n // If we didn't then the client wouldn't see the logs if it was seeded from a prewarm that\n // never made it to the client. However, this also means that you see logs even when the\n // cached function isn't actually re-executed. We should instead ensure prewarms always\n // make it to the client. Another issue is that this will cause double logging in the\n // server terminal. Once while generating the cache entry and once when replaying it on\n // the server, which is required to pick it up for replaying again on the client.\n const replayConsoleLogs = true\n\n const serverConsumerManifest = {\n // moduleLoading must be null because we don't want to trigger preloads of ClientReferences\n // to be added to the consumer. Instead, we'll wait for any ClientReference to be emitted\n // which themselves will handle the preloading.\n moduleLoading: null,\n moduleMap: isEdgeRuntime\n ? clientReferenceManifest.edgeRscModuleMapping\n : clientReferenceManifest.rscModuleMapping,\n serverModuleMap: getServerModuleMap(),\n }\n\n return createFromReadableStream(stream, {\n findSourceMapURL,\n serverConsumerManifest,\n temporaryReferences,\n replayConsoleLogs,\n environmentName: 'Cache',\n })\n },\n }[name]\n\n return React.cache(cachedFn)\n}\n\n/**\n * Returns `true` if the `'use cache'` function is the page component itself,\n * or `generateMetadata`/`generateViewport` in a page file.\n */\nfunction isPageSegmentFunction(\n args: any[]\n): args is [UseCachePageProps, ...unknown[]] {\n const [maybeProps] = args\n\n return (\n maybeProps !== null &&\n typeof maybeProps === 'object' &&\n (maybeProps as UseCachePageProps).$$isPage === true\n )\n}\n\n/**\n * Returns `true` if the `'use cache'` function is the layout component itself,\n * or `generateMetadata`/`generateViewport` in a layout file.\n */\nfunction isLayoutSegmentFunction(\n args: any[]\n): args is [UseCacheLayoutProps, ...unknown[]] {\n const [maybeProps] = args\n\n return (\n maybeProps !== null &&\n typeof maybeProps === 'object' &&\n (maybeProps as UseCacheLayoutProps).$$isLayout === true\n )\n}\n\nfunction shouldForceRevalidate(\n workStore: WorkStore,\n workUnitStore: WorkUnitStore | undefined\n): boolean {\n if (workStore.isOnDemandRevalidate || workStore.isDraftMode) {\n return true\n }\n\n if (workStore.dev && workUnitStore) {\n switch (workUnitStore.type) {\n case 'request':\n return workUnitStore.headers.get('cache-control') === 'no-cache'\n case 'cache':\n case 'private-cache':\n return workUnitStore.forceRevalidate\n case 'prerender-runtime':\n case 'prerender':\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n return false\n}\n\nfunction shouldDiscardCacheEntry(\n entry: CacheEntry,\n workStore: WorkStore,\n workUnitStore: WorkUnitStore | undefined,\n implicitTags: string[],\n implicitTagsExpiration: number\n): boolean {\n // If the cache entry was created before any of the implicit tags were\n // revalidated last, we need to discard it.\n if (entry.timestamp <= implicitTagsExpiration) {\n debug?.(\n 'entry was created at',\n entry.timestamp,\n 'before implicit tags were revalidated at',\n implicitTagsExpiration\n )\n\n return true\n }\n\n // During prerendering, we ignore recently revalidated tags. In dev mode, we\n // can assume that the dynamic dev rendering will have discarded and recreated\n // the affected cache entries, and we don't want to discard those again during\n // the prerender validation. During build-time prerendering, there will never\n // be any pending revalidated tags.\n if (workUnitStore) {\n switch (workUnitStore.type) {\n case 'prerender':\n return false\n case 'prerender-runtime':\n case 'prerender-client':\n case 'prerender-ppr':\n case 'prerender-legacy':\n case 'request':\n case 'cache':\n case 'private-cache':\n case 'unstable-cache':\n break\n default:\n workUnitStore satisfies never\n }\n }\n\n // If the cache entry contains revalidated tags that the cache handler might\n // not know about yet, we need to discard it.\n if (entry.tags.some((tag) => isRecentlyRevalidatedTag(tag, workStore))) {\n return true\n }\n\n // Finally, if any of the implicit tags have been revalidated recently, we\n // also need to discard the cache entry.\n if (implicitTags.some((tag) => isRecentlyRevalidatedTag(tag, workStore))) {\n return true\n }\n\n return false\n}\n\nfunction isRecentlyRevalidatedTag(tag: string, workStore: WorkStore): boolean {\n const { previouslyRevalidatedTags, pendingRevalidatedTags } = workStore\n\n // Was the tag previously revalidated (e.g. by a redirecting server action)?\n if (previouslyRevalidatedTags.includes(tag)) {\n debug?.('tag', tag, 'was previously revalidated')\n\n return true\n }\n\n // It could also have been revalidated by the currently running server action.\n // In this case the revalidation might not have been fully propagated by a\n // remote cache handler yet, so we read it from the pending tags in the work\n // store.\n if (pendingRevalidatedTags?.some((item) => item.tag === tag)) {\n debug?.('tag', tag, 'was just revalidated')\n\n return true\n }\n\n return false\n}\n"],"names":["cache","isEdgeRuntime","process","env","NEXT_RUNTIME","debug","NEXT_PRIVATE_DEBUG_CACHE","console","bind","undefined","filterStackFrame","NODE_ENV","require","filterStackFrameDEV","findSourceMapURL","findSourceMapURLDEV","generateCacheEntry","workStore","cacheContext","clientReferenceManifest","encodedArguments","fn","sharedErrorStack","runInCleanSnapshot","generateCacheEntryWithRestoredWorkStore","workAsyncStorage","run","generateCacheEntryWithCacheContext","createUseCacheStore","defaultCacheLife","kind","outerWorkUnitStore","type","phase","implicitTags","revalidate","expire","stale","explicitRevalidate","explicitExpire","explicitStale","tags","hmrRefreshHash","getHmrRefreshHash","isHmrRefresh","serverComponentsHmrCache","getServerComponentsHmrCache","forceRevalidate","shouldForceRevalidate","runtimeStagePromise","getRuntimeStagePromise","draftMode","getDraftModeProviderForCacheScope","rootParams","headers","cookies","useCacheOrRequestStore","assertDefaultCacheLife","InvariantError","cacheLifeProfiles","cacheStore","workUnitAsyncStorage","dynamicAccessAsyncStorage","abortController","AbortController","generateCacheEntryImpl","propagateCacheLifeAndTagsToRevalidateStore","revalidateStore","entry","outerTags","tag","includes","push","propagateCacheLifeAndTags","collectResult","savedStream","innerCacheStore","startTime","errors","buffer","reader","getReader","read","done","value","error","idx","bufferStream","ReadableStream","pull","controller","invalidDynamicUsageError","length","enqueue","close","collectedTags","collectedRevalidate","collectedExpire","collectedStale","timestamp","cacheSignal","getCacheSignal","endRead","temporaryReferences","createServerTemporaryReferenceSet","args","decodeReply","getServerModuleMap","decodeReplyFromAsyncIterable","Symbol","asyncIterator","Promise","resolve","renderSignal","aborted","addEventListener","once","performance","timeOrigin","now","resultPromise","createLazyResult","apply","handleError","digest","getDigestForWellKnownError","isReactLargeShellError","stream","timeoutAbortController","timer","setTimeout","UseCacheTimeoutError","stack","name","message","abort","dynamicAccessAbortSignal","getStore","signal","abortSignal","AbortSignal","any","prelude","prerender","clientModules","environmentName","onError","reason","clearTimeout","start","hangingPromise","makeHangingPromise","route","renderToReadableStream","returnStream","tee","pendingCacheEntry","cloneCacheEntry","streamA","streamB","clonedEntry","clonePendingCacheEntry","getNthCacheEntry","split","i","encodeFormData","formData","result","key","toString","stringValue","arrayBuffer","byteLength","String","fromCodePoint","Uint16Array","Uint8Array","createTrackedReadableStream","wrapAsInvalidDynamicUsageError","id","boundArgsLength","originalFn","sharedError","isPrivate","cacheHandler","getCacheHandler","Error","captureStackTrace","slice","indexOf","cachedFn","workUnitStore","expression","postponeWithTracking","dynamicTracking","throwToInterruptStaticGeneration","getClientReferenceManifestForRsc","buildId","hangingInputAbortSignal","createHangingInputAbortSignal","makeDevtoolsIOAwarePromise","RenderStage","Runtime","isPageOrLayoutSegmentFunction","isPageSegmentFunction","params","outerParams","searchParams","outerSearchParams","otherOuterArgs","props","_innerParams","innerSearchParams","otherInnerArgs","makeErroringSearchParamsForUseCache","isLayoutSegmentFunction","$$isLayout","outerSlots","innerSlots","JSON","stringify","encryptedBoundArgs","shift","boundArgs","decryptActionBoundArgs","Array","isArray","unshift","createClientTemporaryReferenceSet","cacheKeyParts","encodeCacheKeyParts","encodeReply","encodedCacheKeyParts","dynamicAccessAbortController","serializedCacheKey","prerenderResumeDataCache","getPrerenderResumeDataCache","renderResumeDataCache","getRenderResumeDataCache","beginRead","cachedEntry","get","existingEntry","DYNAMIC_EXPIRE","RUNTIME_PREFETCH_DYNAMIC_STALE","Dynamic","allowEmptyStaticShell","lazyRefreshTags","refreshTagsByCacheKind","isResolvedLazyResult","implicitTagsExpiration","lazyExpiration","expirationsByCacheKind","expiration","Infinity","shouldDiscardCacheEntry","currentTime","isStaticGeneration","newStream","isDraftMode","savedCacheEntry","set","promise","pendingRevalidateWrites","entryLeft","entryRight","ignoredStream","cancel","replayConsoleLogs","serverConsumerManifest","moduleLoading","moduleMap","edgeRscModuleMapping","rscModuleMapping","serverModuleMap","createFromReadableStream","React","maybeProps","$$isPage","isOnDemandRevalidate","dev","some","isRecentlyRevalidatedTag","previouslyRevalidatedTags","pendingRevalidatedTags","item"],"mappings":";;;;+BA80BgBA;;;eAAAA;;;wBAv0BT;wBAKA;wBACmB;0CAIO;8CAoB1B;uCAKA;iCAOA;4BAGgC;gCACR;oCACY;2BACoB;0BAC/B;gCACK;kCAK9B;8BAIA;8DAEW;4BACqC;mDACb;sCACH;iCAEX;;;;;;AA4C5B,MAAMC,gBAAgBC,QAAQC,GAAG,CAACC,YAAY,KAAK;AAEnD,MAAMC,QAAQH,QAAQC,GAAG,CAACG,wBAAwB,GAC9CC,QAAQF,KAAK,CAACG,IAAI,CAACD,SAAS,gBAC5BE;AAEJ,MAAMC,mBACJR,QAAQC,GAAG,CAACQ,QAAQ,KAAK,eACrB,AAACC,QAAQ,sBACNC,mBAAmB,GACtBJ;AACN,MAAMK,mBACJZ,QAAQC,GAAG,CAACQ,QAAQ,KAAK,eACrB,AAACC,QAAQ,sBACNG,mBAAmB,GACtBN;AAEN,SAASO,mBACPC,SAAoB,EACpBC,YAA0B,EAC1BC,uBAAoE,EACpEC,gBAAmC,EACnCC,EAA4C,EAC5CC,gBAAoC;IAEpC,kFAAkF;IAClF,mFAAmF;IACnF,+EAA+E;IAC/E,mFAAmF;IACnF,6EAA6E;IAC7E,OAAOL,UAAUM,kBAAkB,CACjCC,yCACAP,WACAC,cACAC,yBACAC,kBACAC,IACAC;AAEJ;AAEA,SAASE,wCACPP,SAAoB,EACpBC,YAA0B,EAC1BC,uBAAoE,EACpEC,gBAAmC,EACnCC,EAA4C,EAC5CC,gBAAoC;IAEpC,2EAA2E;IAC3E,6EAA6E;IAC7E,sFAAsF;IACtF,sFAAsF;IACtF,+EAA+E;IAC/E,sFAAsF;IACtF,0DAA0D;IAC1D,OAAOG,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