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

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 (274) 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/Route.js +4 -4
  6. package/build/Route.js.map +1 -1
  7. package/build/doctor/index.js +1 -2
  8. package/build/doctor/index.js.map +1 -1
  9. package/build/exports.js +17 -7
  10. package/build/exports.js.map +1 -1
  11. package/build/fast-refresh.js.map +1 -1
  12. package/build/fork/NavigationContainer.d.ts +2 -7
  13. package/build/fork/NavigationContainer.d.ts.map +1 -1
  14. package/build/fork/NavigationContainer.js.map +1 -1
  15. package/build/fork/createMemoryHistory.d.ts.map +1 -1
  16. package/build/fork/createMemoryHistory.js +1 -2
  17. package/build/fork/createMemoryHistory.js.map +1 -1
  18. package/build/fork/extractPathFromURL.js +3 -4
  19. package/build/fork/extractPathFromURL.js.map +1 -1
  20. package/build/fork/findFocusedRoute.d.ts +1 -11
  21. package/build/fork/findFocusedRoute.d.ts.map +1 -1
  22. package/build/fork/findFocusedRoute.js +1 -2
  23. package/build/fork/findFocusedRoute.js.map +1 -1
  24. package/build/fork/getPathFromState-forks.d.ts.map +1 -1
  25. package/build/fork/getPathFromState-forks.js +24 -14
  26. package/build/fork/getPathFromState-forks.js.map +1 -1
  27. package/build/fork/getPathFromState.js +20 -11
  28. package/build/fork/getPathFromState.js.map +1 -1
  29. package/build/fork/getStateFromPath-forks.d.ts +4 -4
  30. package/build/fork/getStateFromPath-forks.d.ts.map +1 -1
  31. package/build/fork/getStateFromPath-forks.js +18 -19
  32. package/build/fork/getStateFromPath-forks.js.map +1 -1
  33. package/build/fork/getStateFromPath.js +18 -9
  34. package/build/fork/getStateFromPath.js.map +1 -1
  35. package/build/fork/native-stack/NativeStackView.js +1 -2
  36. package/build/fork/native-stack/NativeStackView.js.map +1 -1
  37. package/build/fork/native-stack/createNativeStackNavigator.js +18 -9
  38. package/build/fork/native-stack/createNativeStackNavigator.js.map +1 -1
  39. package/build/fork/useBackButton.d.ts +0 -1
  40. package/build/fork/useBackButton.d.ts.map +1 -1
  41. package/build/fork/useBackButton.js +1 -2
  42. package/build/fork/useBackButton.js.map +1 -1
  43. package/build/fork/useBackButton.native.js +18 -9
  44. package/build/fork/useBackButton.native.js.map +1 -1
  45. package/build/fork/useDocumentTitle.js +18 -9
  46. package/build/fork/useDocumentTitle.js.map +1 -1
  47. package/build/fork/useDocumentTitle.native.js +1 -2
  48. package/build/fork/useDocumentTitle.native.js.map +1 -1
  49. package/build/fork/useLinking.d.ts +3 -26
  50. package/build/fork/useLinking.d.ts.map +1 -1
  51. package/build/fork/useLinking.js +20 -10
  52. package/build/fork/useLinking.js.map +1 -1
  53. package/build/fork/useLinking.native.d.ts +6 -6
  54. package/build/fork/useLinking.native.js +19 -10
  55. package/build/fork/useLinking.native.js.map +1 -1
  56. package/build/fork/useThenable.js +18 -9
  57. package/build/fork/useThenable.js.map +1 -1
  58. package/build/fork/validatePathConfig.js +1 -1
  59. package/build/fork/validatePathConfig.js.map +1 -1
  60. package/build/getDevServer/index.js.map +1 -1
  61. package/build/getLinkingConfig.js +3 -3
  62. package/build/getLinkingConfig.js.map +1 -1
  63. package/build/getReactNavigationConfig.js +3 -4
  64. package/build/getReactNavigationConfig.js.map +1 -1
  65. package/build/getRoutes.js +3 -3
  66. package/build/getRoutes.js.map +1 -1
  67. package/build/getRoutesCore.js +6 -7
  68. package/build/getRoutesCore.js.map +1 -1
  69. package/build/getRoutesRedirects.d.ts +0 -1
  70. package/build/getRoutesRedirects.d.ts.map +1 -1
  71. package/build/getRoutesRedirects.js +3 -4
  72. package/build/getRoutesRedirects.js.map +1 -1
  73. package/build/getRoutesSSR.js +3 -3
  74. package/build/getRoutesSSR.js.map +1 -1
  75. package/build/getServerManifest.js +2 -3
  76. package/build/getServerManifest.js.map +1 -1
  77. package/build/global-state/routeInfo.js +18 -9
  78. package/build/global-state/routeInfo.js.map +1 -1
  79. package/build/global-state/router-store.d.ts +6 -6
  80. package/build/global-state/router-store.d.ts.map +1 -1
  81. package/build/global-state/router-store.js +22 -12
  82. package/build/global-state/router-store.js.map +1 -1
  83. package/build/global-state/routing.js +29 -20
  84. package/build/global-state/routing.js.map +1 -1
  85. package/build/global-state/serverLocationContext.d.ts +0 -1
  86. package/build/global-state/serverLocationContext.d.ts.map +1 -1
  87. package/build/global-state/sort-routes.js +1 -2
  88. package/build/global-state/sort-routes.js.map +1 -1
  89. package/build/head/ExpoHead.android.d.ts +1 -1
  90. package/build/head/ExpoHead.android.js +1 -2
  91. package/build/head/ExpoHead.android.js.map +1 -1
  92. package/build/head/ExpoHead.ios.js.map +1 -1
  93. package/build/head/ExpoHeadModule.js.map +1 -1
  94. package/build/head/url.js +2 -3
  95. package/build/head/url.js.map +1 -1
  96. package/build/hooks.js +11 -12
  97. package/build/hooks.js.map +1 -1
  98. package/build/layouts/DrawerClient.d.ts +16 -17
  99. package/build/layouts/DrawerClient.d.ts.map +1 -1
  100. package/build/layouts/RootModal.d.ts +1 -2
  101. package/build/layouts/RootModal.d.ts.map +1 -1
  102. package/build/layouts/RootModal.js +2 -2
  103. package/build/layouts/RootModal.js.map +1 -1
  104. package/build/layouts/StackClient.d.ts +16 -16
  105. package/build/layouts/StackClient.d.ts.map +1 -1
  106. package/build/layouts/StackClient.js.map +1 -1
  107. package/build/layouts/TabsClient.d.ts +12 -12
  108. package/build/layouts/TabsClient.js.map +1 -1
  109. package/build/layouts/withLayoutContext.d.ts +2 -2
  110. package/build/layouts/withLayoutContext.d.ts.map +1 -1
  111. package/build/layouts/withLayoutContext.js +19 -10
  112. package/build/layouts/withLayoutContext.js.map +1 -1
  113. package/build/link/Link.d.ts.map +1 -1
  114. package/build/link/Link.js +2 -2
  115. package/build/link/Link.js.map +1 -1
  116. package/build/link/href.d.ts.map +1 -1
  117. package/build/link/href.js +2 -2
  118. package/build/link/href.js.map +1 -1
  119. package/build/link/linking.d.ts.map +1 -1
  120. package/build/link/linking.js +21 -11
  121. package/build/link/linking.js.map +1 -1
  122. package/build/link/useDomComponentNavigation.js +6 -7
  123. package/build/link/useDomComponentNavigation.js.map +1 -1
  124. package/build/link/useLinkHooks.d.ts.map +1 -1
  125. package/build/link/useLinkHooks.js +2 -2
  126. package/build/link/useLinkHooks.js.map +1 -1
  127. package/build/link/useLinkToPathProps.d.ts.map +1 -1
  128. package/build/link/useLinkToPathProps.js +2 -3
  129. package/build/link/useLinkToPathProps.js.map +1 -1
  130. package/build/link/useLoadedNavigation.d.ts.map +1 -1
  131. package/build/link/useLoadedNavigation.js +2 -3
  132. package/build/link/useLoadedNavigation.js.map +1 -1
  133. package/build/loadStaticParamsAsync.js +3 -4
  134. package/build/loadStaticParamsAsync.js.map +1 -1
  135. package/build/matchers.js +14 -15
  136. package/build/matchers.js.map +1 -1
  137. package/build/onboard/Tutorial.js +1 -2
  138. package/build/onboard/Tutorial.js.map +1 -1
  139. package/build/onboard/createEntryFile.js +2 -3
  140. package/build/onboard/createEntryFile.js.map +1 -1
  141. package/build/qualified-entry.js +1 -2
  142. package/build/qualified-entry.js.map +1 -1
  143. package/build/renderRootComponent.js +18 -9
  144. package/build/renderRootComponent.js.map +1 -1
  145. package/build/routes-manifest.js +1 -2
  146. package/build/routes-manifest.js.map +1 -1
  147. package/build/rsc/entry.js +1 -2
  148. package/build/rsc/entry.js.map +1 -1
  149. package/build/rsc/exports.d.ts +0 -1
  150. package/build/rsc/exports.d.ts.map +1 -1
  151. package/build/rsc/exports.js +18 -18
  152. package/build/rsc/exports.js.map +1 -1
  153. package/build/rsc/middleware.js +2 -3
  154. package/build/rsc/middleware.js.map +1 -1
  155. package/build/rsc/path.d.ts.map +1 -1
  156. package/build/rsc/path.js.map +1 -1
  157. package/build/rsc/router/client.d.ts +7 -7
  158. package/build/rsc/router/client.d.ts.map +1 -1
  159. package/build/rsc/router/client.js +4 -4
  160. package/build/rsc/router/client.js.map +1 -1
  161. package/build/rsc/router/common.js +4 -4
  162. package/build/rsc/router/common.js.map +1 -1
  163. package/build/rsc/router/create-expo-pages.d.ts.map +1 -1
  164. package/build/rsc/router/create-expo-pages.js +1 -2
  165. package/build/rsc/router/create-expo-pages.js.map +1 -1
  166. package/build/rsc/router/create-pages.d.ts +1 -3
  167. package/build/rsc/router/create-pages.d.ts.map +1 -1
  168. package/build/rsc/router/create-pages.js +1 -2
  169. package/build/rsc/router/create-pages.js.map +1 -1
  170. package/build/rsc/router/defineRouter.js +2 -3
  171. package/build/rsc/router/defineRouter.js.map +1 -1
  172. package/build/rsc/router/errors.js.map +1 -1
  173. package/build/rsc/router/expo-definedRouter.d.ts +1 -1
  174. package/build/rsc/router/expo-definedRouter.js.map +1 -1
  175. package/build/rsc/router/fetch.js +1 -2
  176. package/build/rsc/router/fetch.js.map +1 -1
  177. package/build/rsc/router/host.d.ts +3 -3
  178. package/build/rsc/router/host.d.ts.map +1 -1
  179. package/build/rsc/router/host.js.map +1 -1
  180. package/build/rsc/router/noopRouter.d.ts +1 -1
  181. package/build/rsc/router/utils.d.ts.map +1 -1
  182. package/build/rsc/router/utils.js.map +1 -1
  183. package/build/rsc/rsc-renderer.js +1 -2
  184. package/build/rsc/rsc-renderer.js.map +1 -1
  185. package/build/rsc/server.d.ts.map +1 -1
  186. package/build/rsc/server.js +5 -5
  187. package/build/rsc/server.js.map +1 -1
  188. package/build/sortRoutes.d.ts.map +1 -1
  189. package/build/sortRoutes.js +2 -3
  190. package/build/sortRoutes.js.map +1 -1
  191. package/build/static/getRootComponent.js +1 -2
  192. package/build/static/getRootComponent.js.map +1 -1
  193. package/build/static/getServerManifest.js +2 -3
  194. package/build/static/getServerManifest.js.map +1 -1
  195. package/build/static/html.js +2 -3
  196. package/build/static/html.js.map +1 -1
  197. package/build/static/renderStaticContent.js +19 -9
  198. package/build/static/renderStaticContent.js.map +1 -1
  199. package/build/testing-library/context-stubs.d.ts +1 -2
  200. package/build/testing-library/context-stubs.d.ts.map +1 -1
  201. package/build/testing-library/context-stubs.js +3 -3
  202. package/build/testing-library/context-stubs.js.map +1 -1
  203. package/build/testing-library/index.d.ts.map +1 -1
  204. package/build/testing-library/index.js +2 -2
  205. package/build/testing-library/index.js.map +1 -1
  206. package/build/testing-library/mock-config.js +2 -3
  207. package/build/testing-library/mock-config.js.map +1 -1
  208. package/build/testing-library/mocks.js.map +1 -1
  209. package/build/testing-library/require-context-ponyfill.js +1 -1
  210. package/build/testing-library/require-context-ponyfill.js.map +1 -1
  211. package/build/typed-routes/generate.js +4 -5
  212. package/build/typed-routes/generate.js.map +1 -1
  213. package/build/typed-routes/index.d.ts.map +1 -1
  214. package/build/typed-routes/index.js +2 -2
  215. package/build/typed-routes/index.js.map +1 -1
  216. package/build/ui/Slot.d.ts +0 -1
  217. package/build/ui/Slot.d.ts.map +1 -1
  218. package/build/ui/TabContext.d.ts +47 -55
  219. package/build/ui/TabContext.d.ts.map +1 -1
  220. package/build/ui/TabList.js +2 -3
  221. package/build/ui/TabList.js.map +1 -1
  222. package/build/ui/TabRouter.d.ts +27 -27
  223. package/build/ui/TabRouter.d.ts.map +1 -1
  224. package/build/ui/TabRouter.js +18 -9
  225. package/build/ui/TabRouter.js.map +1 -1
  226. package/build/ui/TabSlot.js +4 -5
  227. package/build/ui/TabSlot.js.map +1 -1
  228. package/build/ui/TabTrigger.js +3 -4
  229. package/build/ui/TabTrigger.js.map +1 -1
  230. package/build/ui/Tabs.d.ts +73 -78
  231. package/build/ui/Tabs.d.ts.map +1 -1
  232. package/build/ui/Tabs.js +3 -4
  233. package/build/ui/Tabs.js.map +1 -1
  234. package/build/ui/common.d.ts +2 -3
  235. package/build/ui/common.d.ts.map +1 -1
  236. package/build/ui/common.js +3 -3
  237. package/build/ui/common.js.map +1 -1
  238. package/build/ui/useComponent.d.ts.map +1 -1
  239. package/build/ui/useComponent.js +1 -2
  240. package/build/ui/useComponent.js.map +1 -1
  241. package/build/useDeprecated.js +2 -3
  242. package/build/useDeprecated.js.map +1 -1
  243. package/build/useFocusEffect.js +18 -9
  244. package/build/useFocusEffect.js.map +1 -1
  245. package/build/useNavigation.js +1 -2
  246. package/build/useNavigation.js.map +1 -1
  247. package/build/useScreens.js +5 -6
  248. package/build/useScreens.js.map +1 -1
  249. package/build/utils/splash.js +5 -6
  250. package/build/utils/splash.js.map +1 -1
  251. package/build/utils/url.js +3 -4
  252. package/build/utils/url.js.map +1 -1
  253. package/build/views/EmptyRoute.js +1 -2
  254. package/build/views/EmptyRoute.js.map +1 -1
  255. package/build/views/ErrorBoundary.d.ts +0 -1
  256. package/build/views/ErrorBoundary.d.ts.map +1 -1
  257. package/build/views/ErrorBoundary.js +1 -2
  258. package/build/views/ErrorBoundary.js.map +1 -1
  259. package/build/views/Navigator.js +22 -12
  260. package/build/views/Navigator.js.map +1 -1
  261. package/build/views/Pressable.d.ts.map +1 -1
  262. package/build/views/Screen.js +1 -2
  263. package/build/views/Screen.js.map +1 -1
  264. package/build/views/Sitemap.js +2 -3
  265. package/build/views/Sitemap.js.map +1 -1
  266. package/build/views/SuspenseFallback.js +1 -2
  267. package/build/views/SuspenseFallback.js.map +1 -1
  268. package/build/views/Toast.js +3 -3
  269. package/build/views/Toast.js.map +1 -1
  270. package/build/views/Try.js +17 -7
  271. package/build/views/Try.js.map +1 -1
  272. package/build/views/Unmatched.js +1 -2
  273. package/build/views/Unmatched.js.map +1 -1
  274. package/package.json +4 -4
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkHooks.js","sourceRoot":"","sources":["../../src/link/useLinkHooks.ts"],"names":[],"mappings":";;;AAAA,wFAAwF;AACxF,mCAAmC;AACnC,iCAA4C;AAC5C,+CAA0E;AA4N1E,qDAAqD;AACrD,SAAgB,mBAAmB,CAAC,KAAyD;IAC3F,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACzB,OAAO,KAAK,CAAC,KAAK,CAAC;KACpB;IAED,sDAAsD;IACtD,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;QAClB,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI,EAAE;YAC3B,OAAO,KAAK,CAAC,KAAK,CAAC;SACpB;QACD,MAAM,QAAQ,GAAG;YACf,KAAK,EAAE,IAAI;YACX,qBAAqB,EAAE,KAAK,CAAC,SAAS;SACvC,CAAC;QAEF,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;YAC9B,OAAO,CAAC,GAAG,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;SACnC;QACD,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;AACrC,CAAC;AApBD,kDAoBC;AAEY,QAAA,YAAY,GAAG,uBAAQ,CAAC,MAAM,CAEzC;IACA,GAAG,EAAE,SAAS,YAAY,CAAC,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAsB;QAC/E,OAAO,IAAA,eAAO,EAAC,GAAG,EAAE;YAClB,MAAM,SAAS,GAAG;gBAChB,GAAG;gBACH,MAAM;gBACN,QAAQ;aACT,CAAC;YACF,IAAI,OAAO,EAAE;gBACX,OAAO,SAAS,CAAC;aAClB;YACD,OAAO;gBACL,SAAS;aACV,CAAC;QACJ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,SAAS,YAAY;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC","sourcesContent":["// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { useMemo, MouseEvent } from 'react';\nimport { TextProps, GestureResponderEvent, Platform } from 'react-native';\n\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\n\n// docsMissing\n/**\n * @platform web\n */\nexport type WebAnchorProps = {\n /**\n * Specifies where to open the [`href`](#href).\n *\n * - **_self**: the current tab.\n * - **_blank**: opens in a new tab or window.\n * - **_parent**: opens in the parent browsing context. If no parent, defaults to **_self**.\n * - **_top**: opens in the highest browsing context ancestor. If no ancestors,\n * defaults to **_self**.\n *\n * This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @default '_self'\n *\n * @example\n * ```jsx\n * <Link href=\"https://expo.dev\" target=\"_blank\">Go to Expo in new tab</Link>\n * ```\n */\n target?: '_self' | '_blank' | '_parent' | '_top' | (string & object);\n\n /**\n * Specifies the relationship between the [`href`](#href) and the current route.\n *\n * Common values:\n * - **nofollow**: Indicates to search engines that they should not follow the `href`.\n * This is often used for user-generated content or links that should not influence\n * search engine rankings.\n * - **noopener**: Suggests that the `href` should not have access to the opening\n * window's `window.opener` object, which is a security measure to prevent potentially\n * harmful behavior in cases of links that open new tabs or windows.\n * - **noreferrer**: Requests that the browser does not send the `Referer` HTTP header\n * when navigating to the `href`. This can enhance user privacy.\n *\n * The `rel` property is primarily used for informational and instructive purposes, helping browsers and web\n * crawlers make better decisions about how to handle and interpret the links on a web\n * page. It is important to use appropriate `rel` values to ensure that links behave as intended and adhere\n * to best practices for web development and SEO (Search Engine Optimization).\n *\n * This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @example\n * ```jsx\n * <Link href=\"https://expo.dev\" rel=\"nofollow\">Go to Expo</Link>\n * ```\n */\n rel?: string;\n\n /**\n * Specifies that the [`href`](#href) should be downloaded when the user clicks on the\n * link, instead of navigating to it. It is typically used for links that point to\n * files that the user should download, such as PDFs, images, documents, and more.\n *\n * The value of the `download` property, which represents the filename for the\n * downloaded file. This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @example\n * ```jsx\n * <Link href=\"/image.jpg\" download=\"my-image.jpg\">Download image</Link>\n * ```\n */\n download?: string;\n};\n\n// @docsMissing\nexport interface LinkProps extends Omit<TextProps, 'href'>, WebAnchorProps {\n /**\n * The path of the route to navigate to. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`. The\n * params can be an object of key-value pairs.\n *\n * @example\n * ```tsx Dynamic\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/about\">About</Link>\n * <Link\n * href={{\n * pathname: '/user/[id]',\n * params: { id: 'bacon' }\n * }}>\n * View user\n * </Link>\n * </View>\n * );\n *}\n * ```\n */\n href: Href;\n\n // TODO(EvanBacon): This may need to be extracted for React Native style support.\n /**\n * Used to customize the `Link` component. It will forward all props to the\n * first child of the `Link`. Note that the child component must accept\n * `onPress` or `onClick` props. The `href` and `role` are also\n * passed to the child.\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { Pressable, Text } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/home\" asChild>\n * <Pressable>\n * <Text>Home</Text>\n * </Pressable>\n * </Link>\n * </View>\n * );\n *}\n * ```\n */\n asChild?: boolean;\n\n /**\n * Removes the current route from the history and replace it with the\n * specified URL. This is useful for [redirects](/router/reference/redirects/).\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link replace href=\"/feed\">Login</Link>\n * </View>\n * );\n *}\n * ```\n */\n replace?: boolean;\n /**\n * Always pushes a new route, and never pops or replaces to existing route.\n * You can push the current route multiple times or with new parameters.\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link push href=\"/feed\">Login</Link>\n * </View>\n * );\n *}\n * ```\n */\n push?: boolean;\n /**\n * While in a stack, this will dismiss screens until the provided href is reached. If the href is not found,\n * it will instead replace the current screen with the provided href.\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link dismissTo href=\"/feed\">Close modal</Link>\n * </View>\n * );\n *}\n * ```\n */\n dismissTo?: boolean;\n\n /**\n * On native, this can be used with CSS interop tools like Nativewind.\n * On web, this sets the HTML `class` directly.\n */\n className?: string;\n\n onPress?: (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => void;\n\n /**\n * Relative URL references are either relative to the directory or the document.\n * By default, relative paths are relative to the document.\n *\n * @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Replaces the initial screen with the current route.\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, if the target is valid then screens in the history that matches\n * the uniqueness constraint will be removed.\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n}\n\n// Mutate the style prop to add the className on web.\nexport function useInteropClassName(props: { style?: TextProps['style']; className?: string }) {\n if (Platform.OS !== 'web') {\n return props.style;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMemo(() => {\n if (props.className == null) {\n return props.style;\n }\n const cssStyle = {\n $$css: true,\n __routerLinkClassName: props.className,\n };\n\n if (Array.isArray(props.style)) {\n return [...props.style, cssStyle];\n }\n return [props.style, cssStyle];\n }, [props.style, props.className]);\n}\n\nexport const useHrefAttrs = Platform.select<\n (props: Partial<LinkProps>) => { hrefAttrs?: any } & Partial<LinkProps>\n>({\n web: function useHrefAttrs({ asChild, rel, target, download }: Partial<LinkProps>) {\n return useMemo(() => {\n const hrefAttrs = {\n rel,\n target,\n download,\n };\n if (asChild) {\n return hrefAttrs;\n }\n return {\n hrefAttrs,\n };\n }, [asChild, rel, target, download]);\n },\n default: function useHrefAttrs() {\n return {};\n },\n});\n"]}
1
+ {"version":3,"file":"useLinkHooks.js","sourceRoot":"","sources":["../../src/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EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,SAAS,YAAY;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;CACF,CAAC,CAAC","sourcesContent":["// Fork of @react-navigation/native Link.tsx with `href` and `replace` support added and\n// `to` / `action` support removed.\nimport { useMemo, MouseEvent } from 'react';\nimport { TextProps, GestureResponderEvent, Platform } from 'react-native';\n\nimport { Href } from '../types';\nimport { SingularOptions } from '../useScreens';\n\n// docsMissing\n/**\n * @platform web\n */\nexport type WebAnchorProps = {\n /**\n * Specifies where to open the [`href`](#href).\n *\n * - **_self**: the current tab.\n * - **_blank**: opens in a new tab or window.\n * - **_parent**: opens in the parent browsing context. If no parent, defaults to **_self**.\n * - **_top**: opens in the highest browsing context ancestor. If no ancestors,\n * defaults to **_self**.\n *\n * This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @default '_self'\n *\n * @example\n * ```jsx\n * <Link href=\"https://expo.dev\" target=\"_blank\">Go to Expo in new tab</Link>\n * ```\n */\n target?: '_self' | '_blank' | '_parent' | '_top' | (string & object);\n\n /**\n * Specifies the relationship between the [`href`](#href) and the current route.\n *\n * Common values:\n * - **nofollow**: Indicates to search engines that they should not follow the `href`.\n * This is often used for user-generated content or links that should not influence\n * search engine rankings.\n * - **noopener**: Suggests that the `href` should not have access to the opening\n * window's `window.opener` object, which is a security measure to prevent potentially\n * harmful behavior in cases of links that open new tabs or windows.\n * - **noreferrer**: Requests that the browser does not send the `Referer` HTTP header\n * when navigating to the `href`. This can enhance user privacy.\n *\n * The `rel` property is primarily used for informational and instructive purposes, helping browsers and web\n * crawlers make better decisions about how to handle and interpret the links on a web\n * page. It is important to use appropriate `rel` values to ensure that links behave as intended and adhere\n * to best practices for web development and SEO (Search Engine Optimization).\n *\n * This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @example\n * ```jsx\n * <Link href=\"https://expo.dev\" rel=\"nofollow\">Go to Expo</Link>\n * ```\n */\n rel?: string;\n\n /**\n * Specifies that the [`href`](#href) should be downloaded when the user clicks on the\n * link, instead of navigating to it. It is typically used for links that point to\n * files that the user should download, such as PDFs, images, documents, and more.\n *\n * The value of the `download` property, which represents the filename for the\n * downloaded file. This property is passed to the underlying anchor (`<a>`) tag.\n *\n * @example\n * ```jsx\n * <Link href=\"/image.jpg\" download=\"my-image.jpg\">Download image</Link>\n * ```\n */\n download?: string;\n};\n\n// @docsMissing\nexport interface LinkProps extends Omit<TextProps, 'href'>, WebAnchorProps {\n /**\n * The path of the route to navigate to. It can either be:\n * - **string**: A full path like `/profile/settings` or a relative path like `../settings`.\n * - **object**: An object with a `pathname` and optional `params`. The `pathname` can be\n * a full path like `/profile/settings` or a relative path like `../settings`. The\n * params can be an object of key-value pairs.\n *\n * @example\n * ```tsx Dynamic\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/about\">About</Link>\n * <Link\n * href={{\n * pathname: '/user/[id]',\n * params: { id: 'bacon' }\n * }}>\n * View user\n * </Link>\n * </View>\n * );\n *}\n * ```\n */\n href: Href;\n\n // TODO(EvanBacon): This may need to be extracted for React Native style support.\n /**\n * Used to customize the `Link` component. It will forward all props to the\n * first child of the `Link`. Note that the child component must accept\n * `onPress` or `onClick` props. The `href` and `role` are also\n * passed to the child.\n *\n * @example\n * ```tsx\n * import { Link } from 'expo-router';\n * import { Pressable, Text } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link href=\"/home\" asChild>\n * <Pressable>\n * <Text>Home</Text>\n * </Pressable>\n * </Link>\n * </View>\n * );\n *}\n * ```\n */\n asChild?: boolean;\n\n /**\n * Removes the current route from the history and replace it with the\n * specified URL. This is useful for [redirects](/router/reference/redirects/).\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link replace href=\"/feed\">Login</Link>\n * </View>\n * );\n *}\n * ```\n */\n replace?: boolean;\n /**\n * Always pushes a new route, and never pops or replaces to existing route.\n * You can push the current route multiple times or with new parameters.\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link push href=\"/feed\">Login</Link>\n * </View>\n * );\n *}\n * ```\n */\n push?: boolean;\n /**\n * While in a stack, this will dismiss screens until the provided href is reached. If the href is not found,\n * it will instead replace the current screen with the provided href.\n *\n * @example\n *```tsx\n * import { Link } from 'expo-router';\n * import { View } from 'react-native';\n *\n * export default function Route() {\n * return (\n * <View>\n * <Link dismissTo href=\"/feed\">Close modal</Link>\n * </View>\n * );\n *}\n * ```\n */\n dismissTo?: boolean;\n\n /**\n * On native, this can be used with CSS interop tools like Nativewind.\n * On web, this sets the HTML `class` directly.\n */\n className?: string;\n\n onPress?: (e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => void;\n\n /**\n * Relative URL references are either relative to the directory or the document.\n * By default, relative paths are relative to the document.\n *\n * @see [Resolving relative references in Mozilla's documentation](https://developer.mozilla.org/en-US/docs/Web/API/URL_API/Resolving_relative_references).\n */\n relativeToDirectory?: boolean;\n\n /**\n * Replaces the initial screen with the current route.\n */\n withAnchor?: boolean;\n\n /**\n * When navigating in a Stack, if the target is valid then screens in the history that matches\n * the uniqueness constraint will be removed.\n *\n * If used with `push`, the history will be filtered even if no navigation occurs.\n */\n dangerouslySingular?: SingularOptions;\n}\n\n// Mutate the style prop to add the className on web.\nexport function useInteropClassName(props: { style?: TextProps['style']; className?: string }) {\n if (Platform.OS !== 'web') {\n return props.style;\n }\n\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return useMemo(() => {\n if (props.className == null) {\n return props.style;\n }\n const cssStyle = {\n $$css: true,\n __routerLinkClassName: props.className,\n };\n\n if (Array.isArray(props.style)) {\n return [...props.style, cssStyle];\n }\n return [props.style, cssStyle];\n }, [props.style, props.className]);\n}\n\nexport const useHrefAttrs = Platform.select<\n (props: Partial<LinkProps>) => { hrefAttrs?: any } & Partial<LinkProps>\n>({\n web: function useHrefAttrs({ asChild, rel, target, download }: Partial<LinkProps>) {\n return useMemo(() => {\n const hrefAttrs = {\n rel,\n target,\n download,\n };\n if (asChild) {\n return hrefAttrs;\n }\n return {\n hrefAttrs,\n };\n }, [asChild, rel, target, download]);\n },\n default: function useHrefAttrs() {\n return {};\n },\n});\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkToPathProps.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPathProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAK/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4BxD,KAAK,yBAAyB,GAAG,aAAa,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,yBAAyB;;;sBAG/D,WAAW,iBAAiB,CAAC,GAAG,qBAAqB;EAqB/E;AAED,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,WAY9D"}
1
+ {"version":3,"file":"useLinkToPathProps.d.ts","sourceRoot":"","sources":["../../src/link/useLinkToPathProps.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,qBAAqB,EAAY,MAAM,cAAc,CAAC;AAK/D,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AA4BxD,KAAK,yBAAyB,GAAG,aAAa,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,EAAE,yBAAyB;;;sBAG/D,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB;EAqB/E;AAED,wBAAgB,sBAAsB,CACpC,KAAK,CAAC,EAAE,UAAU,CAAC,iBAAiB,CAAC,GAAG,qBAAqB,WAY9D"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shouldHandleMouseEvent = void 0;
3
+ exports.default = useLinkToPathProps;
4
+ exports.shouldHandleMouseEvent = shouldHandleMouseEvent;
4
5
  const react_native_1 = require("react-native");
5
6
  const useDomComponentNavigation_1 = require("./useDomComponentNavigation");
6
7
  const getPathFromState_forks_1 = require("../fork/getPathFromState-forks");
@@ -47,7 +48,6 @@ function useLinkToPathProps({ href, ...options }) {
47
48
  onPress,
48
49
  };
49
50
  }
50
- exports.default = useLinkToPathProps;
51
51
  function shouldHandleMouseEvent(event) {
52
52
  if (react_native_1.Platform.OS !== 'web') {
53
53
  return !event?.defaultPrevented;
@@ -58,5 +58,4 @@ function shouldHandleMouseEvent(event) {
58
58
  }
59
59
  return false;
60
60
  }
61
- exports.shouldHandleMouseEvent = shouldHandleMouseEvent;
62
61
  //# sourceMappingURL=useLinkToPathProps.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLinkToPathProps.js","sourceRoot":"","sources":["../../src/link/useLinkToPathProps.tsx"],"names":[],"mappings":";;;AACA,+CAA+D;AAE/D,2EAA+D;AAC/D,2EAA+D;AAC/D,+DAA6D;AAE7D,0CAAyD;AACzD,sCAAoD;AAEpD,SAAS,yBAAyB,CAChC,CAAwD;IAExD,IAAI,CAAC,EAAE,gBAAgB,EAAE;QACvB,OAAO,KAAK,CAAC;KACd;IAED;IACE,yBAAyB;IACzB,QAAQ,IAAI,CAAC;QACb,mCAAmC;QACnC,CAAC,CAAC,CAAC,OAAO;QACV,CAAC,CAAC,CAAC,MAAM;QACT,CAAC,CAAC,CAAC,OAAO;QACV,CAAC,CAAC,CAAC,QAAQ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,CAAC;KACb;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAbD,wDAaC","sourcesContent":["import { MouseEvent } from 'react';\nimport { GestureResponderEvent, Platform } from 'react-native';\n\nimport { emitDomLinkEvent } from './useDomComponentNavigation';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport { useExpoRouter } from '../global-state/router-store';\nimport { LinkToOptions } from '../global-state/routing';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction eventShouldPreventDefault(\n e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n): boolean {\n if (e?.defaultPrevented) {\n return false;\n }\n\n if (\n // Only check MouseEvents\n 'button' in e &&\n // ignore clicks with modifier keys\n !e.metaKey &&\n !e.altKey &&\n !e.ctrlKey &&\n !e.shiftKey &&\n (e.button == null || e.button === 0) && // Only accept left clicks\n [undefined, null, '', 'self'].includes(e.currentTarget.target) // let browser handle \"target=_blank\" etc.\n ) {\n return true;\n }\n\n return false;\n}\n\ntype UseLinkToPathPropsOptions = LinkToOptions & {\n href: string;\n};\n\nexport default function useLinkToPathProps({ href, ...options }: UseLinkToPathPropsOptions) {\n const { linkTo } = useExpoRouter();\n\n const onPress = (event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if (shouldHandleMouseEvent(event)) {\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n linkTo(href, options);\n }\n };\n\n let strippedHref = stripGroupSegmentsFromPath(href) || '/';\n\n // Append base url only if needed.\n if (!shouldLinkExternally(strippedHref)) {\n strippedHref = appendBaseUrl(strippedHref);\n }\n\n return {\n href: strippedHref,\n role: 'link' as const,\n onPress,\n };\n}\n\nexport function shouldHandleMouseEvent(\n event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n) {\n if (Platform.OS !== 'web') {\n return !event?.defaultPrevented;\n }\n\n if (event && eventShouldPreventDefault(event)) {\n event.preventDefault();\n return true;\n }\n\n return false;\n}\n"]}
1
+ {"version":3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IAAI,CAAC,IAAI,GAAG,CAAC;IAE3D,kCAAkC;IAClC,IAAI,CAAC,IAAA,0BAAoB,EAAC,YAAY,CAAC,EAAE,CAAC;QACxC,YAAY,GAAG,IAAA,sCAAa,EAAC,YAAY,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO;QACL,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,MAAe;QACrB,OAAO;KACR,CAAC;AACJ,CAAC;AAED,SAAgB,sBAAsB,CACpC,KAA6D;IAE7D,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,EAAE,gBAAgB,CAAC;IAClC,CAAC;IAED,IAAI,KAAK,IAAI,yBAAyB,CAAC,KAAK,CAAC,EAAE,CAAC;QAC9C,KAAK,CAAC,cAAc,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC","sourcesContent":["import { MouseEvent } from 'react';\nimport { GestureResponderEvent, Platform } from 'react-native';\n\nimport { emitDomLinkEvent } from './useDomComponentNavigation';\nimport { appendBaseUrl } from '../fork/getPathFromState-forks';\nimport { useExpoRouter } from '../global-state/router-store';\nimport { LinkToOptions } from '../global-state/routing';\nimport { stripGroupSegmentsFromPath } from '../matchers';\nimport { shouldLinkExternally } from '../utils/url';\n\nfunction eventShouldPreventDefault(\n e: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n): boolean {\n if (e?.defaultPrevented) {\n return false;\n }\n\n if (\n // Only check MouseEvents\n 'button' in e &&\n // ignore clicks with modifier keys\n !e.metaKey &&\n !e.altKey &&\n !e.ctrlKey &&\n !e.shiftKey &&\n (e.button == null || e.button === 0) && // Only accept left clicks\n [undefined, null, '', 'self'].includes(e.currentTarget.target) // let browser handle \"target=_blank\" etc.\n ) {\n return true;\n }\n\n return false;\n}\n\ntype UseLinkToPathPropsOptions = LinkToOptions & {\n href: string;\n};\n\nexport default function useLinkToPathProps({ href, ...options }: UseLinkToPathPropsOptions) {\n const { linkTo } = useExpoRouter();\n\n const onPress = (event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent) => {\n if (shouldHandleMouseEvent(event)) {\n if (emitDomLinkEvent(href, options)) {\n return;\n }\n linkTo(href, options);\n }\n };\n\n let strippedHref = stripGroupSegmentsFromPath(href) || '/';\n\n // Append base url only if needed.\n if (!shouldLinkExternally(strippedHref)) {\n strippedHref = appendBaseUrl(strippedHref);\n }\n\n return {\n href: strippedHref,\n role: 'link' as const,\n onPress,\n };\n}\n\nexport function shouldHandleMouseEvent(\n event?: MouseEvent<HTMLAnchorElement> | GestureResponderEvent\n) {\n if (Platform.OS !== 'web') {\n return !event?.defaultPrevented;\n }\n\n if (event && eventShouldPreventDefault(event)) {\n event.preventDefault();\n return true;\n }\n\n return false;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"useLoadedNavigation.d.ts","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAC;AAK1F,KAAK,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG;IACvE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,mBAAmB,sBA8Bb,iBAAiB,KAAK,IAAI,UAU/C;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAShE"}
1
+ {"version":3,"file":"useLoadedNavigation.d.ts","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,0BAA0B,CAAC;AAK1F,KAAK,iBAAiB,GAAG,cAAc,CAAC,eAAe,CAAC,aAAa,CAAC,GAAG;IACvE,QAAQ,IAAI,eAAe,GAAG,SAAS,CAAC;CACzC,CAAC;AAEF,gFAAgF;AAChF,wBAAgB,mBAAmB,SA8B1B,CAAC,UAAU,EAAE,iBAAiB,KAAK,IAAI,UAU/C;AAED,wBAAgB,qBAAqB,IAAI,iBAAiB,GAAG,IAAI,CAShE"}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useOptionalNavigation = exports.useLoadedNavigation = void 0;
3
+ exports.useLoadedNavigation = useLoadedNavigation;
4
+ exports.useOptionalNavigation = useOptionalNavigation;
4
5
  const native_1 = require("@react-navigation/native");
5
6
  const react_1 = require("react");
6
7
  const router_store_1 = require("../global-state/router-store");
@@ -38,7 +39,6 @@ function useLoadedNavigation() {
38
39
  }, [flush]);
39
40
  return push;
40
41
  }
41
- exports.useLoadedNavigation = useLoadedNavigation;
42
42
  function useOptionalNavigation() {
43
43
  const [navigation, setNavigation] = (0, react_1.useState)(null);
44
44
  const loadNavigation = useLoadedNavigation();
@@ -47,5 +47,4 @@ function useOptionalNavigation() {
47
47
  }, []);
48
48
  return navigation;
49
49
  }
50
- exports.useOptionalNavigation = useOptionalNavigation;
51
50
  //# sourceMappingURL=useLoadedNavigation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useLoadedNavigation.js","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":";;;AAAA,qDAA0F;AAC1F,iCAAiE;AAEjE,+DAA6D;AAM7D,gFAAgF;AAChF,SAAgB,mBAAmB;IACjC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAa,GAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;IAC/B,MAAM,OAAO,GAAG,IAAA,cAAM,EAA8C,EAAE,CAAC,CAAC;IAExE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,SAAS,CAAC,OAAO,GAAG,IAAI,CAAC;QACzB,OAAO,GAAG,EAAE;Y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;AACpB,CAAC;AATD,sDASC","sourcesContent":["import { NavigationProp, NavigationState, useNavigation } from '@react-navigation/native';\nimport { useCallback, useState, useEffect, useRef } from 'react';\n\nimport { useExpoRouter } from '../global-state/router-store';\n\ntype GenericNavigation = NavigationProp<ReactNavigation.RootParamList> & {\n getState(): NavigationState | undefined;\n};\n\n/** Returns a callback which is invoked when the navigation state has loaded. */\nexport function useLoadedNavigation() {\n const { navigationRef } = useExpoRouter();\n const navigation = useNavigation();\n const isMounted = useRef(true);\n const pending = useRef<((navigation: GenericNavigation) => void)[]>([]);\n\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const flush = useCallback(() => {\n if (isMounted.current) {\n const pendingCallbacks = pending.current;\n pending.current = [];\n pendingCallbacks.forEach((callback) => {\n callback(navigation as GenericNavigation);\n });\n }\n }, [navigation]);\n\n useEffect(() => {\n if (navigationRef.current) {\n flush();\n }\n }, [flush]);\n\n const push = useCallback(\n (fn: (navigation: GenericNavigation) => void) => {\n pending.current.push(fn);\n if (navigationRef.current) {\n flush();\n }\n },\n [flush]\n );\n\n return push;\n}\n\nexport function useOptionalNavigation(): GenericNavigation | null {\n const [navigation, setNavigation] = useState<GenericNavigation | null>(null);\n const loadNavigation = useLoadedNavigation();\n\n useEffect(() => {\n loadNavigation((nav) => setNavigation(nav));\n }, []);\n\n return navigation;\n}\n"]}
1
+ {"version":3,"file":"useLoadedNavigation.js","sourceRoot":"","sources":["../../src/link/useLoadedNavigation.ts"],"names":[],"mappings":";;AAUA,kDAwCC;AAED,sDASC;AA7DD,qDAA0F;AAC1F,iCAAiE;AAEjE,+DAA6D;AAM7D,gFAAgF;AAChF,SAAgB,mBAAmB;IACjC,MAAM,EAAE,aAAa,EAAE,GAAG,IAAA,4BAAa,GAAE,CAAC;IAC1C,MAAM,UAAU,GAAG,IAAA,sBAAa,GAAE,CAAC;IACnC,MAAM,SAAS,GAAG,IAAA,cAAM,EAAC,IAAI,CAAC,CAAC;I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AAC;IAE7C,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,cAAc,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IAC9C,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,UAAU,CAAC;AACpB,CAAC","sourcesContent":["import { NavigationProp, NavigationState, useNavigation } from '@react-navigation/native';\nimport { useCallback, useState, useEffect, useRef } from 'react';\n\nimport { useExpoRouter } from '../global-state/router-store';\n\ntype GenericNavigation = NavigationProp<ReactNavigation.RootParamList> & {\n getState(): NavigationState | undefined;\n};\n\n/** Returns a callback which is invoked when the navigation state has loaded. */\nexport function useLoadedNavigation() {\n const { navigationRef } = useExpoRouter();\n const navigation = useNavigation();\n const isMounted = useRef(true);\n const pending = useRef<((navigation: GenericNavigation) => void)[]>([]);\n\n useEffect(() => {\n isMounted.current = true;\n return () => {\n isMounted.current = false;\n };\n }, []);\n\n const flush = useCallback(() => {\n if (isMounted.current) {\n const pendingCallbacks = pending.current;\n pending.current = [];\n pendingCallbacks.forEach((callback) => {\n callback(navigation as GenericNavigation);\n });\n }\n }, [navigation]);\n\n useEffect(() => {\n if (navigationRef.current) {\n flush();\n }\n }, [flush]);\n\n const push = useCallback(\n (fn: (navigation: GenericNavigation) => void) => {\n pending.current.push(fn);\n if (navigationRef.current) {\n flush();\n }\n },\n [flush]\n );\n\n return push;\n}\n\nexport function useOptionalNavigation(): GenericNavigation | null {\n const [navigation, setNavigation] = useState<GenericNavigation | null>(null);\n const loadNavigation = useLoadedNavigation();\n\n useEffect(() => {\n loadNavigation((nav) => setNavigation(nav));\n }, []);\n\n return navigation;\n}\n"]}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.assertStaticParams = exports.evalStaticParamsAsync = exports.loadStaticParamsAsync = void 0;
3
+ exports.loadStaticParamsAsync = loadStaticParamsAsync;
4
+ exports.evalStaticParamsAsync = evalStaticParamsAsync;
5
+ exports.assertStaticParams = assertStaticParams;
4
6
  async function loadStaticParamsAsync(route) {
5
7
  const expandedChildren = await Promise.all(route.children.map((route) => loadStaticParamsRecursive(route, { parentParams: {} })));
6
8
  route.children = expandedChildren.flat();
7
9
  return route;
8
10
  }
9
- exports.loadStaticParamsAsync = loadStaticParamsAsync;
10
11
  async function evalStaticParamsAsync(route, props, generateStaticParams) {
11
12
  if (!route.dynamic && generateStaticParams) {
12
13
  throw new Error('Cannot use generateStaticParams in a route without dynamic segments: ' + route.contextKey);
@@ -22,7 +23,6 @@ async function evalStaticParamsAsync(route, props, generateStaticParams) {
22
23
  }
23
24
  return null;
24
25
  }
25
- exports.evalStaticParamsAsync = evalStaticParamsAsync;
26
26
  async function loadStaticParamsRecursive(route, props) {
27
27
  if (!route?.dynamic && !route?.children?.length) {
28
28
  return [route];
@@ -160,5 +160,4 @@ function assertStaticParams(route, params) {
160
160
  }
161
161
  }
162
162
  }
163
- exports.assertStaticParams = assertStaticParams;
164
163
  //# sourceMappingURL=loadStaticParamsAsync.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"loadStaticParamsAsync.js","sourceRoot":"","sources":["../src/loadStaticParamsAsync.ts"],"names":[],"mappings":";;;AAEO,KAAK,UAAU,qBAAqB,CAAC,KAAgB;IAC1D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,CACxC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC,CACtF,CAAC;IACF,KAAK,CAAC,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,CAAC;IACzC,OAAO,KAAK,CAAC;AACf,CAAC;AAND,sDAMC;AAEM,KAAK,UAAU,qBAAqB,CACzC,KAAgB,EAChB,KAA4B,EAC5B,oBAEyC;IAEzC,IAAI,CAAC,KAAK,CAAC,OAAO,IAAI,oBA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,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;SACzC;KACF;AACH,CAAC;AA7DD,gDA6DC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\n\nexport async function loadStaticParamsAsync(route: RouteNode): Promise<RouteNode> {\n const expandedChildren = await Promise.all(\n route.children.map((route) => loadStaticParamsRecursive(route, { parentParams: {} }))\n );\n route.children = expandedChildren.flat();\n return route;\n}\n\nexport async function evalStaticParamsAsync(\n route: RouteNode,\n props: { parentParams: any },\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[]\n): Promise<Record<string, string | string[]>[] | null> {\n if (!route.dynamic && generateStaticParams) {\n throw new Error(\n 'Cannot use generateStaticParams in a route without dynamic segments: ' + route.contextKey\n );\n }\n\n if (generateStaticParams) {\n const staticParams = await generateStaticParams({\n params: props.parentParams || {},\n });\n\n assertStaticParamsType(staticParams);\n // Assert that at least one param from each matches the dynamic route.\n staticParams.forEach((params) => assertStaticParams(route, params));\n\n return staticParams;\n }\n return null;\n}\n\nasync function loadStaticParamsRecursive(\n route: RouteNode,\n props: { parentParams: any }\n): Promise<RouteNode[]> {\n if (!route?.dynamic && !route?.children?.length) {\n return [route];\n }\n\n const loaded = await route.loadRoute();\n\n const staticParams =\n (await evalStaticParamsAsync(route, props, loaded.generateStaticParams)) ?? [];\n\n const traverseForNode = async (nextParams: Record<string, string | string[]>) => {\n const nextChildren: RouteNode[] = [];\n for (const child of route.children) {\n const children = await loadStaticParamsRecursive(child, {\n ...props,\n parentParams: nextParams,\n });\n nextChildren.push(...children);\n }\n\n return uniqBy(nextChildren, (i) => i.route);\n };\n\n if (!staticParams.length) {\n const nextParams = {\n ...props.parentParams,\n };\n\n route.children = await traverseForNode(nextParams);\n\n return [route];\n }\n\n const createParsedRouteName = (input: string, params: any) => {\n let parsedRouteName = input;\n route.dynamic?.map((query) => {\n const param = params[query.name];\n const formattedParameter = Array.isArray(param) ? param.join('/') : param;\n if (query.deep) {\n parsedRouteName = parsedRouteName.replace(`[...${query.name}]`, formattedParameter);\n } else {\n parsedRouteName = parsedRouteName.replace(`[${query.name}]`, param);\n }\n });\n\n return parsedRouteName;\n };\n\n const generatedRoutes = await Promise.all(\n staticParams.map(async (params) => {\n const nextParams = {\n ...props.parentParams,\n ...params,\n };\n\n const dynamicChildren = await traverseForNode(nextParams);\n const parsedRoute = createParsedRouteName(route.route, params);\n const generatedContextKey = createParsedRouteName(route.contextKey, params);\n\n return {\n ...route,\n // TODO: Add a new field for this\n contextKey: generatedContextKey,\n // Convert the dynamic route to a static route.\n dynamic: null,\n route: parsedRoute,\n children: dynamicChildren,\n };\n })\n );\n\n return [route, ...generatedRoutes];\n}\n\n/** lodash.uniqBy */\nfunction uniqBy<T>(array: T[], key: (item: T) => string): T[] {\n const seen: Record<string, boolean> = {};\n return array.filter((item) => {\n const k = key(item);\n if (seen[k]) {\n return false;\n }\n seen[k] = true;\n return true;\n });\n}\n\nfunction assertStaticParamsType(params: any): asserts params is Record<string, string | string[]> {\n if (!Array.isArray(params)) {\n throw new Error(`generateStaticParams() must return an array of params, received ${params}`);\n }\n}\n\nfunction formatExpected(expected: string[], received: Record<string, any>): string {\n const total = {\n ...received,\n };\n for (const item of expected) {\n if (total[item] == null) {\n total[item] = String(total[item]);\n } else {\n total[item] = `\"${total[item]}\"`;\n }\n }\n\n return [\n '{',\n Object.entries(total)\n .map(([key, value]) => ` \"${key}\": ${value}`)\n .join(',\\n'),\n '}',\n ].join('\\n');\n}\n\nexport function assertStaticParams(\n route: Pick<RouteNode, 'contextKey' | 'dynamic'>,\n params: Record<string, string | string[]>\n) {\n // Type checking\n if (!route.dynamic) {\n throw new Error('assertStaticParams() must be called on a dynamic route.');\n }\n const matches = route.dynamic.every((dynamic) => {\n const value = params[dynamic.name];\n return value !== undefined && value !== null;\n });\n if (!matches) {\n const plural = route.dynamic.length > 1 ? 's' : '';\n const expected = route.dynamic.map((dynamic) => dynamic.name);\n throw new Error(\n `[${\n route.contextKey\n }]: generateStaticParams() must return an array of params that match the dynamic route${plural}. Expected non-nullish values for key${plural}: ${expected\n .map((v) => `\"${v}\"`)\n .join(', ')}.\\nReceived:\\n${formatExpected(expected, params)}`\n );\n }\n\n const validateSingleParam = (\n dynamic: DynamicConvention,\n value: any,\n allowMultipleSegments?: boolean\n ) => {\n if (typeof value !== 'string') {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${\n dynamic.name\n }\" to be of type string, instead found \"${typeof value}\" while parsing \"${value}\".`\n );\n }\n const parts = value.split('/').filter(Boolean);\n if (parts.length > 1 && !allowMultipleSegments) {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${dynamic.name}\" to not contain \"/\" (multiple segments) while parsing \"${value}\".`\n );\n }\n if (parts.length === 0) {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${dynamic.name}\" not to be empty while parsing \"${value}\".`\n );\n }\n };\n\n // `[shape]/bar/[...colors]` -> `[shape]`, `[...colors]`\n for (const dynamic of route.dynamic) {\n let parameter = params[dynamic.name];\n if (dynamic.deep) {\n if (Array.isArray(parameter)) {\n parameter = parameter.filter(Boolean).join('/');\n }\n validateSingleParam(dynamic, parameter, true);\n } else {\n validateSingleParam(dynamic, parameter);\n }\n }\n}\n"]}
1
+ {"version":3,"file":"loadStaticParamsAsync.js","sourceRoot":"","sources":["../src/loadStaticParamsAsync.ts"],"names":[],"mappings":";;AAEA,sDAMC;AAED,sDAyBC;AAuHD,gDA6DC;AArNM,KAAK,UAAU,qBAAqB,CAAC,KAAgB;IAC1D,MAAM,gBAAgB,GAAG,MAAM,OAAO,CAAC,GAAG,CACxC,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,yBAAyB,CAAC,KAAK,EAAE,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAAC,CACtF,CAAC;IACF,KAAK,CAAC,QAAQ,GAAG,gBAAgB,CAAC,IAAI,EAAE,C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,EAAE,CAAC;QACpC,IAAI,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QACrC,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;YACjB,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;gBAC7B,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAClD,CAAC;YACD,mBAAmB,CAAC,OAAO,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,mBAAmB,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC","sourcesContent":["import type { DynamicConvention, RouteNode } from './Route';\n\nexport async function loadStaticParamsAsync(route: RouteNode): Promise<RouteNode> {\n const expandedChildren = await Promise.all(\n route.children.map((route) => loadStaticParamsRecursive(route, { parentParams: {} }))\n );\n route.children = expandedChildren.flat();\n return route;\n}\n\nexport async function evalStaticParamsAsync(\n route: RouteNode,\n props: { parentParams: any },\n generateStaticParams?: (props: {\n params?: Record<string, string | string[]>;\n }) => Record<string, string | string[]>[]\n): Promise<Record<string, string | string[]>[] | null> {\n if (!route.dynamic && generateStaticParams) {\n throw new Error(\n 'Cannot use generateStaticParams in a route without dynamic segments: ' + route.contextKey\n );\n }\n\n if (generateStaticParams) {\n const staticParams = await generateStaticParams({\n params: props.parentParams || {},\n });\n\n assertStaticParamsType(staticParams);\n // Assert that at least one param from each matches the dynamic route.\n staticParams.forEach((params) => assertStaticParams(route, params));\n\n return staticParams;\n }\n return null;\n}\n\nasync function loadStaticParamsRecursive(\n route: RouteNode,\n props: { parentParams: any }\n): Promise<RouteNode[]> {\n if (!route?.dynamic && !route?.children?.length) {\n return [route];\n }\n\n const loaded = await route.loadRoute();\n\n const staticParams =\n (await evalStaticParamsAsync(route, props, loaded.generateStaticParams)) ?? [];\n\n const traverseForNode = async (nextParams: Record<string, string | string[]>) => {\n const nextChildren: RouteNode[] = [];\n for (const child of route.children) {\n const children = await loadStaticParamsRecursive(child, {\n ...props,\n parentParams: nextParams,\n });\n nextChildren.push(...children);\n }\n\n return uniqBy(nextChildren, (i) => i.route);\n };\n\n if (!staticParams.length) {\n const nextParams = {\n ...props.parentParams,\n };\n\n route.children = await traverseForNode(nextParams);\n\n return [route];\n }\n\n const createParsedRouteName = (input: string, params: any) => {\n let parsedRouteName = input;\n route.dynamic?.map((query) => {\n const param = params[query.name];\n const formattedParameter = Array.isArray(param) ? param.join('/') : param;\n if (query.deep) {\n parsedRouteName = parsedRouteName.replace(`[...${query.name}]`, formattedParameter);\n } else {\n parsedRouteName = parsedRouteName.replace(`[${query.name}]`, param);\n }\n });\n\n return parsedRouteName;\n };\n\n const generatedRoutes = await Promise.all(\n staticParams.map(async (params) => {\n const nextParams = {\n ...props.parentParams,\n ...params,\n };\n\n const dynamicChildren = await traverseForNode(nextParams);\n const parsedRoute = createParsedRouteName(route.route, params);\n const generatedContextKey = createParsedRouteName(route.contextKey, params);\n\n return {\n ...route,\n // TODO: Add a new field for this\n contextKey: generatedContextKey,\n // Convert the dynamic route to a static route.\n dynamic: null,\n route: parsedRoute,\n children: dynamicChildren,\n };\n })\n );\n\n return [route, ...generatedRoutes];\n}\n\n/** lodash.uniqBy */\nfunction uniqBy<T>(array: T[], key: (item: T) => string): T[] {\n const seen: Record<string, boolean> = {};\n return array.filter((item) => {\n const k = key(item);\n if (seen[k]) {\n return false;\n }\n seen[k] = true;\n return true;\n });\n}\n\nfunction assertStaticParamsType(params: any): asserts params is Record<string, string | string[]> {\n if (!Array.isArray(params)) {\n throw new Error(`generateStaticParams() must return an array of params, received ${params}`);\n }\n}\n\nfunction formatExpected(expected: string[], received: Record<string, any>): string {\n const total = {\n ...received,\n };\n for (const item of expected) {\n if (total[item] == null) {\n total[item] = String(total[item]);\n } else {\n total[item] = `\"${total[item]}\"`;\n }\n }\n\n return [\n '{',\n Object.entries(total)\n .map(([key, value]) => ` \"${key}\": ${value}`)\n .join(',\\n'),\n '}',\n ].join('\\n');\n}\n\nexport function assertStaticParams(\n route: Pick<RouteNode, 'contextKey' | 'dynamic'>,\n params: Record<string, string | string[]>\n) {\n // Type checking\n if (!route.dynamic) {\n throw new Error('assertStaticParams() must be called on a dynamic route.');\n }\n const matches = route.dynamic.every((dynamic) => {\n const value = params[dynamic.name];\n return value !== undefined && value !== null;\n });\n if (!matches) {\n const plural = route.dynamic.length > 1 ? 's' : '';\n const expected = route.dynamic.map((dynamic) => dynamic.name);\n throw new Error(\n `[${\n route.contextKey\n }]: generateStaticParams() must return an array of params that match the dynamic route${plural}. Expected non-nullish values for key${plural}: ${expected\n .map((v) => `\"${v}\"`)\n .join(', ')}.\\nReceived:\\n${formatExpected(expected, params)}`\n );\n }\n\n const validateSingleParam = (\n dynamic: DynamicConvention,\n value: any,\n allowMultipleSegments?: boolean\n ) => {\n if (typeof value !== 'string') {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${\n dynamic.name\n }\" to be of type string, instead found \"${typeof value}\" while parsing \"${value}\".`\n );\n }\n const parts = value.split('/').filter(Boolean);\n if (parts.length > 1 && !allowMultipleSegments) {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${dynamic.name}\" to not contain \"/\" (multiple segments) while parsing \"${value}\".`\n );\n }\n if (parts.length === 0) {\n throw new Error(\n `generateStaticParams() for route \"${route.contextKey}\" expected param \"${dynamic.name}\" not to be empty while parsing \"${value}\".`\n );\n }\n };\n\n // `[shape]/bar/[...colors]` -> `[shape]`, `[...colors]`\n for (const dynamic of route.dynamic) {\n let parameter = params[dynamic.name];\n if (dynamic.deep) {\n if (Array.isArray(parameter)) {\n parameter = parameter.filter(Boolean).join('/');\n }\n validateSingleParam(dynamic, parameter, true);\n } else {\n validateSingleParam(dynamic, parameter);\n }\n }\n}\n"]}
package/build/matchers.js CHANGED
@@ -1,42 +1,48 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isTypedRoute = exports.stripInvisibleSegmentsFromPath = exports.stripGroupSegmentsFromPath = exports.removeFileSystemDots = exports.removeFileSystemExtensions = exports.removeSupportedExtensions = exports.getContextKey = exports.getNameFromFilePath = exports.matchArrayGroupName = exports.matchLastGroupName = exports.matchGroupName = exports.testNotFound = exports.matchDeepDynamicRouteName = exports.matchDynamicName = void 0;
3
+ exports.matchDynamicName = matchDynamicName;
4
+ exports.matchDeepDynamicRouteName = matchDeepDynamicRouteName;
5
+ exports.testNotFound = testNotFound;
6
+ exports.matchGroupName = matchGroupName;
7
+ exports.matchLastGroupName = matchLastGroupName;
8
+ exports.matchArrayGroupName = matchArrayGroupName;
9
+ exports.getNameFromFilePath = getNameFromFilePath;
10
+ exports.getContextKey = getContextKey;
11
+ exports.removeSupportedExtensions = removeSupportedExtensions;
12
+ exports.removeFileSystemExtensions = removeFileSystemExtensions;
13
+ exports.removeFileSystemDots = removeFileSystemDots;
14
+ exports.stripGroupSegmentsFromPath = stripGroupSegmentsFromPath;
15
+ exports.stripInvisibleSegmentsFromPath = stripInvisibleSegmentsFromPath;
16
+ exports.isTypedRoute = isTypedRoute;
4
17
  /** Match `[page]` -> `page` */
5
18
  function matchDynamicName(name) {
6
19
  // Don't match `...` or `[` or `]` inside the brackets
7
20
  // eslint-disable-next-line no-useless-escape
8
21
  return name.match(/^\[([^[\](?:\.\.\.)]+?)\]$/)?.[1];
9
22
  }
10
- exports.matchDynamicName = matchDynamicName;
11
23
  /** Match `[...page]` -> `page` */
12
24
  function matchDeepDynamicRouteName(name) {
13
25
  return name.match(/^\[\.\.\.([^/]+?)\]$/)?.[1];
14
26
  }
15
- exports.matchDeepDynamicRouteName = matchDeepDynamicRouteName;
16
27
  /** Test `/` -> `page` */
17
28
  function testNotFound(name) {
18
29
  return /\+not-found$/.test(name);
19
30
  }
20
- exports.testNotFound = testNotFound;
21
31
  /** Match `(page)` -> `page` */
22
32
  function matchGroupName(name) {
23
33
  return name.match(/^(?:[^\\(\\)])*?\(([^\\/]+)\).*?$/)?.[1];
24
34
  }
25
- exports.matchGroupName = matchGroupName;
26
35
  /** Match `(app)/(page)` -> `page` */
27
36
  function matchLastGroupName(name) {
28
37
  return name.match(/.*(?:\/|^)\(([^\\/\s]+)\)[^\s]*$/)?.[1];
29
38
  }
30
- exports.matchLastGroupName = matchLastGroupName;
31
39
  /** Match the first array group name `(a,b,c)/(d,c)` -> `'a,b,c'` */
32
40
  function matchArrayGroupName(name) {
33
41
  return name.match(/(?:[^\\(\\)])*?\(([^\\/]+,[^\\/]+)\).*?$/)?.[1];
34
42
  }
35
- exports.matchArrayGroupName = matchArrayGroupName;
36
43
  function getNameFromFilePath(name) {
37
44
  return removeSupportedExtensions(removeFileSystemDots(name));
38
45
  }
39
- exports.getNameFromFilePath = getNameFromFilePath;
40
46
  function getContextKey(name) {
41
47
  // The root path is `` (empty string) so always prepend `/` to ensure
42
48
  // there is some value.
@@ -46,22 +52,18 @@ function getContextKey(name) {
46
52
  }
47
53
  return normal.replace(/\/?_layout$/, '');
48
54
  }
49
- exports.getContextKey = getContextKey;
50
55
  /** Remove `.js`, `.ts`, `.jsx`, `.tsx`, and the +api suffix */
51
56
  function removeSupportedExtensions(name) {
52
57
  return name.replace(/(\+api)?\.[jt]sx?$/g, '');
53
58
  }
54
- exports.removeSupportedExtensions = removeSupportedExtensions;
55
59
  /** Remove `.js`, `.ts`, `.jsx`, `.tsx` */
56
60
  function removeFileSystemExtensions(name) {
57
61
  return name.replace(/\.[jt]sx?$/g, '');
58
62
  }
59
- exports.removeFileSystemExtensions = removeFileSystemExtensions;
60
63
  // Remove any amount of `./` and `../` from the start of the string
61
64
  function removeFileSystemDots(filePath) {
62
65
  return filePath.replace(/^(?:\.\.?\/)+/g, '');
63
66
  }
64
- exports.removeFileSystemDots = removeFileSystemDots;
65
67
  function stripGroupSegmentsFromPath(path) {
66
68
  return path
67
69
  .split('/')
@@ -73,11 +75,9 @@ function stripGroupSegmentsFromPath(path) {
73
75
  }, [])
74
76
  .join('/');
75
77
  }
76
- exports.stripGroupSegmentsFromPath = stripGroupSegmentsFromPath;
77
78
  function stripInvisibleSegmentsFromPath(path) {
78
79
  return stripGroupSegmentsFromPath(path).replace(/\/?index$/, '');
79
80
  }
80
- exports.stripInvisibleSegmentsFromPath = stripInvisibleSegmentsFromPath;
81
81
  /**
82
82
  * Match:
83
83
  * - _layout files, +html, +not-found, string+api, etc
@@ -86,5 +86,4 @@ exports.stripInvisibleSegmentsFromPath = stripInvisibleSegmentsFromPath;
86
86
  function isTypedRoute(name) {
87
87
  return !name.startsWith('+') && name.match(/(_layout|[^/]*?\+[^/]*?)\.[tj]sx?$/) === null;
88
88
  }
89
- exports.isTypedRoute = isTypedRoute;
90
89
  //# sourceMappingURL=matchers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,SAAgB,gBAAgB,CAAC,IAAY;IAC3C,sDAAsD;IACtD,6CAA6C;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC;AAJD,4CAIC;AAED,kCAAkC;AAClC,SAAgB,yBAAyB,CAAC,IAAY;IACpD,OAAO,IAAI,CAAC,KAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AACjD,CAAC;AAFD,8DAEC;AAED,yBAAyB;AACzB,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC;AAFD,oCAEC;AAED,+BAA+B;AAC/B,SAAgB,cAAc,CAAC,IAAY;IACzC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAFD,wCAEC;AAED,qCAAqC;AACrC,SAA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AAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACjB,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE;YAC7B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACb;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAc,CAAC;SACjB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAVD,gEAUC;AAED,SAAgB,8BAA8B,CAAC,IAAY;IACzD,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC;AAFD,wEAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,KAAK,IAAI,CAAC;AAC5F,CAAC;AAFD,oCAEC","sourcesContent":["/** Match `[page]` -> `page` */\nexport function matchDynamicName(name: string): string | undefined {\n // Don't match `...` or `[` or `]` inside the brackets\n // eslint-disable-next-line no-useless-escape\n return name.match(/^\\[([^[\\](?:\\.\\.\\.)]+?)\\]$/)?.[1];\n}\n\n/** Match `[...page]` -> `page` */\nexport function matchDeepDynamicRouteName(name: string): string | undefined {\n return name.match(/^\\[\\.\\.\\.([^/]+?)\\]$/)?.[1];\n}\n\n/** Test `/` -> `page` */\nexport function testNotFound(name: string): boolean {\n return /\\+not-found$/.test(name);\n}\n\n/** Match `(page)` -> `page` */\nexport function matchGroupName(name: string): string | undefined {\n return name.match(/^(?:[^\\\\(\\\\)])*?\\(([^\\\\/]+)\\).*?$/)?.[1];\n}\n\n/** Match `(app)/(page)` -> `page` */\nexport function matchLastGroupName(name: string): string | undefined {\n return name.match(/.*(?:\\/|^)\\(([^\\\\/\\s]+)\\)[^\\s]*$/)?.[1];\n}\n\n/** Match the first array group name `(a,b,c)/(d,c)` -> `'a,b,c'` */\nexport function matchArrayGroupName(name: string) {\n return name.match(/(?:[^\\\\(\\\\)])*?\\(([^\\\\/]+,[^\\\\/]+)\\).*?$/)?.[1];\n}\n\nexport function getNameFromFilePath(name: string): string {\n return removeSupportedExtensions(removeFileSystemDots(name));\n}\n\nexport function getContextKey(name: string): string {\n // The root path is `` (empty string) so always prepend `/` to ensure\n // there is some value.\n const normal = '/' + getNameFromFilePath(name);\n if (!normal.endsWith('_layout')) {\n return normal;\n }\n return normal.replace(/\\/?_layout$/, '');\n}\n\n/** Remove `.js`, `.ts`, `.jsx`, `.tsx`, and the +api suffix */\nexport function removeSupportedExtensions(name: string): string {\n return name.replace(/(\\+api)?\\.[jt]sx?$/g, '');\n}\n\n/** Remove `.js`, `.ts`, `.jsx`, `.tsx` */\nexport function removeFileSystemExtensions(name: string): string {\n return name.replace(/\\.[jt]sx?$/g, '');\n}\n\n// Remove any amount of `./` and `../` from the start of the string\nexport function removeFileSystemDots(filePath: string): string {\n return filePath.replace(/^(?:\\.\\.?\\/)+/g, '');\n}\n\nexport function stripGroupSegmentsFromPath(path: string): string {\n return path\n .split('/')\n .reduce((acc, v) => {\n if (matchGroupName(v) == null) {\n acc.push(v);\n }\n return acc;\n }, [] as string[])\n .join('/');\n}\n\nexport function stripInvisibleSegmentsFromPath(path: string): string {\n return stripGroupSegmentsFromPath(path).replace(/\\/?index$/, '');\n}\n\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport function isTypedRoute(name: string) {\n return !name.startsWith('+') && name.match(/(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/) === null;\n}\n"]}
1
+ {"version":3,"file":"matchers.js","sourceRoot":"","sources":["../src/matchers.tsx"],"names":[],"mappings":";;AACA,4CAIC;AAGD,8DAEC;AAGD,oCAEC;AAGD,wCAEC;AAGD,gDAEC;AAGD,kDAEC;AAED,kDAEC;AAED,sCAQC;AAGD,8DAEC;AAGD,gEAEC;AAGD,oD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IACD,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AAC3C,CAAC;AAED,+DAA+D;AAC/D,SAAgB,yBAAyB,CAAC,IAAY;IACpD,OAAO,IAAI,CAAC,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC;AACjD,CAAC;AAED,0CAA0C;AAC1C,SAAgB,0BAA0B,CAAC,IAAY;IACrD,OAAO,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,EAAE,CAAC,CAAC;AACzC,CAAC;AAED,mEAAmE;AACnE,SAAgB,oBAAoB,CAAC,QAAgB;IACnD,OAAO,QAAQ,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAChD,CAAC;AAED,SAAgB,0BAA0B,CAAC,IAAY;IACrD,OAAO,IAAI;SACR,KAAK,CAAC,GAAG,CAAC;SACV,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACjB,IAAI,cAAc,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC;YAC9B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACd,CAAC;QACD,OAAO,GAAG,CAAC;IACb,CAAC,EAAE,EAAc,CAAC;SACjB,IAAI,CAAC,GAAG,CAAC,CAAC;AACf,CAAC;AAED,SAAgB,8BAA8B,CAAC,IAAY;IACzD,OAAO,0BAA0B,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY;IACvC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,oCAAoC,CAAC,KAAK,IAAI,CAAC;AAC5F,CAAC","sourcesContent":["/** Match `[page]` -> `page` */\nexport function matchDynamicName(name: string): string | undefined {\n // Don't match `...` or `[` or `]` inside the brackets\n // eslint-disable-next-line no-useless-escape\n return name.match(/^\\[([^[\\](?:\\.\\.\\.)]+?)\\]$/)?.[1];\n}\n\n/** Match `[...page]` -> `page` */\nexport function matchDeepDynamicRouteName(name: string): string | undefined {\n return name.match(/^\\[\\.\\.\\.([^/]+?)\\]$/)?.[1];\n}\n\n/** Test `/` -> `page` */\nexport function testNotFound(name: string): boolean {\n return /\\+not-found$/.test(name);\n}\n\n/** Match `(page)` -> `page` */\nexport function matchGroupName(name: string): string | undefined {\n return name.match(/^(?:[^\\\\(\\\\)])*?\\(([^\\\\/]+)\\).*?$/)?.[1];\n}\n\n/** Match `(app)/(page)` -> `page` */\nexport function matchLastGroupName(name: string): string | undefined {\n return name.match(/.*(?:\\/|^)\\(([^\\\\/\\s]+)\\)[^\\s]*$/)?.[1];\n}\n\n/** Match the first array group name `(a,b,c)/(d,c)` -> `'a,b,c'` */\nexport function matchArrayGroupName(name: string) {\n return name.match(/(?:[^\\\\(\\\\)])*?\\(([^\\\\/]+,[^\\\\/]+)\\).*?$/)?.[1];\n}\n\nexport function getNameFromFilePath(name: string): string {\n return removeSupportedExtensions(removeFileSystemDots(name));\n}\n\nexport function getContextKey(name: string): string {\n // The root path is `` (empty string) so always prepend `/` to ensure\n // there is some value.\n const normal = '/' + getNameFromFilePath(name);\n if (!normal.endsWith('_layout')) {\n return normal;\n }\n return normal.replace(/\\/?_layout$/, '');\n}\n\n/** Remove `.js`, `.ts`, `.jsx`, `.tsx`, and the +api suffix */\nexport function removeSupportedExtensions(name: string): string {\n return name.replace(/(\\+api)?\\.[jt]sx?$/g, '');\n}\n\n/** Remove `.js`, `.ts`, `.jsx`, `.tsx` */\nexport function removeFileSystemExtensions(name: string): string {\n return name.replace(/\\.[jt]sx?$/g, '');\n}\n\n// Remove any amount of `./` and `../` from the start of the string\nexport function removeFileSystemDots(filePath: string): string {\n return filePath.replace(/^(?:\\.\\.?\\/)+/g, '');\n}\n\nexport function stripGroupSegmentsFromPath(path: string): string {\n return path\n .split('/')\n .reduce((acc, v) => {\n if (matchGroupName(v) == null) {\n acc.push(v);\n }\n return acc;\n }, [] as string[])\n .join('/');\n}\n\nexport function stripInvisibleSegmentsFromPath(path: string): string {\n return stripGroupSegmentsFromPath(path).replace(/\\/?index$/, '');\n}\n\n/**\n * Match:\n * - _layout files, +html, +not-found, string+api, etc\n * - Routes can still use `+`, but it cannot be in the last segment.\n */\nexport function isTypedRoute(name: string) {\n return !name.startsWith('+') && name.match(/(_layout|[^/]*?\\+[^/]*?)\\.[tj]sx?$/) === null;\n}\n"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Tutorial = void 0;
6
+ exports.Tutorial = Tutorial;
7
7
  const react_1 = __importDefault(require("react"));
8
8
  const react_native_1 = require("react-native");
9
9
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
@@ -68,7 +68,6 @@ function Tutorial() {
68
68
  </react_native_1.View>
69
69
  </react_native_safe_area_context_1.SafeAreaView>);
70
70
  }
71
- exports.Tutorial = Tutorial;
72
71
  function getRootDir() {
73
72
  const dir = process.env.EXPO_ROUTER_ABS_APP_ROOT;
74
73
  if (dir.match(/\/src\/app$/)) {
@@ -1 +1 @@
1
- {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAAkF;AAClF,mFAA8D;AAE9D,uDAAyD;AACzD,wCAAkC;AAClC,kDAA+C;AAE/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,IAAI,CAAC;AAElE,SAAgB,QAAQ;IACtB,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;YACzB,gEAAgE;YAChE,uCAAuC;YACvC,+DAA+D;YAC/D,uGAAuG;YACvG,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AE,CAAC;QACd,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,CAAC;KAChB;IACD,MAAM,EAAE;QACN,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,SAAS,EAAE,EAAE;aACd;YACD,MAAM,EAAE;gBACN,QAAQ,EAAE,UAAU;gBACpB,MAAM,EAAE,EAAE;gBACV,IAAI,EAAE,EAAE;gBACR,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,QAAQ;aACnB;SACF,CAAC;KACH;IACD,IAAI,EAAE;QACJ,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;gBAC3B,UAAU,EAAE,oBAAoB;aACjC;YACD,OAAO,EAAE;gBACP,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;oBAC1B,GAAG,EAAE,aAAa;oBAClB,OAAO,EAAE,WAAW;iBACrB,CAAC;aACH;SACF,CAAC;QACF,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,EAAE;QACb,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,YAAY,EAAE,EAAE;aACjB;SACF,CAAC;KACH;IACD,aAAa,EAAE;QACb,KAAK,EAAE,SAAS;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, StatusBar, StyleSheet, Text, View, Image } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { createEntryFileAsync } from './createEntryFile';\nimport { Link } from '../exports';\nimport { Pressable } from '../views/Pressable';\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === 'web') {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== 'undefined' && location.pathname !== '/') {\n location.replace('/');\n }\n if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {\n window.document.title = 'Welcome to Expo';\n }\n }\n }, []);\n\n return (\n <SafeAreaView style={styles.background}>\n <StatusBar barStyle=\"light-content\" />\n <View style={styles.container}>\n <View style={styles.logotypeWrapper}>\n <Image style={styles.logotype} source={require('expo-router/assets/logotype.png')} />\n </View>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Welcome to Expo\n </Text>\n <Text role=\"heading\" aria-level={2} style={[styles.subtitle, styles.textSecondary]}>\n Start by creating a file{Platform.OS !== 'web' ? '\\n' : ' '}in the{' '}\n <Text style={{ fontWeight: '600' }}>{getRootDir()}</Text> directory.\n </Text>\n <Text>\n <Link\n href=\"https://docs.expo.dev/router/introduction/\"\n {...Platform.select({ web: { target: '_blank' }, native: { asChild: true } })}>\n <Pressable>\n {({ hovered, pressed }) => (\n <Text\n style={[\n styles.link,\n Platform.select({\n web: {\n transitionDuration: '200ms',\n marginBottom: 12,\n },\n }),\n hovered && {\n opacity: 0.8,\n textDecorationLine: 'underline',\n },\n pressed && {\n opacity: 0.8,\n },\n ]}>\n Learn more about Expo Router in the documentation.\n </Text>\n )}\n </Pressable>\n </Link>\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n );\n}\n\nfunction getRootDir() {\n const dir = process.env.EXPO_ROUTER_ABS_APP_ROOT!;\n if (dir.match(/\\/src\\/app$/)) {\n return 'src/app';\n } else if (dir.match(/\\/app$/)) {\n return 'app';\n }\n return dir.split('/').pop() ?? dir;\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={styles.button}>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.buttonContainer,\n hovered && {\n backgroundColor: '#fff',\n },\n pressed &&\n Platform.select({\n web: {\n transform: 'scale(0.98)',\n transitionDuration: '200ms',\n },\n default: {\n backgroundColor: '#fff',\n },\n }),\n ]}>\n <Text\n style={[\n styles.code,\n hovered && { color: '#000' },\n pressed &&\n Platform.select({\n native: { color: '#000' },\n }),\n ]}>\n <Text style={styles.textSecondary}>$</Text> touch {getRootDir()}\n /index.tsx\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n background: {\n backgroundColor: '#000',\n flex: 1,\n },\n container: {\n flex: 1,\n padding: 24,\n paddingBottom: 64,\n alignItems: 'center',\n justifyContent: 'center',\n marginHorizontal: 'auto',\n gap: 16,\n ...Platform.select({\n web: {\n maxWidth: 960,\n },\n native: {\n width: '100%',\n },\n }),\n },\n logotypeWrapper: {\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#151718',\n borderRadius: 12,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: '#313538',\n width: 78,\n height: 78,\n marginBottom: 8,\n },\n logotype: {\n width: 48,\n height: 44,\n },\n title: {\n ...Platform.select({\n web: {\n fontSize: 64,\n lineHeight: 64,\n },\n default: {\n fontSize: 56,\n lineHeight: 56,\n },\n }),\n color: '#fff',\n fontWeight: '800',\n textAlign: 'center',\n },\n buttonContainer: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n },\n }),\n backgroundColor: 'transparent',\n borderColor: '#fff',\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderRadius: 8,\n },\n button: {\n ...Platform.select({\n web: {\n marginTop: 12,\n },\n native: {\n position: 'absolute',\n bottom: 24,\n left: 32,\n right: 32,\n overflow: 'hidden',\n },\n }),\n },\n code: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n fontFamily: 'Courier, monospace',\n },\n default: {\n fontFamily: Platform.select({\n ios: 'Courier New',\n android: 'monospace',\n }),\n },\n }),\n color: '#fff',\n textAlign: 'center',\n userSelect: 'none',\n fontSize: 18,\n fontWeight: 'bold',\n },\n subtitle: {\n fontSize: 34,\n fontWeight: '200',\n textAlign: 'center',\n },\n link: {\n fontSize: 20,\n lineHeight: 26,\n textAlign: 'center',\n color: '#52a9ff',\n marginTop: 12,\n ...Platform.select({\n web: {\n marginBottom: 24,\n },\n }),\n },\n textSecondary: {\n color: '#9ba1a6',\n },\n});\n"]}
1
+ {"version":3,"file":"Tutorial.js","sourceRoot":"","sources":["../../src/onboard/Tutorial.tsx"],"names":[],"mappings":";;;;;AAUA,4BAgEC;AA1ED,kDAA0B;AAC1B,+CAAkF;AAClF,mFAA8D;AAE9D,uDAAyD;AACzD,wCAAkC;AAClC,kDAA+C;AAE/C,MAAM,gBAAgB,GAAG,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,IAAI,CAAC;AAElE,SAAgB,QAAQ;IACtB,eAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,uBAAQ,CAAC,EAAE,KAAK,KAAK,EAAE,CAAC;YAC1B,gEAAgE;YAChE,uCAAuC;YACvC,+DAA+D;YAC/D,uGAAuG;YACvG,oFAAoF;YACpF,IAAI,OAAO,QAAQ,KAAK,WAAW,IAAI,QAAQ,CAAC,QAAQ,KAAK,GAAG,EAAE,CAAC;gBACjE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;YACxB,CAAC;YACD,IAAI,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,EAAE,CAAC;gBAC5E,MAAM,CAAC,QAAQ,CAAC,KAAK,GAAG,iBAAiB,CAAC;YAC5C,CAA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;gBACR,KAAK,EAAE,EAAE;gBACT,QAAQ,EAAE,QAAQ;aACnB;SACF,CAAC;KACH;IACD,IAAI,EAAE;QACJ,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,kBAAkB,EAAE,OAAO;gBAC3B,UAAU,EAAE,oBAAoB;aACjC;YACD,OAAO,EAAE;gBACP,UAAU,EAAE,uBAAQ,CAAC,MAAM,CAAC;oBAC1B,GAAG,EAAE,aAAa;oBAClB,OAAO,EAAE,WAAW;iBACrB,CAAC;aACH;SACF,CAAC;QACF,KAAK,EAAE,MAAM;QACb,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,MAAM;KACnB;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,EAAE;QACd,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,EAAE;QACb,GAAG,uBAAQ,CAAC,MAAM,CAAC;YACjB,GAAG,EAAE;gBACH,YAAY,EAAE,EAAE;aACjB;SACF,CAAC;KACH;IACD,aAAa,EAAE;QACb,KAAK,EAAE,SAAS;KACjB;CACF,CAAC,CAAC","sourcesContent":["import React from 'react';\nimport { Platform, StatusBar, StyleSheet, Text, View, Image } from 'react-native';\nimport { SafeAreaView } from 'react-native-safe-area-context';\n\nimport { createEntryFileAsync } from './createEntryFile';\nimport { Link } from '../exports';\nimport { Pressable } from '../views/Pressable';\n\nconst canAutoTouchFile = process.env.EXPO_ROUTER_APP_ROOT != null;\n\nexport function Tutorial() {\n React.useEffect(() => {\n if (Platform.OS === 'web') {\n // Reset the route on web so the initial route isn't a 404 after\n // the user has created the entry file.\n // This is useful for cases where you are testing the tutorial.\n // To test: touch the new file, then navigate to a missing route `/foobar`, then delete the app folder.\n // you should see the tutorial again and be able to create the entry file once more.\n if (typeof location !== 'undefined' && location.pathname !== '/') {\n location.replace('/');\n }\n if (typeof window !== 'undefined' && typeof window.document !== 'undefined') {\n window.document.title = 'Welcome to Expo';\n }\n }\n }, []);\n\n return (\n <SafeAreaView style={styles.background}>\n <StatusBar barStyle=\"light-content\" />\n <View style={styles.container}>\n <View style={styles.logotypeWrapper}>\n <Image style={styles.logotype} source={require('expo-router/assets/logotype.png')} />\n </View>\n <Text role=\"heading\" aria-level={1} style={styles.title}>\n Welcome to Expo\n </Text>\n <Text role=\"heading\" aria-level={2} style={[styles.subtitle, styles.textSecondary]}>\n Start by creating a file{Platform.OS !== 'web' ? '\\n' : ' '}in the{' '}\n <Text style={{ fontWeight: '600' }}>{getRootDir()}</Text> directory.\n </Text>\n <Text>\n <Link\n href=\"https://docs.expo.dev/router/introduction/\"\n {...Platform.select({ web: { target: '_blank' }, native: { asChild: true } })}>\n <Pressable>\n {({ hovered, pressed }) => (\n <Text\n style={[\n styles.link,\n Platform.select({\n web: {\n transitionDuration: '200ms',\n marginBottom: 12,\n },\n }),\n hovered && {\n opacity: 0.8,\n textDecorationLine: 'underline',\n },\n pressed && {\n opacity: 0.8,\n },\n ]}>\n Learn more about Expo Router in the documentation.\n </Text>\n )}\n </Pressable>\n </Link>\n </Text>\n {canAutoTouchFile && <Button />}\n </View>\n </SafeAreaView>\n );\n}\n\nfunction getRootDir() {\n const dir = process.env.EXPO_ROUTER_ABS_APP_ROOT!;\n if (dir.match(/\\/src\\/app$/)) {\n return 'src/app';\n } else if (dir.match(/\\/app$/)) {\n return 'app';\n }\n return dir.split('/').pop() ?? dir;\n}\n\nfunction Button() {\n return (\n <Pressable\n onPress={() => {\n createEntryFileAsync();\n }}\n style={styles.button}>\n {({ pressed, hovered }) => (\n <View\n style={[\n styles.buttonContainer,\n hovered && {\n backgroundColor: '#fff',\n },\n pressed &&\n Platform.select({\n web: {\n transform: 'scale(0.98)',\n transitionDuration: '200ms',\n },\n default: {\n backgroundColor: '#fff',\n },\n }),\n ]}>\n <Text\n style={[\n styles.code,\n hovered && { color: '#000' },\n pressed &&\n Platform.select({\n native: { color: '#000' },\n }),\n ]}>\n <Text style={styles.textSecondary}>$</Text> touch {getRootDir()}\n /index.tsx\n </Text>\n </View>\n )}\n </Pressable>\n );\n}\n\nconst styles = StyleSheet.create({\n background: {\n backgroundColor: '#000',\n flex: 1,\n },\n container: {\n flex: 1,\n padding: 24,\n paddingBottom: 64,\n alignItems: 'center',\n justifyContent: 'center',\n marginHorizontal: 'auto',\n gap: 16,\n ...Platform.select({\n web: {\n maxWidth: 960,\n },\n native: {\n width: '100%',\n },\n }),\n },\n logotypeWrapper: {\n alignItems: 'center',\n justifyContent: 'center',\n backgroundColor: '#151718',\n borderRadius: 12,\n borderWidth: 1,\n borderStyle: 'solid',\n borderColor: '#313538',\n width: 78,\n height: 78,\n marginBottom: 8,\n },\n logotype: {\n width: 48,\n height: 44,\n },\n title: {\n ...Platform.select({\n web: {\n fontSize: 64,\n lineHeight: 64,\n },\n default: {\n fontSize: 56,\n lineHeight: 56,\n },\n }),\n color: '#fff',\n fontWeight: '800',\n textAlign: 'center',\n },\n buttonContainer: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n },\n }),\n backgroundColor: 'transparent',\n borderColor: '#fff',\n borderWidth: 2,\n paddingVertical: 12,\n paddingHorizontal: 24,\n borderRadius: 8,\n },\n button: {\n ...Platform.select({\n web: {\n marginTop: 12,\n },\n native: {\n position: 'absolute',\n bottom: 24,\n left: 32,\n right: 32,\n overflow: 'hidden',\n },\n }),\n },\n code: {\n ...Platform.select({\n web: {\n transitionDuration: '200ms',\n fontFamily: 'Courier, monospace',\n },\n default: {\n fontFamily: Platform.select({\n ios: 'Courier New',\n android: 'monospace',\n }),\n },\n }),\n color: '#fff',\n textAlign: 'center',\n userSelect: 'none',\n fontSize: 18,\n fontWeight: 'bold',\n },\n subtitle: {\n fontSize: 34,\n fontWeight: '200',\n textAlign: 'center',\n },\n link: {\n fontSize: 20,\n lineHeight: 26,\n textAlign: 'center',\n color: '#52a9ff',\n marginTop: 12,\n ...Platform.select({\n web: {\n marginBottom: 24,\n },\n }),\n },\n textSecondary: {\n color: '#9ba1a6',\n },\n});\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getAbsolutePath = exports.createEntryFileAsync = void 0;
3
+ exports.createEntryFileAsync = createEntryFileAsync;
4
+ exports.getAbsolutePath = getAbsolutePath;
4
5
  const getDevServer_1 = require("../getDevServer");
5
6
  /** Middleware for creating an entry file in the project. */
6
7
  function createEntryFileAsync() {
@@ -21,11 +22,9 @@ function createEntryFileAsync() {
21
22
  }),
22
23
  });
23
24
  }
24
- exports.createEntryFileAsync = createEntryFileAsync;
25
25
  function getAbsolutePath() {
26
26
  return process.env.EXPO_ROUTER_ABS_APP_ROOT + '/index.js';
27
27
  }
28
- exports.getAbsolutePath = getAbsolutePath;
29
28
  const TEMPLATE = `import { StyleSheet, Text, View } from "react-native";
30
29
 
31
30
  export default function Page() {
@@ -1 +1 @@
1
- {"version":3,"file":"createEntryFile.js","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":";;;AAAA,kDAA+C;AAE/C,4DAA4D;AAC5D,SAAgB,oBAAoB;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE;QACzC,gBAAgB;QAChB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;KACR;IAED,+CAA+C;IAC/C,OAAO,KAAK,CAAC,IAAA,2BAAY,GAAE,CAAC,GAAG,GAAG,aAAa,EAAE;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,QAAQ;YAClB,SAAS;YACT,IAAI,EAAE,gBAAgB;YACtB,MAAM;YACN,YAAY,EAAE,eAAe,EAAE;SAChC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAlBD,oDAkBC;AAED,SAAgB,eAAe;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,WAAW,CAAC;AAC5D,CAAC;AAFD,0CAEC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChB,CAAC","sourcesContent":["import { getDevServer } from '../getDevServer';\n\n/** Middleware for creating an entry file in the project. */\nexport function createEntryFileAsync() {\n if (process.env.NODE_ENV === 'production') {\n // No dev server\n console.warn('createEntryFile() cannot be used in production');\n return;\n }\n\n // Pings middleware in the Expo CLI dev server.\n return fetch(getDevServer().url + '_expo/touch', {\n method: 'POST',\n body: JSON.stringify({\n contents: TEMPLATE,\n // Legacy\n path: './app/index.js',\n // New\n absolutePath: getAbsolutePath(),\n }),\n });\n}\n\nexport function getAbsolutePath() {\n return process.env.EXPO_ROUTER_ABS_APP_ROOT + '/index.js';\n}\n\nconst TEMPLATE = `import { StyleSheet, Text, View } from \"react-native\";\n\nexport default function Page() {\n return (\n <View style={styles.container}>\n <View style={styles.main}>\n <Text style={styles.title}>Hello World</Text>\n <Text style={styles.subtitle}>This is the first page of your app.</Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: \"center\",\n padding: 24,\n },\n main: {\n flex: 1,\n justifyContent: \"center\",\n maxWidth: 960,\n marginHorizontal: \"auto\",\n },\n title: {\n fontSize: 64,\n fontWeight: \"bold\",\n },\n subtitle: {\n fontSize: 36,\n color: \"#38434D\",\n },\n});\n`;\n"]}
1
+ {"version":3,"file":"createEntryFile.js","sourceRoot":"","sources":["../../src/onboard/createEntryFile.ts"],"names":[],"mappings":";;AAGA,oDAkBC;AAED,0CAEC;AAzBD,kDAA+C;AAE/C,4DAA4D;AAC5D,SAAgB,oBAAoB;IAClC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY,EAAE,CAAC;QAC1C,gBAAgB;QAChB,OAAO,CAAC,IAAI,CAAC,gDAAgD,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IAED,+CAA+C;IAC/C,OAAO,KAAK,CAAC,IAAA,2BAAY,GAAE,CAAC,GAAG,GAAG,aAAa,EAAE;QAC/C,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,QAAQ,EAAE,QAAQ;YAClB,SAAS;YACT,IAAI,EAAE,gBAAgB;YACtB,MAAM;YACN,YAAY,EAAE,eAAe,EAAE;SAChC,CAAC;KACH,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,eAAe;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAwB,GAAG,WAAW,CAAC;AAC5D,CAAC;AAED,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkChB,CAAC","sourcesContent":["import { getDevServer } from '../getDevServer';\n\n/** Middleware for creating an entry file in the project. */\nexport function createEntryFileAsync() {\n if (process.env.NODE_ENV === 'production') {\n // No dev server\n console.warn('createEntryFile() cannot be used in production');\n return;\n }\n\n // Pings middleware in the Expo CLI dev server.\n return fetch(getDevServer().url + '_expo/touch', {\n method: 'POST',\n body: JSON.stringify({\n contents: TEMPLATE,\n // Legacy\n path: './app/index.js',\n // New\n absolutePath: getAbsolutePath(),\n }),\n });\n}\n\nexport function getAbsolutePath() {\n return process.env.EXPO_ROUTER_ABS_APP_ROOT + '/index.js';\n}\n\nconst TEMPLATE = `import { StyleSheet, Text, View } from \"react-native\";\n\nexport default function Page() {\n return (\n <View style={styles.container}>\n <View style={styles.main}>\n <Text style={styles.title}>Hello World</Text>\n <Text style={styles.subtitle}>This is the first page of your app.</Text>\n </View>\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: {\n flex: 1,\n alignItems: \"center\",\n padding: 24,\n },\n main: {\n flex: 1,\n justifyContent: \"center\",\n maxWidth: 960,\n marginHorizontal: \"auto\",\n },\n title: {\n fontSize: 64,\n fontWeight: \"bold\",\n },\n subtitle: {\n fontSize: 36,\n color: \"#38434D\",\n },\n});\n`;\n"]}
@@ -7,7 +7,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
7
7
  return (mod && mod.__esModule) ? mod : { "default": mod };
8
8
  };
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.App = void 0;
10
+ exports.App = App;
11
11
  // This has to be the string "expo-router/_ctx" as we resolve the exact string to
12
12
  // a different file in a custom resolver for bundle splitting in Node.js.
13
13
  const _ctx_1 = require("expo-router/_ctx");
@@ -21,5 +21,4 @@ function App() {
21
21
  <ExpoRoot_1.ExpoRoot context={_ctx_1.ctx}/>
22
22
  </head_1.Head.Provider>);
23
23
  }
24
- exports.App = App;
25
24
  //# sourceMappingURL=qualified-entry.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"qualified-entry.js","sourceRoot":"","sources":["../src/qualified-entry.tsx"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,yFAAyF;AACzF,6FAA6F;AAC7F,2FAA2F;;;;;;AAE3F,iFAAiF;AACjF,yEAAyE;AACzE,2CAAuC;AACvC,kDAA0B;AAE1B,yCAAsC;AACtC,iCAA8B;AAE9B,0BAAwB;AAExB,4DAA4D;AAC5D,SAAgB,GAAG;IACjB,OAAO,CACL,CAAC,WAAI,CAAC,QAAQ,CACZ;MAAA,CAAC,mBAAQ,CAAC,OAAO,CAAC,CAAC,UAAG,CAAC,EACzB;IAAA,EAAE,WAAI,CAAC,QAAQ,CAAC,CACjB,CAAC;AACJ,CAAC;AAND,kBAMC","sourcesContent":["// The entry component (one that uses context modules) cannot be in the same file as the\n// entry side-effects, otherwise they'll be updated when files are added/removed from the\n// app directory. This will cause a lot of unfortunate errors regarding HMR and Fast Refresh.\n// This is because Fast Refresh is sending the entire file containing an updated component.\n\n// This has to be the string \"expo-router/_ctx\" as we resolve the exact string to\n// a different file in a custom resolver for bundle splitting in Node.js.\nimport { ctx } from 'expo-router/_ctx';\nimport React from 'react';\n\nimport { ExpoRoot } from './ExpoRoot';\nimport { Head } from './head';\n\nimport './fast-refresh';\n\n// Must be exported or Fast Refresh won't update the context\nexport function App() {\n return (\n <Head.Provider>\n <ExpoRoot context={ctx} />\n </Head.Provider>\n );\n}\n"]}
1
+ {"version":3,"file":"qualified-entry.js","sourceRoot":"","sources":["../src/qualified-entry.tsx"],"names":[],"mappings":";AAAA,wFAAwF;AACxF,yFAAyF;AACzF,6FAA6F;AAC7F,2FAA2F;;;;;AAa3F,kBAMC;AAjBD,iFAAiF;AACjF,yEAAyE;AACzE,2CAAuC;AACvC,kDAA0B;AAE1B,yCAAsC;AACtC,iCAA8B;AAE9B,0BAAwB;AAExB,4DAA4D;AAC5D,SAAgB,GAAG;IACjB,OAAO,CACL,CAAC,WAAI,CAAC,QAAQ,CACZ;MAAA,CAAC,mBAAQ,CAAC,OAAO,CAAC,CAAC,UAAG,CAAC,EACzB;IAAA,EAAE,WAAI,CAAC,QAAQ,CAAC,CACjB,CAAC;AACJ,CAAC","sourcesContent":["// The entry component (one that uses context modules) cannot be in the same file as the\n// entry side-effects, otherwise they'll be updated when files are added/removed from the\n// app directory. This will cause a lot of unfortunate errors regarding HMR and Fast Refresh.\n// This is because Fast Refresh is sending the entire file containing an updated component.\n\n// This has to be the string \"expo-router/_ctx\" as we resolve the exact string to\n// a different file in a custom resolver for bundle splitting in Node.js.\nimport { ctx } from 'expo-router/_ctx';\nimport React from 'react';\n\nimport { ExpoRoot } from './ExpoRoot';\nimport { Head } from './head';\n\nimport './fast-refresh';\n\n// Must be exported or Fast Refresh won't update the context\nexport function App() {\n return (\n <Head.Provider>\n <ExpoRoot context={ctx} />\n </Head.Provider>\n );\n}\n"]}
@@ -15,15 +15,25 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
15
15
  }) : function(o, v) {
16
16
  o["default"] = v;
17
17
  });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
25
35
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.renderRootComponent = void 0;
36
+ exports.renderRootComponent = renderRootComponent;
27
37
  const expo_1 = require("expo");
28
38
  const React = __importStar(require("react"));
29
39
  const react_native_1 = require("react-native");
@@ -103,5 +113,4 @@ function renderRootComponent(Component) {
103
113
  // TODO: Render a production-only error screen.
104
114
  }
105
115
  }
106
- exports.renderRootComponent = renderRootComponent;
107
116
  //# sourceMappingURL=renderRootComponent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderRootComponent.js","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+BAA6C;AAC7C,6CAA+B;AAC/B,+CAAoC;AAEpC,6DAA+C;AAE/C,SAAS,YAAY,CAAC,GAAQ;IAC5B,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,iBAAiB,EAAE;QAC7D,OAAO,KAAK,CAAC;KACd;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC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,4BAAqB,EAAC,SAAS,CAAC,CAAC;aAClC;QACH,CAAC,CAAC,CAAC;KACJ;IAAC,OAAO,CAAC,EAAE;QACV,uEAAuE;QACvE,YAAY,CAAC,SAAS,EAAE,CAAC;QAEzB,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC9B,2CAA2C;QAC3C,mFAAmF;QACnF,yIAAyI;QACzI,+FAA+F;QAC/F,IAAA,4BAAqB,EAAC,GAAG,EAAE,CAAC,CAAC,mBAAI,CAAC,AAAD,EAAG,CAAC,CAAC;QAEtC,gFAAgF;QAChF,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE;YACjC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;SACnF;QAED,+CAA+C;QAC/C,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,+CAA+C;KAChD;AACH,CAAC;AAxCD,kDAwCC","sourcesContent":["import { registerRootComponent } from 'expo';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\nimport * as SplashScreen from './utils/splash';\n\nfunction isBaseObject(obj: any) {\n if (Object.prototype.toString.call(obj) !== '[object Object]') {\n return false;\n }\n const proto = Object.getPrototypeOf(obj);\n if (proto === null) {\n return true;\n }\n return proto === Object.prototype;\n}\n\nfunction isErrorShaped(error: any): error is Error {\n return (\n error &&\n typeof error === 'object' &&\n typeof error.name === 'string' &&\n typeof error.message === 'string'\n );\n}\n\n/**\n * After we throw this error, any number of tools could handle it.\n * This check ensures the error is always in a reason state before surfacing it to the runtime.\n */\nfunction convertError(error: any) {\n if (isErrorShaped(error)) {\n return error;\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (error == null) {\n return new Error('A null/undefined error was thrown.');\n }\n }\n\n if (isBaseObject(error)) {\n return new Error(JSON.stringify(error));\n }\n\n return new Error(String(error));\n}\n\n/**\n * Register and mount the root component using the predefined rendering\n * method. This function ensures the Splash Screen and errors are handled correctly.\n */\nexport function renderRootComponent(Component: React.ComponentType<any>) {\n try {\n // This must be delayed so the user has a chance to call it first.\n setTimeout(() => {\n SplashScreen._internal_preventAutoHideAsync?.();\n });\n\n React.startTransition(() => {\n if (process.env.NODE_ENV !== 'production') {\n const { withErrorOverlay } =\n require('@expo/metro-runtime/error-overlay') as typeof import('@expo/metro-runtime/error-overlay');\n registerRootComponent(withErrorOverlay(Component));\n } else {\n registerRootComponent(Component);\n }\n });\n } catch (e) {\n // Hide the splash screen if there was an error so the user can see it.\n SplashScreen.hideAsync();\n\n const error = convertError(e);\n // Prevent the app from throwing confusing:\n // ERROR Invariant Violation: \"main\" has not been registered. This can happen if:\n // * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.\n // * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.\n registerRootComponent(() => <View />);\n\n // Console is pretty useless on native, on web you get interactive stack traces.\n if (process.env.EXPO_OS === 'web') {\n console.error(error);\n console.error(`A runtime error has occurred while rendering the root component.`);\n }\n\n // Give React a tick to render before throwing.\n setTimeout(() => {\n throw error;\n });\n\n // TODO: Render a production-only error screen.\n }\n}\n"]}
1
+ {"version":3,"file":"renderRootComponent.js","sourceRoot":"","sources":["../src/renderRootComponent.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoDA,kDAwCC;AA5FD,+BAA6C;AAC7C,6CAA+B;AAC/B,+CAAoC;AAEpC,6DAA+C;AAE/C,SAAS,YAAY,CAAC,GAAQ;IAC5B,IAAI,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,iBAAiB,EAAE,CAAC;QAC9D,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,KAAK,GAAG,MAAM,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC;IACzC,IAAI,KAAK,KAAK,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,SAAS,CAAC,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,IAAA,4BAAqB,EAAC,SAAS,CAAC,CAAC;YACnC,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,uEAAuE;QACvE,YAAY,CAAC,SAAS,EAAE,CAAC;QAEzB,MAAM,KAAK,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;QAC9B,2CAA2C;QAC3C,mFAAmF;QACnF,yIAAyI;QACzI,+FAA+F;QAC/F,IAAA,4BAAqB,EAAC,GAAG,EAAE,CAAC,CAAC,mBAAI,CAAC,AAAD,EAAG,CAAC,CAAC;QAEtC,gFAAgF;QAChF,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,EAAE,CAAC;YAClC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACrB,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;QACpF,CAAC;QAED,+CAA+C;QAC/C,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,KAAK,CAAC;QACd,CAAC,CAAC,CAAC;QAEH,+CAA+C;IACjD,CAAC;AACH,CAAC","sourcesContent":["import { registerRootComponent } from 'expo';\nimport * as React from 'react';\nimport { View } from 'react-native';\n\nimport * as SplashScreen from './utils/splash';\n\nfunction isBaseObject(obj: any) {\n if (Object.prototype.toString.call(obj) !== '[object Object]') {\n return false;\n }\n const proto = Object.getPrototypeOf(obj);\n if (proto === null) {\n return true;\n }\n return proto === Object.prototype;\n}\n\nfunction isErrorShaped(error: any): error is Error {\n return (\n error &&\n typeof error === 'object' &&\n typeof error.name === 'string' &&\n typeof error.message === 'string'\n );\n}\n\n/**\n * After we throw this error, any number of tools could handle it.\n * This check ensures the error is always in a reason state before surfacing it to the runtime.\n */\nfunction convertError(error: any) {\n if (isErrorShaped(error)) {\n return error;\n }\n\n if (process.env.NODE_ENV === 'development') {\n if (error == null) {\n return new Error('A null/undefined error was thrown.');\n }\n }\n\n if (isBaseObject(error)) {\n return new Error(JSON.stringify(error));\n }\n\n return new Error(String(error));\n}\n\n/**\n * Register and mount the root component using the predefined rendering\n * method. This function ensures the Splash Screen and errors are handled correctly.\n */\nexport function renderRootComponent(Component: React.ComponentType<any>) {\n try {\n // This must be delayed so the user has a chance to call it first.\n setTimeout(() => {\n SplashScreen._internal_preventAutoHideAsync?.();\n });\n\n React.startTransition(() => {\n if (process.env.NODE_ENV !== 'production') {\n const { withErrorOverlay } =\n require('@expo/metro-runtime/error-overlay') as typeof import('@expo/metro-runtime/error-overlay');\n registerRootComponent(withErrorOverlay(Component));\n } else {\n registerRootComponent(Component);\n }\n });\n } catch (e) {\n // Hide the splash screen if there was an error so the user can see it.\n SplashScreen.hideAsync();\n\n const error = convertError(e);\n // Prevent the app from throwing confusing:\n // ERROR Invariant Violation: \"main\" has not been registered. This can happen if:\n // * Metro (the local dev server) is run from the wrong folder. Check if Metro is running, stop it and restart it in the current project.\n // * A module failed to load due to an error and `AppRegistry.registerComponent` wasn't called.\n registerRootComponent(() => <View />);\n\n // Console is pretty useless on native, on web you get interactive stack traces.\n if (process.env.EXPO_OS === 'web') {\n console.error(error);\n console.error(`A runtime error has occurred while rendering the root component.`);\n }\n\n // Give React a tick to render before throwing.\n setTimeout(() => {\n throw error;\n });\n\n // TODO: Render a production-only error screen.\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createRoutesManifest = void 0;
3
+ exports.createRoutesManifest = createRoutesManifest;
4
4
  // This file runs in Node.js environments.
5
5
  // no relative imports
6
6
  const getRoutesSSR_1 = require("./getRoutesSSR");
@@ -27,5 +27,4 @@ function createRoutesManifest(paths, options) {
27
27
  }
28
28
  return (0, getServerManifest_1.getServerManifest)(routeTree);
29
29
  }
30
- exports.createRoutesManifest = createRoutesManifest;
31
30
  //# sourceMappingURL=routes-manifest.js.map