Download next.js/packages/next/src/server/get-app-route-from-entrypoint.ts from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 380 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/server/get-app-route-from-entrypoint.ts
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/next.js/packages/next/src/server/get-app-route-from-entrypoint.ts
-
curl -L -o get-app-route-from-entrypoint.ts https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/next.js/packages/next/src/server/get-app-route-from-entrypoint.ts
380 Bytes
| 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 | |
| } | |