File size: 380 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import matchBundle from './match-bundle'

// matches app/:path*.js
const APP_ROUTE_NAME_REGEX = /^app[/\\](.*)$/

export default function getAppRouteFromEntrypoint(entryFile: string) {
  const pagePath = matchBundle(APP_ROUTE_NAME_REGEX, entryFile)
  if (typeof pagePath === 'string' && !pagePath) {
    return '/'
  }

  if (!pagePath) {
    return null
  }

  return pagePath
}