Buckets:
silverwolf-x/project / packages /next /src /shared /lib /router /utils /format-next-pathname-info.ts
| import type { NextPathnameInfo } from './get-next-pathname-info' | |
| import { removeTrailingSlash } from './remove-trailing-slash' | |
| import { addPathPrefix } from './add-path-prefix' | |
| import { addPathSuffix } from './add-path-suffix' | |
| import { addLocale } from './add-locale' | |
| interface ExtendedInfo extends NextPathnameInfo { | |
| defaultLocale?: string | |
| ignorePrefix?: boolean | |
| } | |
| export function formatNextPathnameInfo(info: ExtendedInfo) { | |
| let pathname = addLocale( | |
| info.pathname, | |
| info.locale, | |
| info.buildId ? undefined : info.defaultLocale, | |
| info.ignorePrefix | |
| ) | |
| if (info.buildId || !info.trailingSlash) { | |
| pathname = removeTrailingSlash(pathname) | |
| } | |
| if (info.buildId) { | |
| pathname = addPathSuffix( | |
| addPathPrefix(pathname, `/_next/data/${info.buildId}`), | |
| info.pathname === '/' ? 'index.json' : '.json' | |
| ) | |
| } | |
| pathname = addPathPrefix(pathname, info.basePath) | |
| return !info.buildId && info.trailingSlash | |
| ? !pathname.endsWith('/') | |
| ? addPathSuffix(pathname, '/') | |
| : pathname | |
| : removeTrailingSlash(pathname) | |
| } | |
Xet Storage Details
- Size:
- 1.07 kB
- Xet hash:
- f3a2bd860b425abd34bec027a266a4f260fe92add2c47b9ef704f3b42ba50427
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.