one 1.1.537 → 1.1.539

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 (462) hide show
  1. package/dist/cjs/Root.native.js +83 -61
  2. package/dist/cjs/Root.native.js.map +1 -6
  3. package/dist/cjs/babel-plugins/one-router-metro.native.js +31 -20
  4. package/dist/cjs/babel-plugins/one-router-metro.native.js.map +1 -6
  5. package/dist/cjs/cli/build.native.js +340 -277
  6. package/dist/cjs/cli/build.native.js.map +1 -6
  7. package/dist/cjs/cli/buildPage.native.js +65 -36
  8. package/dist/cjs/cli/buildPage.native.js.map +1 -6
  9. package/dist/cjs/cli/checkNodeVersion.native.js +17 -14
  10. package/dist/cjs/cli/checkNodeVersion.native.js.map +1 -6
  11. package/dist/cjs/cli/dev.native.js +55 -37
  12. package/dist/cjs/cli/dev.native.js.map +1 -6
  13. package/dist/cjs/cli/label-process.native.js +20 -16
  14. package/dist/cjs/cli/label-process.native.js.map +1 -6
  15. package/dist/cjs/cli/main.native.js +37 -22
  16. package/dist/cjs/cli/main.native.js.map +1 -6
  17. package/dist/cjs/cli/patch.native.js +28 -19
  18. package/dist/cjs/cli/patch.native.js.map +1 -6
  19. package/dist/cjs/cli/prebuild.native.js +26 -18
  20. package/dist/cjs/cli/prebuild.native.js.map +1 -6
  21. package/dist/cjs/cli/runAndroid.native.js +26 -18
  22. package/dist/cjs/cli/runAndroid.native.js.map +1 -6
  23. package/dist/cjs/cli/runIos.native.js +26 -18
  24. package/dist/cjs/cli/runIos.native.js.map +1 -6
  25. package/dist/cjs/cli.native.js +281 -220
  26. package/dist/cjs/cli.native.js.map +1 -6
  27. package/dist/cjs/clientLoaderResolver.native.js +21 -19
  28. package/dist/cjs/clientLoaderResolver.native.js.map +1 -6
  29. package/dist/cjs/config.native.js +26 -21
  30. package/dist/cjs/config.native.js.map +1 -6
  31. package/dist/cjs/constants.native.js +36 -30
  32. package/dist/cjs/constants.native.js.map +1 -6
  33. package/dist/cjs/createApp.native.js +26 -21
  34. package/dist/cjs/createApp.native.js.map +1 -6
  35. package/dist/cjs/createHandleRequest.native.js +94 -85
  36. package/dist/cjs/createHandleRequest.native.js.map +1 -6
  37. package/dist/cjs/createMiddleware.native.js +17 -14
  38. package/dist/cjs/createMiddleware.native.js.map +1 -6
  39. package/dist/cjs/fallbackViews/Sitemap.native.js +21 -17
  40. package/dist/cjs/fallbackViews/Sitemap.native.js.map +1 -6
  41. package/dist/cjs/fallbackViews/Unmatched.native.js +27 -19
  42. package/dist/cjs/fallbackViews/Unmatched.native.js.map +1 -6
  43. package/dist/cjs/fork/NavigationContainer.native.js +93 -64
  44. package/dist/cjs/fork/NavigationContainer.native.js.map +1 -6
  45. package/dist/cjs/fork/__tests__/getPathFromState.test.cjs +9 -10
  46. package/dist/cjs/fork/__tests__/getPathFromState.test.js +3 -3
  47. package/dist/cjs/fork/__tests__/getPathFromState.test.js.map +1 -1
  48. package/dist/cjs/fork/__tests__/getPathFromState.test.native.js +1144 -1288
  49. package/dist/cjs/fork/__tests__/getPathFromState.test.native.js.map +1 -6
  50. package/dist/cjs/fork/__tests__/getStateFromPath.test.cjs +5 -7
  51. package/dist/cjs/fork/__tests__/getStateFromPath.test.js +5 -5
  52. package/dist/cjs/fork/__tests__/getStateFromPath.test.js.map +1 -1
  53. package/dist/cjs/fork/__tests__/getStateFromPath.test.native.js +1881 -2104
  54. package/dist/cjs/fork/__tests__/getStateFromPath.test.native.js.map +1 -6
  55. package/dist/cjs/fork/_shared.native.js +19 -19
  56. package/dist/cjs/fork/_shared.native.js.map +1 -6
  57. package/dist/cjs/fork/createMemoryHistory.native.js +131 -109
  58. package/dist/cjs/fork/createMemoryHistory.native.js.map +1 -6
  59. package/dist/cjs/fork/extractPathFromURL.native.js +43 -41
  60. package/dist/cjs/fork/extractPathFromURL.native.js.map +1 -6
  61. package/dist/cjs/fork/findFocusedRoute.native.js +20 -16
  62. package/dist/cjs/fork/findFocusedRoute.native.js.map +1 -6
  63. package/dist/cjs/fork/getPathFromState-mods.native.js +37 -25
  64. package/dist/cjs/fork/getPathFromState-mods.native.js.map +1 -6
  65. package/dist/cjs/fork/getPathFromState.native.js +112 -107
  66. package/dist/cjs/fork/getPathFromState.native.js.map +1 -6
  67. package/dist/cjs/fork/getPathFromState.test.native.js +63 -74
  68. package/dist/cjs/fork/getPathFromState.test.native.js.map +1 -6
  69. package/dist/cjs/fork/getStateFromPath-mods.native.js +126 -131
  70. package/dist/cjs/fork/getStateFromPath-mods.native.js.map +1 -6
  71. package/dist/cjs/fork/getStateFromPath.native.js +271 -240
  72. package/dist/cjs/fork/getStateFromPath.native.js.map +1 -6
  73. package/dist/cjs/fork/getStateFromPath.test.native.js +167 -306
  74. package/dist/cjs/fork/getStateFromPath.test.native.js.map +1 -6
  75. package/dist/cjs/fork/useBackButton.native.js +28 -23
  76. package/dist/cjs/fork/useBackButton.native.js.map +1 -6
  77. package/dist/cjs/fork/useDocumentTitle.native.js +17 -15
  78. package/dist/cjs/fork/useDocumentTitle.native.js.map +1 -6
  79. package/dist/cjs/fork/useLinking.native.js +111 -100
  80. package/dist/cjs/fork/useLinking.native.js.map +1 -6
  81. package/dist/cjs/fork/useThenable.native.js +41 -44
  82. package/dist/cjs/fork/useThenable.native.js.map +1 -6
  83. package/dist/cjs/fork/validatePathConfig.native.js +48 -49
  84. package/dist/cjs/fork/validatePathConfig.native.js.map +1 -6
  85. package/dist/cjs/getReactNavigationConfig.native.js +36 -39
  86. package/dist/cjs/getReactNavigationConfig.native.js.map +1 -6
  87. package/dist/cjs/getURL.native.js +25 -17
  88. package/dist/cjs/getURL.native.js.map +1 -6
  89. package/dist/cjs/head/Head.android.js +20 -16
  90. package/dist/cjs/head/Head.android.js.map +1 -6
  91. package/dist/cjs/head/Head.ios.js +162 -156
  92. package/dist/cjs/head/Head.ios.js.map +1 -6
  93. package/dist/cjs/head/Head.native.js +24 -18
  94. package/dist/cjs/head/Head.native.js.map +1 -6
  95. package/dist/cjs/head/HeadModule.native.js +21 -16
  96. package/dist/cjs/head/HeadModule.native.js.map +1 -6
  97. package/dist/cjs/head/index.native.js +13 -12
  98. package/dist/cjs/head/index.native.js.map +1 -6
  99. package/dist/cjs/head/types.native.js +9 -5
  100. package/dist/cjs/head/types.native.js.map +1 -6
  101. package/dist/cjs/head/url.js +2 -2
  102. package/dist/cjs/head/url.js.map +1 -1
  103. package/dist/cjs/head/url.native.js +23 -20
  104. package/dist/cjs/head/url.native.js.map +1 -6
  105. package/dist/cjs/hooks.native.js +62 -67
  106. package/dist/cjs/hooks.native.js.map +1 -6
  107. package/dist/cjs/href.native.js +18 -16
  108. package/dist/cjs/href.native.js.map +1 -6
  109. package/dist/cjs/import-mode/index.android.js +18 -10
  110. package/dist/cjs/import-mode/index.android.js.map +1 -6
  111. package/dist/cjs/import-mode/index.ios.js +18 -10
  112. package/dist/cjs/import-mode/index.ios.js.map +1 -6
  113. package/dist/cjs/import-mode/index.native.js +16 -9
  114. package/dist/cjs/import-mode/index.native.js.map +1 -6
  115. package/dist/cjs/index.native.js +57 -63
  116. package/dist/cjs/index.native.js.map +1 -6
  117. package/dist/cjs/interfaces/router.native.js +17 -14
  118. package/dist/cjs/interfaces/router.native.js.map +1 -6
  119. package/dist/cjs/layouts/Drawer.native.js +22 -15
  120. package/dist/cjs/layouts/Drawer.native.js.map +1 -6
  121. package/dist/cjs/layouts/Stack.native.js +22 -15
  122. package/dist/cjs/layouts/Stack.native.js.map +1 -6
  123. package/dist/cjs/layouts/Tabs.native.js +76 -63
  124. package/dist/cjs/layouts/Tabs.native.js.map +1 -6
  125. package/dist/cjs/layouts/withLayoutContext.native.js +67 -56
  126. package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -6
  127. package/dist/cjs/link/Link.native.js +94 -89
  128. package/dist/cjs/link/Link.native.js.map +1 -6
  129. package/dist/cjs/link/Redirect.native.js +25 -20
  130. package/dist/cjs/link/Redirect.native.js.map +1 -6
  131. package/dist/cjs/link/href.native.js +42 -38
  132. package/dist/cjs/link/href.native.js.map +1 -6
  133. package/dist/cjs/link/linking.native.js +63 -61
  134. package/dist/cjs/link/linking.native.js.map +1 -6
  135. package/dist/cjs/link/path.native.js +34 -38
  136. package/dist/cjs/link/path.native.js.map +1 -6
  137. package/dist/cjs/link/useLinkTo.native.js +36 -30
  138. package/dist/cjs/link/useLinkTo.native.js.map +1 -6
  139. package/dist/cjs/link/useLoadedNavigation.native.js +40 -40
  140. package/dist/cjs/link/useLoadedNavigation.native.js.map +1 -6
  141. package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js +115 -112
  142. package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js.map +1 -6
  143. package/dist/cjs/polyfills-mobile.native.js +28 -15
  144. package/dist/cjs/polyfills-mobile.native.js.map +1 -6
  145. package/dist/cjs/polyfills-server.native.js +19 -13
  146. package/dist/cjs/polyfills-server.native.js.map +1 -6
  147. package/dist/cjs/render.native.js +16 -13
  148. package/dist/cjs/render.native.js.map +1 -6
  149. package/dist/cjs/router/FlagsContext.native.js +19 -15
  150. package/dist/cjs/router/FlagsContext.native.js.map +1 -6
  151. package/dist/cjs/router/Route.native.js +39 -28
  152. package/dist/cjs/router/Route.native.js.map +1 -6
  153. package/dist/cjs/router/RouteInfoContext.native.js +37 -21
  154. package/dist/cjs/router/RouteInfoContext.native.js.map +1 -6
  155. package/dist/cjs/router/RouterStore.native.js +9 -5
  156. package/dist/cjs/router/RouterStore.native.js.map +1 -6
  157. package/dist/cjs/router/createRoute.native.js +31 -26
  158. package/dist/cjs/router/createRoute.native.js.map +1 -6
  159. package/dist/cjs/router/filterRootHTML.native.js +40 -24
  160. package/dist/cjs/router/filterRootHTML.native.js.map +1 -6
  161. package/dist/cjs/router/getLinkingConfig.native.js +24 -21
  162. package/dist/cjs/router/getLinkingConfig.native.js.map +1 -6
  163. package/dist/cjs/router/getNormalizedStatePath.native.js +32 -28
  164. package/dist/cjs/router/getNormalizedStatePath.native.js.map +1 -6
  165. package/dist/cjs/router/getRoutes.native.js +261 -273
  166. package/dist/cjs/router/getRoutes.native.js.map +1 -6
  167. package/dist/cjs/router/glob-patterns.native.js +21 -24
  168. package/dist/cjs/router/glob-patterns.native.js.map +1 -6
  169. package/dist/cjs/router/imperative-api.native.js +39 -32
  170. package/dist/cjs/router/imperative-api.native.js.map +1 -6
  171. package/dist/cjs/router/lastAction.native.js +24 -20
  172. package/dist/cjs/router/lastAction.native.js.map +1 -6
  173. package/dist/cjs/router/matchers.native.js +18 -26
  174. package/dist/cjs/router/matchers.native.js.map +1 -6
  175. package/dist/cjs/router/matchers.test.native.js +19 -17
  176. package/dist/cjs/router/matchers.test.native.js.map +1 -6
  177. package/dist/cjs/router/router.native.js +156 -150
  178. package/dist/cjs/router/router.native.js.map +1 -6
  179. package/dist/cjs/router/serverLocationContext.native.js +19 -15
  180. package/dist/cjs/router/serverLocationContext.native.js.map +1 -6
  181. package/dist/cjs/router/sortRoutes.native.js +37 -44
  182. package/dist/cjs/router/sortRoutes.native.js.map +1 -6
  183. package/dist/cjs/router/useInitializeOneRouter.native.js +28 -20
  184. package/dist/cjs/router/useInitializeOneRouter.native.js.map +1 -6
  185. package/dist/cjs/router/useNavigation.native.js +42 -35
  186. package/dist/cjs/router/useNavigation.native.js.map +1 -6
  187. package/dist/cjs/router/useScreens.native.js +280 -248
  188. package/dist/cjs/router/useScreens.native.js.map +1 -6
  189. package/dist/cjs/router/useViteRoutes.native.js +36 -31
  190. package/dist/cjs/router/useViteRoutes.native.js.map +1 -6
  191. package/dist/cjs/router/utils/getNavigateAction.native.js +33 -23
  192. package/dist/cjs/router/utils/getNavigateAction.native.js.map +1 -6
  193. package/dist/cjs/router/utils/getNavigateAction.test.native.js +142 -197
  194. package/dist/cjs/router/utils/getNavigateAction.test.native.js.map +1 -6
  195. package/dist/cjs/serve-worker.native.js +25 -16
  196. package/dist/cjs/serve-worker.native.js.map +1 -6
  197. package/dist/cjs/serve.native.js +50 -25
  198. package/dist/cjs/serve.native.js.map +1 -6
  199. package/dist/cjs/server/ServerContextScript.native.js +31 -26
  200. package/dist/cjs/server/ServerContextScript.native.js.map +1 -6
  201. package/dist/cjs/server/createRoutesManifest.native.js +26 -23
  202. package/dist/cjs/server/createRoutesManifest.native.js.map +1 -6
  203. package/dist/cjs/server/getServerManifest.native.js +107 -87
  204. package/dist/cjs/server/getServerManifest.native.js.map +1 -6
  205. package/dist/cjs/server/oneServe.native.js +199 -132
  206. package/dist/cjs/server/oneServe.native.js.map +1 -6
  207. package/dist/cjs/server/setServerGlobals.native.js +17 -14
  208. package/dist/cjs/server/setServerGlobals.native.js.map +1 -6
  209. package/dist/cjs/server/setupBuildOptions.native.js +17 -14
  210. package/dist/cjs/server/setupBuildOptions.native.js.map +1 -6
  211. package/dist/cjs/server/setupServerGlobals.native.js +3 -2
  212. package/dist/cjs/server/setupServerGlobals.native.js.map +1 -6
  213. package/dist/cjs/server-render.native.js +39 -29
  214. package/dist/cjs/server-render.native.js.map +1 -6
  215. package/dist/cjs/setup.native.js.map +1 -6
  216. package/dist/cjs/testing-utils.native.js +39 -41
  217. package/dist/cjs/testing-utils.native.js.map +1 -6
  218. package/dist/cjs/typed-routes/generateRouteTypes.native.js +36 -22
  219. package/dist/cjs/typed-routes/generateRouteTypes.native.js.map +1 -6
  220. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js +53 -47
  221. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -6
  222. package/dist/cjs/types.native.js +9 -5
  223. package/dist/cjs/types.native.js.map +1 -6
  224. package/dist/cjs/useFocusEffect.native.js +39 -36
  225. package/dist/cjs/useFocusEffect.native.js.map +1 -6
  226. package/dist/cjs/useLoader.native.js +67 -52
  227. package/dist/cjs/useLoader.native.js.map +1 -6
  228. package/dist/cjs/useServerHeadInsertion.native.js +32 -25
  229. package/dist/cjs/useServerHeadInsertion.native.js.map +1 -6
  230. package/dist/cjs/utils/assertIsReady.native.js +18 -16
  231. package/dist/cjs/utils/assertIsReady.native.js.map +1 -6
  232. package/dist/cjs/utils/cleanUrl.native.js +26 -19
  233. package/dist/cjs/utils/cleanUrl.native.js.map +1 -6
  234. package/dist/cjs/utils/dynamicImport.native.js +18 -15
  235. package/dist/cjs/utils/dynamicImport.native.js.map +1 -6
  236. package/dist/cjs/utils/ensureExists.native.js +18 -16
  237. package/dist/cjs/utils/ensureExists.native.js.map +1 -6
  238. package/dist/cjs/utils/existsAsync.native.js +27 -23
  239. package/dist/cjs/utils/existsAsync.native.js.map +1 -6
  240. package/dist/cjs/utils/getPageExport.native.js +34 -30
  241. package/dist/cjs/utils/getPageExport.native.js.map +1 -6
  242. package/dist/cjs/utils/getPathnameFromFilePath.native.js +36 -27
  243. package/dist/cjs/utils/getPathnameFromFilePath.native.js.map +1 -6
  244. package/dist/cjs/utils/getRouterRootFromOneOptions.native.js +17 -14
  245. package/dist/cjs/utils/getRouterRootFromOneOptions.native.js.map +1 -6
  246. package/dist/cjs/utils/globDir.native.js +24 -18
  247. package/dist/cjs/utils/globDir.native.js.map +1 -6
  248. package/dist/cjs/utils/hashString.native.js +23 -17
  249. package/dist/cjs/utils/hashString.native.js.map +1 -6
  250. package/dist/cjs/utils/isResponse.native.js +21 -15
  251. package/dist/cjs/utils/isResponse.native.js.map +1 -6
  252. package/dist/cjs/utils/isRolldown.native.js +24 -19
  253. package/dist/cjs/utils/isRolldown.native.js.map +1 -6
  254. package/dist/cjs/utils/isStatus.native.js +17 -14
  255. package/dist/cjs/utils/isStatus.native.js.map +1 -6
  256. package/dist/cjs/utils/platform.native.js +17 -14
  257. package/dist/cjs/utils/platform.native.js.map +1 -6
  258. package/dist/cjs/utils/promiseWithResolvers.native.js +22 -17
  259. package/dist/cjs/utils/promiseWithResolvers.native.js.map +1 -6
  260. package/dist/cjs/utils/rand.native.js +18 -15
  261. package/dist/cjs/utils/rand.native.js.map +1 -6
  262. package/dist/cjs/utils/redirect.native.js +26 -21
  263. package/dist/cjs/utils/redirect.native.js.map +1 -6
  264. package/dist/cjs/utils/removeSearch.native.js +17 -14
  265. package/dist/cjs/utils/removeSearch.native.js.map +1 -6
  266. package/dist/cjs/utils/removeUndefined.native.js +18 -16
  267. package/dist/cjs/utils/removeUndefined.native.js.map +1 -6
  268. package/dist/cjs/utils/toAbsolute.native.js +21 -17
  269. package/dist/cjs/utils/toAbsolute.native.js.map +1 -6
  270. package/dist/cjs/utils/url.native.js +17 -16
  271. package/dist/cjs/utils/url.native.js.map +1 -6
  272. package/dist/cjs/utils/useConstant.native.js +26 -21
  273. package/dist/cjs/utils/useConstant.native.js.map +1 -6
  274. package/dist/cjs/utils/weakKey.native.js +25 -21
  275. package/dist/cjs/utils/weakKey.native.js.map +1 -6
  276. package/dist/cjs/utils/weakMemo.native.js +23 -18
  277. package/dist/cjs/utils/weakMemo.native.js.map +1 -6
  278. package/dist/cjs/utils/withStaticProperties.native.js +48 -35
  279. package/dist/cjs/utils/withStaticProperties.native.js.map +1 -6
  280. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js +120 -95
  281. package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -6
  282. package/dist/cjs/vercel/build/config/vc-build-output-config-base.native.js +17 -14
  283. package/dist/cjs/vercel/build/config/vc-build-output-config-base.native.js.map +1 -6
  284. package/dist/cjs/vercel/build/config/vc-config-base.native.js +17 -14
  285. package/dist/cjs/vercel/build/config/vc-config-base.native.js.map +1 -6
  286. package/dist/cjs/vercel/build/config/vc-package-base.native.js +17 -14
  287. package/dist/cjs/vercel/build/config/vc-package-base.native.js.map +1 -6
  288. package/dist/cjs/vercel/build/generate/createApiServerlessFunction.native.js +60 -71
  289. package/dist/cjs/vercel/build/generate/createApiServerlessFunction.native.js.map +1 -6
  290. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js +36 -24
  291. package/dist/cjs/vercel/build/generate/createSsrServerlessFunction.native.js.map +1 -6
  292. package/dist/cjs/vercel/build/getPathFromRoute.native.js +18 -15
  293. package/dist/cjs/vercel/build/getPathFromRoute.native.js.map +1 -6
  294. package/dist/cjs/views/EmptyRoute.native.js +19 -15
  295. package/dist/cjs/views/EmptyRoute.native.js.map +1 -6
  296. package/dist/cjs/views/ErrorBoundary.native.js +33 -19
  297. package/dist/cjs/views/ErrorBoundary.native.js.map +1 -6
  298. package/dist/cjs/views/LoadProgressBar.native.js +75 -67
  299. package/dist/cjs/views/LoadProgressBar.native.js.map +1 -6
  300. package/dist/cjs/views/Navigator.native.js +99 -64
  301. package/dist/cjs/views/Navigator.native.js.map +1 -6
  302. package/dist/cjs/views/OneStackRouter.native.js +27 -23
  303. package/dist/cjs/views/OneStackRouter.native.js.map +1 -6
  304. package/dist/cjs/views/PreloadLinks.native.js +16 -13
  305. package/dist/cjs/views/PreloadLinks.native.js.map +1 -6
  306. package/dist/cjs/views/RootErrorBoundary.native.js +54 -53
  307. package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -6
  308. package/dist/cjs/views/Screen.native.js +28 -22
  309. package/dist/cjs/views/Screen.native.js.map +1 -6
  310. package/dist/cjs/views/ScrollBehavior.native.js +54 -43
  311. package/dist/cjs/views/ScrollBehavior.native.js.map +1 -6
  312. package/dist/cjs/views/Try.native.js +60 -54
  313. package/dist/cjs/views/Try.native.js.map +1 -6
  314. package/dist/cjs/vite/DevHead.native.js +19 -15
  315. package/dist/cjs/vite/DevHead.native.js.map +1 -6
  316. package/dist/cjs/vite/constants.native.js +20 -17
  317. package/dist/cjs/vite/constants.native.js.map +1 -6
  318. package/dist/cjs/vite/customNodeExternals.native.js +35 -25
  319. package/dist/cjs/vite/customNodeExternals.native.js.map +1 -6
  320. package/dist/cjs/vite/ensureTsConfig.native.js +21 -16
  321. package/dist/cjs/vite/ensureTsConfig.native.js.map +1 -6
  322. package/dist/cjs/vite/findDepsToOptimize.native.js +46 -43
  323. package/dist/cjs/vite/findDepsToOptimize.native.js.map +1 -6
  324. package/dist/cjs/vite/getManifest.native.js +23 -16
  325. package/dist/cjs/vite/getManifest.native.js.map +1 -6
  326. package/dist/cjs/vite/loadConfig.native.js +22 -22
  327. package/dist/cjs/vite/loadConfig.native.js.map +1 -6
  328. package/dist/cjs/vite/makePluginWebOnly.native.js +20 -19
  329. package/dist/cjs/vite/makePluginWebOnly.native.js.map +1 -6
  330. package/dist/cjs/vite/one-server-only.native.js +24 -33
  331. package/dist/cjs/vite/one-server-only.native.js.map +1 -6
  332. package/dist/cjs/vite/one.native.js +202 -181
  333. package/dist/cjs/vite/one.native.js.map +1 -6
  334. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js +75 -74
  335. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -6
  336. package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js +69 -56
  337. package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -6
  338. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +154 -108
  339. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -6
  340. package/dist/cjs/vite/plugins/fixDependenciesPlugin.native.js +25 -16
  341. package/dist/cjs/vite/plugins/fixDependenciesPlugin.native.js.map +1 -6
  342. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +33 -24
  343. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -6
  344. package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js +26 -24
  345. package/dist/cjs/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -6
  346. package/dist/cjs/vite/plugins/useDomPlugin.native.js +32 -26
  347. package/dist/cjs/vite/plugins/useDomPlugin.native.js.map +1 -6
  348. package/dist/cjs/vite/plugins/virtualEntryConstants.native.js +24 -20
  349. package/dist/cjs/vite/plugins/virtualEntryConstants.native.js.map +1 -6
  350. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +38 -45
  351. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -6
  352. package/dist/cjs/vite/replaceLoader.native.js +26 -20
  353. package/dist/cjs/vite/replaceLoader.native.js.map +1 -6
  354. package/dist/cjs/vite/resolveResponse.native.js +59 -42
  355. package/dist/cjs/vite/resolveResponse.native.js.map +1 -6
  356. package/dist/cjs/vite/types.native.js +9 -5
  357. package/dist/cjs/vite/types.native.js.map +1 -6
  358. package/dist/cjs/vite.native.js +26 -22
  359. package/dist/cjs/vite.native.js.map +1 -6
  360. package/dist/cjs/zero/getQueryKey.native.js +18 -15
  361. package/dist/cjs/zero/getQueryKey.native.js.map +1 -6
  362. package/dist/cjs/zero/isZeroQuery.native.js +23 -15
  363. package/dist/cjs/zero/isZeroQuery.native.js.map +1 -6
  364. package/dist/cjs/zero/resolveQuery.native.js +23 -19
  365. package/dist/cjs/zero/resolveQuery.native.js.map +1 -6
  366. package/dist/cjs/zero/subscribeToQuery.native.js +18 -15
  367. package/dist/cjs/zero/subscribeToQuery.native.js.map +1 -6
  368. package/dist/cjs/zero/types.native.js +9 -5
  369. package/dist/cjs/zero/types.native.js.map +1 -6
  370. package/dist/cjs/zero/useQuery.js +2 -2
  371. package/dist/cjs/zero/useQuery.js.map +1 -1
  372. package/dist/cjs/zero/useQuery.native.js +30 -19
  373. package/dist/cjs/zero/useQuery.native.js.map +1 -6
  374. package/dist/cjs/zero/useQueryZero.native.js +35 -34
  375. package/dist/cjs/zero/useQueryZero.native.js.map +1 -6
  376. package/dist/cjs/zero.native.js +20 -17
  377. package/dist/cjs/zero.native.js.map +1 -6
  378. package/dist/esm/cli/build.native.js +2 -2
  379. package/dist/esm/cli/build.native.js.map +1 -1
  380. package/dist/esm/cli/buildPage.native.js +5 -2
  381. package/dist/esm/cli/buildPage.native.js.map +1 -1
  382. package/dist/esm/cli/label-process.native.js +1 -1
  383. package/dist/esm/cli/main.native.js +2 -2
  384. package/dist/esm/cli.native.js +3 -3
  385. package/dist/esm/createApp.native.js.map +1 -1
  386. package/dist/esm/fork/__tests__/getPathFromState.test.js +3 -3
  387. package/dist/esm/fork/__tests__/getPathFromState.test.js.map +1 -1
  388. package/dist/esm/fork/__tests__/getPathFromState.test.mjs +9 -10
  389. package/dist/esm/fork/__tests__/getPathFromState.test.mjs.map +1 -1
  390. package/dist/esm/fork/__tests__/getPathFromState.test.native.js.map +1 -1
  391. package/dist/esm/fork/__tests__/getStateFromPath.test.js +5 -5
  392. package/dist/esm/fork/__tests__/getStateFromPath.test.js.map +1 -1
  393. package/dist/esm/fork/__tests__/getStateFromPath.test.mjs +5 -7
  394. package/dist/esm/fork/__tests__/getStateFromPath.test.mjs.map +1 -1
  395. package/dist/esm/fork/__tests__/getStateFromPath.test.native.js.map +1 -1
  396. package/dist/esm/fork/getStateFromPath.native.js +6 -1
  397. package/dist/esm/fork/getStateFromPath.native.js.map +1 -1
  398. package/dist/esm/fork/useBackButton.native.js.map +1 -1
  399. package/dist/esm/fork/useDocumentTitle.native.js.map +1 -1
  400. package/dist/esm/fork/useLinking.native.js +6 -1
  401. package/dist/esm/fork/useLinking.native.js.map +1 -1
  402. package/dist/esm/fork/validatePathConfig.native.js +7 -2
  403. package/dist/esm/fork/validatePathConfig.native.js.map +1 -1
  404. package/dist/esm/getURL.native.js.map +1 -1
  405. package/dist/esm/head/Head.android.js.map +1 -1
  406. package/dist/esm/head/Head.ios.js +7 -2
  407. package/dist/esm/head/Head.ios.js.map +1 -1
  408. package/dist/esm/head/url.js +2 -2
  409. package/dist/esm/head/url.js.map +1 -1
  410. package/dist/esm/head/url.native.js.map +1 -1
  411. package/dist/esm/import-mode/index.android.js.map +1 -1
  412. package/dist/esm/import-mode/index.ios.js.map +1 -1
  413. package/dist/esm/import-mode/index.native.js.map +1 -1
  414. package/dist/esm/metro-config/getViteMetroPluginOptions.native.js +2 -2
  415. package/dist/esm/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
  416. package/dist/esm/render.native.js.map +1 -1
  417. package/dist/esm/router/filterRootHTML.native.js +6 -1
  418. package/dist/esm/router/filterRootHTML.native.js.map +1 -1
  419. package/dist/esm/router/router.native.js +6 -1
  420. package/dist/esm/router/router.native.js.map +1 -1
  421. package/dist/esm/router/useScreens.native.js +7 -4
  422. package/dist/esm/router/useScreens.native.js.map +1 -1
  423. package/dist/esm/server/oneServe.native.js +1 -1
  424. package/dist/esm/testing-utils.native.js +1 -1
  425. package/dist/esm/typed-routes/generateRouteTypes.native.js +2 -2
  426. package/dist/esm/useLoader.native.js +5 -2
  427. package/dist/esm/useLoader.native.js.map +1 -1
  428. package/dist/esm/utils/existsAsync.native.js +1 -1
  429. package/dist/esm/utils/getPathnameFromFilePath.native.js +1 -1
  430. package/dist/esm/utils/isResponse.native.js +4 -1
  431. package/dist/esm/utils/isResponse.native.js.map +1 -1
  432. package/dist/esm/utils/toAbsolute.native.js +1 -1
  433. package/dist/esm/utils/withStaticProperties.native.js +6 -1
  434. package/dist/esm/utils/withStaticProperties.native.js.map +1 -1
  435. package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js +1 -1
  436. package/dist/esm/vercel/build/generate/createApiServerlessFunction.native.js +1 -1
  437. package/dist/esm/vercel/build/generate/createSsrServerlessFunction.native.js +1 -1
  438. package/dist/esm/views/PreloadLinks.native.js.map +1 -1
  439. package/dist/esm/views/RootErrorBoundary.native.js +4 -1
  440. package/dist/esm/vite/customNodeExternals.native.js +2 -2
  441. package/dist/esm/vite/ensureTsConfig.native.js +1 -1
  442. package/dist/esm/vite/findDepsToOptimize.native.js +3 -3
  443. package/dist/esm/vite/one-server-only.native.js.map +1 -1
  444. package/dist/esm/vite/one.native.js +8 -3
  445. package/dist/esm/vite/one.native.js.map +1 -1
  446. package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js +8 -5
  447. package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
  448. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +8 -5
  449. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  450. package/dist/esm/vite/plugins/fixDependenciesPlugin.native.js +6 -1
  451. package/dist/esm/vite/plugins/fixDependenciesPlugin.native.js.map +1 -1
  452. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -1
  453. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  454. package/dist/esm/vite/plugins/useDomPlugin.native.js +1 -1
  455. package/dist/esm/vite/resolveResponse.native.js +9 -1
  456. package/dist/esm/vite/resolveResponse.native.js.map +1 -1
  457. package/dist/esm/zero/isZeroQuery.native.js +6 -1
  458. package/dist/esm/zero/isZeroQuery.native.js.map +1 -1
  459. package/dist/esm/zero/useQuery.js +2 -2
  460. package/dist/esm/zero/useQuery.js.map +1 -1
  461. package/dist/esm/zero/useQuery.native.js.map +1 -1
  462. package/package.json +10 -10
@@ -1,44 +1,70 @@
1
1
  "use strict";
2
+
2
3
  var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __getProtoOf = Object.getPrototypeOf,
8
+ __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
- for (var name in all)
9
- __defProp(target, name, { get: all[name], enumerable: !0 });
10
- }, __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from == "object" || typeof from == "function")
12
- for (let key of __getOwnPropNames(from))
13
- !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- return to;
15
- };
10
+ for (var name in all) __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: !0
13
+ });
14
+ },
15
+ __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
17
+ get: () => from[key],
18
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
19
+ });
20
+ return to;
21
+ };
16
22
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
17
23
  // If the importer is in node compatibility mode or this is not an ESM
18
24
  // file that has been converted to a CommonJS file using a Babel-
19
25
  // compatible transform (i.e. "__esModule" has not been set), then set
20
26
  // "default" to the CommonJS "module.exports" for node compatibility.
21
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
22
- mod
23
- )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
28
+ value: mod,
29
+ enumerable: !0
30
+ }) : target, mod)),
31
+ __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
32
+ value: !0
33
+ }), mod);
24
34
  var getStateFromPath_exports = {};
25
35
  __export(getStateFromPath_exports, {
26
36
  getStateFromPath: () => getStateFromPath
27
37
  });
28
38
  module.exports = __toCommonJS(getStateFromPath_exports);
29
- var import_escape_string_regexp = __toESM(require("escape-string-regexp"), 1), import_findFocusedRoute = require("./findFocusedRoute"), import_validatePathConfig = require("./validatePathConfig"), import_getStateFromPath_mods = require("./getStateFromPath-mods"), import_shared = require("./_shared");
39
+ var import_escape_string_regexp = __toESM(require("escape-string-regexp"), 1),
40
+ import_findFocusedRoute = require("./findFocusedRoute.native.js"),
41
+ import_validatePathConfig = require("./validatePathConfig.native.js"),
42
+ import_getStateFromPath_mods = require("./getStateFromPath-mods.native.js"),
43
+ import_shared = require("./_shared.native.js");
44
+ function _type_of(obj) {
45
+ "@swc/helpers - typeof";
46
+
47
+ return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
48
+ }
30
49
  function getStateFromPath(path, options) {
31
- var _options_path, { initialRoutes, configs, configWithRegexes } = getConfigResources(options), screens = options == null ? void 0 : options.screens, pathData = (0, import_getStateFromPath_mods.getUrlWithReactNavigationConcessions)(path), remaining = pathData.nonstandardPathname.replace(/\/+/g, "/").replace(/^\//, "").replace(/\?.*$/, "");
50
+ var _options_path,
51
+ {
52
+ initialRoutes,
53
+ configs,
54
+ configWithRegexes
55
+ } = getConfigResources(options),
56
+ screens = options?.screens,
57
+ pathData = (0, import_getStateFromPath_mods.getUrlWithReactNavigationConcessions)(path),
58
+ remaining = pathData.nonstandardPathname.replace(/\/+/g, "/").replace(/^\//, "").replace(/\?.*$/, "");
32
59
  remaining = remaining.endsWith("/") ? remaining : `${remaining}/`;
33
60
  var prefix = options == null || (_options_path = options.path) === null || _options_path === void 0 ? void 0 : _options_path.replace(/^\//, "");
34
61
  if (prefix) {
35
62
  var normalizedPrefix = prefix.endsWith("/") ? prefix : `${prefix}/`;
36
- if (!remaining.startsWith(normalizedPrefix))
37
- return;
63
+ if (!remaining.startsWith(normalizedPrefix)) return;
38
64
  remaining = remaining.replace(normalizedPrefix, "");
39
65
  }
40
66
  if (screens === void 0) {
41
- var routes = remaining.split("/").filter(Boolean).map(function(segment) {
67
+ var routes = remaining.split("/").filter(Boolean).map(function (segment) {
42
68
  var name = decodeURIComponent(segment);
43
69
  return {
44
70
  name
@@ -48,23 +74,23 @@ function getStateFromPath(path, options) {
48
74
  }
49
75
  if (remaining === "/") {
50
76
  var match = (0, import_getStateFromPath_mods.matchForEmptyPath)(configWithRegexes);
51
- return match ? createNestedStateObject(
52
- pathData,
53
- // @modified: pass pathData instead of path
54
- match.routeNames.map(function(name) {
55
- return {
56
- name
57
- };
58
- }),
59
- initialRoutes,
60
- configs
61
- ) : void 0;
77
+ return match ? createNestedStateObject(pathData,
78
+ // @modified: pass pathData instead of path
79
+ match.routeNames.map(function (name) {
80
+ return {
81
+ name
82
+ };
83
+ }), initialRoutes, configs) : void 0;
62
84
  }
63
- var result, current, { routes: routes1, remainingPath } = matchAgainstConfigs(remaining, configWithRegexes);
64
- if (routes1 !== void 0 && (current = createNestedStateObject(pathData, routes1, initialRoutes, configs), remaining = remainingPath, result = current), !(current == null || result == null))
65
- return result;
85
+ var result,
86
+ current,
87
+ {
88
+ routes: routes1,
89
+ remainingPath
90
+ } = matchAgainstConfigs(remaining, configWithRegexes);
91
+ if (routes1 !== void 0 && (current = createNestedStateObject(pathData, routes1, initialRoutes, configs), remaining = remainingPath, result = current), !(current == null || result == null)) return result;
66
92
  }
67
- var cachedConfigResources = /* @__PURE__ */ new WeakMap();
93
+ var cachedConfigResources = /* @__PURE__ */new WeakMap();
68
94
  function getConfigResources(options) {
69
95
  if (!options) return prepareConfigResources();
70
96
  var cached = cachedConfigResources.get(options);
@@ -74,7 +100,8 @@ function getConfigResources(options) {
74
100
  }
75
101
  function prepareConfigResources(options, previousSegments) {
76
102
  options && (0, import_validatePathConfig.validatePathConfig)(options);
77
- var initialRoutes = getInitialRoutes(options), configs = getNormalizedConfigs(initialRoutes, options == null ? void 0 : options.screens, previousSegments);
103
+ var initialRoutes = getInitialRoutes(options),
104
+ configs = getNormalizedConfigs(initialRoutes, options?.screens, previousSegments);
78
105
  checkForDuplicatedConfigs(configs);
79
106
  var configWithRegexes = getConfigsWithRegexes(configs);
80
107
  return {
@@ -85,27 +112,29 @@ function prepareConfigResources(options, previousSegments) {
85
112
  }
86
113
  function getInitialRoutes(options) {
87
114
  var initialRoutes = [];
88
- return options != null && options.initialRouteName && initialRoutes.push({
115
+ return options?.initialRouteName && initialRoutes.push({
89
116
  initialRouteName: options.initialRouteName,
90
117
  parentScreens: []
91
118
  }), initialRoutes;
92
119
  }
93
120
  function getNormalizedConfigs(initialRoutes) {
94
- var screens = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}, previousSegments = arguments.length > 2 ? arguments[2] : void 0;
95
- return [].concat(...Object.keys(screens).map(function(key) {
121
+ var screens = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
122
+ previousSegments = arguments.length > 2 ? arguments[2] : void 0;
123
+ return [].concat(...Object.keys(screens).map(function (key) {
96
124
  return createNormalizedConfigs(key, screens, [], initialRoutes, []);
97
125
  })).map((0, import_getStateFromPath_mods.appendIsInitial)(initialRoutes)).sort((0, import_getStateFromPath_mods.getRouteConfigSorter)(previousSegments));
98
126
  }
99
127
  function checkForDuplicatedConfigs(configs) {
100
- configs.reduce(function(acc, config) {
128
+ configs.reduce(function (acc, config) {
101
129
  if (acc[config.pattern]) {
102
- var a = acc[config.pattern].routeNames, b = config.routeNames, intersects = a.length > b.length ? b.every(function(it, i) {
103
- return a[i] === it;
104
- }) : a.every(function(it, i) {
105
- return b[i] === it;
106
- });
107
- if (!intersects)
108
- throw new Error(`Found conflicting screens with the same pattern. The pattern '${config.pattern}' resolves to both '${a.join(" > ")}' and '${b.join(" > ")}'. Patterns must be unique and cannot resolve to more than one screen.`);
130
+ var a = acc[config.pattern].routeNames,
131
+ b = config.routeNames,
132
+ intersects = a.length > b.length ? b.every(function (it, i) {
133
+ return a[i] === it;
134
+ }) : a.every(function (it, i) {
135
+ return b[i] === it;
136
+ });
137
+ if (!intersects) throw new Error(`Found conflicting screens with the same pattern. The pattern '${config.pattern}' resolves to both '${a.join(" > ")}' and '${b.join(" > ")}'. Patterns must be unique and cannot resolve to more than one screen.`);
109
138
  }
110
139
  return Object.assign(acc, {
111
140
  [config.pattern]: config
@@ -113,7 +142,7 @@ function checkForDuplicatedConfigs(configs) {
113
142
  }, {});
114
143
  }
115
144
  function getConfigsWithRegexes(configs) {
116
- return configs.map(function(c) {
145
+ return configs.map(function (c) {
117
146
  return {
118
147
  ...c,
119
148
  // Add `$` to the regex to make sure it matches till end of the path and not just beginning
@@ -123,226 +152,228 @@ function getConfigsWithRegexes(configs) {
123
152
  };
124
153
  });
125
154
  }
126
- var joinPaths = function() {
127
- for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++)
128
- paths[_key] = arguments[_key];
129
- return [].concat(...paths.map(function(p) {
130
- return p.split("/");
131
- })).filter(Boolean).join("/");
132
- }, matchAgainstConfigs = function(remaining, configs) {
133
- var routes, remainingPath = remaining, allParams = /* @__PURE__ */ Object.create(null), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
134
- try {
135
- for (var _loop = function() {
136
- var config = _step.value;
137
- if (!config.regex)
138
- return "continue";
139
- var match = remainingPath.match(config.regex);
140
- if (match) {
141
- var _config_pattern, matchResult = (_config_pattern = config.pattern) === null || _config_pattern === void 0 ? void 0 : _config_pattern.split("/").reduce(
142
- // Position of the current path param segment in the path (e.g in pattern `a/:b/:c`, `:a` is 0 and `:b` is 1)
143
- // The extracted params
144
- function(acc, p, index) {
145
- if (!(0, import_shared.isDynamicPart)(p))
146
- return acc;
147
- acc.pos += 1;
148
- var decodedParamSegment = (0, import_getStateFromPath_mods.decodeURIComponentSafe)(
149
- // @modified: use decodeURIComponent**Safe**
150
- // The param segments appear every second item starting from 2 in the regex match result
151
- match[(acc.pos + 1) * 2].replace(/\/$/, "")
152
- );
153
- return Object.assign(acc.matchedParams, {
154
- [p]: Object.assign(acc.matchedParams[p] || {}, {
155
- [index]: decodedParamSegment
156
- })
157
- }), acc;
158
- },
159
- {
160
- pos: -1,
161
- matchedParams: {}
155
+ var joinPaths = function () {
156
+ for (var _len = arguments.length, paths = new Array(_len), _key = 0; _key < _len; _key++) paths[_key] = arguments[_key];
157
+ return [].concat(...paths.map(function (p) {
158
+ return p.split("/");
159
+ })).filter(Boolean).join("/");
160
+ },
161
+ matchAgainstConfigs = function (remaining, configs) {
162
+ var routes,
163
+ remainingPath = remaining,
164
+ allParams = /* @__PURE__ */Object.create(null),
165
+ _iteratorNormalCompletion = !0,
166
+ _didIteratorError = !1,
167
+ _iteratorError = void 0;
168
+ try {
169
+ for (var _loop = function () {
170
+ var config = _step.value;
171
+ if (!config.regex) return "continue";
172
+ var match = remainingPath.match(config.regex);
173
+ if (match) {
174
+ var _config_pattern,
175
+ matchResult = (_config_pattern = config.pattern) === null || _config_pattern === void 0 ? void 0 : _config_pattern.split("/").reduce(
176
+ // Position of the current path param segment in the path (e.g in pattern `a/:b/:c`, `:a` is 0 and `:b` is 1)
177
+ // The extracted params
178
+ function (acc, p, index) {
179
+ if (!(0, import_shared.isDynamicPart)(p)) return acc;
180
+ acc.pos += 1;
181
+ var decodedParamSegment = (0, import_getStateFromPath_mods.decodeURIComponentSafe)(
182
+ // @modified: use decodeURIComponent**Safe**
183
+ // The param segments appear every second item starting from 2 in the regex match result
184
+ match[(acc.pos + 1) * 2].replace(/\/$/, ""));
185
+ return Object.assign(acc.matchedParams, {
186
+ [p]: Object.assign(acc.matchedParams[p] || {}, {
187
+ [index]: decodedParamSegment
188
+ })
189
+ }), acc;
190
+ }, {
191
+ pos: -1,
192
+ matchedParams: {}
193
+ }),
194
+ matchedParams = matchResult.matchedParams || {};
195
+ return routes = config.routeNames.map(function (name) {
196
+ var _routeConfig_pattern_replace,
197
+ routeConfig = configs.find(function (c) {
198
+ return c.screen === name && config.pattern.startsWith(c.pattern);
199
+ }),
200
+ normalizedPath = routeConfig?.path.split("/").filter(Boolean).join("/"),
201
+ numInitialSegments = routeConfig == null || (_routeConfig_pattern_replace = routeConfig.pattern.replace(new RegExp(`${(0, import_escape_string_regexp.default)(normalizedPath)}$`), "")) === null || _routeConfig_pattern_replace === void 0 ? void 0 : _routeConfig_pattern_replace.split("/").length,
202
+ params = normalizedPath?.split("/").reduce(function (acc, p, index) {
203
+ var _matchedParams_p;
204
+ if (!(0, import_shared.isDynamicPart)(p)) return acc;
205
+ var offset = numInitialSegments ? numInitialSegments - 1 : 0,
206
+ value = (0, import_shared.getParamValue)(p, (_matchedParams_p = matchedParams[p]) === null || _matchedParams_p === void 0 ? void 0 : _matchedParams_p[index + offset]);
207
+ if (value) {
208
+ var _routeConfig_parse,
209
+ key = (0, import_shared.replacePart)(p);
210
+ acc[key] = !(routeConfig == null || (_routeConfig_parse = routeConfig.parse) === null || _routeConfig_parse === void 0) && _routeConfig_parse[key] ? routeConfig.parse[key](value) : value;
211
+ }
212
+ return acc;
213
+ }, {});
214
+ return params && Object.keys(params).length ? (Object.assign(allParams, params), {
215
+ name,
216
+ params
217
+ }) : {
218
+ name
219
+ };
220
+ }), remainingPath = remainingPath.replace(match[1], ""), "break";
162
221
  }
163
- ), matchedParams = matchResult.matchedParams || {};
164
- return routes = config.routeNames.map(function(name) {
165
- var _routeConfig_pattern_replace, routeConfig = configs.find(function(c) {
166
- return c.screen === name && config.pattern.startsWith(c.pattern);
167
- }), normalizedPath = routeConfig == null ? void 0 : routeConfig.path.split("/").filter(Boolean).join("/"), numInitialSegments = routeConfig == null || (_routeConfig_pattern_replace = routeConfig.pattern.replace(new RegExp(`${(0, import_escape_string_regexp.default)(normalizedPath)}$`), "")) === null || _routeConfig_pattern_replace === void 0 ? void 0 : _routeConfig_pattern_replace.split("/").length, params = normalizedPath == null ? void 0 : normalizedPath.split("/").reduce(function(acc, p, index) {
168
- var _matchedParams_p;
169
- if (!(0, import_shared.isDynamicPart)(p))
170
- return acc;
171
- var offset = numInitialSegments ? numInitialSegments - 1 : 0, value = (0, import_shared.getParamValue)(p, (_matchedParams_p = matchedParams[p]) === null || _matchedParams_p === void 0 ? void 0 : _matchedParams_p[index + offset]);
172
- if (value) {
173
- var _routeConfig_parse, key = (0, import_shared.replacePart)(p);
174
- acc[key] = !(routeConfig == null || (_routeConfig_parse = routeConfig.parse) === null || _routeConfig_parse === void 0) && _routeConfig_parse[key] ? routeConfig.parse[key](value) : value;
175
- }
176
- return acc;
177
- }, {});
178
- return params && Object.keys(params).length ? (Object.assign(allParams, params), {
179
- name,
180
- params
181
- }) : {
182
- name
183
- };
184
- }), remainingPath = remainingPath.replace(match[1], ""), "break";
222
+ }, _iterator = configs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
223
+ var _ret = _loop();
224
+ if (_ret === "break") break;
185
225
  }
186
- }, _iterator = configs[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
187
- var _ret = _loop();
188
- if (_ret === "break") break;
189
- }
190
- } catch (err) {
191
- _didIteratorError = !0, _iteratorError = err;
192
- } finally {
193
- try {
194
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
226
+ } catch (err) {
227
+ _didIteratorError = !0, _iteratorError = err;
195
228
  } finally {
196
- if (_didIteratorError)
197
- throw _iteratorError;
198
- }
199
- }
200
- return (0, import_getStateFromPath_mods.populateParams)(routes, allParams), {
201
- routes,
202
- remainingPath
203
- };
204
- }, createNormalizedConfigs = function(screen, routeConfig) {
205
- var routeNames = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [], initials = arguments.length > 3 ? arguments[3] : void 0, parentScreens = arguments.length > 4 ? arguments[4] : void 0, parentPattern = arguments.length > 5 ? arguments[5] : void 0, configs = [];
206
- routeNames.push(screen), parentScreens.push(screen);
207
- var config = routeConfig[screen];
208
- if (typeof config == "string") {
209
- var pattern = parentPattern ? joinPaths(parentPattern, config) : config;
210
- configs.push(createConfigItem(screen, routeNames, pattern, config));
211
- } else if (typeof config == "object") {
212
- var pattern1;
213
- if (typeof config.path == "string") {
214
- if (config.exact && config.path === void 0)
215
- throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");
216
- pattern1 = config.exact !== !0 ? joinPaths(parentPattern || "", config.path || "") : config.path || "", configs.push(createConfigItem(screen, routeNames, pattern1, config.path, config.parse, config));
229
+ try {
230
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
231
+ } finally {
232
+ if (_didIteratorError) throw _iteratorError;
233
+ }
217
234
  }
218
- config.screens && (config.initialRouteName && initials.push({
219
- initialRouteName: config.initialRouteName,
220
- parentScreens
221
- }), Object.keys(config.screens).forEach(function(nestedConfig) {
222
- var result = createNormalizedConfigs(nestedConfig, config.screens, routeNames, initials, [
223
- ...parentScreens
224
- ], pattern1 ?? parentPattern);
225
- configs.push(...result);
226
- }));
227
- }
228
- return routeNames.pop(), configs;
229
- }, createConfigItem = function(screen, routeNames, pattern, path) {
230
- var parse = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0, config = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
231
- pattern = pattern.split("/").filter(Boolean).join("/");
232
- var regex = pattern ? new RegExp(`^(${pattern.split("/").map(function(it) {
233
- return it.startsWith(":") ? `(([^/]+\\/)${it.endsWith("?") ? "?" : ""})` : `${it === "*" ? ".*" : (0, import_escape_string_regexp.default)(it)}\\/`;
234
- }).join("")})`) : void 0;
235
- return {
236
- screen,
237
- regex,
238
- pattern,
239
- path,
240
- // The routeNames array is mutated, so copy it to keep the current state
241
- routeNames: [
242
- ...routeNames
243
- ],
244
- parse,
245
- // @modified - start
246
- ...(0, import_getStateFromPath_mods.createConfigItemAdditionalProperties)(screen, pattern, routeNames, config)
247
- };
248
- }, findParseConfigForRoute = function(routeName, flatConfig) {
249
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
250
- try {
251
- for (var _iterator = flatConfig[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
252
- var config = _step.value;
253
- if (routeName === config.routeNames[config.routeNames.length - 1])
254
- return config.parse;
235
+ return (0, import_getStateFromPath_mods.populateParams)(routes, allParams), {
236
+ routes,
237
+ remainingPath
238
+ };
239
+ },
240
+ createNormalizedConfigs = function (screen, routeConfig) {
241
+ var routeNames = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : [],
242
+ initials = arguments.length > 3 ? arguments[3] : void 0,
243
+ parentScreens = arguments.length > 4 ? arguments[4] : void 0,
244
+ parentPattern = arguments.length > 5 ? arguments[5] : void 0,
245
+ configs = [];
246
+ routeNames.push(screen), parentScreens.push(screen);
247
+ var config = routeConfig[screen];
248
+ if (typeof config == "string") {
249
+ var pattern = parentPattern ? joinPaths(parentPattern, config) : config;
250
+ configs.push(createConfigItem(screen, routeNames, pattern, config));
251
+ } else if ((typeof config > "u" ? "undefined" : _type_of(config)) === "object") {
252
+ var pattern1;
253
+ if (typeof config.path == "string") {
254
+ if (config.exact && config.path === void 0) throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");
255
+ pattern1 = config.exact !== !0 ? joinPaths(parentPattern || "", config.path || "") : config.path || "", configs.push(createConfigItem(screen, routeNames, pattern1, config.path, config.parse, config));
256
+ }
257
+ config.screens && (config.initialRouteName && initials.push({
258
+ initialRouteName: config.initialRouteName,
259
+ parentScreens
260
+ }), Object.keys(config.screens).forEach(function (nestedConfig) {
261
+ var result = createNormalizedConfigs(nestedConfig, config.screens, routeNames, initials, [...parentScreens], pattern1 ?? parentPattern);
262
+ configs.push(...result);
263
+ }));
255
264
  }
256
- } catch (err) {
257
- _didIteratorError = !0, _iteratorError = err;
258
- } finally {
265
+ return routeNames.pop(), configs;
266
+ },
267
+ createConfigItem = function (screen, routeNames, pattern, path) {
268
+ var parse = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : void 0,
269
+ config = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
270
+ pattern = pattern.split("/").filter(Boolean).join("/");
271
+ var regex = pattern ? new RegExp(`^(${pattern.split("/").map(function (it) {
272
+ return it.startsWith(":") ? `(([^/]+\\/)${it.endsWith("?") ? "?" : ""})` : `${it === "*" ? ".*" : (0, import_escape_string_regexp.default)(it)}\\/`;
273
+ }).join("")})`) : void 0;
274
+ return {
275
+ screen,
276
+ regex,
277
+ pattern,
278
+ path,
279
+ // The routeNames array is mutated, so copy it to keep the current state
280
+ routeNames: [...routeNames],
281
+ parse,
282
+ // @modified - start
283
+ ...(0, import_getStateFromPath_mods.createConfigItemAdditionalProperties)(screen, pattern, routeNames, config)
284
+ };
285
+ },
286
+ findParseConfigForRoute = function (routeName, flatConfig) {
287
+ var _iteratorNormalCompletion = !0,
288
+ _didIteratorError = !1,
289
+ _iteratorError = void 0;
259
290
  try {
260
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
291
+ for (var _iterator = flatConfig[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
292
+ var config = _step.value;
293
+ if (routeName === config.routeNames[config.routeNames.length - 1]) return config.parse;
294
+ }
295
+ } catch (err) {
296
+ _didIteratorError = !0, _iteratorError = err;
261
297
  } finally {
262
- if (_didIteratorError)
263
- throw _iteratorError;
298
+ try {
299
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
300
+ } finally {
301
+ if (_didIteratorError) throw _iteratorError;
302
+ }
264
303
  }
265
- }
266
- }, findInitialRoute = function(routeName, parentScreens, initialRoutes) {
267
- var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
268
- try {
269
- for (var _iterator = initialRoutes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
270
- var config = _step.value;
271
- if (parentScreens.length === config.parentScreens.length) {
272
- for (var sameParents = !0, i = 0; i < parentScreens.length; i++)
273
- if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {
304
+ },
305
+ findInitialRoute = function (routeName, parentScreens, initialRoutes) {
306
+ var _iteratorNormalCompletion = !0,
307
+ _didIteratorError = !1,
308
+ _iteratorError = void 0;
309
+ try {
310
+ for (var _iterator = initialRoutes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
311
+ var config = _step.value;
312
+ if (parentScreens.length === config.parentScreens.length) {
313
+ for (var sameParents = !0, i = 0; i < parentScreens.length; i++) if (parentScreens[i].localeCompare(config.parentScreens[i]) !== 0) {
274
314
  sameParents = !1;
275
315
  break;
276
316
  }
277
- if (sameParents)
278
- return routeName !== config.initialRouteName ? config.initialRouteName : void 0;
317
+ if (sameParents) return routeName !== config.initialRouteName ? config.initialRouteName : void 0;
318
+ }
279
319
  }
280
- }
281
- } catch (err) {
282
- _didIteratorError = !0, _iteratorError = err;
283
- } finally {
284
- try {
285
- !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
320
+ } catch (err) {
321
+ _didIteratorError = !0, _iteratorError = err;
286
322
  } finally {
287
- if (_didIteratorError)
288
- throw _iteratorError;
323
+ try {
324
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
325
+ } finally {
326
+ if (_didIteratorError) throw _iteratorError;
327
+ }
289
328
  }
290
- }
291
- }, createStateObject = function(initialRoute, route, isEmpty) {
292
- return isEmpty ? initialRoute ? {
293
- index: 1,
294
- routes: [
295
- {
329
+ },
330
+ createStateObject = function (initialRoute, route, isEmpty) {
331
+ return isEmpty ? initialRoute ? {
332
+ index: 1,
333
+ routes: [{
296
334
  name: initialRoute
297
- },
298
- route
299
- ]
300
- } : {
301
- routes: [
302
- route
303
- ]
304
- } : initialRoute ? {
305
- index: 1,
306
- routes: [
307
- {
335
+ }, route]
336
+ } : {
337
+ routes: [route]
338
+ } : initialRoute ? {
339
+ index: 1,
340
+ routes: [{
308
341
  name: initialRoute
309
- },
310
- {
342
+ }, {
311
343
  ...route,
312
344
  state: {
313
345
  routes: []
314
346
  }
315
- }
316
- ]
317
- } : {
318
- routes: [
319
- {
347
+ }]
348
+ } : {
349
+ routes: [{
320
350
  ...route,
321
351
  state: {
322
352
  routes: []
323
353
  }
324
- }
325
- ]
326
- };
327
- }, createNestedStateObject = function(param, routes, initialRoutes, flatConfig) {
328
- var { path, ...restPathData } = param, route = routes.shift(), parentScreens = [], initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
329
- parentScreens.push(route.name);
330
- var state = createStateObject(initialRoute, route, routes.length === 0);
331
- if (routes.length > 0)
332
- for (var nestedState = state; route = routes.shift(); ) {
354
+ }]
355
+ };
356
+ },
357
+ createNestedStateObject = function (param, routes, initialRoutes, flatConfig) {
358
+ var {
359
+ path,
360
+ ...restPathData
361
+ } = param,
362
+ route = routes.shift(),
363
+ parentScreens = [],
364
+ initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
365
+ parentScreens.push(route.name);
366
+ var state = createStateObject(initialRoute, route, routes.length === 0);
367
+ if (routes.length > 0) for (var nestedState = state; route = routes.shift();) {
333
368
  initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
334
369
  var nestedStateIndex = nestedState.index || nestedState.routes.length - 1;
335
370
  nestedState.routes[nestedStateIndex].state = createStateObject(initialRoute, route, routes.length === 0), routes.length > 0 && (nestedState = nestedState.routes[nestedStateIndex].state), parentScreens.push(route.name);
336
371
  }
337
- route = (0, import_findFocusedRoute.findFocusedRoute)(state), route.path = restPathData.pathWithoutGroups;
338
- var params = (0, import_getStateFromPath_mods.parseQueryParamsExtended)(path, route, flatConfig ? findParseConfigForRoute(route.name, flatConfig) : void 0, restPathData.url.hash);
339
- return params && (route.params = {
340
- ...route.params,
341
- ...params
342
- }), state;
343
- };
344
- // Annotate the CommonJS export names for ESM import in node:
345
- 0 && (module.exports = {
346
- getStateFromPath
347
- });
348
- //# sourceMappingURL=getStateFromPath.js.map
372
+ route = (0, import_findFocusedRoute.findFocusedRoute)(state), route.path = restPathData.pathWithoutGroups;
373
+ var params = (0, import_getStateFromPath_mods.parseQueryParamsExtended)(path, route, flatConfig ? findParseConfigForRoute(route.name, flatConfig) : void 0, restPathData.url.hash);
374
+ return params && (route.params = {
375
+ ...route.params,
376
+ ...params
377
+ }), state;
378
+ };
379
+ //# sourceMappingURL=getStateFromPath.native.js.map