File size: 1,116 Bytes
b91e262 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | import { Normalizers } from '../../normalizers'
import type { Normalizer } from '../../normalizer'
import { PrefixingNormalizer } from '../../prefixing-normalizer'
import { normalizePagePath } from '../../../../shared/lib/page-path/normalize-page-path'
import { UnderscoreNormalizer } from '../../underscore-normalizer'
export class AppBundlePathNormalizer extends PrefixingNormalizer {
constructor() {
super('app')
}
public normalize(page: string): string {
return super.normalize(normalizePagePath(page))
}
}
export class DevAppBundlePathNormalizer extends Normalizers {
constructor(pageNormalizer: Normalizer, isTurbopack: boolean) {
const normalizers = [
// This should normalize the filename to a page.
pageNormalizer,
// Normalize the app page to a pathname.
new AppBundlePathNormalizer(),
]
// %5F to _ replacement should only happen with Turbopack.
if (isTurbopack) {
normalizers.unshift(new UnderscoreNormalizer())
}
super(normalizers)
}
public normalize(filename: string): string {
return super.normalize(filename)
}
}
|