Download next.js/packages/next/src/server/request/utils.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.8 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/server/request/utils.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/server/request/utils.ts
-
curl -L -o utils.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/server/request/utils.ts
1.8 kB
| import { StaticGenBailoutError } from '../../client/components/static-generation-bailout' | |
| import { afterTaskAsyncStorage } from '../app-render/after-task-async-storage.external' | |
| import type { WorkStore } from '../app-render/work-async-storage.external' | |
| export function throwWithStaticGenerationBailoutError( | |
| route: string, | |
| expression: string | |
| ): never { | |
| throw new StaticGenBailoutError( | |
| `Route ${route} couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering` | |
| ) | |
| } | |
| export function throwWithStaticGenerationBailoutErrorWithDynamicError( | |
| route: string, | |
| expression: string | |
| ): never { | |
| throw new StaticGenBailoutError( | |
| `Route ${route} with \`dynamic = "error"\` couldn't be rendered statically because it used ${expression}. See more info here: https://nextjs.org/docs/app/building-your-application/rendering/static-and-dynamic#dynamic-rendering` | |
| ) | |
| } | |
| export function throwForSearchParamsAccessInUseCache( | |
| workStore: WorkStore, | |
| constructorOpt: Function | |
| ): never { | |
| const error = new Error( | |
| `Route ${workStore.route} used "searchParams" inside "use cache". Accessing Dynamic data sources inside a cache scope is not supported. If you need this data inside a cached function use "searchParams" outside of the cached function and pass the required dynamic data in as an argument. See more info here: https://nextjs.org/docs/messages/next-request-in-use-cache` | |
| ) | |
| Error.captureStackTrace(error, constructorOpt) | |
| workStore.invalidDynamicUsageError ??= error | |
| throw error | |
| } | |
| export function isRequestAPICallableInsideAfter() { | |
| const afterTaskStore = afterTaskAsyncStorage.getStore() | |
| return afterTaskStore?.rootTaskSpawnPhase === 'action' | |
| } | |