one 1.1.320 → 1.1.322

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,345 @@
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 router_exports = {};
24
+ __export(router_exports, {
25
+ canDismiss: () => canDismiss,
26
+ canGoBack: () => canGoBack,
27
+ cleanup: () => cleanup,
28
+ dismiss: () => dismiss,
29
+ dismissAll: () => dismissAll,
30
+ getRouteInfo: () => getRouteInfo,
31
+ getSortedRoutes: () => getSortedRoutes,
32
+ goBack: () => goBack,
33
+ hasAttemptedToHideSplash: () => hasAttemptedToHideSplash,
34
+ initialState: () => initialState,
35
+ initialize: () => initialize,
36
+ linkTo: () => linkTo,
37
+ linking: () => linking,
38
+ navigate: () => navigate,
39
+ navigationRef: () => navigationRef,
40
+ preloadRoute: () => preloadRoute,
41
+ preloadingLoader: () => preloadingLoader,
42
+ push: () => push,
43
+ replace: () => replace,
44
+ rootComponent: () => rootComponent,
45
+ rootState: () => rootState,
46
+ rootStateSnapshot: () => rootStateSnapshot,
47
+ routeInfo: () => routeInfo,
48
+ routeInfoSnapshot: () => routeInfoSnapshot,
49
+ routeNode: () => routeNode,
50
+ setLoadingState: () => setLoadingState,
51
+ setParams: () => setParams,
52
+ snapshot: () => snapshot,
53
+ subscribeToLoadingState: () => subscribeToLoadingState,
54
+ subscribeToRootState: () => subscribeToRootState,
55
+ subscribeToStore: () => subscribeToStore,
56
+ updateState: () => updateState,
57
+ useOneRouter: () => useOneRouter,
58
+ useStoreRootState: () => useStoreRootState,
59
+ useStoreRouteInfo: () => useStoreRouteInfo
60
+ });
61
+ module.exports = __toCommonJS(router_exports);
62
+ var import_native = require("@react-navigation/native"), Linking = __toESM(require("expo-linking"), 1), import_non_secure = require("nanoid/non-secure"), import_react = require("react"), import_react_native = require("react-native-web"), import_cleanUrl = require("../cleanUrl"), import_getPathFromState = require("../fork/getPathFromState"), import_getStateFromPath = require("../fork/getStateFromPath"), import_getLinkingConfig = require("../getLinkingConfig"), import_getRoutes = require("../getRoutes"), import_href = require("../link/href"), import_path = require("../link/path"), import_matchers = require("../matchers"), import_sortRoutes = require("../sortRoutes"), import_useScreens = require("../useScreens"), import_assertIsReady = require("../utils/assertIsReady"), import_dynamicImport = require("../utils/dynamicImport"), import_removeSearch = require("../utils/removeSearch"), import_url = require("../utils/url"), import_getNormalizedStatePath = require("./getNormalizedStatePath"), import_lastAction = require("./lastAction");
63
+ let routeNode = null, rootComponent, linking, hasAttemptedToHideSplash = !1, initialState, rootState, nextState, routeInfo, splashScreenAnimationFrame, navigationRef = null, navigationRefSubscription;
64
+ const rootStateSubscribers = /* @__PURE__ */ new Set(), loadingStateSubscribers = /* @__PURE__ */ new Set(), storeSubscribers = /* @__PURE__ */ new Set();
65
+ function initialize(context, ref, initialLocation) {
66
+ if (cleanUpState(), routeNode = (0, import_getRoutes.getRoutes)(context, {
67
+ ignoreEntryPoints: !0,
68
+ platform: import_react_native.Platform.OS
69
+ }), rootComponent = routeNode ? (0, import_useScreens.getQualifiedRouteComponent)(routeNode) : import_react.Fragment, !routeNode && process.env.NODE_ENV === "production")
70
+ throw new Error("No routes found");
71
+ navigationRef = ref, setupLinking(initialLocation), subscribeToNavigationChanges();
72
+ }
73
+ function cleanUpState() {
74
+ initialState = void 0, rootState = void 0, nextState = void 0, routeInfo = void 0, linking = void 0, navigationRefSubscription?.(), rootStateSubscribers.clear(), storeSubscribers.clear();
75
+ }
76
+ function setupLinking(initialLocation) {
77
+ routeNode && (linking = (0, import_getLinkingConfig.getLinkingConfig)(routeNode), initialLocation && (linking.getInitialURL = () => initialLocation.toString(), initialState = linking.getStateFromPath?.(
78
+ initialLocation.pathname + (initialLocation.search || ""),
79
+ linking.config
80
+ ))), initialState ? (rootState = initialState, routeInfo = getRouteInfo(initialState)) : routeInfo = {
81
+ unstable_globalHref: "",
82
+ pathname: "",
83
+ isIndex: !1,
84
+ params: {},
85
+ segments: []
86
+ };
87
+ }
88
+ function subscribeToNavigationChanges() {
89
+ navigationRefSubscription = navigationRef.addListener("state", (data) => {
90
+ const state = data.data.state;
91
+ hasAttemptedToHideSplash || (hasAttemptedToHideSplash = !0, splashScreenAnimationFrame = requestAnimationFrame(() => {
92
+ })), nextOptions && (state.linkOptions = nextOptions, nextOptions = null);
93
+ let shouldUpdateSubscribers = nextState === state;
94
+ if (nextState = void 0, state && state !== rootState && (updateState(state, void 0), shouldUpdateSubscribers = !0), shouldUpdateSubscribers)
95
+ for (const subscriber of rootStateSubscribers)
96
+ subscriber(state);
97
+ }), updateSnapshot();
98
+ for (const subscriber of storeSubscribers)
99
+ subscriber();
100
+ }
101
+ function navigate(url, options) {
102
+ return linkTo((0, import_href.resolveHref)(url), "NAVIGATE", options);
103
+ }
104
+ function push(url, options) {
105
+ return linkTo((0, import_href.resolveHref)(url), "PUSH", options);
106
+ }
107
+ function dismiss(count) {
108
+ navigationRef?.dispatch(import_native.StackActions.pop(count));
109
+ }
110
+ function replace(url, options) {
111
+ return linkTo((0, import_href.resolveHref)(url), "REPLACE", options);
112
+ }
113
+ function setParams(params = {}) {
114
+ return (0, import_assertIsReady.assertIsReady)(navigationRef), navigationRef?.current?.setParams(
115
+ // @ts-expect-error
116
+ params
117
+ );
118
+ }
119
+ function dismissAll() {
120
+ navigationRef?.dispatch(import_native.StackActions.popToTop());
121
+ }
122
+ function goBack() {
123
+ (0, import_assertIsReady.assertIsReady)(navigationRef), navigationRef?.current?.goBack();
124
+ }
125
+ function canGoBack() {
126
+ return navigationRef.isReady() ? navigationRef?.current?.canGoBack() ?? !1 : !1;
127
+ }
128
+ function canDismiss() {
129
+ let state = rootState;
130
+ for (; state; ) {
131
+ if (state.type === "stack" && state.routes.length > 1)
132
+ return !0;
133
+ if (state.index === void 0)
134
+ return !1;
135
+ state = state.routes?.[state.index]?.state;
136
+ }
137
+ return !1;
138
+ }
139
+ function getSortedRoutes() {
140
+ if (!routeNode)
141
+ throw new Error("No routes");
142
+ return routeNode.children.filter((route) => !route.internal).sort(import_sortRoutes.sortRoutes);
143
+ }
144
+ function updateState(state, nextStateParam = state) {
145
+ rootState = state, nextState = nextStateParam;
146
+ const nextRouteInfo = getRouteInfo(state);
147
+ (0, import_getPathFromState.deepEqual)(routeInfo, nextRouteInfo) || (routeInfo = nextRouteInfo);
148
+ }
149
+ function getRouteInfo(state) {
150
+ return getRouteInfoFromState(
151
+ (state2, asPath) => (0, import_getPathFromState.getPathDataFromState)(state2, {
152
+ screens: [],
153
+ ...linking?.config,
154
+ preserveDynamicRoutes: asPath,
155
+ preserveGroups: asPath
156
+ }),
157
+ state
158
+ );
159
+ }
160
+ function getRouteInfoFromState(getPathFromState, state, baseUrl) {
161
+ const { path } = getPathFromState(state, !1), qualified = getPathFromState(state, !0);
162
+ return {
163
+ unstable_globalHref: path,
164
+ pathname: (0, import_getStateFromPath.stripBaseUrl)(path, baseUrl).split("?")[0],
165
+ isIndex: isIndexPath(state),
166
+ ...(0, import_getNormalizedStatePath.getNormalizedStatePath)(qualified, baseUrl)
167
+ };
168
+ }
169
+ function subscribeToRootState(subscriber) {
170
+ return rootStateSubscribers.add(subscriber), () => {
171
+ rootStateSubscribers.delete(subscriber);
172
+ };
173
+ }
174
+ function subscribeToStore(subscriber) {
175
+ return storeSubscribers.add(subscriber), () => {
176
+ storeSubscribers.delete(subscriber);
177
+ };
178
+ }
179
+ function subscribeToLoadingState(subscriber) {
180
+ return loadingStateSubscribers.add(subscriber), () => {
181
+ loadingStateSubscribers.delete(subscriber);
182
+ };
183
+ }
184
+ function setLoadingState(state) {
185
+ for (const listener of loadingStateSubscribers)
186
+ listener(state);
187
+ }
188
+ let currentSnapshot = null;
189
+ function updateSnapshot() {
190
+ currentSnapshot = getSnapshot();
191
+ }
192
+ function snapshot() {
193
+ return currentSnapshot;
194
+ }
195
+ function getSnapshot() {
196
+ return {
197
+ linkTo,
198
+ routeNode,
199
+ rootComponent,
200
+ linking,
201
+ hasAttemptedToHideSplash,
202
+ initialState,
203
+ rootState,
204
+ nextState,
205
+ routeInfo,
206
+ splashScreenAnimationFrame,
207
+ navigationRef,
208
+ navigationRefSubscription,
209
+ rootStateSubscribers,
210
+ storeSubscribers
211
+ };
212
+ }
213
+ function rootStateSnapshot() {
214
+ return rootState;
215
+ }
216
+ function routeInfoSnapshot() {
217
+ return routeInfo;
218
+ }
219
+ function useOneRouter() {
220
+ return (0, import_react.useSyncExternalStore)(subscribeToStore, snapshot, snapshot);
221
+ }
222
+ function syncStoreRootState() {
223
+ if (!navigationRef)
224
+ throw new Error("No navigationRef, possible duplicate One dep");
225
+ if (navigationRef.isReady()) {
226
+ const currentState = navigationRef.getRootState();
227
+ rootState !== currentState && updateState(currentState);
228
+ }
229
+ }
230
+ function useStoreRootState() {
231
+ return syncStoreRootState(), (0, import_react.useSyncExternalStore)(subscribeToRootState, rootStateSnapshot, rootStateSnapshot);
232
+ }
233
+ function useStoreRouteInfo() {
234
+ return syncStoreRootState(), (0, import_react.useSyncExternalStore)(subscribeToRootState, routeInfoSnapshot, routeInfoSnapshot);
235
+ }
236
+ function isIndexPath(state) {
237
+ const route = getActualLastRoute(state.routes[state.index ?? state.routes.length - 1]);
238
+ return route.state ? isIndexPath(route.state) : route.name === "index" ? !0 : route.params && "screen" in route.params ? route.params.screen === "index" : !!route.name.match(/.+\/index$/);
239
+ }
240
+ function getActualLastRoute(routeLike) {
241
+ if (routeLike.name[0] === "(" && routeLike.state?.routes) {
242
+ const routes = routeLike.state.routes;
243
+ return getActualLastRoute(routes[routes.length - 1]);
244
+ }
245
+ return routeLike;
246
+ }
247
+ function cleanup() {
248
+ splashScreenAnimationFrame && cancelAnimationFrame(splashScreenAnimationFrame);
249
+ }
250
+ const preloadingLoader = {};
251
+ function setupPreload(href) {
252
+ preloadingLoader[href] || (preloadingLoader[href] = async () => {
253
+ const [_preload, loader] = await Promise.all([
254
+ (0, import_dynamicImport.dynamicImport)((0, import_cleanUrl.getPreloadPath)(href)),
255
+ (0, import_dynamicImport.dynamicImport)((0, import_cleanUrl.getLoaderPath)(href))
256
+ ]);
257
+ try {
258
+ return await (await loader).loader?.();
259
+ } catch (err) {
260
+ return console.error(`Error preloading loader: ${err}`), null;
261
+ }
262
+ });
263
+ }
264
+ function preloadRoute(href) {
265
+ process.env.NODE_ENV !== "development" && (setupPreload(href), typeof preloadingLoader[href] == "function" && preloadingLoader[href]());
266
+ }
267
+ async function linkTo(href, event, options) {
268
+ if (href[0] === "#")
269
+ return;
270
+ if ((0, import_url.shouldLinkExternally)(href)) {
271
+ Linking.openURL(href);
272
+ return;
273
+ }
274
+ (0, import_assertIsReady.assertIsReady)(navigationRef);
275
+ const current = navigationRef.current;
276
+ if (current == null)
277
+ throw new Error(
278
+ "Couldn't find a navigation object. Is your component inside NavigationContainer?"
279
+ );
280
+ if (!linking)
281
+ throw new Error("Attempted to link to route when no routes are present");
282
+ if ((0, import_lastAction.setLastAction)(), href === ".." || href === "../") {
283
+ current.goBack();
284
+ return;
285
+ }
286
+ if (href.startsWith(".")) {
287
+ let base = routeInfo?.segments?.map((segment) => {
288
+ if (!segment.startsWith("[")) return segment;
289
+ if (segment.startsWith("[...")) {
290
+ segment = segment.slice(4, -1);
291
+ const params = routeInfo?.params?.[segment];
292
+ return Array.isArray(params) ? params.join("/") : params?.split(",")?.join("/") ?? "";
293
+ }
294
+ return segment = segment.slice(1, -1), routeInfo?.params?.[segment];
295
+ }).filter(Boolean).join("/") ?? "/";
296
+ routeInfo?.isIndex || (base += "/.."), href = (0, import_path.resolve)(base, href);
297
+ }
298
+ const state = linking.getStateFromPath(href, linking.config);
299
+ if (!state || state.routes.length === 0) {
300
+ console.error("Could not generate a valid navigation state for the given path: " + href), console.error("linking.config", linking.config), console.error("routes", getSortedRoutes());
301
+ return;
302
+ }
303
+ setLoadingState("loading"), globalThis.__vxrntodopath = (0, import_removeSearch.removeSearch)(href), preloadRoute(href);
304
+ const rootState2 = navigationRef.getRootState(), action = getNavigateAction(state, rootState2, event);
305
+ nextOptions = options ?? null, (0, import_react.startTransition)(() => {
306
+ const current2 = navigationRef.getCurrentRoute();
307
+ navigationRef.dispatch(action);
308
+ let warningTm;
309
+ const interval = setInterval(() => {
310
+ const next = navigationRef.getCurrentRoute();
311
+ current2 !== next && setTimeout(() => {
312
+ setLoadingState("loaded");
313
+ }), clearTimeout(warningTm), clearTimeout(interval);
314
+ }, 16);
315
+ process.env.NODE_ENV === "development" && (warningTm = setTimeout(() => {
316
+ console.warn("Routing took more than 8 seconds");
317
+ }, 1e3));
318
+ });
319
+ }
320
+ let nextOptions = null;
321
+ function getNavigateAction(actionState, navigationState, type = "NAVIGATE") {
322
+ let actionStateRoute;
323
+ for (; actionState && navigationState; ) {
324
+ const stateRoute = navigationState.routes[navigationState.index];
325
+ actionStateRoute = actionState.routes[actionState.routes.length - 1];
326
+ const childState = actionStateRoute.state, nextNavigationState = stateRoute.state, dynamicName = (0, import_matchers.matchDynamicName)(actionStateRoute.name);
327
+ if (actionStateRoute.name !== stateRoute.name || !childState || !nextNavigationState || dynamicName && actionStateRoute.params?.[dynamicName] !== stateRoute.params?.[dynamicName])
328
+ break;
329
+ actionState = childState, navigationState = nextNavigationState;
330
+ }
331
+ const rootPayload = { params: {} };
332
+ let payload = rootPayload, params = payload.params;
333
+ for (; actionStateRoute; )
334
+ Object.assign(params, { ...actionStateRoute.params }), payload.screen = actionStateRoute.name, payload.params = { ...actionStateRoute.params }, actionStateRoute = actionStateRoute.state?.routes[actionStateRoute.state?.routes.length - 1], payload.params ??= {}, payload = payload.params, params = payload;
335
+ return type === "PUSH" && ((0, import_lastAction.setLastAction)(), type = "NAVIGATE", navigationState.type === "stack" && (rootPayload.key = `${rootPayload.name}-${(0, import_non_secure.nanoid)()}`)), type === "REPLACE" && navigationState.type === "tab" && (type = "JUMP_TO"), {
336
+ type,
337
+ target: navigationState.key,
338
+ payload: {
339
+ key: rootPayload.key,
340
+ name: rootPayload.screen,
341
+ params: rootPayload.params
342
+ }
343
+ };
344
+ }
345
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1,22 @@
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 serverLocationContext_exports = {};
16
+ __export(serverLocationContext_exports, {
17
+ ServerLocationContext: () => ServerLocationContext
18
+ });
19
+ module.exports = __toCommonJS(serverLocationContext_exports);
20
+ var import_react = require("react");
21
+ const ServerLocationContext = (0, import_react.createContext)(void 0);
22
+ //# sourceMappingURL=serverLocationContext.js.map
@@ -0,0 +1,43 @@
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 useInitializeOneRouter_exports = {};
24
+ __export(useInitializeOneRouter_exports, {
25
+ resetState: () => resetState,
26
+ useInitializeOneRouter: () => useInitializeOneRouter
27
+ });
28
+ module.exports = __toCommonJS(useInitializeOneRouter_exports);
29
+ var import_native = require("@react-navigation/native"), import_router = require("./router"), routerStore = __toESM(require("./router"), 1);
30
+ let initialized = !1;
31
+ function useInitializeOneRouter(context, initialLocation) {
32
+ const navigationRef = (0, import_native.useNavigationContainerRef)();
33
+ return initialized || ((0, import_router.initialize)(context, navigationRef, initialLocation), initialized = !0), routerStore;
34
+ }
35
+ function resetState() {
36
+ initialized = !1, resetReactNavigationContexts();
37
+ }
38
+ globalThis.__vxrnresetState = resetState;
39
+ function resetReactNavigationContexts() {
40
+ const contexts = "__react_navigation__elements_contexts";
41
+ globalThis[contexts] = /* @__PURE__ */ new Map();
42
+ }
43
+ //# sourceMappingURL=useInitializeOneRouter.js.map
@@ -0,0 +1,184 @@
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 serve_exports = {};
24
+ __export(serve_exports, {
25
+ serve: () => serve
26
+ });
27
+ module.exports = __toCommonJS(serve_exports);
28
+ var import_polyfills_server = require("./polyfills-server"), import_fs_extra = __toESM(require("fs-extra"), 1), import_node_path = require("node:path"), import_vxrn = require("vxrn");
29
+ process.on("uncaughtException", (err) => {
30
+ console.error("[one] Uncaught exception", err?.stack || err);
31
+ });
32
+ async function serve(args = {}) {
33
+ const buildInfo = await import_fs_extra.default.readJSON("dist/buildInfo.json");
34
+ process.env.ONE_CACHE_KEY = buildInfo.constants.CACHE_KEY;
35
+ const { labelProcess } = await import("./cli/label-process"), { removeUndefined } = await import("./utils/removeUndefined"), { loadUserOneOptions } = await import("./vite/one");
36
+ labelProcess("serve"), (0, import_vxrn.loadEnv)("production");
37
+ const oneOptions = await loadUserOneOptions("serve");
38
+ return process.env.VXRN_REACT_19 = "1", await (0, import_vxrn.serve)({
39
+ server: {
40
+ // fallback to one plugin
41
+ ...oneOptions.server,
42
+ // override with any flags given to cli
43
+ ...removeUndefined({
44
+ port: args.port ? +args.port : void 0,
45
+ host: args.host,
46
+ compress: args.compress,
47
+ platform: args.platform,
48
+ cacheHeaders: args.cacheHeaders
49
+ }),
50
+ async beforeStart(options, app) {
51
+ await oneOptions.server?.beforeStart?.(options, app), await oneServe(oneOptions, options, buildInfo, app);
52
+ }
53
+ }
54
+ });
55
+ }
56
+ async function oneServe(options, vxrnOptions, buildInfo, app) {
57
+ const { createHandleRequest } = await import("./createHandleRequest"), { isResponse } = await import("./utils/isResponse"), { isStatusRedirect } = await import("./utils/isStatus"), { resolveAPIRequest } = await import("./vite/resolveAPIRequest"), isAPIRequest = /* @__PURE__ */ new WeakMap(), root = vxrnOptions.root || ".", redirects = options.web?.redirects;
58
+ if (redirects)
59
+ for (const redirect of redirects)
60
+ app.get(redirect.source, (context) => {
61
+ const destinationUrl = redirect.destination.replace(/:\w+/g, (param) => {
62
+ const paramName = param.substring(1);
63
+ return context.req.param(paramName) || "";
64
+ });
65
+ return context.redirect(destinationUrl, redirect.permanent ? 301 : 302);
66
+ });
67
+ if (!buildInfo)
68
+ throw new Error("No build info found, have you run build?");
69
+ const { routeMap, builtRoutes } = buildInfo, routeToBuildInfo = {};
70
+ for (const route of builtRoutes) {
71
+ routeToBuildInfo[route.cleanPath] = route;
72
+ const bracketRoutePath = route.cleanPath.split("/").map((part) => part[0] === ":" ? `[${part.slice(1)}]` : part).join("/");
73
+ routeToBuildInfo[bracketRoutePath] = route;
74
+ }
75
+ const serverOptions = {
76
+ ...options,
77
+ root
78
+ }, render = (await import((0, import_vxrn.getServerEntry)(serverOptions))).default.render, apiCJS = options.build?.api?.outputFormat === "cjs", handleRequest = createHandleRequest(
79
+ {},
80
+ {
81
+ async handleAPI({ route, request, loaderProps }) {
82
+ const apiFile = (0, import_node_path.join)(
83
+ process.cwd(),
84
+ "dist",
85
+ "api",
86
+ route.page.replace("[", "_").replace("]", "_") + (apiCJS ? ".cjs" : ".js")
87
+ );
88
+ return isAPIRequest.set(request, !0), resolveAPIRequest(
89
+ async () => {
90
+ try {
91
+ return await import(apiFile);
92
+ } catch (err) {
93
+ return console.error(`
94
+ [one] Error importing API route at ${apiFile}:
95
+
96
+ ${err}
97
+
98
+ If this is an import error, you can likely fix this by adding this dependency to
99
+ the "optimizeDeps.include" array in your vite.config.ts.
100
+
101
+ \u{1F41E} For a better error message run "node" and enter:
102
+
103
+ import('${apiFile}')
104
+
105
+ `), {};
106
+ }
107
+ },
108
+ request,
109
+ loaderProps?.params || {}
110
+ );
111
+ },
112
+ async handleSSR({ route, url, loaderProps }) {
113
+ if (route.type === "ssr") {
114
+ const buildInfo2 = routeToBuildInfo[route.page];
115
+ if (!buildInfo2)
116
+ throw new Error(
117
+ `No buildinfo found for ${url}, route: ${route.page}, in keys: ${Object.keys(routeToBuildInfo)}`
118
+ );
119
+ try {
120
+ const loaderData = await (await import(buildInfo2.serverJsPath)).loader?.(loaderProps), preloads = buildInfo2.preloads, headers = new Headers();
121
+ return headers.set("content-type", "text/html"), new Response(
122
+ await render({
123
+ loaderData,
124
+ loaderProps,
125
+ path: loaderProps?.path || "/",
126
+ preloads
127
+ }),
128
+ {
129
+ headers
130
+ }
131
+ );
132
+ } catch (err) {
133
+ console.error(`[one] Error rendering SSR route ${route.page}
134
+
135
+ ${err?.stack ?? err}
136
+
137
+ url: ${url}`);
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ), htmlFiles = {};
143
+ for (const key in routeMap)
144
+ routeToBuildInfo[key]?.type !== "ssr" && (htmlFiles[key] = await import_fs_extra.default.readFile((0, import_node_path.join)("dist/client", routeMap[key]), "utf-8"));
145
+ app.use(async (context, next) => {
146
+ const html = htmlFiles[context.req.path];
147
+ if (html)
148
+ return context.html(html);
149
+ try {
150
+ const request = context.req.raw, response = await handleRequest.handler(request);
151
+ if (response) {
152
+ if (isResponse(response)) {
153
+ if (isStatusRedirect(response.status)) {
154
+ const location = `${response.headers.get("location") || ""}`;
155
+ return response.headers.forEach((value, key) => {
156
+ context.header(key, value);
157
+ }), context.redirect(location, response.status);
158
+ }
159
+ if (isAPIRequest.get(request))
160
+ try {
161
+ response.headers.set("Cache-Control", "no-store");
162
+ } catch (err) {
163
+ console.info(
164
+ `Error udpating cache header on api route "${context.req.path}" to no-store, it is ${response.headers.get("cache-control")}, continue`,
165
+ err
166
+ );
167
+ }
168
+ return response;
169
+ }
170
+ return context.json(
171
+ response,
172
+ 200,
173
+ isAPIRequest.get(request) ? {
174
+ "Cache-Control": "no-store"
175
+ } : void 0
176
+ );
177
+ }
178
+ } catch (err) {
179
+ console.error(` [one] Error handling request: ${err.stack}`);
180
+ }
181
+ await next();
182
+ });
183
+ }
184
+ //# sourceMappingURL=serve.js.map
@@ -0,0 +1,40 @@
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 createRoutesManifest_exports = {};
16
+ __export(createRoutesManifest_exports, {
17
+ createRoutesManifest: () => createRoutesManifest
18
+ });
19
+ module.exports = __toCommonJS(createRoutesManifest_exports);
20
+ var import_getRoutes = require("../getRoutes"), import_getServerManifest = require("./getServerManifest");
21
+ function createMockModuleWithContext(map = []) {
22
+ const contextModule = (key) => ({ default() {
23
+ } });
24
+ return Object.defineProperty(contextModule, "keys", {
25
+ value: () => map
26
+ }), contextModule;
27
+ }
28
+ function createRoutesManifest(paths, options) {
29
+ const routeTree = (0, import_getRoutes.getRoutes)(createMockModuleWithContext(paths), {
30
+ ...options,
31
+ preserveApiRoutes: !0,
32
+ ignoreRequireErrors: !0,
33
+ ignoreEntryPoints: !0,
34
+ platform: "web"
35
+ });
36
+ if (!routeTree)
37
+ throw new Error(`No route tree found in paths: ${JSON.stringify(paths)}`);
38
+ return (0, import_getServerManifest.getServerManifest)(routeTree);
39
+ }
40
+ //# sourceMappingURL=createRoutesManifest.js.map