Buckets:
| import { existsSync } from 'fs' | |
| import path from 'path' | |
| import loadConfig from '../server/config' | |
| import { PHASE_PRODUCTION_BUILD } from '../shared/lib/constants' | |
| import { getProjectDir } from '../lib/get-project-dir' | |
| import { printAndExit } from '../server/lib/utils' | |
| import { loadBindings } from '../build/swc' | |
| export type NextPostBuildOptions = {} | |
| const nextPostBuild = async ( | |
| _options: NextPostBuildOptions, | |
| directory?: string | |
| ) => { | |
| const dir = getProjectDir(directory) | |
| if (!existsSync(dir)) { | |
| printAndExit(`> No such directory exists as the project root: ${dir}`) | |
| } | |
| const config = await loadConfig(PHASE_PRODUCTION_BUILD, dir) | |
| const persistentCaching = | |
| config.experimental?.turbopackFileSystemCacheForBuild || false | |
| if (!persistentCaching) { | |
| console.log('Persistent caching for build is not enabled. Nothing to do.') | |
| return | |
| } | |
| const distDir = path.join(dir, config.distDir) | |
| const cachePath = path.join(distDir, 'cache', 'turbopack') | |
| if (!existsSync(cachePath)) { | |
| console.log('No Turbopack cache directory found. Nothing to do.') | |
| return | |
| } | |
| const bindings = await loadBindings(config.experimental?.useWasmBinary) | |
| await bindings.turbo.databaseCompact(cachePath) | |
| console.log('Turbopack database compaction complete.') | |
| } | |
| export { nextPostBuild } | |
Xet Storage Details
- Size:
- 1.33 kB
- Xet hash:
- 7a018ef59c4462ee441b60c0948ad5f0b0324cbc21fde81df6fe38cd398da2dd
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.