expo-router 5.0.2-preview.0 → 5.0.2-preview.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (286) hide show
  1. package/build/ExpoRoot.js +18 -9
  2. package/build/ExpoRoot.js.map +1 -1
  3. package/build/LocationProvider.js +2 -3
  4. package/build/LocationProvider.js.map +1 -1
  5. package/build/Prefetch.d.ts +9 -0
  6. package/build/Prefetch.d.ts.map +1 -0
  7. package/build/Prefetch.js +19 -0
  8. package/build/Prefetch.js.map +1 -0
  9. package/build/Route.js +4 -4
  10. package/build/Route.js.map +1 -1
  11. package/build/doctor/index.js +1 -2
  12. package/build/doctor/index.js.map +1 -1
  13. package/build/exports.js +17 -7
  14. package/build/exports.js.map +1 -1
  15. package/build/fast-refresh.js.map +1 -1
  16. package/build/fork/NavigationContainer.d.ts +2 -7
  17. package/build/fork/NavigationContainer.d.ts.map +1 -1
  18. package/build/fork/NavigationContainer.js.map +1 -1
  19. package/build/fork/createMemoryHistory.d.ts.map +1 -1
  20. package/build/fork/createMemoryHistory.js +1 -2
  21. package/build/fork/createMemoryHistory.js.map +1 -1
  22. package/build/fork/extractPathFromURL.js +3 -4
  23. package/build/fork/extractPathFromURL.js.map +1 -1
  24. package/build/fork/findFocusedRoute.d.ts +1 -11
  25. package/build/fork/findFocusedRoute.d.ts.map +1 -1
  26. package/build/fork/findFocusedRoute.js +1 -2
  27. package/build/fork/findFocusedRoute.js.map +1 -1
  28. package/build/fork/getPathFromState-forks.d.ts.map +1 -1
  29. package/build/fork/getPathFromState-forks.js +24 -14
  30. package/build/fork/getPathFromState-forks.js.map +1 -1
  31. package/build/fork/getPathFromState.js +20 -11
  32. package/build/fork/getPathFromState.js.map +1 -1
  33. package/build/fork/getStateFromPath-forks.d.ts +4 -4
  34. package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
  35. package/build/fork/getStateFromPath-forks.js +18 -19
  36. package/build/fork/getStateFromPath-forks.js.map +1 -1
  37. package/build/fork/getStateFromPath.js +18 -9
  38. package/build/fork/getStateFromPath.js.map +1 -1
  39. package/build/fork/native-stack/NativeStackView.js +1 -2
  40. package/build/fork/native-stack/NativeStackView.js.map +1 -1
  41. package/build/fork/native-stack/createNativeStackNavigator.js +18 -9
  42. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
  43. package/build/fork/useBackButton.d.ts +0 -1
  44. package/build/fork/useBackButton.d.ts.map +1 -1
  45. package/build/fork/useBackButton.js +1 -2
  46. package/build/fork/useBackButton.js.map +1 -1
  47. package/build/fork/useBackButton.native.js +18 -9
  48. package/build/fork/useBackButton.native.js.map +1 -1
  49. package/build/fork/useDocumentTitle.js +18 -9
  50. package/build/fork/useDocumentTitle.js.map +1 -1
  51. package/build/fork/useDocumentTitle.native.js +1 -2
  52. package/build/fork/useDocumentTitle.native.js.map +1 -1
  53. package/build/fork/useLinking.d.ts +3 -26
  54. package/build/fork/useLinking.d.ts.map +1 -1
  55. package/build/fork/useLinking.js +20 -10
  56. package/build/fork/useLinking.js.map +1 -1
  57. package/build/fork/useLinking.native.d.ts +6 -6
  58. package/build/fork/useLinking.native.js +19 -10
  59. package/build/fork/useLinking.native.js.map +1 -1
  60. package/build/fork/useThenable.js +18 -9
  61. package/build/fork/useThenable.js.map +1 -1
  62. package/build/fork/validatePathConfig.js +1 -1
  63. package/build/fork/validatePathConfig.js.map +1 -1
  64. package/build/getDevServer/index.js.map +1 -1
  65. package/build/getLinkingConfig.js +3 -3
  66. package/build/getLinkingConfig.js.map +1 -1
  67. package/build/getReactNavigationConfig.js +3 -4
  68. package/build/getReactNavigationConfig.js.map +1 -1
  69. package/build/getRoutes.js +3 -3
  70. package/build/getRoutes.js.map +1 -1
  71. package/build/getRoutesCore.js +6 -7
  72. package/build/getRoutesCore.js.map +1 -1
  73. package/build/getRoutesRedirects.d.ts +0 -1
  74. package/build/getRoutesRedirects.d.ts.map +1 -1
  75. package/build/getRoutesRedirects.js +3 -4
  76. package/build/getRoutesRedirects.js.map +1 -1
  77. package/build/getRoutesSSR.js +3 -3
  78. package/build/getRoutesSSR.js.map +1 -1
  79. package/build/getServerManifest.js +2 -3
  80. package/build/getServerManifest.js.map +1 -1
  81. package/build/global-state/routeInfo.js +18 -9
  82. package/build/global-state/routeInfo.js.map +1 -1
  83. package/build/global-state/router-store.d.ts +7 -6
  84. package/build/global-state/router-store.d.ts.map +1 -1
  85. package/build/global-state/router-store.js +24 -13
  86. package/build/global-state/router-store.js.map +1 -1
  87. package/build/global-state/routing.d.ts +1 -0
  88. package/build/global-state/routing.d.ts.map +1 -1
  89. package/build/global-state/routing.js +33 -20
  90. package/build/global-state/routing.js.map +1 -1
  91. package/build/global-state/serverLocationContext.d.ts +0 -1
  92. package/build/global-state/serverLocationContext.d.ts.map +1 -1
  93. package/build/global-state/sort-routes.js +1 -2
  94. package/build/global-state/sort-routes.js.map +1 -1
  95. package/build/head/ExpoHead.android.d.ts +1 -1
  96. package/build/head/ExpoHead.android.js +1 -2
  97. package/build/head/ExpoHead.android.js.map +1 -1
  98. package/build/head/ExpoHead.ios.js.map +1 -1
  99. package/build/head/ExpoHeadModule.js.map +1 -1
  100. package/build/head/url.js +2 -3
  101. package/build/head/url.js.map +1 -1
  102. package/build/hooks.d.ts.map +1 -1
  103. package/build/hooks.js +18 -18
  104. package/build/hooks.js.map +1 -1
  105. package/build/imperative-api.d.ts +4 -0
  106. package/build/imperative-api.d.ts.map +1 -1
  107. package/build/imperative-api.js +1 -0
  108. package/build/imperative-api.js.map +1 -1
  109. package/build/layouts/DrawerClient.d.ts +16 -17
  110. package/build/layouts/DrawerClient.d.ts.map +1 -1
  111. package/build/layouts/RootModal.d.ts +1 -2
  112. package/build/layouts/RootModal.d.ts.map +1 -1
  113. package/build/layouts/RootModal.js +2 -2
  114. package/build/layouts/RootModal.js.map +1 -1
  115. package/build/layouts/StackClient.d.ts +16 -16
  116. package/build/layouts/StackClient.d.ts.map +1 -1
  117. package/build/layouts/StackClient.js.map +1 -1
  118. package/build/layouts/TabsClient.d.ts +12 -12
  119. package/build/layouts/TabsClient.js.map +1 -1
  120. package/build/layouts/withLayoutContext.d.ts +2 -2
  121. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  122. package/build/layouts/withLayoutContext.js +19 -10
  123. package/build/layouts/withLayoutContext.js.map +1 -1
  124. package/build/link/Link.d.ts.map +1 -1
  125. package/build/link/Link.js +10 -5
  126. package/build/link/Link.js.map +1 -1
  127. package/build/link/href.d.ts.map +1 -1
  128. package/build/link/href.js +2 -2
  129. package/build/link/href.js.map +1 -1
  130. package/build/link/linking.d.ts.map +1 -1
  131. package/build/link/linking.js +21 -11
  132. package/build/link/linking.js.map +1 -1
  133. package/build/link/useDomComponentNavigation.js +6 -7
  134. package/build/link/useDomComponentNavigation.js.map +1 -1
  135. package/build/link/useLinkHooks.d.ts +5 -0
  136. package/build/link/useLinkHooks.d.ts.map +1 -1
  137. package/build/link/useLinkHooks.js +2 -2
  138. package/build/link/useLinkHooks.js.map +1 -1
  139. package/build/link/useLinkToPathProps.d.ts.map +1 -1
  140. package/build/link/useLinkToPathProps.js +2 -3
  141. package/build/link/useLinkToPathProps.js.map +1 -1
  142. package/build/link/useLoadedNavigation.d.ts.map +1 -1
  143. package/build/link/useLoadedNavigation.js +2 -3
  144. package/build/link/useLoadedNavigation.js.map +1 -1
  145. package/build/loadStaticParamsAsync.js +3 -4
  146. package/build/loadStaticParamsAsync.js.map +1 -1
  147. package/build/matchers.js +14 -15
  148. package/build/matchers.js.map +1 -1
  149. package/build/onboard/Tutorial.js +1 -2
  150. package/build/onboard/Tutorial.js.map +1 -1
  151. package/build/onboard/createEntryFile.js +2 -3
  152. package/build/onboard/createEntryFile.js.map +1 -1
  153. package/build/qualified-entry.js +1 -2
  154. package/build/qualified-entry.js.map +1 -1
  155. package/build/renderRootComponent.js +18 -9
  156. package/build/renderRootComponent.js.map +1 -1
  157. package/build/routes-manifest.js +1 -2
  158. package/build/routes-manifest.js.map +1 -1
  159. package/build/rsc/entry.js +1 -2
  160. package/build/rsc/entry.js.map +1 -1
  161. package/build/rsc/exports.d.ts +0 -1
  162. package/build/rsc/exports.d.ts.map +1 -1
  163. package/build/rsc/exports.js +18 -18
  164. package/build/rsc/exports.js.map +1 -1
  165. package/build/rsc/middleware.js +2 -3
  166. package/build/rsc/middleware.js.map +1 -1
  167. package/build/rsc/path.d.ts.map +1 -1
  168. package/build/rsc/path.js.map +1 -1
  169. package/build/rsc/router/client.d.ts +7 -7
  170. package/build/rsc/router/client.d.ts.map +1 -1
  171. package/build/rsc/router/client.js +4 -4
  172. package/build/rsc/router/client.js.map +1 -1
  173. package/build/rsc/router/common.js +4 -4
  174. package/build/rsc/router/common.js.map +1 -1
  175. package/build/rsc/router/create-expo-pages.d.ts.map +1 -1
  176. package/build/rsc/router/create-expo-pages.js +1 -2
  177. package/build/rsc/router/create-expo-pages.js.map +1 -1
  178. package/build/rsc/router/create-pages.d.ts +1 -3
  179. package/build/rsc/router/create-pages.d.ts.map +1 -1
  180. package/build/rsc/router/create-pages.js +1 -2
  181. package/build/rsc/router/create-pages.js.map +1 -1
  182. package/build/rsc/router/defineRouter.js +2 -3
  183. package/build/rsc/router/defineRouter.js.map +1 -1
  184. package/build/rsc/router/errors.js.map +1 -1
  185. package/build/rsc/router/expo-definedRouter.d.ts +1 -1
  186. package/build/rsc/router/expo-definedRouter.js.map +1 -1
  187. package/build/rsc/router/fetch.js +1 -2
  188. package/build/rsc/router/fetch.js.map +1 -1
  189. package/build/rsc/router/host.d.ts +3 -3
  190. package/build/rsc/router/host.d.ts.map +1 -1
  191. package/build/rsc/router/host.js.map +1 -1
  192. package/build/rsc/router/noopRouter.d.ts +1 -1
  193. package/build/rsc/router/utils.d.ts.map +1 -1
  194. package/build/rsc/router/utils.js.map +1 -1
  195. package/build/rsc/rsc-renderer.js +1 -2
  196. package/build/rsc/rsc-renderer.js.map +1 -1
  197. package/build/rsc/server.d.ts.map +1 -1
  198. package/build/rsc/server.js +5 -5
  199. package/build/rsc/server.js.map +1 -1
  200. package/build/sortRoutes.d.ts.map +1 -1
  201. package/build/sortRoutes.js +2 -3
  202. package/build/sortRoutes.js.map +1 -1
  203. package/build/static/getRootComponent.js +1 -2
  204. package/build/static/getRootComponent.js.map +1 -1
  205. package/build/static/getServerManifest.js +2 -3
  206. package/build/static/getServerManifest.js.map +1 -1
  207. package/build/static/html.js +2 -3
  208. package/build/static/html.js.map +1 -1
  209. package/build/static/renderStaticContent.js +19 -9
  210. package/build/static/renderStaticContent.js.map +1 -1
  211. package/build/testing-library/context-stubs.d.ts +1 -2
  212. package/build/testing-library/context-stubs.d.ts.map +1 -1
  213. package/build/testing-library/context-stubs.js +3 -3
  214. package/build/testing-library/context-stubs.js.map +1 -1
  215. package/build/testing-library/index.d.ts.map +1 -1
  216. package/build/testing-library/index.js +2 -2
  217. package/build/testing-library/index.js.map +1 -1
  218. package/build/testing-library/mock-config.js +2 -3
  219. package/build/testing-library/mock-config.js.map +1 -1
  220. package/build/testing-library/mocks.js.map +1 -1
  221. package/build/testing-library/require-context-ponyfill.js +1 -1
  222. package/build/testing-library/require-context-ponyfill.js.map +1 -1
  223. package/build/typed-routes/generate.js +4 -5
  224. package/build/typed-routes/generate.js.map +1 -1
  225. package/build/typed-routes/index.d.ts.map +1 -1
  226. package/build/typed-routes/index.js +2 -2
  227. package/build/typed-routes/index.js.map +1 -1
  228. package/build/ui/Slot.d.ts +0 -1
  229. package/build/ui/Slot.d.ts.map +1 -1
  230. package/build/ui/TabContext.d.ts +47 -55
  231. package/build/ui/TabContext.d.ts.map +1 -1
  232. package/build/ui/TabList.js +2 -3
  233. package/build/ui/TabList.js.map +1 -1
  234. package/build/ui/TabRouter.d.ts +27 -27
  235. package/build/ui/TabRouter.d.ts.map +1 -1
  236. package/build/ui/TabRouter.js +18 -9
  237. package/build/ui/TabRouter.js.map +1 -1
  238. package/build/ui/TabSlot.js +4 -5
  239. package/build/ui/TabSlot.js.map +1 -1
  240. package/build/ui/TabTrigger.js +3 -4
  241. package/build/ui/TabTrigger.js.map +1 -1
  242. package/build/ui/Tabs.d.ts +73 -78
  243. package/build/ui/Tabs.d.ts.map +1 -1
  244. package/build/ui/Tabs.js +3 -4
  245. package/build/ui/Tabs.js.map +1 -1
  246. package/build/ui/common.d.ts +2 -3
  247. package/build/ui/common.d.ts.map +1 -1
  248. package/build/ui/common.js +3 -3
  249. package/build/ui/common.js.map +1 -1
  250. package/build/ui/useComponent.d.ts.map +1 -1
  251. package/build/ui/useComponent.js +1 -2
  252. package/build/ui/useComponent.js.map +1 -1
  253. package/build/useDeprecated.js +2 -3
  254. package/build/useDeprecated.js.map +1 -1
  255. package/build/useFocusEffect.js +18 -9
  256. package/build/useFocusEffect.js.map +1 -1
  257. package/build/useNavigation.js +1 -2
  258. package/build/useNavigation.js.map +1 -1
  259. package/build/useScreens.js +5 -6
  260. package/build/useScreens.js.map +1 -1
  261. package/build/utils/splash.js +5 -6
  262. package/build/utils/splash.js.map +1 -1
  263. package/build/utils/url.js +3 -4
  264. package/build/utils/url.js.map +1 -1
  265. package/build/views/EmptyRoute.js +1 -2
  266. package/build/views/EmptyRoute.js.map +1 -1
  267. package/build/views/ErrorBoundary.d.ts +0 -1
  268. package/build/views/ErrorBoundary.d.ts.map +1 -1
  269. package/build/views/ErrorBoundary.js +1 -2
  270. package/build/views/ErrorBoundary.js.map +1 -1
  271. package/build/views/Navigator.js +22 -12
  272. package/build/views/Navigator.js.map +1 -1
  273. package/build/views/Pressable.d.ts.map +1 -1
  274. package/build/views/Screen.js +1 -2
  275. package/build/views/Screen.js.map +1 -1
  276. package/build/views/Sitemap.js +2 -3
  277. package/build/views/Sitemap.js.map +1 -1
  278. package/build/views/SuspenseFallback.js +1 -2
  279. package/build/views/SuspenseFallback.js.map +1 -1
  280. package/build/views/Toast.js +3 -3
  281. package/build/views/Toast.js.map +1 -1
  282. package/build/views/Try.js +17 -7
  283. package/build/views/Try.js.map +1 -1
  284. package/build/views/Unmatched.js +1 -2
  285. package/build/views/Unmatched.js.map +1 -1
  286. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"getReactNavigationConfig.js","sourceRoot":"","sources":["../src/getReactNavigationConfig.ts"],"names":[],"mappings":";;;AACA,yCAAyE;AAWzE,sBAAsB;AACtB,mBAAmB;AACnB,SAAS,oCAAoC,CAAC,OAAe;IAC3D,wEAAwE;IACxE,IAAI,OAAO,KAAK,OAAO,EAAE;QACvB,OAAO,EAAE,CAAC;KACX;IACD,IAAI,OAAO,KAAK,YAAY,EAAE;QAC5B,OAAO,YAAY,CAAC;KACrB;IAED,MAAM,IAAI,GAAG,IAAA,oCAAyB,EAAC,OAAO,CAAC,CAAC;IAChD,IAAI,IAAI,IAAI,IAAI,EAAE;QAChB,OAAO,GAAG,GAAG,IAAI,CAAC;KACnB;IACD,MAAM,WAAW,GAAG,IAAA,2BAAgB,EAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,WAAW,IAAI,IAAI,EAAE;QACvB,OAAO,IAAI,WAAW,EAAE,CAAC;KAC1B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,OAAO;IACL,gEAAgE;IAChE,yDAAyD;IACzD,qEAAqE;IACrE,QAAQ;SACL,KAAK,CAAC,GAAG,CAAC;QACX,qDAAqD;SACpD,GAAG,CAAC,oCAAoC,CAAC;QAC1C,sDAAsD;SACrD,MAAM,CAAC,OAAO,CAAC;QAChB,4BAA4B;SAC3B,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC;AAdD,gDAcC;AAED,SAAS,wBAAwB,CAAC,IAAe,EAAE,QAAiB;IAClE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE;QACzB,IAAI,CAAC,QAAQ,EAAE;YACb,OAAO;gBACL,IAAI;gBACJ,OAAO,EAAE,EAAE;gBACX,MAAM,EAAE,IAAI;aACb,CAAC;SACH;QACD,OAAO,IAAI,CAAC;KACb;IACD,MAAM,OAAO,GAAG,+BAA+B,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAEzE,MAAM,MAAM,GAAW;QACrB,IAAI;QACJ,OAAO;KACR,CAAC;IAEF,IAAI,IAAI,CAAC,gBAAgB,EAAE;QACzB,mEAAmE;QACnE,kEAAkE;QAClE,6EAA6E;QAC7E,2CAA2C;QAC3C,MAAM,CAAC,gBAAgB,GAAG,IAAI,CAAC,gBAAgB,CAAC;KACjD;IAED,IAAI,CAAC,QAAQ,EAAE;QACb,MAAM,CAAC,MAAM,GAAG,IAAI,CAAC;KACtB;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,+BAA+B,CAC7C,KAAkB,EAClB,QAAiB;IAEjB,OAAO,MAAM,CAAC,WAAW,CACvB,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,wBAAwB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAU,CAAC,CACrF,CAAC;AACJ,CAAC;AAPD,0EAOC;AAED,SAAgB,wBAAwB,CAAC,MAAiB,EAAE,QAAiB;IAC3E,MAAM,MAAM,GAAG;QACb,gBAAgB,EAAE,SAAS;QAC3B,OAAO,EAAE,+BAA+B,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC;KACpE,CAAC;IAEF,IAAI,MAAM,CAAC,gBAAgB,EAAE;QAC3B,yFAAyF;QACzF,yEAAyE;QACzE,MAAM,CAAC,gBAAgB,GAAG,MAAM,CAAC,gBAAuB,CAAC;KAC1D;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAZD,4DAYC","sourcesContent":["import type { RouteNode } from './Route';\nimport { matchDeepDynamicRouteName, matchDynamicName } from './matchers';\n\nexport type Screen =\n | string\n | {\n path: string;\n screens: Record<string, Screen>;\n _route?: RouteNode;\n initialRouteName?: string;\n };\n\n// `[page]` -> `:page`\n// `page` -> `page`\nfunction convertDynamicRouteToReactNavigation(segment: string): string {\n // NOTE(EvanBacon): To support shared routes we preserve group segments.\n if (segment === 'index') {\n return '';\n }\n if (segment === '+not-found') {\n return '*not-found';\n }\n\n const rest = matchDeepDynamicRouteName(segment);\n if (rest != null) {\n return '*' + rest;\n }\n const dynamicName = matchDynamicName(segment);\n\n if (dynamicName != null) {\n return `:${dynamicName}`;\n }\n\n return segment;\n}\n\nexport function parseRouteSegments(segments: string): string {\n return (\n // NOTE(EvanBacon): When there are nested routes without layouts\n // the node.route will be something like `app/home/index`\n // this needs to be split to ensure each segment is parsed correctly.\n segments\n .split('/')\n // Convert each segment to a React Navigation format.\n .map(convertDynamicRouteToReactNavigation)\n // Remove any empty paths from groups or index routes.\n .filter(Boolean)\n // Join to return as a path.\n .join('/')\n );\n}\n\nfunction convertRouteNodeToScreen(node: RouteNode, metaOnly: boolean): Screen {\n const path = parseRouteSegments(node.route);\n if (!node.children.length) {\n if (!metaOnly) {\n return {\n path,\n screens: {},\n _route: node,\n };\n }\n return path;\n }\n const screens = getReactNavigationScreensConfig(node.children, metaOnly);\n\n const screen: Screen = {\n path,\n screens,\n };\n\n if (node.initialRouteName) {\n // NOTE(EvanBacon): This is bad because it forces all Layout Routes\n // to be loaded into memory. We should move towards a system where\n // the initial route name is either loaded asynchronously in the Layout Route\n // or defined via a file system convention.\n screen.initialRouteName = node.initialRouteName;\n }\n\n if (!metaOnly) {\n screen._route = node;\n }\n\n return screen;\n}\n\nexport function getReactNavigationScreensConfig(\n nodes: RouteNode[],\n metaOnly: boolean\n): Record<string, Screen> {\n return Object.fromEntries(\n nodes.map((node) => [node.route, convertRouteNodeToScreen(node, metaOnly)] as const)\n );\n}\n\nexport function getReactNavigationConfig(routes: RouteNode, metaOnly: boolean) {\n const config = {\n initialRouteName: undefined,\n screens: getReactNavigationScreensConfig(routes.children, metaOnly),\n };\n\n if (routes.initialRouteName) {\n // We're using LinkingOptions the generic type is `object` instead of a proper ParamList.\n // So we need to cast the initialRouteName to `any` to avoid type errors.\n config.initialRouteName = routes.initialRouteName as any;\n }\n return config;\n}\n"]}
1
+ {"version":3,"file":"getReactNavigationConfig.js","sourceRoot":"","sources":["../src/getReactNavigationConfig.ts"],"names":[],"mappings":";;AAoCA,gDAcC;AAoCD,0EAOC;AAED,4DAYC;AA1GD,yCAAyE;AAWzE,sBAAsB;AACtB,mBAAmB;AACnB,SAAS,oCAAoC,CAAC,OAAe;IAC3D,wEAAwE;IACxE,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;QACxB,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,OAAO,KAAK,YAAY,EAAE,CAAC;QAC7B,OAAO,YAAY,CAAC;IACtB,CAAC;IAED,MAAM,IAAI,GAAG,IAAA,oCAAyB,EAAC,OAAO,CAAC,CAAC;IAChD,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;QACjB,OAAO,GAAG,GAAG,IAAI,CAAC;IACpB,CAAC;IACD,MAAM,WAAW,GAAG,IAAA,2BAAgB,EAAC,OAAO,CAAC,CAAC;IAE9C,IAAI,WAAW,IAAI,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,OAAO;IACL,gEAAgE;IAChE,yDAAyD;IACzD,qEAAqE;IACrE,QAAQ;SACL,KAAK,CAAC,GAAG,CAAC;QACX,qDAAqD;SACpD,GAAG,CAAC,oCAAoC,CAAC;QAC1C,sDAAsD;SACrD,MAAM,CAAC,OAAO,CAAC;QAChB,4BAA4B;SAC3B,IAAI,CAAC,GAAG,CAAC,CACb,CAAC;AACJ,CAAC;AAED,SAAS,wBAAwB,CAAC,IAAe,EAAE,QAAiB;IAClE,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC5C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D,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { RouteNode } from './Route';\nimport { matchDeepDynamicRouteName, matchDynamicName } from './matchers';\n\nexport type Screen =\n | string\n | {\n path: string;\n screens: Record<string, Screen>;\n _route?: RouteNode;\n initialRouteName?: string;\n };\n\n// `[page]` -> `:page`\n// `page` -> `page`\nfunction convertDynamicRouteToReactNavigation(segment: string): string {\n // NOTE(EvanBacon): To support shared routes we preserve group segments.\n if (segment === 'index') {\n return '';\n }\n if (segment === '+not-found') {\n return '*not-found';\n }\n\n const rest = matchDeepDynamicRouteName(segment);\n if (rest != null) {\n return '*' + rest;\n }\n const dynamicName = matchDynamicName(segment);\n\n if (dynamicName != null) {\n return `:${dynamicName}`;\n }\n\n return segment;\n}\n\nexport function parseRouteSegments(segments: string): string {\n return (\n // NOTE(EvanBacon): When there are nested routes without layouts\n // the node.route will be something like `app/home/index`\n // this needs to be split to ensure each segment is parsed correctly.\n segments\n .split('/')\n // Convert each segment to a React Navigation format.\n .map(convertDynamicRouteToReactNavigation)\n // Remove any empty paths from groups or index routes.\n .filter(Boolean)\n // Join to return as a path.\n .join('/')\n );\n}\n\nfunction convertRouteNodeToScreen(node: RouteNode, metaOnly: boolean): Screen {\n const path = parseRouteSegments(node.route);\n if (!node.children.length) {\n if (!metaOnly) {\n return {\n path,\n screens: {},\n _route: node,\n };\n }\n return path;\n }\n const screens = getReactNavigationScreensConfig(node.children, metaOnly);\n\n const screen: Screen = {\n path,\n screens,\n };\n\n if (node.initialRouteName) {\n // NOTE(EvanBacon): This is bad because it forces all Layout Routes\n // to be loaded into memory. We should move towards a system where\n // the initial route name is either loaded asynchronously in the Layout Route\n // or defined via a file system convention.\n screen.initialRouteName = node.initialRouteName;\n }\n\n if (!metaOnly) {\n screen._route = node;\n }\n\n return screen;\n}\n\nexport function getReactNavigationScreensConfig(\n nodes: RouteNode[],\n metaOnly: boolean\n): Record<string, Screen> {\n return Object.fromEntries(\n nodes.map((node) => [node.route, convertRouteNodeToScreen(node, metaOnly)] as const)\n );\n}\n\nexport function getReactNavigationConfig(routes: RouteNode, metaOnly: boolean) {\n const config = {\n initialRouteName: undefined,\n screens: getReactNavigationScreensConfig(routes.children, metaOnly),\n };\n\n if (routes.initialRouteName) {\n // We're using LinkingOptions the generic type is `object` instead of a proper ParamList.\n // So we need to cast the initialRouteName to `any` to avoid type errors.\n config.initialRouteName = routes.initialRouteName as any;\n }\n return config;\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIgnoreList = exports.extrapolateGroups = exports.generateDynamic = exports.getExactRoutes = exports.getRoutes = void 0;
3
+ exports.getIgnoreList = exports.extrapolateGroups = exports.generateDynamic = void 0;
4
+ exports.getRoutes = getRoutes;
5
+ exports.getExactRoutes = getExactRoutes;
4
6
  const getRoutesCore_1 = require("./getRoutesCore");
5
7
  /**
6
8
  * Given a Metro context module, return an array of nested routes.
@@ -75,14 +77,12 @@ function getRoutes(contextModule, options = {}) {
75
77
  ...options,
76
78
  });
77
79
  }
78
- exports.getRoutes = getRoutes;
79
80
  function getExactRoutes(contextModule, options = {}) {
80
81
  return getRoutes(contextModule, {
81
82
  ...options,
82
83
  skipGenerated: true,
83
84
  });
84
85
  }
85
- exports.getExactRoutes = getExactRoutes;
86
86
  var getRoutesCore_2 = require("./getRoutesCore");
87
87
  Object.defineProperty(exports, "generateDynamic", { enumerable: true, get: function () { return getRoutesCore_2.generateDynamic; } });
88
88
  Object.defineProperty(exports, "extrapolateGroups", { enumerable: true, get: function () { return getRoutesCore_2.extrapolateGroups; } });
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":";;;AACA,mDAA0F;AAI1F;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,UAAmB,EAAE;IAC5E,OAAO,IAAA,yBAAa,EAAC,aAAa,EAAE;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AI,EAAE,YAAY,EAAE,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;oBAC7D,QAAQ,EAAE,EAAE;iBACb,CAAC;aACH;iBAAM,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,SAAS,CAAC,IAAI,QAAQ,EAAE;gBAClE,OAAO;oBACL,GAAG,QAAQ;oBACX,SAAS;wBACP,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;oBAClE,CAAC;iBACF,CAAC;aACH;YACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,cAAc,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAzDD,8BAyDC;AAED,SAAgB,cAAc,CAC5B,aAA6B,EAC7B,UAAmB,EAAE;IAErB,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AARD,wCAQC;AAED,iDAAoF;AAA3E,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,8GAAA,aAAa,OAAA","sourcesContent":["import type { RouteNode } from './Route';\nimport { getRoutes as getRoutesCore, type Options as OptionsCore } from './getRoutesCore';\nimport type { RequireContext } from './types';\n\nexport type Options = Omit<OptionsCore, 'getSystemRoute'>;\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options = {}): RouteNode | null {\n return getRoutesCore(contextModule, {\n getSystemRoute({ route, type }, defaults) {\n if (route === '' && type === 'layout') {\n // Root layout when no layout is defined.\n return {\n type: 'layout',\n loadRoute: () => ({\n default: (require('./views/Navigator') as typeof import('./views/Navigator'))\n .DefaultNavigator,\n }),\n // Generate a fake file name for the directory\n contextKey: 'expo-router/build/views/Navigator.js',\n route: '',\n generated: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '_sitemap' && type === 'route') {\n return {\n loadRoute() {\n const { Sitemap, getNavOptions } = require('./views/Sitemap');\n return { default: Sitemap, getNavOptions };\n },\n route: '_sitemap',\n type: 'route',\n contextKey: 'expo-router/build/views/Sitemap.js',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '+not-found' && type === 'route') {\n return {\n loadRoute() {\n return { default: require('./views/Unmatched').Unmatched };\n },\n type: 'route',\n route: '+not-found',\n contextKey: 'expo-router/build/views/Unmatched.js',\n generated: true,\n internal: true,\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n };\n } else if ((type === 'redirect' || type === 'rewrite') && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return require('./getRoutesRedirects').getRedirectModule(route);\n },\n };\n }\n throw new Error(`Unknown system route: ${route} and type: ${type}`);\n },\n ...options,\n });\n}\n\nexport function getExactRoutes(\n contextModule: RequireContext,\n options: Options = {}\n): RouteNode | null {\n return getRoutes(contextModule, {\n ...options,\n skipGenerated: true,\n });\n}\n\nexport { generateDynamic, extrapolateGroups, getIgnoreList } from './getRoutesCore';\n"]}
1
+ {"version":3,"file":"getRoutes.js","sourceRoot":"","sources":["../src/getRoutes.ts"],"names":[],"mappings":";;;AAiBA,8BAyDC;AAED,wCAQC;AAnFD,mDAA0F;AAI1F;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,UAAmB,EAAE;IAC5E,OAAO,IAAA,yBAAa,EAAC,aAAa,EAAE;QAClC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ;YACtC,IAAI,KAAK,KAAK,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EAAE,IAAI,EAAE,CAAC;oBAC7D,QAAQ,EAAE,EAAE;iBACb,CAAC;YACJ,CAAC;iBAAM,IAAI,CAAC,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,SAAS,CAAC,IAAI,QAAQ,EAAE,CAAC;gBACnE,OAAO;oBACL,GAAG,QAAQ;oBACX,SAAS;wBACP,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;oBAClE,CAAC;iBACF,CAAC;YACJ,CAAC;YACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,cAAc,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,cAAc,CAC5B,aAA6B,EAC7B,UAAmB,EAAE;IAErB,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,iDAAoF;AAA3E,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,8GAAA,aAAa,OAAA","sourcesContent":["import type { RouteNode } from './Route';\nimport { getRoutes as getRoutesCore, type Options as OptionsCore } from './getRoutesCore';\nimport type { RequireContext } from './types';\n\nexport type Options = Omit<OptionsCore, 'getSystemRoute'>;\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options = {}): RouteNode | null {\n return getRoutesCore(contextModule, {\n getSystemRoute({ route, type }, defaults) {\n if (route === '' && type === 'layout') {\n // Root layout when no layout is defined.\n return {\n type: 'layout',\n loadRoute: () => ({\n default: (require('./views/Navigator') as typeof import('./views/Navigator'))\n .DefaultNavigator,\n }),\n // Generate a fake file name for the directory\n contextKey: 'expo-router/build/views/Navigator.js',\n route: '',\n generated: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '_sitemap' && type === 'route') {\n return {\n loadRoute() {\n const { Sitemap, getNavOptions } = require('./views/Sitemap');\n return { default: Sitemap, getNavOptions };\n },\n route: '_sitemap',\n type: 'route',\n contextKey: 'expo-router/build/views/Sitemap.js',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '+not-found' && type === 'route') {\n return {\n loadRoute() {\n return { default: require('./views/Unmatched').Unmatched };\n },\n type: 'route',\n route: '+not-found',\n contextKey: 'expo-router/build/views/Unmatched.js',\n generated: true,\n internal: true,\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n };\n } else if ((type === 'redirect' || type === 'rewrite') && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return require('./getRoutesRedirects').getRedirectModule(route);\n },\n };\n }\n throw new Error(`Unknown system route: ${route} and type: ${type}`);\n },\n ...options,\n });\n}\n\nexport function getExactRoutes(\n contextModule: RequireContext,\n options: Options = {}\n): RouteNode | null {\n return getRoutes(contextModule, {\n ...options,\n skipGenerated: true,\n });\n}\n\nexport { generateDynamic, extrapolateGroups, getIgnoreList } from './getRoutesCore';\n"]}
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.generateDynamic = exports.extrapolateGroups = exports.getIgnoreList = exports.getRoutes = void 0;
3
+ exports.getRoutes = getRoutes;
4
+ exports.getIgnoreList = getIgnoreList;
5
+ exports.extrapolateGroups = extrapolateGroups;
6
+ exports.generateDynamic = generateDynamic;
4
7
  const matchers_1 = require("./matchers");
5
8
  const url_1 = require("./utils/url");
6
9
  const validPlatforms = new Set(['android', 'ios', 'native', 'web']);
@@ -28,7 +31,6 @@ function getRoutes(contextModule, options) {
28
31
  }
29
32
  return rootNode;
30
33
  }
31
- exports.getRoutes = getRoutes;
32
34
  /**
33
35
  * Converts the RequireContext keys (file paths) into a directory tree.
34
36
  */
@@ -180,7 +182,7 @@ function getDirectoryTree(contextModule, options) {
180
182
  return routeModule;
181
183
  },
182
184
  contextKey: filePath,
183
- route: '',
185
+ route: '', // This is overwritten during hoisting based upon the _layout
184
186
  dynamic: null,
185
187
  children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting
186
188
  };
@@ -450,7 +452,6 @@ function getIgnoreList(options) {
450
452
  }
451
453
  return ignore;
452
454
  }
453
- exports.getIgnoreList = getIgnoreList;
454
455
  /**
455
456
  * Generates a set of strings which have the router array syntax extrapolated.
456
457
  *
@@ -476,7 +477,6 @@ function extrapolateGroups(key, keys = new Set()) {
476
477
  }
477
478
  return keys;
478
479
  }
479
- exports.extrapolateGroups = extrapolateGroups;
480
480
  function generateDynamic(path) {
481
481
  const dynamic = path
482
482
  .split('/')
@@ -497,7 +497,6 @@ function generateDynamic(path) {
497
497
  .filter((part) => !!part);
498
498
  return dynamic.length === 0 ? null : dynamic;
499
499
  }
500
- exports.generateDynamic = generateDynamic;
501
500
  function appendSitemapRoute(directory, options) {
502
501
  if (!directory.files.has('_sitemap') && options.getSystemRoute) {
503
502
  directory.files.set('_sitemap', [
@@ -553,7 +552,7 @@ function getLayoutNode(node, options) {
553
552
  return {
554
553
  ...node,
555
554
  route: node.route.replace(/\/?_layout$/, ''),
556
- children: [],
555
+ children: [], // Each layout should have its own children
557
556
  initialRouteName: anchor,
558
557
  };
559
558
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;;AACA,yCAUoB;AAEpB,qCAAmD;AA8CnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SA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I,CAAC,CAAC;gBAEd,IAAI,SAAS,EAAE;oBACb,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,iBAAiB,SAAS,0BAA0B,iBAAiB,EAAE,CAC/H,CAAC;iBACH;qBAAM;oBACL,MAAM,IAAI,KAAK,CACb,UAAU,IAAI,CAAC,UAAU,wBAAwB,MAAM,yBAAyB,iBAAiB,EAAE,CACpG,CAAC;iBACH;aACF;YAED,2GAA2G;YAC3G,IAAI,CAAC,gBAAgB,GAAG,MAAM,CAAC;YAC/B,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;SAC1C;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,wCAAwC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;SACvE;KACF;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE;QACd,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;KACH;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (route: Pick<RouteNode, 'route' | 'type'>, defaults?: RouteNode) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: [string, string][] | undefined;\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n // Remove the leading `./` or `/`\n const source = redirect.source.replace(/^\\.?\\//, '');\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestination = isExternalRedirect\n ? redirect.destination\n : stripInvisibleSegmentsFromPath(\n removeFileSystemDots(\n removeFileSystemExtensions(redirect.destination.replace(/^\\.?\\/?/, ''))\n )\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = isExternalRedirect\n ? targetDestination\n : validRedirectDestinations.find((key) => key[0] === targetDestination)?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n const fakeContextKey = removeFileSystemDots(removeSupportedExtensions(source));\n contextKeys.push(fakeContextKey);\n redirects[fakeContextKey] = {\n source,\n destination,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n // Remove the leading `./` or `/`\n const source = rewrite.source.replace(/^\\.?\\//, '');\n const targetDestination = stripInvisibleSegmentsFromPath(\n removeFileSystemDots(removeSupportedExtensions(rewrite.destination))\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = validRedirectDestinations.find(\n (key) => key[0] === targetDestination\n )?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n // Add a fake context key\n const fakeContextKey = `./${source}.tsx`;\n contextKeys.push(fakeContextKey);\n rewrites[fakeContextKey] = { source, destination, methods: rewrite.methods };\n }\n }\n }\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n node.destinationContextKey = redirects[filePath].destination;\n node.permanent = redirects[filePath].permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'redirect',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'redirect';\n }\n\n if (meta.isRewrite) {\n node.destinationContextKey = rewrites[filePath].destination;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'rewrite',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'rewrite';\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RedirectConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Please rename to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `Api routes cannot have platform extensions. Please remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\nexport function getIgnoreList(options?: Options) {\n const ignore: RegExp[] = [/^\\.\\/\\+html\\.[tj]sx?$/, ...(options?.ignore ?? [])];\n if (options?.preserveApiRoutes !== true) {\n ignore.push(/\\+api\\.[tj]sx?$/);\n }\n return ignore;\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n\n const deepDynamicName = matchDeepDynamicRouteName(part);\n const dynamicName = deepDynamicName ?? matchDynamicName(part);\n\n if (!dynamicName) return null;\n return { name: dynamicName, deep: !!deepDynamicName };\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
1
+ {"version":3,"file":"getRoutesCore.js","sourceRoot":"","sources":["../src/getRoutesCore.ts"],"names":[],"mappings":";;AAyEA,8BAeC;AA2gBD,sCAMC;AAOD,8CAwBC;AAED,0CAqBC;AA9pBD,yCAUoB;AAEpB,qCAAmD;AA8CnD,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,OAAgB;IACvE,MAAM,aAAa,GAAG,gBAAgB,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAE/D,yBAAyB;IACzB,IAAI,CAAC,aAAa,EAAE,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,QAAQ,GAAG,4BAA4B,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;IAEtE,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,CAAC;QAC/B,wCAA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AAW,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;QAC3C,CAAC;QAED,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAClC,wCAAwC,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;AACH,CAAC;AAED,SAAS,eAAe,CAAC,MAAmB;IAC1C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,YAAY,KAAK,CAAC,UAAU,sEAAsE,CACnG,CAAC;IACJ,CAAC;IAED,wFAAwF;IACxF,4CAA4C;IAC5C,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnC,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\nimport {\n matchArrayGroupName,\n matchDeepDynamicRouteName,\n matchDynamicName,\n matchGroupName,\n matchLastGroupName,\n removeFileSystemDots,\n removeFileSystemExtensions,\n removeSupportedExtensions,\n stripInvisibleSegmentsFromPath,\n} from './matchers';\nimport type { RequireContext } from './types';\nimport { shouldLinkExternally } from './utils/url';\n\nexport type Options = {\n ignore?: RegExp[];\n preserveApiRoutes?: boolean;\n ignoreRequireErrors?: boolean;\n ignoreEntryPoints?: boolean;\n /* Used to simplify testing for toEqual() comparison */\n internal_stripLoadRoute?: boolean;\n /* Used to simplify by skipping the generated routes */\n skipGenerated?: boolean;\n /* Skip the generated not found route */\n notFound?: boolean;\n importMode?: string;\n platformRoutes?: boolean;\n sitemap?: boolean;\n platform?: string;\n redirects?: RedirectConfig[];\n rewrites?: RewriteConfig[];\n /* Keep redirects as valid routes within the RouteConfig tree */\n preserveRedirectAndRewrites?: boolean;\n\n /** Get the system route for a location. Useful for shimming React Native imports in SSR environments. */\n getSystemRoute: (route: Pick<RouteNode, 'route' | 'type'>, defaults?: RouteNode) => RouteNode;\n};\n\ntype DirectoryNode = {\n layout?: RouteNode[];\n files: Map<string, RouteNode[]>;\n subdirectories: Map<string, DirectoryNode>;\n};\n\nexport type RedirectConfig = {\n source: string;\n destination: string;\n permanent?: boolean;\n methods?: string[];\n external?: boolean;\n};\n\nexport type RewriteConfig = {\n source: string;\n destination: string;\n methods?: string[];\n};\n\nconst validPlatforms = new Set(['android', 'ios', 'native', 'web']);\n\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options): RouteNode | null {\n const directoryTree = getDirectoryTree(contextModule, options);\n\n // If there are no routes\n if (!directoryTree) {\n return null;\n }\n\n const rootNode = flattenDirectoryTreeToRoutes(directoryTree, options);\n\n if (!options.ignoreEntryPoints) {\n crawlAndAppendInitialRoutesAndEntryFiles(rootNode, options);\n }\n\n return rootNode;\n}\n\n/**\n * Converts the RequireContext keys (file paths) into a directory tree.\n */\nfunction getDirectoryTree(contextModule: RequireContext, options: Options) {\n const importMode = options.importMode || process.env.EXPO_ROUTER_IMPORT_MODE;\n\n const ignoreList: RegExp[] = [/^\\.\\/\\+(html|native-intent)\\.[tj]sx?$/]; // Ignore the top level ./+html file\n\n if (options.ignore) {\n ignoreList.push(...options.ignore);\n }\n if (!options.preserveApiRoutes) {\n ignoreList.push(/\\+api$/, /\\+api\\.[tj]sx?$/);\n }\n\n const rootDirectory: DirectoryNode = {\n files: new Map(),\n subdirectories: new Map(),\n };\n\n let hasRoutes = false;\n let isValid = false;\n\n const contextKeys = contextModule.keys();\n const redirects: Record<string, RedirectConfig> = {};\n const rewrites: Record<string, RewriteConfig> = {};\n\n let validRedirectDestinations: [string, string][] | undefined;\n\n // If we are keeping redirects as valid routes, then we need to add them to the contextKeys\n // This is useful for generating a sitemap with redirects, or static site generation that includes redirects\n if (options.preserveRedirectAndRewrites) {\n if (options.redirects) {\n for (const redirect of options.redirects) {\n // Remove the leading `./` or `/`\n const source = redirect.source.replace(/^\\.?\\//, '');\n\n const isExternalRedirect = shouldLinkExternally(redirect.destination);\n\n const targetDestination = isExternalRedirect\n ? redirect.destination\n : stripInvisibleSegmentsFromPath(\n removeFileSystemDots(\n removeFileSystemExtensions(redirect.destination.replace(/^\\.?\\/?/, ''))\n )\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = isExternalRedirect\n ? targetDestination\n : validRedirectDestinations.find((key) => key[0] === targetDestination)?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${redirect.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n const fakeContextKey = removeFileSystemDots(removeSupportedExtensions(source));\n contextKeys.push(fakeContextKey);\n redirects[fakeContextKey] = {\n source,\n destination,\n permanent: Boolean(redirect.permanent),\n external: isExternalRedirect,\n methods: redirect.methods,\n };\n }\n }\n\n if (options.rewrites) {\n for (const rewrite of options.rewrites) {\n // Remove the leading `./` or `/`\n const source = rewrite.source.replace(/^\\.?\\//, '');\n const targetDestination = stripInvisibleSegmentsFromPath(\n removeFileSystemDots(removeSupportedExtensions(rewrite.destination))\n );\n\n const normalizedSource = removeFileSystemDots(removeSupportedExtensions(source));\n\n if (ignoreList.some((regex) => regex.test(normalizedSource))) {\n continue;\n }\n\n // Loop over this once and cache the valid destinations\n validRedirectDestinations ??= contextKeys.map((key) => {\n return [\n stripInvisibleSegmentsFromPath(removeFileSystemDots(removeSupportedExtensions(key))),\n key,\n ];\n });\n\n const destination = validRedirectDestinations.find(\n (key) => key[0] === targetDestination\n )?.[1];\n\n if (!destination) {\n /*\n * Only throw the error when we are preserving the api routes\n * When doing a static export, API routes will not exist so the redirect destination may not exist.\n * The desired behavior for this error is to warn the user when running `expo start`, so its ok if\n * `expo export` swallows this error.\n */\n if (options.preserveApiRoutes) {\n throw new Error(`Redirect destination \"${rewrite.destination}\" does not exist.`);\n }\n\n continue;\n }\n\n // Add a fake context key\n const fakeContextKey = `./${source}.tsx`;\n contextKeys.push(fakeContextKey);\n rewrites[fakeContextKey] = { source, destination, methods: rewrite.methods };\n }\n }\n }\n\n for (const filePath of contextKeys) {\n if (ignoreList.some((regex) => regex.test(filePath))) {\n continue;\n }\n\n isValid = true;\n\n const meta = getFileMeta(filePath, options, redirects, rewrites);\n\n // This is a file that should be ignored. e.g maybe it has an invalid platform?\n if (meta.specificity < 0) {\n continue;\n }\n\n let node: RouteNode = {\n type: meta.isApi ? 'api' : meta.isLayout ? 'layout' : 'route',\n loadRoute() {\n let routeModule: any;\n if (options.ignoreRequireErrors) {\n try {\n routeModule = contextModule(filePath);\n } catch {\n routeModule = {};\n }\n } else {\n routeModule = contextModule(filePath);\n }\n\n if (process.env.NODE_ENV === 'development' && importMode === 'sync') {\n // In development mode, when async routes are disabled, add some extra error handling to improve the developer experience.\n // This can be useful when you accidentally use an async function in a route file for the default export.\n if (routeModule instanceof Promise) {\n throw new Error(\n `Route \"${filePath}\" cannot be a promise when async routes is disabled.`\n );\n }\n\n const defaultExport = routeModule?.default;\n if (defaultExport instanceof Promise) {\n throw new Error(\n `The default export from route \"${filePath}\" is a promise. Ensure the React Component does not use async or promises.`\n );\n }\n\n // check if default is an async function without invoking it\n if (\n defaultExport instanceof Function &&\n // This only works on web because Hermes support async functions so we have to transform them out.\n defaultExport.constructor.name === 'AsyncFunction'\n ) {\n throw new Error(\n `The default export from route \"${filePath}\" is an async function. Ensure the React Component does not use async or promises.`\n );\n }\n }\n\n return routeModule;\n },\n contextKey: filePath,\n route: '', // This is overwritten during hoisting based upon the _layout\n dynamic: null,\n children: [], // While we are building the directory tree, we don't know the node's children just yet. This is added during hoisting\n };\n\n if (meta.isRedirect) {\n node.destinationContextKey = redirects[filePath].destination;\n node.permanent = redirects[filePath].permanent;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'redirect',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'redirect';\n }\n\n if (meta.isRewrite) {\n node.destinationContextKey = rewrites[filePath].destination;\n node.generated = true;\n if (node.type === 'route') {\n node = options.getSystemRoute(\n {\n type: 'rewrite',\n route: removeFileSystemDots(removeSupportedExtensions(node.destinationContextKey)),\n },\n node\n );\n }\n if (redirects[filePath].methods) {\n node.methods = redirects[filePath].methods;\n }\n node.type = 'rewrite';\n }\n\n if (process.env.NODE_ENV === 'development') {\n // If the user has set the `EXPO_ROUTER_IMPORT_MODE` to `sync` then we should\n // filter the missing routes.\n if (node.type !== 'api' && importMode === 'sync') {\n const routeItem = node.loadRoute();\n // Have a warning for nullish ex\n const route = routeItem?.default;\n if (route == null) {\n // Do not throw an error since a user may just be creating a new route.\n console.warn(\n `Route \"${filePath}\" is missing the required default export. Ensure a React component is exported as default.`\n );\n continue;\n }\n if (['boolean', 'number', 'string'].includes(typeof route)) {\n throw new Error(\n `The default export from route \"${filePath}\" is an unsupported type: \"${typeof route}\". Only React Components are supported as default exports from route files.`\n );\n }\n }\n }\n\n /**\n * A single filepath may be extrapolated into multiple routes if it contains array syntax.\n * Another way to thinking about is that a filepath node is present in multiple leaves of the directory tree.\n */\n for (const route of extrapolateGroups(meta.route)) {\n // Traverse the directory tree to its leaf node, creating any missing directories along the way\n const subdirectoryParts = route.split('/').slice(0, -1);\n\n // Start at the root directory and traverse the path to the leaf directory\n let directory = rootDirectory;\n\n for (const part of subdirectoryParts) {\n let subDirectory = directory.subdirectories.get(part);\n\n // Create any missing subdirectories\n if (!subDirectory) {\n subDirectory = {\n files: new Map(),\n subdirectories: new Map(),\n };\n directory.subdirectories.set(part, subDirectory);\n }\n\n directory = subDirectory;\n }\n\n // Clone the node for this route\n node = { ...node, route };\n\n if (meta.isLayout) {\n directory.layout ??= [];\n const existing = directory.layout[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The layouts \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n node = getLayoutNode(node, options);\n directory.layout[meta.specificity] = node;\n }\n } else if (meta.isApi) {\n const fileKey = `${route}+api`;\n let nodes = directory.files.get(fileKey);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(fileKey, nodes);\n }\n\n // API Routes have no specificity, they are always the first node\n const existing = nodes[0];\n\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The API route file \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n nodes[0] = node;\n }\n } else {\n let nodes = directory.files.get(route);\n\n if (!nodes) {\n nodes = [];\n directory.files.set(route, nodes);\n }\n\n /**\n * If there is an existing node with the same specificity, then we have a conflict.\n * NOTE(Platform Routes):\n * We cannot check for specificity conflicts here, as we haven't processed all the context keys yet!\n * This will be checked during hoisting, as well as enforcing that all routes have a non-platform route.\n */\n const existing = nodes[meta.specificity];\n if (existing) {\n // In production, use the first route found\n if (process.env.NODE_ENV !== 'production') {\n throw new Error(\n `The route files \"${filePath}\" and \"${existing.contextKey}\" conflict on the route \"/${route}\". Please remove or rename one of these files.`\n );\n }\n } else {\n hasRoutes ||= true;\n nodes[meta.specificity] = node;\n }\n }\n }\n }\n\n // If there are no routes/layouts then we should display the tutorial.\n if (!isValid) {\n return null;\n }\n\n /**\n * If there are no top-level _layout, add a default _layout\n * While this is a generated route, it will still be generated even if skipGenerated is true.\n */\n if (!rootDirectory.layout) {\n rootDirectory.layout = [\n options.getSystemRoute({\n type: 'layout',\n route: '',\n }),\n ];\n }\n\n // Only include the sitemap if there are routes.\n if (!options.skipGenerated) {\n if (hasRoutes && options.sitemap !== false) {\n appendSitemapRoute(rootDirectory, options);\n }\n if (options.notFound !== false) {\n appendNotFoundRoute(rootDirectory, options);\n }\n }\n return rootDirectory;\n}\n\n/**\n * Flatten the directory tree into routes, hoisting routes to the nearest _layout.\n */\nfunction flattenDirectoryTreeToRoutes(\n directory: DirectoryNode,\n options: Options,\n /* The nearest _layout file in the directory tree */\n layout?: RouteNode,\n /* Route names are relative to their layout */\n pathToRemove = ''\n) {\n /**\n * This directory has a _layout file so it becomes the new target for hoisting routes.\n */\n if (directory.layout) {\n const previousLayout = layout;\n layout = getMostSpecific(directory.layout);\n\n // Add the new layout as a child of its parent\n if (previousLayout) {\n previousLayout.children.push(layout);\n }\n\n if (options.internal_stripLoadRoute) {\n delete (layout as any).loadRoute;\n }\n\n // `route` is the absolute pathname. We need to make this relative to the last _layout\n const newRoute = layout.route.replace(pathToRemove, '');\n pathToRemove = layout.route ? `${layout.route}/` : '';\n\n // Now update this layout with the new relative route and dynamic conventions\n layout.route = newRoute;\n layout.dynamic = generateDynamic(layout.contextKey.slice(0));\n }\n\n // This should never occur as there will always be a root layout, but it makes the type system happy\n if (!layout) throw new Error('Expo Router Internal Error: No nearest layout');\n\n for (const routes of directory.files.values()) {\n const routeNode = getMostSpecific(routes);\n\n // `route` is the absolute pathname. We need to make this relative to the nearest layout\n routeNode.route = routeNode.route.replace(pathToRemove, '');\n routeNode.dynamic = generateDynamic(routeNode.route);\n\n if (options.internal_stripLoadRoute) {\n delete (routeNode as any).loadRoute;\n }\n\n layout.children.push(routeNode);\n }\n\n // Recursively flatten the subdirectories\n for (const child of directory.subdirectories.values()) {\n flattenDirectoryTreeToRoutes(child, options, layout, pathToRemove);\n }\n\n return layout;\n}\n\nfunction getFileMeta(\n originalKey: string,\n options: Options,\n redirects: Record<string, RedirectConfig>,\n rewrites: Record<string, RedirectConfig>\n) {\n // Remove the leading `./`\n const key = removeSupportedExtensions(removeFileSystemDots(originalKey));\n let route = key;\n\n const parts = removeFileSystemDots(originalKey).split('/');\n const filename = parts[parts.length - 1];\n const [filenameWithoutExtensions, platformExtension] =\n removeSupportedExtensions(filename).split('.');\n\n const isLayout = filenameWithoutExtensions === '_layout';\n const isApi = originalKey.match(/\\+api\\.(\\w+\\.)?[jt]sx?$/);\n\n if (filenameWithoutExtensions.startsWith('(') && filenameWithoutExtensions.endsWith(')')) {\n throw new Error(`Invalid route ${originalKey}. Routes cannot end with '(group)' syntax`);\n }\n\n // Nested routes cannot start with the '+' character, except for the '+not-found' route\n if (!isApi && filename.startsWith('+') && filenameWithoutExtensions !== '+not-found') {\n const renamedRoute = [...parts.slice(0, -1), filename.slice(1)].join('/');\n throw new Error(\n `Invalid route ${originalKey}. Route nodes cannot start with the '+' character. \"Please rename to ${renamedRoute}\"`\n );\n }\n let specificity = 0;\n\n const hasPlatformExtension = validPlatforms.has(platformExtension);\n const usePlatformRoutes = options.platformRoutes ?? true;\n\n if (hasPlatformExtension) {\n if (!usePlatformRoutes) {\n // If the user has disabled platform routes, then we should ignore this file\n specificity = -1;\n } else if (!options.platform) {\n // If we don't have a platform, then we should ignore this file\n // This used by typed routes, sitemap, etc\n specificity = -1;\n } else if (platformExtension === options.platform) {\n // If the platform extension is the same as the options.platform, then it is the most specific\n specificity = 2;\n } else if (platformExtension === 'native' && options.platform !== 'web') {\n // `native` is allow but isn't as specific as the platform\n specificity = 1;\n } else if (platformExtension !== options.platform) {\n // Somehow we have a platform extension that doesn't match the options.platform and it isn't native\n // This is an invalid file and we will ignore it\n specificity = -1;\n }\n\n if (isApi && specificity !== 0) {\n throw new Error(\n `Api routes cannot have platform extensions. Please remove '.${platformExtension}' from '${originalKey}'`\n );\n }\n\n route = route.replace(new RegExp(`.${platformExtension}$`), '');\n }\n\n return {\n route,\n specificity,\n isLayout,\n isApi,\n isRedirect: key in redirects,\n isRewrite: key in rewrites,\n };\n}\n\nexport function getIgnoreList(options?: Options) {\n const ignore: RegExp[] = [/^\\.\\/\\+html\\.[tj]sx?$/, ...(options?.ignore ?? [])];\n if (options?.preserveApiRoutes !== true) {\n ignore.push(/\\+api\\.[tj]sx?$/);\n }\n return ignore;\n}\n\n/**\n * Generates a set of strings which have the router array syntax extrapolated.\n *\n * /(a,b)/(c,d)/e.tsx => new Set(['a/c/e.tsx', 'a/d/e.tsx', 'b/c/e.tsx', 'b/d/e.tsx'])\n */\nexport function extrapolateGroups(key: string, keys: Set<string> = new Set()): Set<string> {\n const match = matchArrayGroupName(key);\n\n if (!match) {\n keys.add(key);\n return keys;\n }\n const groups = match.split(',');\n const groupsSet = new Set(groups);\n\n if (groupsSet.size !== groups.length) {\n throw new Error(`Array syntax cannot contain duplicate group name \"${groups}\" in \"${key}\".`);\n }\n\n if (groups.length === 1) {\n keys.add(key);\n return keys;\n }\n\n for (const group of groups) {\n extrapolateGroups(key.replace(match, group.trim()), keys);\n }\n\n return keys;\n}\n\nexport function generateDynamic(path: string): DynamicConvention[] | null {\n const dynamic = path\n .split('/')\n .map((part): DynamicConvention | null => {\n if (part === '+not-found') {\n return {\n name: '+not-found',\n deep: true,\n notFound: true,\n };\n }\n\n const deepDynamicName = matchDeepDynamicRouteName(part);\n const dynamicName = deepDynamicName ?? matchDynamicName(part);\n\n if (!dynamicName) return null;\n return { name: dynamicName, deep: !!deepDynamicName };\n })\n .filter((part): part is DynamicConvention => !!part);\n\n return dynamic.length === 0 ? null : dynamic;\n}\n\nfunction appendSitemapRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('_sitemap') && options.getSystemRoute) {\n directory.files.set('_sitemap', [\n options.getSystemRoute({\n type: 'route',\n route: '_sitemap',\n }),\n ]);\n }\n}\n\nfunction appendNotFoundRoute(directory: DirectoryNode, options: Options) {\n if (!directory.files.has('+not-found') && options.getSystemRoute) {\n directory.files.set('+not-found', [\n options.getSystemRoute({\n type: 'route',\n route: '+not-found',\n }),\n ]);\n }\n}\n\nfunction getLayoutNode(node: RouteNode, options: Options) {\n /**\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group name.\n */\n // We may strip loadRoute during testing\n const groupName = matchLastGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n\n return {\n ...node,\n route: node.route.replace(/\\/?_layout$/, ''),\n children: [], // Each layout should have its own children\n initialRouteName: anchor,\n };\n}\n\nfunction crawlAndAppendInitialRoutesAndEntryFiles(\n node: RouteNode,\n options: Options,\n entryPoints: string[] = []\n) {\n if (node.type === 'route') {\n node.entryPoints = [...new Set([...entryPoints, node.contextKey])];\n } else if (node.type === 'redirect') {\n node.entryPoints = [...new Set([...entryPoints, node.destinationContextKey!])];\n } else if (node.type === 'layout') {\n if (!node.children) {\n throw new Error(`Layout \"${node.contextKey}\" does not contain any child routes`);\n }\n\n // Every node below this layout will have it as an entryPoint\n entryPoints = [...entryPoints, node.contextKey];\n\n /**\n * Calculate the initialRouteNode\n *\n * A file called `(a,b)/(c)/_layout.tsx` will generate two _layout routes: `(a)/(c)/_layout` and `(b)/(c)/_layout`.\n * Each of these layouts will have a different anchor based upon the first group.\n */\n const groupName = matchGroupName(node.route);\n const childMatchingGroup = node.children.find((child) => {\n return child.route.replace(/\\/index$/, '') === groupName;\n });\n let anchor = childMatchingGroup?.route;\n // We may strip loadRoute during testing\n if (!options.internal_stripLoadRoute) {\n const loaded = node.loadRoute();\n if (loaded?.unstable_settings) {\n try {\n // Allow unstable_settings={ initialRouteName: '...' } to override the default initial route name.\n anchor =\n loaded.unstable_settings.anchor ?? loaded.unstable_settings.initialRouteName ?? anchor;\n } catch (error: any) {\n if (error instanceof Error) {\n if (!error.message.match(/You cannot dot into a client module/)) {\n throw error;\n }\n }\n }\n\n if (groupName) {\n // Allow unstable_settings={ 'custom': { initialRouteName: '...' } } to override the less specific initial route name.\n const groupSpecificInitialRouteName =\n loaded.unstable_settings?.[groupName]?.anchor ??\n loaded.unstable_settings?.[groupName]?.initialRouteName;\n\n anchor = groupSpecificInitialRouteName ?? anchor;\n }\n }\n }\n\n if (anchor) {\n const anchorRoute = node.children.find((child) => child.route === anchor);\n if (!anchorRoute) {\n const validAnchorRoutes = node.children\n .filter((child) => !child.generated)\n .map((child) => `'${child.route}'`)\n .join(', ');\n\n if (groupName) {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}' for group '(${groupName})'. Valid options are: ${validAnchorRoutes}`\n );\n } else {\n throw new Error(\n `Layout ${node.contextKey} has invalid anchor '${anchor}'. Valid options are: ${validAnchorRoutes}`\n );\n }\n }\n\n // Navigators can add initialsRoutes into the history, so they need to be to be included in the entryPoints\n node.initialRouteName = anchor;\n entryPoints.push(anchorRoute.contextKey);\n }\n\n for (const child of node.children) {\n crawlAndAppendInitialRoutesAndEntryFiles(child, options, entryPoints);\n }\n }\n}\n\nfunction getMostSpecific(routes: RouteNode[]) {\n const route = routes[routes.length - 1];\n\n if (!routes[0]) {\n throw new Error(\n `The file ${route.contextKey} does not have a fallback sibling file without a platform extension.`\n );\n }\n\n // This works even tho routes is holey array (e.g it might have index 0 and 2 but not 1)\n // `.length` includes the holes in its count\n return routes[routes.length - 1];\n}\n"]}
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { RedirectConfig } from './getRoutesCore';
3
2
  export declare function getRedirectModule(route: string): {
4
3
  default: () => import("react").CElement<{
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesRedirects.d.ts","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM;;;;;;EAiC9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,UAuBnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,UAe7F"}
1
+ {"version":3,"file":"getRoutesRedirects.d.ts","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAGjD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM;;;;;;EAiC9C;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,UAuBnE;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,UAe7F"}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mergeVariablesWithPath = exports.convertRedirect = exports.getRedirectModule = void 0;
3
+ exports.getRedirectModule = getRedirectModule;
4
+ exports.convertRedirect = convertRedirect;
5
+ exports.mergeVariablesWithPath = mergeVariablesWithPath;
4
6
  const react_1 = require("react");
5
7
  const matchers_1 = require("./matchers");
6
8
  function getRedirectModule(route) {
@@ -32,7 +34,6 @@ function getRedirectModule(route) {
32
34
  },
33
35
  };
34
36
  }
35
- exports.getRedirectModule = getRedirectModule;
36
37
  function convertRedirect(path, config) {
37
38
  const params = {};
38
39
  const parts = path.split('/');
@@ -51,7 +52,6 @@ function convertRedirect(path, config) {
51
52
  }
52
53
  return mergeVariablesWithPath(config.destination, params);
53
54
  }
54
- exports.convertRedirect = convertRedirect;
55
55
  function mergeVariablesWithPath(path, params) {
56
56
  return path
57
57
  .split('/')
@@ -67,5 +67,4 @@ function mergeVariablesWithPath(path, params) {
67
67
  .filter(Boolean)
68
68
  .join('/');
69
69
  }
70
- exports.mergeVariablesWithPath = mergeVariablesWithPath;
71
70
  //# sourceMappingURL=getRoutesRedirects.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;;AAAA,iCAAsC;AAGtC,yCAAyE;AAEzE,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO;QACL,OAAO,EAAE,SAAS,iBAAiB;YACjC,2DAA2D;YAC3D,iEAAiE;YACjE,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,qBAAqB,EAAE,CAAC;YAE1D,4EAA4E;YAC5E,IAAI,IAAI,GAAG,KAAK;iBACb,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,IAAI,IAAA,oCAAyB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,CAAC,KAAK,CAAC,CAAC;YACnC,MAAM;SACP;KACF;IAED,OAAO,sBAAsB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;AAC5D,CAAC;AAvBD,0CAuBC;AAED,SAAgB,sBAAsB,CAAC,IAAY,EAAE,MAAyC;IAC5F,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,IAAI,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE;YACV,OAAO,IAAI,CAAC;SACb;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAfD,wDAeC","sourcesContent":["import { createElement } from 'react';\n\nimport { RedirectConfig } from './getRoutesCore';\nimport { matchDeepDynamicRouteName, matchDynamicName } from './matchers';\n\nexport function getRedirectModule(route: string) {\n return {\n default: function RedirectComponent() {\n // Use the store directly instead of useGlobalSearchParams.\n // Importing the hooks directly causes build errors on the server\n const params = require('./hooks').useGlobalSearchParams();\n\n // Replace dynamic parts of the route with the actual values from the params\n let href = route\n .split('/')\n .map((part) => {\n const match = matchDynamicName(part) || matchDeepDynamicRouteName(part);\n if (!match) {\n return part;\n }\n\n const param = params[match];\n delete params[match];\n return param;\n })\n .filter(Boolean)\n .join('/');\n\n // Add any remaining params as query string\n const queryString = new URLSearchParams(params as Record<string, any>).toString();\n\n if (queryString) {\n href += `?${queryString}`;\n }\n\n return createElement(require('./link/Link').Redirect, { href });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record<string, string | string[]> = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n let match = matchDynamicName(sourcePart);\n\n if (match) {\n params[match] = parts[index];\n continue;\n }\n\n match = matchDeepDynamicRouteName(sourcePart);\n\n if (match) {\n params[match] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record<string, string | string[]>) {\n return path\n .split('/')\n .map((part) => {\n const match = matchDynamicName(part) || matchDeepDynamicRouteName(part);\n if (!match) {\n return part;\n }\n\n const param = params[match];\n delete params[match];\n return param;\n })\n .filter(Boolean)\n .join('/');\n}\n"]}
1
+ {"version":3,"file":"getRoutesRedirects.js","sourceRoot":"","sources":["../src/getRoutesRedirects.tsx"],"names":[],"mappings":";;AAKA,8CAiCC;AAED,0CAuBC;AAED,wDAeC;AAhFD,iCAAsC;AAGtC,yCAAyE;AAEzE,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO;QACL,OAAO,EAAE,SAAS,iBAAiB;YACjC,2DAA2D;YAC3D,iEAAiE;YACjE,MAAM,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,qBAAqB,EAAE,CAAC;YAE1D,4EAA4E;YAC5E,IAAI,IAAI,GAAG,KAAK;iBACb,KAAK,CAAC,GAAG,CAAC;iBACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;gBACZ,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,IAAI,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;gBACxE,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,OAAO,IAAI,CAAC;gBACd,CAAC;gBAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;gBACrB,OAAO,KAAK,CAAC;YACf,CAAC,CAAC;iBACD,MAAM,CAAC,OAAO,CAAC;iB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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,IAAI,IAAA,oCAAyB,EAAC,IAAI,CAAC,CAAC;QACxE,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,IAAI,CAAC;QACd,CAAC;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;SACD,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC","sourcesContent":["import { createElement } from 'react';\n\nimport { RedirectConfig } from './getRoutesCore';\nimport { matchDeepDynamicRouteName, matchDynamicName } from './matchers';\n\nexport function getRedirectModule(route: string) {\n return {\n default: function RedirectComponent() {\n // Use the store directly instead of useGlobalSearchParams.\n // Importing the hooks directly causes build errors on the server\n const params = require('./hooks').useGlobalSearchParams();\n\n // Replace dynamic parts of the route with the actual values from the params\n let href = route\n .split('/')\n .map((part) => {\n const match = matchDynamicName(part) || matchDeepDynamicRouteName(part);\n if (!match) {\n return part;\n }\n\n const param = params[match];\n delete params[match];\n return param;\n })\n .filter(Boolean)\n .join('/');\n\n // Add any remaining params as query string\n const queryString = new URLSearchParams(params as Record<string, any>).toString();\n\n if (queryString) {\n href += `?${queryString}`;\n }\n\n return createElement(require('./link/Link').Redirect, { href });\n },\n };\n}\n\nexport function convertRedirect(path: string, config: RedirectConfig) {\n const params: Record<string, string | string[]> = {};\n\n const parts = path.split('/');\n const sourceParts = config.source.split('/');\n\n for (const [index, sourcePart] of sourceParts.entries()) {\n let match = matchDynamicName(sourcePart);\n\n if (match) {\n params[match] = parts[index];\n continue;\n }\n\n match = matchDeepDynamicRouteName(sourcePart);\n\n if (match) {\n params[match] = parts.slice(index);\n break;\n }\n }\n\n return mergeVariablesWithPath(config.destination, params);\n}\n\nexport function mergeVariablesWithPath(path: string, params: Record<string, string | string[]>) {\n return path\n .split('/')\n .map((part) => {\n const match = matchDynamicName(part) || matchDeepDynamicRouteName(part);\n if (!match) {\n return part;\n }\n\n const param = params[match];\n delete params[match];\n return param;\n })\n .filter(Boolean)\n .join('/');\n}\n"]}
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIgnoreList = exports.extrapolateGroups = exports.generateDynamic = exports.getExactRoutes = exports.getRoutes = void 0;
3
+ exports.getIgnoreList = exports.extrapolateGroups = exports.generateDynamic = void 0;
4
+ exports.getRoutes = getRoutes;
5
+ exports.getExactRoutes = getExactRoutes;
4
6
  const getRoutesCore_1 = require("./getRoutesCore");
5
7
  /**
6
8
  * Given a Metro context module, return an array of nested routes.
@@ -73,14 +75,12 @@ function getRoutes(contextModule, options = {}) {
73
75
  ...options,
74
76
  });
75
77
  }
76
- exports.getRoutes = getRoutes;
77
78
  function getExactRoutes(contextModule, options = {}) {
78
79
  return getRoutes(contextModule, {
79
80
  ...options,
80
81
  skipGenerated: true,
81
82
  });
82
83
  }
83
- exports.getExactRoutes = getExactRoutes;
84
84
  var getRoutesCore_2 = require("./getRoutesCore");
85
85
  Object.defineProperty(exports, "generateDynamic", { enumerable: true, get: function () { return getRoutesCore_2.generateDynamic; } });
86
86
  Object.defineProperty(exports, "extrapolateGroups", { enumerable: true, get: function () { return getRoutesCore_2.extrapolateGroups; } });
@@ -1 +1 @@
1
- {"version":3,"file":"getRoutesSSR.js","sourceRoot":"","sources":["../src/getRoutesSSR.ts"],"names":[],"mappings":";;;AACA,mDAA0F;AAI1F;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,UAAmB,EAAE;IAC5E,OAAO,IAAA,yBAAa,EAAC,aAAa,EAAE;QAClC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ;YACtC,IAAI,KAAK,KAAK,EAAE,IAAI,I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Q,EAAE;gBAClE,OAAO;oBACL,GAAG,QAAQ;oBACX,SAAS;wBACP,OAAO,OAAO,CAAC,sBAAsB,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC;oBAClE,CAAC;iBACF,CAAC;aACH;YACD,MAAM,IAAI,KAAK,CAAC,yBAAyB,KAAK,cAAc,IAAI,EAAE,CAAC,CAAC;QACtE,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAvDD,8BAuDC;AAED,SAAgB,cAAc,CAC5B,aAA6B,EAC7B,UAAmB,EAAE;IAErB,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AARD,wCAQC;AAED,iDAAoF;AAA3E,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,8GAAA,aAAa,OAAA","sourcesContent":["import type { RouteNode } from './Route';\nimport { getRoutes as getRoutesCore, type Options as OptionsCore } from './getRoutesCore';\nimport type { RequireContext } from './types';\n\nexport type Options = Omit<OptionsCore, 'getSystemRoute'>;\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options = {}): RouteNode | null {\n return getRoutesCore(contextModule, {\n getSystemRoute({ route, type }, defaults) {\n if (route === '' && type === 'layout') {\n // Root layout when no layout is defined.\n return {\n type: 'layout',\n loadRoute: () => ({\n default: () => null,\n }),\n // Generate a fake file name for the directory\n contextKey: 'expo-router/build/views/Navigator.js',\n route: '',\n generated: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '_sitemap' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n route: '_sitemap',\n type: 'route',\n contextKey: 'expo-router/build/views/Sitemap.js',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '+not-found' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n type: 'route',\n route: '+not-found',\n contextKey: 'expo-router/build/views/Unmatched.js',\n generated: true,\n internal: true,\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n };\n } else if ((type === 'redirect' || type === 'rewrite') && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return require('./getRoutesRedirects').getRedirectModule(route);\n },\n };\n }\n throw new Error(`Unknown system route: ${route} and type: ${type}`);\n },\n ...options,\n });\n}\n\nexport function getExactRoutes(\n contextModule: RequireContext,\n options: Options = {}\n): RouteNode | null {\n return getRoutes(contextModule, {\n ...options,\n skipGenerated: true,\n });\n}\n\nexport { generateDynamic, extrapolateGroups, getIgnoreList } from './getRoutesCore';\n"]}
1
+ {"version":3,"file":"getRoutesSSR.js","sourceRoot":"","sources":["../src/getRoutesSSR.ts"],"names":[],"mappings":";;;AAiBA,8BAuDC;AAED,wCAQC;AAjFD,mDAA0F;AAI1F;;;;;;;;;;;GAWG;AACH,SAAgB,SAAS,CAAC,aAA6B,EAAE,UAAmB,EAAE;IAC5E,OAAO,IAAA,yBAAa,EAAC,aAAa,EAAE;QAClC,cAAc,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,QAAQ;YACtC,IAAI,KAAK,KAAK,EAAE,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACtC,yCAAyC;gBACzC,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;wBAChB,OAAO,EAAE,GAAG,EAAE,CAAC,IAAI;qBACpB,CAAC;oBACF,8CAA8C;oBAC9C,UAAU,EAAE,sCAAsC;oBAClD,KAAK,EAAE,EAAE;oBACT,SAAS,EAAE,IAAI;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CAAC,CAAC;QACtE,CAAC;QACD,GAAG,OAAO;KACX,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,cAAc,CAC5B,aAA6B,EAC7B,UAAmB,EAAE;IAErB,OAAO,SAAS,CAAC,aAAa,EAAE;QAC9B,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACpB,CAAC,CAAC;AACL,CAAC;AAED,iDAAoF;AAA3E,gHAAA,eAAe,OAAA;AAAE,kHAAA,iBAAiB,OAAA;AAAE,8GAAA,aAAa,OAAA","sourcesContent":["import type { RouteNode } from './Route';\nimport { getRoutes as getRoutesCore, type Options as OptionsCore } from './getRoutesCore';\nimport type { RequireContext } from './types';\n\nexport type Options = Omit<OptionsCore, 'getSystemRoute'>;\n/**\n * Given a Metro context module, return an array of nested routes.\n *\n * This is a two step process:\n * 1. Convert the RequireContext keys (file paths) into a directory tree.\n * - This should extrapolate array syntax into multiple routes\n * - Routes are given a specificity score\n * 2. Flatten the directory tree into routes\n * - Routes in directories without _layout files are hoisted to the nearest _layout\n * - The name of the route is relative to the nearest _layout\n * - If multiple routes have the same name, the most specific route is used\n */\nexport function getRoutes(contextModule: RequireContext, options: Options = {}): RouteNode | null {\n return getRoutesCore(contextModule, {\n getSystemRoute({ route, type }, defaults) {\n if (route === '' && type === 'layout') {\n // Root layout when no layout is defined.\n return {\n type: 'layout',\n loadRoute: () => ({\n default: () => null,\n }),\n // Generate a fake file name for the directory\n contextKey: 'expo-router/build/views/Navigator.js',\n route: '',\n generated: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '_sitemap' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n route: '_sitemap',\n type: 'route',\n contextKey: 'expo-router/build/views/Sitemap.js',\n generated: true,\n internal: true,\n dynamic: null,\n children: [],\n };\n } else if (route === '+not-found' && type === 'route') {\n return {\n loadRoute: () => ({\n default: () => null,\n }),\n type: 'route',\n route: '+not-found',\n contextKey: 'expo-router/build/views/Unmatched.js',\n generated: true,\n internal: true,\n dynamic: [{ name: '+not-found', deep: true, notFound: true }],\n children: [],\n };\n } else if ((type === 'redirect' || type === 'rewrite') && defaults) {\n return {\n ...defaults,\n loadRoute() {\n return require('./getRoutesRedirects').getRedirectModule(route);\n },\n };\n }\n throw new Error(`Unknown system route: ${route} and type: ${type}`);\n },\n ...options,\n });\n}\n\nexport function getExactRoutes(\n contextModule: RequireContext,\n options: Options = {}\n): RouteNode | null {\n return getRoutes(contextModule, {\n ...options,\n skipGenerated: true,\n });\n}\n\nexport { generateDynamic, extrapolateGroups, getIgnoreList } from './getRoutesCore';\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parseParameter = exports.getServerManifest = void 0;
3
+ exports.getServerManifest = getServerManifest;
4
+ exports.parseParameter = parseParameter;
4
5
  const matchers_1 = require("./matchers");
5
6
  const sortRoutes_1 = require("./sortRoutes");
6
7
  function isNotFoundRoute(route) {
@@ -70,7 +71,6 @@ function getServerManifest(route) {
70
71
  rewrites: getMatchableManifestForPaths(rewrites),
71
72
  };
72
73
  }
73
- exports.getServerManifest = getServerManifest;
74
74
  function getMatchableManifestForPaths(paths) {
75
75
  return paths.map(([normalizedRoutePath, absoluteRoute, node]) => {
76
76
  const matcher = getNamedRouteRegex(normalizedRoutePath, absoluteRoute, node.contextKey);
@@ -215,5 +215,4 @@ function parseParameter(param) {
215
215
  }
216
216
  return { name, repeat, optional };
217
217
  }
218
- exports.parseParameter = parseParameter;
219
218
  //# sourceMappingURL=getServerManifest.js.map