one 1.1.320 → 1.1.321

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. package/dist/cjs/Root.js +182 -0
  2. package/dist/cjs/Route.js +45 -0
  3. package/dist/cjs/cleanUrl.js +41 -0
  4. package/dist/cjs/cli/label-process.js +25 -0
  5. package/dist/cjs/cli/main.js +46 -0
  6. package/dist/cjs/cli/patch.js +34 -0
  7. package/dist/cjs/cli/prebuild.js +34 -0
  8. package/dist/cjs/cli/run.js +52 -0
  9. package/dist/cjs/cli/runAndroid.js +34 -0
  10. package/dist/cjs/cli/runIos.js +34 -0
  11. package/dist/cjs/cli.js +220 -0
  12. package/dist/cjs/clientLoaderResolver.js +32 -0
  13. package/dist/cjs/config.js +27 -0
  14. package/dist/cjs/constants.js +28 -0
  15. package/dist/cjs/createApp.js +46 -0
  16. package/dist/cjs/createHandleRequest.js +138 -0
  17. package/dist/cjs/createRoute.js +37 -0
  18. package/dist/cjs/fallbackViews/Sitemap.js +82 -0
  19. package/dist/cjs/fallbackViews/Unmatched.js +58 -0
  20. package/dist/cjs/fork/NavigationContainer.js +85 -0
  21. package/dist/cjs/fork/createMemoryHistory.js +100 -0
  22. package/dist/cjs/fork/extractPathFromURL.js +62 -0
  23. package/dist/cjs/fork/findFocusedRoute.js +26 -0
  24. package/dist/cjs/fork/getPathFromState.js +265 -0
  25. package/dist/cjs/fork/getStateFromPath.js +381 -0
  26. package/dist/cjs/fork/useLinking.js +182 -0
  27. package/dist/cjs/fork/validatePathConfig.js +46 -0
  28. package/dist/cjs/getLinkingConfig.js +59 -0
  29. package/dist/cjs/getReactNavigationConfig.js +69 -0
  30. package/dist/cjs/getRoutes.js +294 -0
  31. package/dist/cjs/getURL.js +24 -0
  32. package/dist/cjs/head/Head.js +23 -0
  33. package/dist/cjs/head/HeadModule.js +22 -0
  34. package/dist/cjs/head/index.js +15 -0
  35. package/dist/cjs/head/types.js +14 -0
  36. package/dist/cjs/head/url.js +52 -0
  37. package/dist/cjs/hooks.js +99 -0
  38. package/dist/cjs/imperative-api.js +45 -0
  39. package/dist/cjs/import-mode/index.js +21 -0
  40. package/dist/cjs/import-mode/index.web.js +21 -0
  41. package/dist/cjs/index.js +65 -0
  42. package/dist/cjs/interfaces/router.js +23 -0
  43. package/dist/cjs/layouts/Drawer.js +24 -0
  44. package/dist/cjs/layouts/Stack.js +24 -0
  45. package/dist/cjs/layouts/Tabs.js +52 -0
  46. package/dist/cjs/layouts/withLayoutContext.js +77 -0
  47. package/dist/cjs/link/Link.js +98 -0
  48. package/dist/cjs/link/Redirect.js +31 -0
  49. package/dist/cjs/link/href.js +50 -0
  50. package/dist/cjs/link/linking.js +82 -0
  51. package/dist/cjs/link/path.js +65 -0
  52. package/dist/cjs/link/useLinkTo.js +42 -0
  53. package/dist/cjs/link/useLoadedNavigation.js +50 -0
  54. package/dist/cjs/matchers.js +68 -0
  55. package/dist/cjs/platform.js +21 -0
  56. package/dist/cjs/polyfills-mobile.js +26 -0
  57. package/dist/cjs/polyfills-server.js +23 -0
  58. package/dist/cjs/render.js +44 -0
  59. package/dist/cjs/router/RouterStore.js +14 -0
  60. package/dist/cjs/router/getNormalizedStatePath.js +50 -0
  61. package/dist/cjs/router/lastAction.js +25 -0
  62. package/dist/cjs/router/router.js +345 -0
  63. package/dist/cjs/router/serverLocationContext.js +22 -0
  64. package/dist/cjs/router/useInitializeOneRouter.js +43 -0
  65. package/dist/cjs/serve.js +184 -0
  66. package/dist/cjs/server/createRoutesManifest.js +40 -0
  67. package/dist/cjs/server/getServerManifest.js +109 -0
  68. package/dist/cjs/server-render.js +42 -0
  69. package/dist/cjs/sortRoutes.js +64 -0
  70. package/dist/cjs/typed-routes/generateRouteTypes.js +33 -0
  71. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js +83 -0
  72. package/dist/cjs/types.js +14 -0
  73. package/dist/cjs/useFocusEffect.js +79 -0
  74. package/dist/cjs/useLoader.js +97 -0
  75. package/dist/cjs/useNavigation.js +60 -0
  76. package/dist/cjs/useScreens.js +176 -0
  77. package/dist/cjs/useViteRoutes.js +77 -0
  78. package/dist/cjs/utils/assertIsReady.js +26 -0
  79. package/dist/cjs/utils/dynamicImport.js +24 -0
  80. package/dist/cjs/utils/existsAsync.js +28 -0
  81. package/dist/cjs/utils/getPageExport.js +38 -0
  82. package/dist/cjs/utils/globDir.js +37 -0
  83. package/dist/cjs/utils/hashString.js +32 -0
  84. package/dist/cjs/utils/isResponse.js +23 -0
  85. package/dist/cjs/utils/isStatus.js +23 -0
  86. package/dist/cjs/utils/promiseWithResolvers.js +26 -0
  87. package/dist/cjs/utils/rand.js +21 -0
  88. package/dist/cjs/utils/redirect.js +28 -0
  89. package/dist/cjs/utils/removeSearch.js +23 -0
  90. package/dist/cjs/utils/removeUndefined.js +26 -0
  91. package/dist/cjs/utils/url.js +31 -0
  92. package/dist/cjs/utils/weakKey.js +24 -0
  93. package/dist/cjs/utils/weakMemo.js +30 -0
  94. package/dist/cjs/views/EmptyRoute.js +25 -0
  95. package/dist/cjs/views/ErrorBoundary.js +33 -0
  96. package/dist/cjs/views/LoadProgressBar.js +83 -0
  97. package/dist/cjs/views/Navigator.js +101 -0
  98. package/dist/cjs/views/PreloadLinks.js +42 -0
  99. package/dist/cjs/views/RootErrorBoundary.js +47 -0
  100. package/dist/cjs/views/Screen.js +29 -0
  101. package/dist/cjs/views/ScrollRestoration.js +70 -0
  102. package/dist/cjs/views/Try.js +44 -0
  103. package/dist/cjs/vite/build.js +377 -0
  104. package/dist/cjs/vite/clientTreeShakePlugin.js +76 -0
  105. package/dist/cjs/vite/constants.js +22 -0
  106. package/dist/cjs/vite/createFileSystemRouter.cjs +2 -1
  107. package/dist/cjs/vite/createFileSystemRouter.js +244 -0
  108. package/dist/cjs/vite/createFileSystemRouter.js.map +6 -0
  109. package/dist/cjs/vite/createFileSystemRouter.native.js +2 -1
  110. package/dist/cjs/vite/createFileSystemRouter.native.js.map +2 -2
  111. package/dist/cjs/vite/customNodeExternals.js +52 -0
  112. package/dist/cjs/vite/ensureTsConfig.js +66 -0
  113. package/dist/cjs/vite/findDepsToOptimize.js +66 -0
  114. package/dist/cjs/vite/fixDependenciesPlugin.js +43 -0
  115. package/dist/cjs/vite/generateTypesForRoutes.js +36 -0
  116. package/dist/cjs/vite/getManifest.js +27 -0
  117. package/dist/cjs/vite/headers.js +39 -0
  118. package/dist/cjs/vite/makePluginWebOnly.js +27 -0
  119. package/dist/cjs/vite/one.js +290 -0
  120. package/dist/cjs/vite/removeReactNativeWebAnimatedPlugin.js +50 -0
  121. package/dist/cjs/vite/replaceLoader.js +34 -0
  122. package/dist/cjs/vite/resolveAPIRequest.js +71 -0
  123. package/dist/cjs/vite/server.js +16 -0
  124. package/dist/cjs/vite/types.js +14 -0
  125. package/dist/cjs/vite/virtualEntryPlugin.js +67 -0
  126. package/dist/cjs/vite/vitePluginSsrCss.js +130 -0
  127. package/dist/cjs/vite.cjs +2 -0
  128. package/dist/cjs/vite.js +29 -0
  129. package/dist/cjs/vite.js.map +6 -0
  130. package/dist/cjs/vite.native.js +3 -1
  131. package/dist/cjs/vite.native.js.map +1 -1
  132. package/dist/cjs/zero/getQueryKey.js +24 -0
  133. package/dist/cjs/zero/isZeroQuery.js +23 -0
  134. package/dist/cjs/zero/resolveQuery.js +38 -0
  135. package/dist/cjs/zero/subscribeToQuery.js +28 -0
  136. package/dist/cjs/zero/types.js +14 -0
  137. package/dist/cjs/zero/useQuery.js +47 -0
  138. package/dist/cjs/zero/useQueryZero.js +38 -0
  139. package/dist/cjs/zero.js +23 -0
  140. package/dist/esm/vite/createFileSystemRouter.js +2 -1
  141. package/dist/esm/vite/createFileSystemRouter.js.map +1 -1
  142. package/dist/esm/vite/createFileSystemRouter.mjs +2 -1
  143. package/dist/esm/vite/createFileSystemRouter.mjs.map +1 -1
  144. package/dist/esm/vite/createFileSystemRouter.native.js +2 -1
  145. package/dist/esm/vite/createFileSystemRouter.native.js.map +2 -2
  146. package/dist/esm/vite.js +2 -0
  147. package/dist/esm/vite.js.map +1 -1
  148. package/dist/esm/vite.mjs +2 -1
  149. package/dist/esm/vite.mjs.map +1 -1
  150. package/dist/esm/vite.native.js +2 -0
  151. package/dist/esm/vite.native.js.map +2 -2
  152. package/package.json +8 -8
  153. package/src/vite/createFileSystemRouter.tsx +1 -1
  154. package/src/vite.ts +1 -0
  155. package/types/vite.d.ts +1 -0
  156. package/types/vite.d.ts.map +1 -1
  157. package/dist/cjs/createApp.native.cjs +0 -38
  158. package/dist/cjs/createApp.native.cjs.map +0 -6
  159. package/dist/cjs/fork/NavigationContainer.native.cjs +0 -103
  160. package/dist/cjs/fork/NavigationContainer.native.cjs.map +0 -6
  161. package/dist/cjs/fork/useLinking.native.cjs +0 -126
  162. package/dist/cjs/fork/useLinking.native.cjs.map +0 -6
  163. package/dist/cjs/getURL.native.cjs +0 -48
  164. package/dist/cjs/getURL.native.cjs.map +0 -6
  165. package/dist/cjs/head/Head.android.cjs +0 -28
  166. package/dist/cjs/head/Head.android.cjs.map +0 -6
  167. package/dist/cjs/head/Head.ios.cjs +0 -210
  168. package/dist/cjs/head/Head.ios.cjs.map +0 -6
  169. package/dist/cjs/import-mode/index.android.cjs +0 -26
  170. package/dist/cjs/import-mode/index.android.cjs.map +0 -6
  171. package/dist/cjs/import-mode/index.ios.cjs +0 -26
  172. package/dist/cjs/import-mode/index.ios.cjs.map +0 -6
  173. package/dist/cjs/import-mode/index.native.cjs +0 -26
  174. package/dist/cjs/import-mode/index.native.cjs.map +0 -6
  175. package/dist/cjs/render.native.cjs +0 -28
  176. package/dist/cjs/render.native.cjs.map +0 -6
  177. package/dist/cjs/views/PreloadLinks.native.cjs +0 -28
  178. package/dist/cjs/views/PreloadLinks.native.cjs.map +0 -6
  179. package/dist/cjs/vite/createFileSystemRouter.cjs.map +0 -6
  180. package/dist/cjs/vite/headers.native.cjs +0 -32
  181. package/dist/cjs/vite/headers.native.cjs.map +0 -6
  182. package/dist/cjs/vite.cjs.map +0 -6
  183. /package/dist/cjs/{Root.cjs.map → Root.js.map} +0 -0
  184. /package/dist/cjs/{Route.cjs.map → Route.js.map} +0 -0
  185. /package/dist/cjs/{cleanUrl.cjs.map → cleanUrl.js.map} +0 -0
  186. /package/dist/cjs/cli/{label-process.cjs.map → label-process.js.map} +0 -0
  187. /package/dist/cjs/cli/{main.cjs.map → main.js.map} +0 -0
  188. /package/dist/cjs/cli/{patch.cjs.map → patch.js.map} +0 -0
  189. /package/dist/cjs/cli/{prebuild.cjs.map → prebuild.js.map} +0 -0
  190. /package/dist/cjs/cli/{run.cjs.map → run.js.map} +0 -0
  191. /package/dist/cjs/cli/{runAndroid.cjs.map → runAndroid.js.map} +0 -0
  192. /package/dist/cjs/cli/{runIos.cjs.map → runIos.js.map} +0 -0
  193. /package/dist/cjs/{cli.cjs.map → cli.js.map} +0 -0
  194. /package/dist/cjs/{clientLoaderResolver.cjs.map → clientLoaderResolver.js.map} +0 -0
  195. /package/dist/cjs/{config.cjs.map → config.js.map} +0 -0
  196. /package/dist/cjs/{constants.cjs.map → constants.js.map} +0 -0
  197. /package/dist/cjs/{createApp.cjs.map → createApp.js.map} +0 -0
  198. /package/dist/cjs/{createHandleRequest.cjs.map → createHandleRequest.js.map} +0 -0
  199. /package/dist/cjs/{createRoute.cjs.map → createRoute.js.map} +0 -0
  200. /package/dist/cjs/fallbackViews/{Sitemap.cjs.map → Sitemap.js.map} +0 -0
  201. /package/dist/cjs/fallbackViews/{Unmatched.cjs.map → Unmatched.js.map} +0 -0
  202. /package/dist/cjs/fork/{NavigationContainer.cjs.map → NavigationContainer.js.map} +0 -0
  203. /package/dist/cjs/fork/{createMemoryHistory.cjs.map → createMemoryHistory.js.map} +0 -0
  204. /package/dist/cjs/fork/{extractPathFromURL.cjs.map → extractPathFromURL.js.map} +0 -0
  205. /package/dist/cjs/fork/{findFocusedRoute.cjs.map → findFocusedRoute.js.map} +0 -0
  206. /package/dist/cjs/fork/{getPathFromState.cjs.map → getPathFromState.js.map} +0 -0
  207. /package/dist/cjs/fork/{getStateFromPath.cjs.map → getStateFromPath.js.map} +0 -0
  208. /package/dist/cjs/fork/{useLinking.cjs.map → useLinking.js.map} +0 -0
  209. /package/dist/cjs/fork/{validatePathConfig.cjs.map → validatePathConfig.js.map} +0 -0
  210. /package/dist/cjs/{getLinkingConfig.cjs.map → getLinkingConfig.js.map} +0 -0
  211. /package/dist/cjs/{getReactNavigationConfig.cjs.map → getReactNavigationConfig.js.map} +0 -0
  212. /package/dist/cjs/{getRoutes.cjs.map → getRoutes.js.map} +0 -0
  213. /package/dist/cjs/{getURL.cjs.map → getURL.js.map} +0 -0
  214. /package/dist/cjs/head/{Head.cjs.map → Head.js.map} +0 -0
  215. /package/dist/cjs/head/{HeadModule.cjs.map → HeadModule.js.map} +0 -0
  216. /package/dist/cjs/head/{index.cjs.map → index.js.map} +0 -0
  217. /package/dist/cjs/head/{types.cjs.map → types.js.map} +0 -0
  218. /package/dist/cjs/head/{url.cjs.map → url.js.map} +0 -0
  219. /package/dist/cjs/{hooks.cjs.map → hooks.js.map} +0 -0
  220. /package/dist/cjs/{imperative-api.cjs.map → imperative-api.js.map} +0 -0
  221. /package/dist/cjs/import-mode/{index.cjs.map → index.js.map} +0 -0
  222. /package/dist/cjs/import-mode/{index.web.cjs.map → index.web.js.map} +0 -0
  223. /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
  224. /package/dist/cjs/interfaces/{router.cjs.map → router.js.map} +0 -0
  225. /package/dist/cjs/layouts/{Drawer.cjs.map → Drawer.js.map} +0 -0
  226. /package/dist/cjs/layouts/{Stack.cjs.map → Stack.js.map} +0 -0
  227. /package/dist/cjs/layouts/{Tabs.cjs.map → Tabs.js.map} +0 -0
  228. /package/dist/cjs/layouts/{withLayoutContext.cjs.map → withLayoutContext.js.map} +0 -0
  229. /package/dist/cjs/link/{Link.cjs.map → Link.js.map} +0 -0
  230. /package/dist/cjs/link/{Redirect.cjs.map → Redirect.js.map} +0 -0
  231. /package/dist/cjs/link/{href.cjs.map → href.js.map} +0 -0
  232. /package/dist/cjs/link/{linking.cjs.map → linking.js.map} +0 -0
  233. /package/dist/cjs/link/{path.cjs.map → path.js.map} +0 -0
  234. /package/dist/cjs/link/{useLinkTo.cjs.map → useLinkTo.js.map} +0 -0
  235. /package/dist/cjs/link/{useLoadedNavigation.cjs.map → useLoadedNavigation.js.map} +0 -0
  236. /package/dist/cjs/{matchers.cjs.map → matchers.js.map} +0 -0
  237. /package/dist/cjs/{platform.cjs.map → platform.js.map} +0 -0
  238. /package/dist/cjs/{polyfills-mobile.cjs.map → polyfills-mobile.js.map} +0 -0
  239. /package/dist/cjs/{polyfills-server.cjs.map → polyfills-server.js.map} +0 -0
  240. /package/dist/cjs/{render.cjs.map → render.js.map} +0 -0
  241. /package/dist/cjs/router/{RouterStore.cjs.map → RouterStore.js.map} +0 -0
  242. /package/dist/cjs/router/{getNormalizedStatePath.cjs.map → getNormalizedStatePath.js.map} +0 -0
  243. /package/dist/cjs/router/{lastAction.cjs.map → lastAction.js.map} +0 -0
  244. /package/dist/cjs/router/{router.cjs.map → router.js.map} +0 -0
  245. /package/dist/cjs/router/{serverLocationContext.cjs.map → serverLocationContext.js.map} +0 -0
  246. /package/dist/cjs/router/{useInitializeOneRouter.cjs.map → useInitializeOneRouter.js.map} +0 -0
  247. /package/dist/cjs/{serve.cjs.map → serve.js.map} +0 -0
  248. /package/dist/cjs/server/{createRoutesManifest.cjs.map → createRoutesManifest.js.map} +0 -0
  249. /package/dist/cjs/server/{getServerManifest.cjs.map → getServerManifest.js.map} +0 -0
  250. /package/dist/cjs/{server-render.cjs.map → server-render.js.map} +0 -0
  251. /package/dist/cjs/{sortRoutes.cjs.map → sortRoutes.js.map} +0 -0
  252. /package/dist/cjs/typed-routes/{generateRouteTypes.cjs.map → generateRouteTypes.js.map} +0 -0
  253. /package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.cjs.map → getTypedRoutesDeclarationFile.js.map} +0 -0
  254. /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
  255. /package/dist/cjs/{useFocusEffect.cjs.map → useFocusEffect.js.map} +0 -0
  256. /package/dist/cjs/{useLoader.cjs.map → useLoader.js.map} +0 -0
  257. /package/dist/cjs/{useNavigation.cjs.map → useNavigation.js.map} +0 -0
  258. /package/dist/cjs/{useScreens.cjs.map → useScreens.js.map} +0 -0
  259. /package/dist/cjs/{useViteRoutes.cjs.map → useViteRoutes.js.map} +0 -0
  260. /package/dist/cjs/utils/{assertIsReady.cjs.map → assertIsReady.js.map} +0 -0
  261. /package/dist/cjs/utils/{dynamicImport.cjs.map → dynamicImport.js.map} +0 -0
  262. /package/dist/cjs/utils/{existsAsync.cjs.map → existsAsync.js.map} +0 -0
  263. /package/dist/cjs/utils/{getPageExport.cjs.map → getPageExport.js.map} +0 -0
  264. /package/dist/cjs/utils/{globDir.cjs.map → globDir.js.map} +0 -0
  265. /package/dist/cjs/utils/{hashString.cjs.map → hashString.js.map} +0 -0
  266. /package/dist/cjs/utils/{isResponse.cjs.map → isResponse.js.map} +0 -0
  267. /package/dist/cjs/utils/{isStatus.cjs.map → isStatus.js.map} +0 -0
  268. /package/dist/cjs/utils/{promiseWithResolvers.cjs.map → promiseWithResolvers.js.map} +0 -0
  269. /package/dist/cjs/utils/{rand.cjs.map → rand.js.map} +0 -0
  270. /package/dist/cjs/utils/{redirect.cjs.map → redirect.js.map} +0 -0
  271. /package/dist/cjs/utils/{removeSearch.cjs.map → removeSearch.js.map} +0 -0
  272. /package/dist/cjs/utils/{removeUndefined.cjs.map → removeUndefined.js.map} +0 -0
  273. /package/dist/cjs/utils/{url.cjs.map → url.js.map} +0 -0
  274. /package/dist/cjs/utils/{weakKey.cjs.map → weakKey.js.map} +0 -0
  275. /package/dist/cjs/utils/{weakMemo.cjs.map → weakMemo.js.map} +0 -0
  276. /package/dist/cjs/views/{EmptyRoute.cjs.map → EmptyRoute.js.map} +0 -0
  277. /package/dist/cjs/views/{ErrorBoundary.cjs.map → ErrorBoundary.js.map} +0 -0
  278. /package/dist/cjs/views/{LoadProgressBar.cjs.map → LoadProgressBar.js.map} +0 -0
  279. /package/dist/cjs/views/{Navigator.cjs.map → Navigator.js.map} +0 -0
  280. /package/dist/cjs/views/{PreloadLinks.cjs.map → PreloadLinks.js.map} +0 -0
  281. /package/dist/cjs/views/{RootErrorBoundary.cjs.map → RootErrorBoundary.js.map} +0 -0
  282. /package/dist/cjs/views/{Screen.cjs.map → Screen.js.map} +0 -0
  283. /package/dist/cjs/views/{ScrollRestoration.cjs.map → ScrollRestoration.js.map} +0 -0
  284. /package/dist/cjs/views/{Try.cjs.map → Try.js.map} +0 -0
  285. /package/dist/cjs/vite/{build.cjs.map → build.js.map} +0 -0
  286. /package/dist/cjs/vite/{clientTreeShakePlugin.cjs.map → clientTreeShakePlugin.js.map} +0 -0
  287. /package/dist/cjs/vite/{constants.cjs.map → constants.js.map} +0 -0
  288. /package/dist/cjs/vite/{customNodeExternals.cjs.map → customNodeExternals.js.map} +0 -0
  289. /package/dist/cjs/vite/{ensureTsConfig.cjs.map → ensureTsConfig.js.map} +0 -0
  290. /package/dist/cjs/vite/{findDepsToOptimize.cjs.map → findDepsToOptimize.js.map} +0 -0
  291. /package/dist/cjs/vite/{fixDependenciesPlugin.cjs.map → fixDependenciesPlugin.js.map} +0 -0
  292. /package/dist/cjs/vite/{generateTypesForRoutes.cjs.map → generateTypesForRoutes.js.map} +0 -0
  293. /package/dist/cjs/vite/{getManifest.cjs.map → getManifest.js.map} +0 -0
  294. /package/dist/cjs/vite/{headers.cjs.map → headers.js.map} +0 -0
  295. /package/dist/cjs/vite/{makePluginWebOnly.cjs.map → makePluginWebOnly.js.map} +0 -0
  296. /package/dist/cjs/vite/{one.cjs.map → one.js.map} +0 -0
  297. /package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.cjs.map → removeReactNativeWebAnimatedPlugin.js.map} +0 -0
  298. /package/dist/cjs/vite/{replaceLoader.cjs.map → replaceLoader.js.map} +0 -0
  299. /package/dist/cjs/vite/{resolveAPIRequest.cjs.map → resolveAPIRequest.js.map} +0 -0
  300. /package/dist/cjs/vite/{server.cjs.map → server.js.map} +0 -0
  301. /package/dist/cjs/vite/{types.cjs.map → types.js.map} +0 -0
  302. /package/dist/cjs/vite/{virtualEntryPlugin.cjs.map → virtualEntryPlugin.js.map} +0 -0
  303. /package/dist/cjs/vite/{vitePluginSsrCss.cjs.map → vitePluginSsrCss.js.map} +0 -0
  304. /package/dist/cjs/zero/{getQueryKey.cjs.map → getQueryKey.js.map} +0 -0
  305. /package/dist/cjs/zero/{isZeroQuery.cjs.map → isZeroQuery.js.map} +0 -0
  306. /package/dist/cjs/zero/{resolveQuery.cjs.map → resolveQuery.js.map} +0 -0
  307. /package/dist/cjs/zero/{subscribeToQuery.cjs.map → subscribeToQuery.js.map} +0 -0
  308. /package/dist/cjs/zero/{types.cjs.map → types.js.map} +0 -0
  309. /package/dist/cjs/zero/{useQuery.cjs.map → useQuery.js.map} +0 -0
  310. /package/dist/cjs/zero/{useQueryZero.cjs.map → useQueryZero.js.map} +0 -0
  311. /package/dist/cjs/{zero.cjs.map → zero.js.map} +0 -0
@@ -0,0 +1,109 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var getServerManifest_exports = {};
16
+ __export(getServerManifest_exports, {
17
+ getServerManifest: () => getServerManifest,
18
+ parseParam: () => parseParam
19
+ });
20
+ module.exports = __toCommonJS(getServerManifest_exports);
21
+ var import_matchers = require("../matchers"), import_sortRoutes = require("../sortRoutes");
22
+ function isNotFoundRoute(route) {
23
+ return !!(route.dynamic && route.dynamic[route.dynamic.length - 1].notFound);
24
+ }
25
+ function getServerManifest(route) {
26
+ function getFlatNodes(route2, layouts) {
27
+ if (route2.children.length)
28
+ return route2.children.flatMap((child) => getFlatNodes(child, [...layouts || [], route2]));
29
+ let key;
30
+ return route2.type === "api" ? key = (0, import_matchers.getContextKey)(route2.contextKey).replace(/\/index$/, "") || "/" : key = layouts?.flatMap((route3) => {
31
+ const key2 = (0, import_matchers.getContextKey)(route3.route).replace(/\/index$/, "") || "/";
32
+ return key2 === "/" || key2.startsWith("/(") ? [] : [key2];
33
+ }) + (0, import_matchers.getContextKey)(route2.route).replace(/\/index$/, "") || "/", [[key, { ...route2, layouts }]];
34
+ }
35
+ const flat = getFlatNodes(route).sort(([, a], [, b]) => (0, import_sortRoutes.sortRoutes)(b, a)).reverse(), pathToRoute = {};
36
+ for (const [path, route2] of flat)
37
+ pathToRoute[path] && (console.warn(`
38
+ [one] \u274C Duplicate routes error`), console.warn(" Multiple routes at the same path! One route will always win over the other."), console.warn(` path: ${path}`), console.warn(` first route: ${pathToRoute[path].contextKey}`), console.warn(` second route: ${route2.contextKey}
39
+ `)), pathToRoute[path] = route2;
40
+ const apiRoutes = [], pageRoutes = [];
41
+ for (const [path, node] of flat) {
42
+ if (node.type === "api") {
43
+ apiRoutes.push(getGeneratedNamedRouteRegex(path, node));
44
+ continue;
45
+ }
46
+ pageRoutes.push(getGeneratedNamedRouteRegex(path, node));
47
+ }
48
+ return {
49
+ apiRoutes,
50
+ pageRoutes
51
+ };
52
+ }
53
+ function getGeneratedNamedRouteRegex(normalizedRoute, node) {
54
+ return {
55
+ ...getNamedRouteRegex(normalizedRoute, node),
56
+ generated: !0,
57
+ isNotFound: isNotFoundRoute(node)
58
+ };
59
+ }
60
+ function getNamedRouteRegex(normalizedRoute, node) {
61
+ const result = getNamedRegex(normalizedRoute);
62
+ return {
63
+ file: node.contextKey,
64
+ page: (0, import_matchers.getContextKey)(node.route),
65
+ type: node.type,
66
+ namedRegex: result.namedRegex,
67
+ routeKeys: result.routeKeys,
68
+ layouts: node.layouts
69
+ };
70
+ }
71
+ function buildGetSafeRouteKey() {
72
+ let currentCharCode = 96, currentLength = 1;
73
+ return () => {
74
+ let result = "", incrementNext = !0;
75
+ for (let i = 0; i < currentLength; i++)
76
+ incrementNext && (currentCharCode++, currentCharCode > 122 ? (currentCharCode = 97, incrementNext = !0) : incrementNext = !1), result = String.fromCharCode(currentCharCode) + result;
77
+ return incrementNext && (currentLength++, currentCharCode = 96), result;
78
+ };
79
+ }
80
+ function removeTrailingSlash(route) {
81
+ return route.replace(/\/$/, "") || "/";
82
+ }
83
+ function getNamedRegex(route) {
84
+ const segments = removeTrailingSlash(route).slice(1).split("/"), getSafeRouteKey = buildGetSafeRouteKey(), routeKeys = {};
85
+ return {
86
+ namedRegex: `^${segments.map((segment, index) => {
87
+ if (segment === "+not-found" && index === segments.length - 1 && (segment = "[...not-found]"), /^\[.*\]$/.test(segment)) {
88
+ const { name, optional, repeat } = parseParam(segment);
89
+ let cleanedKey = name.replace(/\W/g, ""), invalidKey = !1;
90
+ return (cleanedKey.length === 0 || cleanedKey.length > 30) && (invalidKey = !0), Number.isNaN(Number.parseInt(cleanedKey.slice(0, 1), 10)) || (invalidKey = !0), cleanedKey in routeKeys && (invalidKey = !0), invalidKey && (cleanedKey = getSafeRouteKey()), routeKeys[cleanedKey] = name, repeat ? optional ? `(?:/(?<${cleanedKey}>.+?))?` : `/(?<${cleanedKey}>.+?)` : `/(?<${cleanedKey}>[^/]+?)`;
91
+ }
92
+ if (insideParensRegex.test(segment)) {
93
+ const groupName = (0, import_matchers.matchGroupName)(segment).split(",").map((group) => group.trim()).filter(Boolean);
94
+ return groupName.length > 1 ? `(?:/${`\\((?:${groupName.map(escapeStringRegexp).join("|")})\\)`})?` : `(?:/${escapeStringRegexp(segment)})?`;
95
+ }
96
+ return `/${escapeStringRegexp(segment)}`;
97
+ }).join("")}(?:/)?$`,
98
+ routeKeys
99
+ };
100
+ }
101
+ const insideBracketsRegex = /^\[.*\]$/, insideParensRegex = /^\(.*\)$/, tripleDotRegex = /^\.\.\./, replaceRegex = /[|\\{}()[\]^$+*?.-]/g, hasRegExpRegex = /[|\\{}()[\]^$+*?.-]/;
102
+ function escapeStringRegexp(str) {
103
+ return hasRegExpRegex.test(str) ? str.replace(replaceRegex, "\\$&") : str;
104
+ }
105
+ function parseParam(param) {
106
+ let repeat = !1, optional = !1, name = param;
107
+ return insideBracketsRegex.test(name) && (optional = !0, name = name.slice(1, -1)), tripleDotRegex.test(name) && (repeat = !0, name = name.slice(3)), { name, repeat, optional };
108
+ }
109
+ //# sourceMappingURL=getServerManifest.js.map
@@ -0,0 +1,42 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var server_render_exports = {};
24
+ __export(server_render_exports, {
25
+ renderToString: () => renderToString
26
+ });
27
+ module.exports = __toCommonJS(server_render_exports);
28
+ var import_server = __toESM(require("react-dom/server.browser"), 1);
29
+ const renderToString = async (app, options) => {
30
+ const readableStream = await import_server.default.renderToReadableStream(app, {
31
+ bootstrapModules: options.preloads
32
+ });
33
+ return await readableStream.allReady, await streamToString(readableStream);
34
+ };
35
+ async function streamToString(stream) {
36
+ const decoder = new TextDecoder("utf-8", { fatal: !0 });
37
+ let result = "";
38
+ for await (const chunk of stream)
39
+ result += decoder.decode(chunk, { stream: !0 });
40
+ return result += decoder.decode(), result;
41
+ }
42
+ //# sourceMappingURL=server-render.js.map
@@ -0,0 +1,64 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var sortRoutes_exports = {};
16
+ __export(sortRoutes_exports, {
17
+ sortRoutes: () => sortRoutes,
18
+ sortRoutesWithInitial: () => sortRoutesWithInitial
19
+ });
20
+ module.exports = __toCommonJS(sortRoutes_exports);
21
+ var import_matchers = require("./matchers");
22
+ function sortDynamicConvention(a, b) {
23
+ return a.deep && !b.deep ? 1 : !a.deep && b.deep ? -1 : 0;
24
+ }
25
+ function sortRoutes(a, b) {
26
+ if (a.dynamic && !b.dynamic)
27
+ return 1;
28
+ if (!a.dynamic && b.dynamic)
29
+ return -1;
30
+ if (a.dynamic && b.dynamic) {
31
+ if (a.dynamic.length !== b.dynamic.length)
32
+ return b.dynamic.length - a.dynamic.length;
33
+ for (let i = 0; i < a.dynamic.length; i++) {
34
+ const aDynamic = a.dynamic[i], bDynamic = b.dynamic[i];
35
+ if (aDynamic.notFound && bDynamic.notFound) {
36
+ const s2 = sortDynamicConvention(aDynamic, bDynamic);
37
+ if (s2)
38
+ return s2;
39
+ }
40
+ if (aDynamic.notFound && !bDynamic.notFound)
41
+ return 1;
42
+ if (!aDynamic.notFound && bDynamic.notFound)
43
+ return -1;
44
+ const s = sortDynamicConvention(aDynamic, bDynamic);
45
+ if (s)
46
+ return s;
47
+ }
48
+ return 0;
49
+ }
50
+ const aIndex = a.route === "index" || (0, import_matchers.matchGroupName)(a.route) != null, bIndex = b.route === "index" || (0, import_matchers.matchGroupName)(b.route) != null;
51
+ return aIndex && !bIndex ? -1 : !aIndex && bIndex ? 1 : a.route.length - b.route.length;
52
+ }
53
+ function sortRoutesWithInitial(initialRouteName) {
54
+ return (a, b) => {
55
+ if (initialRouteName) {
56
+ if (a.route === initialRouteName)
57
+ return -1;
58
+ if (b.route === initialRouteName)
59
+ return 1;
60
+ }
61
+ return sortRoutes(a, b);
62
+ };
63
+ }
64
+ //# sourceMappingURL=sortRoutes.js.map
@@ -0,0 +1,33 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var generateRouteTypes_exports = {};
24
+ __export(generateRouteTypes_exports, {
25
+ generateRouteTypes: () => generateRouteTypes
26
+ });
27
+ module.exports = __toCommonJS(generateRouteTypes_exports);
28
+ var import_fs_extra = __toESM(require("fs-extra"), 1), import_promises = require("node:fs/promises"), import_node_path = require("node:path"), import_useViteRoutes = require("../useViteRoutes"), import_globDir = require("../utils/globDir"), import_getTypedRoutesDeclarationFile = require("./getTypedRoutesDeclarationFile");
29
+ async function generateRouteTypes(outFile) {
30
+ const routes = (0, import_globDir.globDir)("app").reduce((acc, cur) => (acc[cur] = {}, acc), {}), context = (0, import_useViteRoutes.globbedRoutesToRouteContext)(routes), declarations = (0, import_getTypedRoutesDeclarationFile.getTypedRoutesDeclarationFile)(context);
31
+ await import_fs_extra.default.ensureDir((0, import_node_path.dirname)(outFile)), await (0, import_promises.writeFile)(outFile, declarations);
32
+ }
33
+ //# sourceMappingURL=generateRouteTypes.js.map
@@ -0,0 +1,83 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var getTypedRoutesDeclarationFile_exports = {};
16
+ __export(getTypedRoutesDeclarationFile_exports, {
17
+ getTypedRoutesDeclarationFile: () => getTypedRoutesDeclarationFile
18
+ });
19
+ module.exports = __toCommonJS(getTypedRoutesDeclarationFile_exports);
20
+ var import_getRoutes = require("../getRoutes"), import_matchers = require("../matchers");
21
+ const CATCH_ALL = /\[\.\.\..+?\]/g, SLUG = /\[.+?\]/g;
22
+ function getTypedRoutesDeclarationFile(ctx) {
23
+ const staticRoutes = /* @__PURE__ */ new Set(), dynamicRoutes = /* @__PURE__ */ new Set(), dynamicRouteContextKeys = /* @__PURE__ */ new Set();
24
+ return walkRouteNode(
25
+ (0, import_getRoutes.getRoutes)(ctx, {
26
+ platformRoutes: !1,
27
+ // We don't need to generate platform specific routes
28
+ ignoreEntryPoints: !0,
29
+ ignoreRequireErrors: !0
30
+ // importMode: 'async',
31
+ }),
32
+ "",
33
+ staticRoutes,
34
+ dynamicRoutes,
35
+ dynamicRouteContextKeys
36
+ ), `
37
+ import type { OneRouter } from 'one'
38
+
39
+ declare module 'one' {
40
+ export namespace OneRouter {
41
+ export interface __routes<T extends string = string> extends Record<string, unknown> {
42
+ StaticRoutes: ${setToUnionType(staticRoutes)}
43
+ DynamicRoutes: ${setToUnionType(dynamicRoutes)}
44
+ DynamicRouteTemplate: ${setToUnionType(dynamicRouteContextKeys)}
45
+ IsTyped: true
46
+ }
47
+ }
48
+ }
49
+ `.trim();
50
+ }
51
+ function walkRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys) {
52
+ if (routeNode) {
53
+ addRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys), parentRoutePath = `${(0, import_matchers.removeSupportedExtensions)(`${parentRoutePath}/${routeNode.route}`).replace(/\/?index$/, "")}`;
54
+ for (const child of routeNode.children)
55
+ walkRouteNode(child, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys);
56
+ }
57
+ }
58
+ function addRouteNode(routeNode, parentRoutePath, staticRoutes, dynamicRoutes, dynamicRouteContextKeys) {
59
+ if (!routeNode?.route || !(0, import_matchers.isTypedRoute)(routeNode.route)) return;
60
+ let routePath = `${parentRoutePath}/${(0, import_matchers.removeSupportedExtensions)(routeNode.route).replace(/\/?index$/, "")}`;
61
+ if (routePath.startsWith("/") || (routePath = `/${routePath}`), routeNode.dynamic)
62
+ for (const path of generateCombinations(routePath))
63
+ dynamicRouteContextKeys.add(path), dynamicRoutes.add(
64
+ `${path.replaceAll(CATCH_ALL, "${string}").replaceAll(SLUG, "${OneRouter.SingleRoutePart<T>}")}`
65
+ );
66
+ else
67
+ for (const combination of generateCombinations(routePath))
68
+ staticRoutes.add(combination);
69
+ }
70
+ const setToUnionType = (set) => set.size > 0 ? [...set].sort().map((s) => `\`${s}\``).join(" | ") : "never";
71
+ function generateCombinations(pathname) {
72
+ const groups = pathname.split("/").filter((part) => part.startsWith("(") && part.endsWith(")")), combinations = [];
73
+ function generate(currentIndex, currentPath) {
74
+ if (currentIndex === groups.length) {
75
+ combinations.push(currentPath.replace(/\/{2,}/g, "/"));
76
+ return;
77
+ }
78
+ const group = groups[currentIndex], withoutGroup = currentPath.replace(`/${group}`, "");
79
+ generate(currentIndex + 1, withoutGroup), generate(currentIndex + 1, currentPath);
80
+ }
81
+ return generate(0, pathname), combinations;
82
+ }
83
+ //# sourceMappingURL=getTypedRoutesDeclarationFile.js.map
@@ -0,0 +1,14 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __copyProps = (to, from, except, desc) => {
6
+ if (from && typeof from == "object" || typeof from == "function")
7
+ for (let key of __getOwnPropNames(from))
8
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
9
+ return to;
10
+ };
11
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
12
+ var types_exports = {};
13
+ module.exports = __toCommonJS(types_exports);
14
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,79 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var useFocusEffect_exports = {};
24
+ __export(useFocusEffect_exports, {
25
+ useFocusEffect: () => useFocusEffect
26
+ });
27
+ module.exports = __toCommonJS(useFocusEffect_exports);
28
+ var React = __toESM(require("react"), 1), import_useLoadedNavigation = require("./link/useLoadedNavigation");
29
+ function useFocusEffect(effect, do_not_pass_a_second_prop) {
30
+ const navigation = (0, import_useLoadedNavigation.useOptionalNavigation)();
31
+ do_not_pass_a_second_prop !== void 0 && console.error(`You passed a second argument to 'useFocusEffect', but it only accepts one argument. If you want to pass a dependency array, you can use 'React.useCallback':
32
+
33
+ useFocusEffect(
34
+ React.useCallback(() => {
35
+ // Your code here
36
+ }, [depA, depB])
37
+ );
38
+
39
+ See usage guide: https://reactnavigation.org/docs/use-focus-effect`), React.useEffect(() => {
40
+ if (!navigation)
41
+ return;
42
+ let isFocused = !1, cleanup;
43
+ const callback = () => {
44
+ const destroy = effect();
45
+ if (destroy === void 0 || typeof destroy == "function")
46
+ return destroy;
47
+ if (process.env.NODE_ENV !== "production") {
48
+ let message = "An effect function must not return anything besides a function, which is used for clean-up.";
49
+ destroy === null ? message += " You returned 'null'. If your effect does not require clean-up, return 'undefined' (or nothing)." : typeof destroy.then == "function" ? message += `
50
+
51
+ It looks like you wrote 'useFocusEffect(async () => ...)' or returned a Promise. Instead, write the async function inside your effect and call it immediately:
52
+
53
+ useFocusEffect(
54
+ React.useCallback(() => {
55
+ async function fetchData() {
56
+ // You can await here
57
+ const response = await MyAPI.getData(someId);
58
+ // ...
59
+ }
60
+
61
+ fetchData();
62
+ }, [someId])
63
+ );
64
+
65
+ See usage guide: https://reactnavigation.org/docs/use-focus-effect` : message += ` You returned '${JSON.stringify(destroy)}'.`, console.error(message);
66
+ }
67
+ };
68
+ navigation.isFocused() && (cleanup = callback(), isFocused = !0);
69
+ const unsubscribeFocus = navigation.addListener("focus", () => {
70
+ isFocused || (cleanup !== void 0 && cleanup(), cleanup = callback(), isFocused = !0);
71
+ }), unsubscribeBlur = navigation.addListener("blur", () => {
72
+ cleanup !== void 0 && cleanup(), cleanup = void 0, isFocused = !1;
73
+ });
74
+ return () => {
75
+ cleanup !== void 0 && cleanup(), unsubscribeFocus(), unsubscribeBlur();
76
+ };
77
+ }, [effect, navigation]);
78
+ }
79
+ //# sourceMappingURL=useFocusEffect.js.map
@@ -0,0 +1,97 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: !0 });
8
+ }, __copyProps = (to, from, except, desc) => {
9
+ if (from && typeof from == "object" || typeof from == "function")
10
+ for (let key of __getOwnPropNames(from))
11
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
12
+ return to;
13
+ };
14
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
15
+ var useLoader_exports = {};
16
+ __export(useLoader_exports, {
17
+ useLoader: () => useLoader
18
+ });
19
+ module.exports = __toCommonJS(useLoader_exports);
20
+ var import_react = require("react"), import_cleanUrl = require("./cleanUrl"), import_hooks = require("./hooks"), import_href = require("./link/href"), import_Route = require("./Route"), import_router = require("./router/router"), import_dynamicImport = require("./utils/dynamicImport"), import_weakKey = require("./utils/weakKey");
21
+ const promises = {}, errors = {}, loadedData = {};
22
+ function useLoader(loader) {
23
+ const preloadedProps = globalThis.__vxrnLoaderProps__;
24
+ if (typeof window > "u")
25
+ return useAsyncFn(
26
+ loader,
27
+ preloadedProps || {
28
+ params: (0, import_hooks.useActiveParams)()
29
+ }
30
+ );
31
+ const isNative = !1, routeNode = (0, import_Route.useRouteNode)(), params = (0, import_hooks.useParams)(), pathName = "/" + (0, import_href.resolveHref)({ pathname: routeNode?.route || "", params }).replace(/index$/, ""), currentPath = (isNative ? null : globalThis.__vxrntodopath) || // @zetavg: not sure why we're using `globalThis['__vxrntodopath']` here, but this breaks native when switching between tabs where the value stays with the previous path, so ignoring this on native
32
+ // TODO likely either not needed or needs proper path from server side
33
+ (typeof window < "u" ? window.location?.pathname || pathName : "/"), preloadedData = preloadedProps?.path === currentPath ? globalThis.__vxrnLoaderData__ : void 0, currentData = (0, import_react.useRef)(preloadedData);
34
+ if ((0, import_react.useEffect)(() => {
35
+ preloadedData && (loadedData[currentPath] = preloadedData, delete globalThis.__vxrnLoaderData__);
36
+ }, [preloadedData]), errors[currentPath])
37
+ throw errors[currentPath];
38
+ const loaded = loadedData[currentPath];
39
+ if (typeof loaded < "u")
40
+ return loaded;
41
+ if (!preloadedData) {
42
+ if (import_router.preloadingLoader[currentPath] && (typeof import_router.preloadingLoader[currentPath] == "function" && (import_router.preloadingLoader[currentPath] = import_router.preloadingLoader[currentPath]()), promises[currentPath] = import_router.preloadingLoader[currentPath].then((val) => {
43
+ loadedData[currentPath] = val;
44
+ }).catch((err) => {
45
+ console.error("Error loading loader", err), errors[currentPath] = err, delete promises[currentPath], delete import_router.preloadingLoader[currentPath];
46
+ })), !promises[currentPath]) {
47
+ const getData = async () => {
48
+ const loaderJSUrl = (0, import_cleanUrl.getLoaderPath)(currentPath, !0);
49
+ try {
50
+ const response = await (async () => {
51
+ if (isNative) {
52
+ const nativeLoaderJSUrl = `${loaderJSUrl}?platform=ios`;
53
+ try {
54
+ const loaderJsCodeResp = await fetch(nativeLoaderJSUrl);
55
+ if (!loaderJsCodeResp.ok)
56
+ throw new Error(`Response not ok: ${loaderJsCodeResp.status}`);
57
+ const loaderJsCode = await loaderJsCodeResp.text(), result = eval(
58
+ `() => { var exports = {}; ${loaderJsCode}; return exports; }`
59
+ )();
60
+ if (typeof result.loader != "function")
61
+ throw new Error("Loader code isn't exporting a `loader` function");
62
+ return result;
63
+ } catch (e) {
64
+ return console.error(`Error fetching loader from URL: ${nativeLoaderJSUrl}, ${e}`), { loader: () => ({}) };
65
+ }
66
+ }
67
+ return await (0, import_dynamicImport.dynamicImport)(loaderJSUrl);
68
+ })();
69
+ return loadedData[currentPath] = response.loader(), loadedData[currentPath];
70
+ } catch (err) {
71
+ return console.error(`Error calling loader: ${err}`), errors[currentPath] = err, delete promises[currentPath], null;
72
+ }
73
+ };
74
+ promises[currentPath] = getData();
75
+ }
76
+ throw promises[currentPath];
77
+ }
78
+ return currentData.current;
79
+ }
80
+ const results = /* @__PURE__ */ new Map(), started = /* @__PURE__ */ new Map();
81
+ function useAsyncFn(val, props) {
82
+ const key = (val ? (0, import_weakKey.weakKey)(val) : "") + JSON.stringify(props);
83
+ if (val && !started.get(key)) {
84
+ started.set(key, !0);
85
+ let next = val(props);
86
+ next instanceof Promise && (next = next.then((final) => {
87
+ results.set(key, final);
88
+ }).catch((err) => {
89
+ console.error("Error running loader()", err), results.set(key, void 0);
90
+ })), results.set(key, next);
91
+ }
92
+ const current = results.get(key);
93
+ if (current instanceof Promise)
94
+ throw current;
95
+ return current;
96
+ }
97
+ //# sourceMappingURL=useLoader.js.map
@@ -0,0 +1,60 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf, __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: !0 });
9
+ }, __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from == "object" || typeof from == "function")
11
+ for (let key of __getOwnPropNames(from))
12
+ !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
13
+ return to;
14
+ };
15
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
16
+ // If the importer is in node compatibility mode or this is not an ESM
17
+ // file that has been converted to a CommonJS file using a Babel-
18
+ // compatible transform (i.e. "__esModule" has not been set), then set
19
+ // "default" to the CommonJS "module.exports" for node compatibility.
20
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
21
+ mod
22
+ )), __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: !0 }), mod);
23
+ var useNavigation_exports = {};
24
+ __export(useNavigation_exports, {
25
+ resolveParentId: () => resolveParentId,
26
+ useNavigation: () => useNavigation
27
+ });
28
+ module.exports = __toCommonJS(useNavigation_exports);
29
+ var import_native = require("@react-navigation/native"), import_react = __toESM(require("react"), 1), import_matchers = require("./matchers"), import_Route = require("./Route");
30
+ function useNavigation(parent) {
31
+ const navigation = (0, import_native.useNavigation)(), contextKey = (0, import_Route.useContextKey)(), normalizedParent = import_react.default.useMemo(() => {
32
+ if (!parent)
33
+ return null;
34
+ const normalized = (0, import_matchers.getNameFromFilePath)(parent);
35
+ return parent.startsWith(".") ? relativePaths(contextKey, parent) : normalized;
36
+ }, [contextKey, parent]);
37
+ if (normalizedParent != null) {
38
+ const parentNavigation = navigation.getParent(normalizedParent);
39
+ if (!parentNavigation)
40
+ throw new Error(
41
+ `Could not find parent navigation with route "${parent}".` + (normalizedParent !== parent ? ` (normalized: ${normalizedParent})` : "")
42
+ );
43
+ return parentNavigation;
44
+ }
45
+ return navigation;
46
+ }
47
+ function resolveParentId(contextKey, parentId) {
48
+ return parentId ? parentId.startsWith(".") ? (0, import_matchers.getNameFromFilePath)(relativePaths(contextKey, parentId)) : (0, import_matchers.getNameFromFilePath)(parentId) : null;
49
+ }
50
+ function relativePaths(from, to) {
51
+ const fromParts = from.split("/").filter(Boolean), toParts = to.split("/").filter(Boolean);
52
+ for (const part of toParts)
53
+ if (part === "..") {
54
+ if (fromParts.length === 0)
55
+ throw new Error(`Cannot resolve path "${to}" relative to "${from}"`);
56
+ fromParts.pop();
57
+ } else part === "." || fromParts.push(part);
58
+ return "/" + fromParts.join("/");
59
+ }
60
+ //# sourceMappingURL=useNavigation.js.map