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
97 KiB
Text
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":["renderToReadableStream","decodeReply","decodeReplyFromAsyncIterable","createTemporaryReferenceSet","createServerTemporaryReferenceSet","createFromReadableStream","encodeReply","createClientTemporaryReferenceSet","prerender","workAsyncStorage","getHmrRefreshHash","getRenderResumeDataCache","getPrerenderResumeDataCache","workUnitAsyncStorage","getDraftModeProviderForCacheScope","getCacheSignal","isHmrRefresh","getServerComponentsHmrCache","getRuntimeStagePromise","makeDevtoolsIOAwarePromise","makeHangingPromise","getClientReferenceManifestForRsc","getServerModuleMap","decryptActionBoundArgs","InvariantError","getDigestForWellKnownError","DYNAMIC_EXPIRE","RUNTIME_PREFETCH_DYNAMIC_STALE","getCacheHandler","UseCacheTimeoutError","createHangingInputAbortSignal","postponeWithTracking","throwToInterruptStaticGeneration","makeErroringSearchParamsForUseCache","React","createLazyResult","isResolvedLazyResult","dynamicAccessAsyncStorage","isReactLargeShellError","RenderStage","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","run","generateCacheEntryWithCacheContext","createUseCacheStore","defaultCacheLife","kind","outerWorkUnitStore","type","phase","implicitTags","revalidate","expire","stale","explicitRevalidate","explicitExpire","explicitStale","tags","hmrRefreshHash","serverComponentsHmrCache","forceRevalidate","shouldForceRevalidate","runtimeStagePromise","draftMode","rootParams","headers","cookies","useCacheOrRequestStore","assertDefaultCacheLife","cacheLifeProfiles","cacheStore","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","endRead","temporaryReferences","args","Symbol","asyncIterator","Promise","resolve","renderSignal","aborted","addEventListener","once","performance","timeOrigin","now","resultPromise","apply","handleError","digest","stream","timeoutAbortController","timer","setTimeout","stack","name","message","abort","dynamicAccessAbortSignal","getStore","signal","abortSignal","AbortSignal","any","prelude","clientModules","environmentName","onError","reason","clearTimeout","start","hangingPromise","route","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","cache","id","boundArgsLength","originalFn","sharedError","isPrivate","cacheHandler","Error","captureStackTrace","slice","indexOf","cachedFn","workUnitStore","expression","dynamicTracking","buildId","hangingInputAbortSignal","Runtime","isPageOrLayoutSegmentFunction","isPageSegmentFunction","params","outerParams","searchParams","outerSearchParams","otherOuterArgs","props","_innerParams","innerSearchParams","otherInnerArgs","isLayoutSegmentFunction","$$isLayout","outerSlots","innerSlots","JSON","stringify","encryptedBoundArgs","shift","boundArgs","Array","isArray","unshift","cacheKeyParts","encodeCacheKeyParts","encodedCacheKeyParts","dynamicAccessAbortController","serializedCacheKey","prerenderResumeDataCache","renderResumeDataCache","beginRead","cachedEntry","get","existingEntry","Dynamic","allowEmptyStaticShell","lazyRefreshTags","refreshTagsByCacheKind","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","maybeProps","$$isPage","isOnDemandRevalidate","dev","some","isRecentlyReval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