Download next.js/packages/next/src/build/generate-build-id.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 657 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/generate-build-id.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/build/generate-build-id.ts
-
curl -L -o generate-build-id.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/build/generate-build-id.ts
657 Bytes
| export async function generateBuildId( | |
| generate: () => string | null | Promise<string | null>, | |
| fallback: () => string | |
| ): Promise<string> { | |
| let buildId = await generate() | |
| // If there's no buildId defined we'll fall back | |
| if (buildId === null) { | |
| // We also create a new buildId if it contains the word `ad` to avoid false | |
| // positives with ad blockers | |
| while (!buildId || /ad/i.test(buildId)) { | |
| buildId = fallback() | |
| } | |
| } | |
| if (typeof buildId !== 'string') { | |
| throw new Error( | |
| 'generateBuildId did not return a string. https://nextjs.org/docs/messages/generatebuildid-not-a-string' | |
| ) | |
| } | |
| return buildId.trim() | |
| } | |