one 1.1.319 → 1.1.321

Sign up to get free protection for your applications and to get access to all the features.
Files changed (332) 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/{getURL.native.cjs → cli/patch.cjs} +11 -15
  7. package/dist/cjs/cli/patch.js +34 -0
  8. package/dist/cjs/cli/patch.js.map +6 -0
  9. package/dist/cjs/cli/patch.native.js +39 -0
  10. package/dist/cjs/cli/patch.native.js.map +6 -0
  11. package/dist/cjs/cli/prebuild.js +34 -0
  12. package/dist/cjs/cli/run.js +52 -0
  13. package/dist/cjs/cli/runAndroid.js +34 -0
  14. package/dist/cjs/cli/runIos.js +34 -0
  15. package/dist/cjs/cli.cjs +17 -0
  16. package/dist/cjs/cli.js +220 -0
  17. package/dist/cjs/{cli.cjs.map → cli.js.map} +1 -1
  18. package/dist/cjs/cli.native.js +12 -0
  19. package/dist/cjs/cli.native.js.map +2 -2
  20. package/dist/cjs/clientLoaderResolver.js +32 -0
  21. package/dist/cjs/config.js +27 -0
  22. package/dist/cjs/constants.js +28 -0
  23. package/dist/cjs/createApp.js +46 -0
  24. package/dist/cjs/createHandleRequest.js +138 -0
  25. package/dist/cjs/createRoute.js +37 -0
  26. package/dist/cjs/fallbackViews/Sitemap.js +82 -0
  27. package/dist/cjs/fallbackViews/Unmatched.js +58 -0
  28. package/dist/cjs/fork/NavigationContainer.js +85 -0
  29. package/dist/cjs/fork/createMemoryHistory.js +100 -0
  30. package/dist/cjs/fork/extractPathFromURL.js +62 -0
  31. package/dist/cjs/fork/findFocusedRoute.js +26 -0
  32. package/dist/cjs/fork/getPathFromState.js +265 -0
  33. package/dist/cjs/fork/getStateFromPath.js +381 -0
  34. package/dist/cjs/fork/useLinking.js +182 -0
  35. package/dist/cjs/fork/validatePathConfig.js +46 -0
  36. package/dist/cjs/getLinkingConfig.js +59 -0
  37. package/dist/cjs/getReactNavigationConfig.js +69 -0
  38. package/dist/cjs/getRoutes.js +294 -0
  39. package/dist/cjs/getURL.js +24 -0
  40. package/dist/cjs/head/Head.js +23 -0
  41. package/dist/cjs/head/HeadModule.js +22 -0
  42. package/dist/cjs/head/index.js +15 -0
  43. package/dist/cjs/head/types.js +14 -0
  44. package/dist/cjs/head/url.js +52 -0
  45. package/dist/cjs/hooks.js +99 -0
  46. package/dist/cjs/imperative-api.js +45 -0
  47. package/dist/cjs/import-mode/index.js +21 -0
  48. package/dist/cjs/import-mode/index.web.js +21 -0
  49. package/dist/cjs/index.js +65 -0
  50. package/dist/cjs/interfaces/router.js +23 -0
  51. package/dist/cjs/layouts/Drawer.js +24 -0
  52. package/dist/cjs/layouts/Stack.js +24 -0
  53. package/dist/cjs/layouts/Tabs.js +52 -0
  54. package/dist/cjs/layouts/withLayoutContext.js +77 -0
  55. package/dist/cjs/link/Link.js +98 -0
  56. package/dist/cjs/link/Redirect.js +31 -0
  57. package/dist/cjs/link/href.js +50 -0
  58. package/dist/cjs/link/linking.js +82 -0
  59. package/dist/cjs/link/path.js +65 -0
  60. package/dist/cjs/link/useLinkTo.js +42 -0
  61. package/dist/cjs/link/useLoadedNavigation.js +50 -0
  62. package/dist/cjs/matchers.js +68 -0
  63. package/dist/cjs/platform.js +21 -0
  64. package/dist/cjs/polyfills-mobile.js +26 -0
  65. package/dist/cjs/polyfills-server.js +23 -0
  66. package/dist/cjs/render.js +44 -0
  67. package/dist/cjs/router/RouterStore.js +14 -0
  68. package/dist/cjs/router/getNormalizedStatePath.js +50 -0
  69. package/dist/cjs/router/lastAction.js +25 -0
  70. package/dist/cjs/router/router.js +345 -0
  71. package/dist/cjs/router/serverLocationContext.js +22 -0
  72. package/dist/cjs/router/useInitializeOneRouter.js +43 -0
  73. package/dist/cjs/serve.js +184 -0
  74. package/dist/cjs/server/createRoutesManifest.js +40 -0
  75. package/dist/cjs/server/getServerManifest.js +109 -0
  76. package/dist/cjs/server-render.js +42 -0
  77. package/dist/cjs/sortRoutes.js +64 -0
  78. package/dist/cjs/typed-routes/generateRouteTypes.js +33 -0
  79. package/dist/cjs/typed-routes/getTypedRoutesDeclarationFile.js +83 -0
  80. package/dist/cjs/types.js +14 -0
  81. package/dist/cjs/useFocusEffect.js +79 -0
  82. package/dist/cjs/useLoader.js +97 -0
  83. package/dist/cjs/useNavigation.js +60 -0
  84. package/dist/cjs/useScreens.js +176 -0
  85. package/dist/cjs/useViteRoutes.js +77 -0
  86. package/dist/cjs/utils/assertIsReady.js +26 -0
  87. package/dist/cjs/utils/dynamicImport.js +24 -0
  88. package/dist/cjs/utils/existsAsync.js +28 -0
  89. package/dist/cjs/utils/getPageExport.js +38 -0
  90. package/dist/cjs/utils/globDir.js +37 -0
  91. package/dist/cjs/utils/hashString.js +32 -0
  92. package/dist/cjs/utils/isResponse.js +23 -0
  93. package/dist/cjs/utils/isStatus.js +23 -0
  94. package/dist/cjs/utils/promiseWithResolvers.js +26 -0
  95. package/dist/cjs/utils/rand.js +21 -0
  96. package/dist/cjs/utils/redirect.js +28 -0
  97. package/dist/cjs/utils/removeSearch.js +23 -0
  98. package/dist/cjs/utils/removeUndefined.js +26 -0
  99. package/dist/cjs/utils/url.js +31 -0
  100. package/dist/cjs/utils/weakKey.js +24 -0
  101. package/dist/cjs/utils/weakMemo.js +30 -0
  102. package/dist/cjs/views/EmptyRoute.js +25 -0
  103. package/dist/cjs/views/ErrorBoundary.js +33 -0
  104. package/dist/cjs/views/LoadProgressBar.js +83 -0
  105. package/dist/cjs/views/Navigator.js +101 -0
  106. package/dist/cjs/views/PreloadLinks.js +42 -0
  107. package/dist/cjs/views/RootErrorBoundary.js +47 -0
  108. package/dist/cjs/views/Screen.js +29 -0
  109. package/dist/cjs/views/ScrollRestoration.js +70 -0
  110. package/dist/cjs/views/Try.js +44 -0
  111. package/dist/cjs/vite/build.js +377 -0
  112. package/dist/cjs/vite/clientTreeShakePlugin.js +76 -0
  113. package/dist/cjs/vite/constants.js +22 -0
  114. package/dist/cjs/vite/createFileSystemRouter.cjs +2 -1
  115. package/dist/cjs/vite/createFileSystemRouter.js +244 -0
  116. package/dist/cjs/vite/createFileSystemRouter.js.map +6 -0
  117. package/dist/cjs/vite/createFileSystemRouter.native.js +2 -1
  118. package/dist/cjs/vite/createFileSystemRouter.native.js.map +2 -2
  119. package/dist/cjs/vite/customNodeExternals.js +52 -0
  120. package/dist/cjs/vite/ensureTsConfig.js +66 -0
  121. package/dist/cjs/vite/findDepsToOptimize.js +66 -0
  122. package/dist/cjs/vite/fixDependenciesPlugin.js +43 -0
  123. package/dist/cjs/vite/generateTypesForRoutes.js +36 -0
  124. package/dist/cjs/vite/getManifest.js +27 -0
  125. package/dist/cjs/vite/headers.js +39 -0
  126. package/dist/cjs/vite/makePluginWebOnly.js +27 -0
  127. package/dist/cjs/vite/one.js +290 -0
  128. package/dist/cjs/vite/removeReactNativeWebAnimatedPlugin.js +50 -0
  129. package/dist/cjs/vite/replaceLoader.js +34 -0
  130. package/dist/cjs/vite/resolveAPIRequest.js +71 -0
  131. package/dist/cjs/vite/server.js +16 -0
  132. package/dist/cjs/vite/types.js +14 -0
  133. package/dist/cjs/vite/virtualEntryPlugin.js +67 -0
  134. package/dist/cjs/vite/vitePluginSsrCss.js +130 -0
  135. package/dist/cjs/vite.cjs +2 -0
  136. package/dist/cjs/vite.js +29 -0
  137. package/dist/cjs/vite.js.map +6 -0
  138. package/dist/cjs/vite.native.js +3 -1
  139. package/dist/cjs/vite.native.js.map +1 -1
  140. package/dist/cjs/zero/getQueryKey.js +24 -0
  141. package/dist/cjs/zero/isZeroQuery.js +23 -0
  142. package/dist/cjs/zero/resolveQuery.js +38 -0
  143. package/dist/cjs/zero/subscribeToQuery.js +28 -0
  144. package/dist/cjs/zero/types.js +14 -0
  145. package/dist/cjs/zero/useQuery.js +47 -0
  146. package/dist/cjs/zero/useQueryZero.js +38 -0
  147. package/dist/cjs/zero.js +23 -0
  148. package/dist/esm/cli/patch.js +10 -0
  149. package/dist/esm/cli/patch.js.map +6 -0
  150. package/dist/esm/cli/patch.mjs +10 -0
  151. package/dist/esm/cli/patch.mjs.map +1 -0
  152. package/dist/esm/cli/patch.native.js +10 -0
  153. package/dist/esm/cli/patch.native.js.map +6 -0
  154. package/dist/esm/cli.js +12 -0
  155. package/dist/esm/cli.js.map +1 -1
  156. package/dist/esm/cli.mjs +17 -0
  157. package/dist/esm/cli.mjs.map +1 -1
  158. package/dist/esm/cli.native.js +12 -0
  159. package/dist/esm/cli.native.js.map +2 -2
  160. package/dist/esm/vite/createFileSystemRouter.js +2 -1
  161. package/dist/esm/vite/createFileSystemRouter.js.map +1 -1
  162. package/dist/esm/vite/createFileSystemRouter.mjs +2 -1
  163. package/dist/esm/vite/createFileSystemRouter.mjs.map +1 -1
  164. package/dist/esm/vite/createFileSystemRouter.native.js +2 -1
  165. package/dist/esm/vite/createFileSystemRouter.native.js.map +2 -2
  166. package/dist/esm/vite.js +2 -0
  167. package/dist/esm/vite.js.map +1 -1
  168. package/dist/esm/vite.mjs +2 -1
  169. package/dist/esm/vite.mjs.map +1 -1
  170. package/dist/esm/vite.native.js +2 -0
  171. package/dist/esm/vite.native.js.map +2 -2
  172. package/package.json +8 -8
  173. package/src/cli/patch.ts +6 -0
  174. package/src/cli.ts +14 -0
  175. package/src/vite/createFileSystemRouter.tsx +1 -1
  176. package/src/vite.ts +1 -0
  177. package/types/cli/patch.d.ts +2 -0
  178. package/types/cli/patch.d.ts.map +1 -0
  179. package/types/vite.d.ts +1 -0
  180. package/types/vite.d.ts.map +1 -1
  181. package/dist/cjs/createApp.native.cjs +0 -38
  182. package/dist/cjs/createApp.native.cjs.map +0 -6
  183. package/dist/cjs/fork/NavigationContainer.native.cjs +0 -103
  184. package/dist/cjs/fork/NavigationContainer.native.cjs.map +0 -6
  185. package/dist/cjs/fork/useLinking.native.cjs +0 -126
  186. package/dist/cjs/fork/useLinking.native.cjs.map +0 -6
  187. package/dist/cjs/getURL.native.cjs.map +0 -6
  188. package/dist/cjs/head/Head.android.cjs +0 -28
  189. package/dist/cjs/head/Head.android.cjs.map +0 -6
  190. package/dist/cjs/head/Head.ios.cjs +0 -210
  191. package/dist/cjs/head/Head.ios.cjs.map +0 -6
  192. package/dist/cjs/import-mode/index.android.cjs +0 -26
  193. package/dist/cjs/import-mode/index.android.cjs.map +0 -6
  194. package/dist/cjs/import-mode/index.ios.cjs +0 -26
  195. package/dist/cjs/import-mode/index.ios.cjs.map +0 -6
  196. package/dist/cjs/import-mode/index.native.cjs +0 -26
  197. package/dist/cjs/import-mode/index.native.cjs.map +0 -6
  198. package/dist/cjs/render.native.cjs +0 -28
  199. package/dist/cjs/render.native.cjs.map +0 -6
  200. package/dist/cjs/views/PreloadLinks.native.cjs +0 -28
  201. package/dist/cjs/views/PreloadLinks.native.cjs.map +0 -6
  202. package/dist/cjs/vite/createFileSystemRouter.cjs.map +0 -6
  203. package/dist/cjs/vite/headers.native.cjs +0 -32
  204. package/dist/cjs/vite/headers.native.cjs.map +0 -6
  205. package/dist/cjs/vite.cjs.map +0 -6
  206. /package/dist/cjs/{Root.cjs.map → Root.js.map} +0 -0
  207. /package/dist/cjs/{Route.cjs.map → Route.js.map} +0 -0
  208. /package/dist/cjs/{cleanUrl.cjs.map → cleanUrl.js.map} +0 -0
  209. /package/dist/cjs/cli/{label-process.cjs.map → label-process.js.map} +0 -0
  210. /package/dist/cjs/cli/{main.cjs.map → main.js.map} +0 -0
  211. /package/dist/cjs/cli/{prebuild.cjs.map → prebuild.js.map} +0 -0
  212. /package/dist/cjs/cli/{run.cjs.map → run.js.map} +0 -0
  213. /package/dist/cjs/cli/{runAndroid.cjs.map → runAndroid.js.map} +0 -0
  214. /package/dist/cjs/cli/{runIos.cjs.map → runIos.js.map} +0 -0
  215. /package/dist/cjs/{clientLoaderResolver.cjs.map → clientLoaderResolver.js.map} +0 -0
  216. /package/dist/cjs/{config.cjs.map → config.js.map} +0 -0
  217. /package/dist/cjs/{constants.cjs.map → constants.js.map} +0 -0
  218. /package/dist/cjs/{createApp.cjs.map → createApp.js.map} +0 -0
  219. /package/dist/cjs/{createHandleRequest.cjs.map → createHandleRequest.js.map} +0 -0
  220. /package/dist/cjs/{createRoute.cjs.map → createRoute.js.map} +0 -0
  221. /package/dist/cjs/fallbackViews/{Sitemap.cjs.map → Sitemap.js.map} +0 -0
  222. /package/dist/cjs/fallbackViews/{Unmatched.cjs.map → Unmatched.js.map} +0 -0
  223. /package/dist/cjs/fork/{NavigationContainer.cjs.map → NavigationContainer.js.map} +0 -0
  224. /package/dist/cjs/fork/{createMemoryHistory.cjs.map → createMemoryHistory.js.map} +0 -0
  225. /package/dist/cjs/fork/{extractPathFromURL.cjs.map → extractPathFromURL.js.map} +0 -0
  226. /package/dist/cjs/fork/{findFocusedRoute.cjs.map → findFocusedRoute.js.map} +0 -0
  227. /package/dist/cjs/fork/{getPathFromState.cjs.map → getPathFromState.js.map} +0 -0
  228. /package/dist/cjs/fork/{getStateFromPath.cjs.map → getStateFromPath.js.map} +0 -0
  229. /package/dist/cjs/fork/{useLinking.cjs.map → useLinking.js.map} +0 -0
  230. /package/dist/cjs/fork/{validatePathConfig.cjs.map → validatePathConfig.js.map} +0 -0
  231. /package/dist/cjs/{getLinkingConfig.cjs.map → getLinkingConfig.js.map} +0 -0
  232. /package/dist/cjs/{getReactNavigationConfig.cjs.map → getReactNavigationConfig.js.map} +0 -0
  233. /package/dist/cjs/{getRoutes.cjs.map → getRoutes.js.map} +0 -0
  234. /package/dist/cjs/{getURL.cjs.map → getURL.js.map} +0 -0
  235. /package/dist/cjs/head/{Head.cjs.map → Head.js.map} +0 -0
  236. /package/dist/cjs/head/{HeadModule.cjs.map → HeadModule.js.map} +0 -0
  237. /package/dist/cjs/head/{index.cjs.map → index.js.map} +0 -0
  238. /package/dist/cjs/head/{types.cjs.map → types.js.map} +0 -0
  239. /package/dist/cjs/head/{url.cjs.map → url.js.map} +0 -0
  240. /package/dist/cjs/{hooks.cjs.map → hooks.js.map} +0 -0
  241. /package/dist/cjs/{imperative-api.cjs.map → imperative-api.js.map} +0 -0
  242. /package/dist/cjs/import-mode/{index.cjs.map → index.js.map} +0 -0
  243. /package/dist/cjs/import-mode/{index.web.cjs.map → index.web.js.map} +0 -0
  244. /package/dist/cjs/{index.cjs.map → index.js.map} +0 -0
  245. /package/dist/cjs/interfaces/{router.cjs.map → router.js.map} +0 -0
  246. /package/dist/cjs/layouts/{Drawer.cjs.map → Drawer.js.map} +0 -0
  247. /package/dist/cjs/layouts/{Stack.cjs.map → Stack.js.map} +0 -0
  248. /package/dist/cjs/layouts/{Tabs.cjs.map → Tabs.js.map} +0 -0
  249. /package/dist/cjs/layouts/{withLayoutContext.cjs.map → withLayoutContext.js.map} +0 -0
  250. /package/dist/cjs/link/{Link.cjs.map → Link.js.map} +0 -0
  251. /package/dist/cjs/link/{Redirect.cjs.map → Redirect.js.map} +0 -0
  252. /package/dist/cjs/link/{href.cjs.map → href.js.map} +0 -0
  253. /package/dist/cjs/link/{linking.cjs.map → linking.js.map} +0 -0
  254. /package/dist/cjs/link/{path.cjs.map → path.js.map} +0 -0
  255. /package/dist/cjs/link/{useLinkTo.cjs.map → useLinkTo.js.map} +0 -0
  256. /package/dist/cjs/link/{useLoadedNavigation.cjs.map → useLoadedNavigation.js.map} +0 -0
  257. /package/dist/cjs/{matchers.cjs.map → matchers.js.map} +0 -0
  258. /package/dist/cjs/{platform.cjs.map → platform.js.map} +0 -0
  259. /package/dist/cjs/{polyfills-mobile.cjs.map → polyfills-mobile.js.map} +0 -0
  260. /package/dist/cjs/{polyfills-server.cjs.map → polyfills-server.js.map} +0 -0
  261. /package/dist/cjs/{render.cjs.map → render.js.map} +0 -0
  262. /package/dist/cjs/router/{RouterStore.cjs.map → RouterStore.js.map} +0 -0
  263. /package/dist/cjs/router/{getNormalizedStatePath.cjs.map → getNormalizedStatePath.js.map} +0 -0
  264. /package/dist/cjs/router/{lastAction.cjs.map → lastAction.js.map} +0 -0
  265. /package/dist/cjs/router/{router.cjs.map → router.js.map} +0 -0
  266. /package/dist/cjs/router/{serverLocationContext.cjs.map → serverLocationContext.js.map} +0 -0
  267. /package/dist/cjs/router/{useInitializeOneRouter.cjs.map → useInitializeOneRouter.js.map} +0 -0
  268. /package/dist/cjs/{serve.cjs.map → serve.js.map} +0 -0
  269. /package/dist/cjs/server/{createRoutesManifest.cjs.map → createRoutesManifest.js.map} +0 -0
  270. /package/dist/cjs/server/{getServerManifest.cjs.map → getServerManifest.js.map} +0 -0
  271. /package/dist/cjs/{server-render.cjs.map → server-render.js.map} +0 -0
  272. /package/dist/cjs/{sortRoutes.cjs.map → sortRoutes.js.map} +0 -0
  273. /package/dist/cjs/typed-routes/{generateRouteTypes.cjs.map → generateRouteTypes.js.map} +0 -0
  274. /package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.cjs.map → getTypedRoutesDeclarationFile.js.map} +0 -0
  275. /package/dist/cjs/{types.cjs.map → types.js.map} +0 -0
  276. /package/dist/cjs/{useFocusEffect.cjs.map → useFocusEffect.js.map} +0 -0
  277. /package/dist/cjs/{useLoader.cjs.map → useLoader.js.map} +0 -0
  278. /package/dist/cjs/{useNavigation.cjs.map → useNavigation.js.map} +0 -0
  279. /package/dist/cjs/{useScreens.cjs.map → useScreens.js.map} +0 -0
  280. /package/dist/cjs/{useViteRoutes.cjs.map → useViteRoutes.js.map} +0 -0
  281. /package/dist/cjs/utils/{assertIsReady.cjs.map → assertIsReady.js.map} +0 -0
  282. /package/dist/cjs/utils/{dynamicImport.cjs.map → dynamicImport.js.map} +0 -0
  283. /package/dist/cjs/utils/{existsAsync.cjs.map → existsAsync.js.map} +0 -0
  284. /package/dist/cjs/utils/{getPageExport.cjs.map → getPageExport.js.map} +0 -0
  285. /package/dist/cjs/utils/{globDir.cjs.map → globDir.js.map} +0 -0
  286. /package/dist/cjs/utils/{hashString.cjs.map → hashString.js.map} +0 -0
  287. /package/dist/cjs/utils/{isResponse.cjs.map → isResponse.js.map} +0 -0
  288. /package/dist/cjs/utils/{isStatus.cjs.map → isStatus.js.map} +0 -0
  289. /package/dist/cjs/utils/{promiseWithResolvers.cjs.map → promiseWithResolvers.js.map} +0 -0
  290. /package/dist/cjs/utils/{rand.cjs.map → rand.js.map} +0 -0
  291. /package/dist/cjs/utils/{redirect.cjs.map → redirect.js.map} +0 -0
  292. /package/dist/cjs/utils/{removeSearch.cjs.map → removeSearch.js.map} +0 -0
  293. /package/dist/cjs/utils/{removeUndefined.cjs.map → removeUndefined.js.map} +0 -0
  294. /package/dist/cjs/utils/{url.cjs.map → url.js.map} +0 -0
  295. /package/dist/cjs/utils/{weakKey.cjs.map → weakKey.js.map} +0 -0
  296. /package/dist/cjs/utils/{weakMemo.cjs.map → weakMemo.js.map} +0 -0
  297. /package/dist/cjs/views/{EmptyRoute.cjs.map → EmptyRoute.js.map} +0 -0
  298. /package/dist/cjs/views/{ErrorBoundary.cjs.map → ErrorBoundary.js.map} +0 -0
  299. /package/dist/cjs/views/{LoadProgressBar.cjs.map → LoadProgressBar.js.map} +0 -0
  300. /package/dist/cjs/views/{Navigator.cjs.map → Navigator.js.map} +0 -0
  301. /package/dist/cjs/views/{PreloadLinks.cjs.map → PreloadLinks.js.map} +0 -0
  302. /package/dist/cjs/views/{RootErrorBoundary.cjs.map → RootErrorBoundary.js.map} +0 -0
  303. /package/dist/cjs/views/{Screen.cjs.map → Screen.js.map} +0 -0
  304. /package/dist/cjs/views/{ScrollRestoration.cjs.map → ScrollRestoration.js.map} +0 -0
  305. /package/dist/cjs/views/{Try.cjs.map → Try.js.map} +0 -0
  306. /package/dist/cjs/vite/{build.cjs.map → build.js.map} +0 -0
  307. /package/dist/cjs/vite/{clientTreeShakePlugin.cjs.map → clientTreeShakePlugin.js.map} +0 -0
  308. /package/dist/cjs/vite/{constants.cjs.map → constants.js.map} +0 -0
  309. /package/dist/cjs/vite/{customNodeExternals.cjs.map → customNodeExternals.js.map} +0 -0
  310. /package/dist/cjs/vite/{ensureTsConfig.cjs.map → ensureTsConfig.js.map} +0 -0
  311. /package/dist/cjs/vite/{findDepsToOptimize.cjs.map → findDepsToOptimize.js.map} +0 -0
  312. /package/dist/cjs/vite/{fixDependenciesPlugin.cjs.map → fixDependenciesPlugin.js.map} +0 -0
  313. /package/dist/cjs/vite/{generateTypesForRoutes.cjs.map → generateTypesForRoutes.js.map} +0 -0
  314. /package/dist/cjs/vite/{getManifest.cjs.map → getManifest.js.map} +0 -0
  315. /package/dist/cjs/vite/{headers.cjs.map → headers.js.map} +0 -0
  316. /package/dist/cjs/vite/{makePluginWebOnly.cjs.map → makePluginWebOnly.js.map} +0 -0
  317. /package/dist/cjs/vite/{one.cjs.map → one.js.map} +0 -0
  318. /package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.cjs.map → removeReactNativeWebAnimatedPlugin.js.map} +0 -0
  319. /package/dist/cjs/vite/{replaceLoader.cjs.map → replaceLoader.js.map} +0 -0
  320. /package/dist/cjs/vite/{resolveAPIRequest.cjs.map → resolveAPIRequest.js.map} +0 -0
  321. /package/dist/cjs/vite/{server.cjs.map → server.js.map} +0 -0
  322. /package/dist/cjs/vite/{types.cjs.map → types.js.map} +0 -0
  323. /package/dist/cjs/vite/{virtualEntryPlugin.cjs.map → virtualEntryPlugin.js.map} +0 -0
  324. /package/dist/cjs/vite/{vitePluginSsrCss.cjs.map → vitePluginSsrCss.js.map} +0 -0
  325. /package/dist/cjs/zero/{getQueryKey.cjs.map → getQueryKey.js.map} +0 -0
  326. /package/dist/cjs/zero/{isZeroQuery.cjs.map → isZeroQuery.js.map} +0 -0
  327. /package/dist/cjs/zero/{resolveQuery.cjs.map → resolveQuery.js.map} +0 -0
  328. /package/dist/cjs/zero/{subscribeToQuery.cjs.map → subscribeToQuery.js.map} +0 -0
  329. /package/dist/cjs/zero/{types.cjs.map → types.js.map} +0 -0
  330. /package/dist/cjs/zero/{useQuery.cjs.map → useQuery.js.map} +0 -0
  331. /package/dist/cjs/zero/{useQueryZero.cjs.map → useQueryZero.js.map} +0 -0
  332. /package/dist/cjs/{zero.cjs.map → zero.js.map} +0 -0
@@ -0,0 +1,377 @@
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 build_exports = {};
24
+ __export(build_exports, {
25
+ build: () => build
26
+ });
27
+ module.exports = __toCommonJS(build_exports);
28
+ var constants = __toESM(require("../constants"), 1), import_fs_extra = __toESM(require("fs-extra"), 1), import_micromatch = __toESM(require("micromatch"), 1), import_node_module = require("node:module"), import_node_path = __toESM(require("node:path"), 1), import_rollup_plugin_node_externals = require("rollup-plugin-node-externals"), import_vite = require("vite"), import_vxrn = require("vxrn"), import_cleanUrl = require("../cleanUrl"), import_label_process = require("../cli/label-process"), import_getManifest = require("./getManifest"), import_one = require("./one"), import_replaceLoader = require("./replaceLoader");
29
+ const import_meta = {}, { ensureDir, readFile, outputFile } = import_fs_extra.default;
30
+ process.on("uncaughtException", (err) => {
31
+ console.error(err?.message || err);
32
+ });
33
+ async function build(args) {
34
+ (0, import_label_process.labelProcess)("build");
35
+ const userOptions = await (0, import_one.loadUserOneOptions)("build"), serverOutputFormat = userOptions.build?.server?.outputFormat ?? "esm";
36
+ process.env.VXRN_REACT_19 = "1", process.env.ONE_SERVER_URL || console.warn(
37
+ "\u26A0\uFE0F No ONE_SERVER_URL environment set, set it in your .env to your target deploy URL"
38
+ );
39
+ const vxrnOutput = await (0, import_vxrn.build)(
40
+ {
41
+ server: userOptions.server,
42
+ build: {
43
+ analyze: !0,
44
+ server: {
45
+ outputFormat: serverOutputFormat
46
+ }
47
+ }
48
+ },
49
+ args
50
+ ), options = await (0, import_vxrn.fillOptions)(vxrnOutput.options), toAbsolute = (p) => import_node_path.default.resolve(options.root, p), manifest = (0, import_getManifest.getManifest)(), { optimizeDeps } = (0, import_vxrn.getOptimizeDeps)("build"), apiBuildConfig = (0, import_vite.mergeConfig)(
51
+ // feels like this should build off the *server* build config not web
52
+ vxrnOutput.webBuildConfig,
53
+ {
54
+ configFile: !1,
55
+ appType: "custom",
56
+ optimizeDeps
57
+ }
58
+ );
59
+ if (manifest.apiRoutes.length) {
60
+ console.info(`
61
+ \u{1F528} build api routes
62
+ `);
63
+ const processEnvDefines = Object.fromEntries(
64
+ Object.entries(process.env).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)])
65
+ ), apiRouteExternalRegex = buildRegexExcludingDeps(optimizeDeps.include), apiEntryPoints = manifest.apiRoutes.reduce((entries, { page, file }) => (entries[page.slice(1) + ".js"] = (0, import_node_path.join)("app", file), entries), {}), apiOutputFormat = userOptions?.build?.api?.outputFormat ?? serverOutputFormat, treeshake = userOptions?.build?.api?.treeshake;
66
+ await (0, import_vite.build)(
67
+ (0, import_vite.mergeConfig)(apiBuildConfig, {
68
+ appType: "custom",
69
+ configFile: !1,
70
+ plugins: [
71
+ (0, import_rollup_plugin_node_externals.nodeExternals)({
72
+ exclude: optimizeDeps.include
73
+ })
74
+ ],
75
+ define: {
76
+ ...processEnvDefines
77
+ },
78
+ ssr: {
79
+ noExternal: !0,
80
+ // we patched them to switch to react 19
81
+ external: ["react", "react-dom"],
82
+ optimizeDeps
83
+ },
84
+ build: {
85
+ ssr: !0,
86
+ emptyOutDir: !1,
87
+ outDir: "dist/api",
88
+ copyPublicDir: !1,
89
+ minify: !1,
90
+ rollupOptions: {
91
+ treeshake: treeshake ?? {
92
+ moduleSideEffects: !1
93
+ },
94
+ plugins: [
95
+ // otherwise rollup is leaving commonjs-only top level imports...
96
+ apiOutputFormat === "esm" ? import_vxrn.rollupRemoveUnusedImportsPlugin : null
97
+ ].filter(Boolean),
98
+ // too many issues
99
+ // treeshake: {
100
+ // moduleSideEffects: false,
101
+ // },
102
+ // prevents it from shaking out the exports
103
+ preserveEntrySignatures: "strict",
104
+ input: apiEntryPoints,
105
+ external: apiRouteExternalRegex,
106
+ output: {
107
+ entryFileNames: "[name]",
108
+ exports: "auto",
109
+ ...apiOutputFormat === "esm" ? {
110
+ format: "esm",
111
+ esModule: !0
112
+ } : {
113
+ format: "cjs",
114
+ // Preserve folder structure and use .cjs extension
115
+ entryFileNames: (chunkInfo) => chunkInfo.name.replace(/\.js$/, ".cjs"),
116
+ chunkFileNames: (chunkInfo) => {
117
+ const dir = import_node_path.default.dirname(chunkInfo.name), name = import_node_path.default.basename(chunkInfo.name, import_node_path.default.extname(chunkInfo.name));
118
+ return import_node_path.default.join(dir, `${name}-[hash].cjs`);
119
+ },
120
+ assetFileNames: (assetInfo) => {
121
+ const name = assetInfo.name ?? "", dir = import_node_path.default.dirname(name), baseName = import_node_path.default.basename(name, import_node_path.default.extname(name)), ext = import_node_path.default.extname(name);
122
+ return import_node_path.default.join(dir, `${baseName}-[hash]${ext}`);
123
+ }
124
+ }
125
+ }
126
+ }
127
+ }
128
+ })
129
+ );
130
+ }
131
+ globalThis.require = (0, import_node_module.createRequire)((0, import_node_path.join)(import_meta.url, ".."));
132
+ const assets = [], builtRoutes = [];
133
+ console.info(`
134
+ \u{1F528} build static routes
135
+ `);
136
+ let render = null;
137
+ const entryServer = vxrnOutput.serverEntry;
138
+ try {
139
+ const serverImport = await import(entryServer);
140
+ render = serverImport.default.render || // for an unknown reason this is necessary
141
+ serverImport.default.default?.render, typeof render != "function" && (console.error("\u274C Error: didn't find render function in entry", serverImport), process.exit(1));
142
+ } catch (err) {
143
+ console.error("\u274C Error importing the root entry:"), console.error(` This error happened in the built file: ${entryServer}`), console.error(err.stack), process.exit(1);
144
+ }
145
+ const staticDir = (0, import_node_path.join)("dist/static"), clientDir = (0, import_node_path.join)("dist/client");
146
+ await ensureDir(staticDir);
147
+ const outputEntries = [...vxrnOutput.serverOutput.entries()];
148
+ for (const [index, output] of outputEntries) {
149
+ let collectImports = function({ imports = [], css }, { type = "js" } = {}) {
150
+ return [
151
+ ...new Set(
152
+ [
153
+ ...type === "js" ? imports : css || [],
154
+ ...imports.flatMap((name) => {
155
+ const found = vxrnOutput.clientManifest[name];
156
+ return found || console.warn("No found imports", name, vxrnOutput.clientManifest), collectImports(found, { type });
157
+ })
158
+ ].flat().filter((x) => x && (type === "css" || x.endsWith(".js"))).map((x) => type === "css" || x.startsWith("assets/") ? x : `assets/${x.slice(1)}`)
159
+ )
160
+ ];
161
+ };
162
+ if (output.type === "asset") {
163
+ assets.push(output);
164
+ continue;
165
+ }
166
+ const id = output.facadeModuleId || "", file = import_node_path.default.basename(id);
167
+ if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api") || !id.includes("/app/"))
168
+ continue;
169
+ const relativeId = (0, import_node_path.relative)(process.cwd(), id).replace("app/", "/"), onlyBuild = vxrnOutput.buildArgs?.only;
170
+ if (onlyBuild && !import_micromatch.default.contains(relativeId, onlyBuild))
171
+ continue;
172
+ const clientManifestKey = Object.keys(vxrnOutput.clientManifest).find((key) => id.endsWith(key)) || "";
173
+ if (!clientManifestKey)
174
+ continue;
175
+ const clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey], findMatchingRoute = (route) => route.file && clientManifestKey.endsWith(route.file.slice(1)), foundRoute = manifest.pageRoutes.find(findMatchingRoute);
176
+ if (!foundRoute) {
177
+ clientManifestKey.startsWith("app") && (console.error(" No html route found!", { id, clientManifestKey }), console.error(" In manifest", manifest), process.exit(1));
178
+ continue;
179
+ }
180
+ clientManifestEntry || console.warn(
181
+ `No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(
182
+ vxrnOutput.clientManifest,
183
+ null,
184
+ 2
185
+ )}`
186
+ );
187
+ const entryImports = collectImports(clientManifestEntry || {}), layoutEntries = foundRoute.layouts?.flatMap((layout) => {
188
+ const clientKey = `app${layout.contextKey.slice(1)}`;
189
+ return vxrnOutput.clientManifest[clientKey];
190
+ }) ?? [], layoutImports = layoutEntries.flatMap((entry) => [entry.file, ...collectImports(entry)]), preloadSetupFilePreloads = (() => {
191
+ if (userOptions.setupFile) {
192
+ const needle = userOptions.setupFile.replace(/^\.\//, "");
193
+ for (const file2 in vxrnOutput.clientManifest)
194
+ if (file2 === needle)
195
+ return [
196
+ vxrnOutput.clientManifest[file2].file
197
+ // getting 404s for preloading the imports as well?
198
+ // ...(entry.imports as string[])
199
+ ];
200
+ }
201
+ return [];
202
+ })(), preloads = [
203
+ .../* @__PURE__ */ new Set([
204
+ ...preloadSetupFilePreloads,
205
+ // add the route entry js (like ./app/index.ts)
206
+ clientManifestEntry.file,
207
+ // add the virtual entry
208
+ vxrnOutput.clientManifest["virtual:one-entry"].file,
209
+ ...entryImports,
210
+ ...layoutImports
211
+ ])
212
+ ].map((path) => `/${path}`), allEntries = [clientManifestEntry, ...layoutEntries], allCSS = allEntries.flatMap((entry) => collectImports(entry, { type: "css" })).map((path) => `/${path}`);
213
+ process.env.DEBUG && console.info("[one] building routes", { foundRoute, layoutEntries, allEntries, allCSS });
214
+ const serverJsPath = toAbsolute((0, import_node_path.join)("dist/server", output.fileName));
215
+ let exported;
216
+ try {
217
+ exported = await import(serverJsPath);
218
+ } catch (err) {
219
+ throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
220
+ cause: err
221
+ });
222
+ }
223
+ if (foundRoute.type !== "ssr" && !foundRoute.page.includes("+not-found") && !foundRoute.page.includes("_sitemap") && !exported.generateStaticParams && relativeId.includes("["))
224
+ throw new Error(`[one] Error: Missing generateStaticParams
225
+
226
+ Route ${foundRoute.page} of type ${foundRoute.type} must export generateStaticParams so build can complete.
227
+
228
+ See docs on generateStaticParams:
229
+ https://onestack.dev/docs/routing-exports#generatestaticparams
230
+
231
+ `);
232
+ const paramsList = await exported.generateStaticParams?.() ?? [{}];
233
+ console.info(`
234
+ [build] page ${relativeId} (with ${paramsList.length} routes)
235
+ `), process.env.DEBUG && console.info("paramsList", JSON.stringify(paramsList, null, 2));
236
+ for (const params of paramsList) {
237
+ const cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""), path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg"), htmlPath = `${path.endsWith("/") ? `${removeTrailingSlash(path)}/index` : path}.html`, clientJsPath = (0, import_node_path.join)("dist/client", clientManifestEntry.file), htmlOutPath = toAbsolute((0, import_node_path.join)(staticDir, htmlPath));
238
+ let loaderData = {};
239
+ try {
240
+ console.info(` \u21A6 route ${path}`);
241
+ const cleanPath = path === "/" ? path : removeTrailingSlash(path), preloadPath = (0, import_cleanUrl.getPreloadPath)(path);
242
+ if (await import_fs_extra.default.writeFile(
243
+ (0, import_node_path.join)(clientDir, preloadPath),
244
+ preloads.map((preload) => `import "${preload}"`).join(`
245
+ `)
246
+ ), builtRoutes.push({
247
+ type: foundRoute.type,
248
+ cleanPath,
249
+ preloadPath,
250
+ clientJsPath,
251
+ serverJsPath,
252
+ htmlPath,
253
+ loaderData,
254
+ params,
255
+ path,
256
+ preloads
257
+ }), foundRoute.type !== "ssr") {
258
+ const loaderProps = { path, params };
259
+ if (globalThis.__vxrnLoaderProps__ = loaderProps, globalThis.__vxrnresetState?.(), exported.loader) {
260
+ loaderData = await exported.loader?.({ path, params }) ?? null;
261
+ const code = await readFile(clientJsPath, "utf-8"), withLoader = (0, import_replaceLoader.replaceLoader)({
262
+ code,
263
+ loaderData
264
+ }), loaderPartialPath = (0, import_node_path.join)(clientDir, (0, import_cleanUrl.getLoaderPath)(path));
265
+ await outputFile(loaderPartialPath, withLoader);
266
+ }
267
+ if (foundRoute.type === "ssg") {
268
+ const html = await render({ path, preloads, loaderProps, loaderData, css: allCSS });
269
+ await outputFile(htmlOutPath, html);
270
+ continue;
271
+ }
272
+ foundRoute.type === "spa" && await outputFile(
273
+ htmlOutPath,
274
+ `<html><head>
275
+ <script>globalThis['global'] = globalThis</script>
276
+ <script>globalThis['__vxrnIsSPA'] = true</script>
277
+ ${preloads.map((preload) => ` <script type="module" src="${preload}"></script>`).join(`
278
+ `)}
279
+ ${allCSS.map((file2) => ` <link rel="stylesheet" href=${file2} />`).join(`
280
+ `)}
281
+ </head></html>`
282
+ );
283
+ }
284
+ } catch (err) {
285
+ const errMsg = err instanceof Error ? `${err.message}
286
+ ${err.stack}` : `${err}`;
287
+ console.error(
288
+ `Error building static page at ${path} with id ${relativeId}:
289
+
290
+ ${errMsg}
291
+
292
+ loaderData:
293
+
294
+ ${JSON.stringify(loaderData || null, null, 2)}
295
+ params:
296
+
297
+ ${JSON.stringify(params || null, null, 2)}`
298
+ ), console.error(err), process.exit(1);
299
+ }
300
+ }
301
+ }
302
+ await moveAllFiles(staticDir, clientDir), await import_fs_extra.default.rm(staticDir, { force: !0, recursive: !0 });
303
+ const buildInfoForWriting = {
304
+ routeMap: builtRoutes.reduce((acc, { cleanPath, htmlPath }) => (acc[cleanPath] = htmlPath, acc), {}),
305
+ builtRoutes,
306
+ constants: JSON.parse(JSON.stringify({ ...constants }))
307
+ }, buildInfo = {
308
+ ...buildInfoForWriting,
309
+ ...vxrnOutput
310
+ };
311
+ await import_fs_extra.default.writeJSON(toAbsolute("dist/buildInfo.json"), buildInfoForWriting);
312
+ let postBuildLogs = [];
313
+ (userOptions.web?.deploy ?? options.server?.platform) === "vercel" && (await import_fs_extra.default.writeFile(
314
+ (0, import_node_path.join)(options.root, "dist", "index.js"),
315
+ `import { serve } from 'one/serve'
316
+ const handler = await serve()
317
+ export const { GET, POST, PUT, PATCH, OPTIONS } = handler`
318
+ ), postBuildLogs.push(`wrote vercel entry to: ${(0, import_node_path.join)(".", "dist", "index.js")}`), postBuildLogs.push("point vercel outputDirectory to dist")), userOptions?.afterBuild && await userOptions?.afterBuild?.(buildInfo), process.env.VXRN_ANALYZE_BUNDLE && postBuildLogs.push(`client build report: ${toAbsolute("dist/report.html")}`), postBuildLogs.length && (console.info(`
319
+
320
+ `), postBuildLogs.forEach((log) => {
321
+ console.info(` \xB7 ${log}`);
322
+ })), console.info(`
323
+
324
+ \u{1F49B} build complete
325
+
326
+ `);
327
+ }
328
+ function removeTrailingSlash(path) {
329
+ return path.endsWith("/") ? path.slice(0, path.length - 1) : path;
330
+ }
331
+ async function moveAllFiles(src, dest) {
332
+ try {
333
+ await import_fs_extra.default.copy(src, dest, { overwrite: !0, errorOnExist: !1 });
334
+ } catch (err) {
335
+ console.error("Error moving files:", err);
336
+ }
337
+ }
338
+ function getPathnameFromFilePath(path, params = {}, strict = !1) {
339
+ const dirname = import_node_path.default.dirname(path).replace(/\([^\/]+\)/gi, ""), fileName = import_node_path.default.basename(path).replace(/\.[a-z]+$/, ""), nameWithParams = (() => {
340
+ if (fileName === "index")
341
+ return "/";
342
+ if (fileName.startsWith("[...")) {
343
+ const part = fileName.replace("[...", "").replace("]", "");
344
+ return params[part] || console.warn(`couldn't resolve ${fileName} segment in path ${path}`), `/${params[part]}`;
345
+ }
346
+ return `/${fileName.split("/").map((part) => {
347
+ if (part[0] === "[") {
348
+ const found = params[part.slice(1, part.length - 1)];
349
+ if (!found) {
350
+ if (strict)
351
+ throw new Error(
352
+ `[one] Params doesn't fit route:
353
+
354
+ - path: ${path}
355
+ - part: ${part}
356
+ - fileName: ${fileName}
357
+ - params:
358
+
359
+ ${JSON.stringify(params, null, 2)}`
360
+ );
361
+ return ":" + part.replace("[", "").replace("]", "");
362
+ }
363
+ return found;
364
+ }
365
+ return part;
366
+ }).join("/")}`;
367
+ })();
368
+ return `${dirname}${nameWithParams}`.replace(/\/\/+/gi, "/");
369
+ }
370
+ function escapeRegex(string) {
371
+ return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
372
+ }
373
+ function buildRegexExcludingDeps(deps) {
374
+ const regexPattern = `node_modules/(?!(${deps.map((dep) => escapeRegex(dep)).join("|")})).*`;
375
+ return new RegExp(regexPattern);
376
+ }
377
+ //# sourceMappingURL=build.js.map
@@ -0,0 +1,76 @@
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 clientTreeShakePlugin_exports = {};
24
+ __export(clientTreeShakePlugin_exports, {
25
+ clientTreeShakePlugin: () => clientTreeShakePlugin,
26
+ transformTreeShakeClient: () => transformTreeShakeClient
27
+ });
28
+ module.exports = __toCommonJS(clientTreeShakePlugin_exports);
29
+ var import_generator = __toESM(require("@babel/generator"), 1), import_parser = require("@babel/parser"), import_traverse = __toESM(require("@babel/traverse"), 1), import_babel_dead_code_elimination = require("babel-dead-code-elimination"), import_constants = require("./constants");
30
+ const traverse = import_traverse.default.default, generate = import_generator.default.default, clientTreeShakePlugin = () => ({
31
+ name: "one-client-tree-shake",
32
+ enforce: "pre",
33
+ applyToEnvironment(env) {
34
+ return env.name === "client" || env.name === "ios" || env.name === "android";
35
+ },
36
+ async transform(code, id, settings) {
37
+ if (this.environment.name !== "ssr")
38
+ return await transformTreeShakeClient(code, id);
39
+ }
40
+ });
41
+ async function transformTreeShakeClient(code, id) {
42
+ if (id.includes("node_modules") || !/generateStaticParams|loader/.test(code))
43
+ return;
44
+ const ast = (0, import_parser.parse)(code, { sourceType: "module", plugins: ["typescript", "jsx"] }), referenced = (0, import_babel_dead_code_elimination.findReferencedIdentifiers)(ast), removed = {
45
+ loader: !1,
46
+ generateStaticParams: !1
47
+ };
48
+ traverse(ast, {
49
+ ExportNamedDeclaration(path) {
50
+ if (path.node.declaration && path.node.declaration.type === "FunctionDeclaration") {
51
+ if (!path.node.declaration.id) return;
52
+ const functionName = path.node.declaration.id.name;
53
+ (functionName === "loader" || functionName === "generateStaticParams") && (path.remove(), removed[functionName] = !0);
54
+ } else path.node.declaration && path.node.declaration.type === "VariableDeclaration" && path.node.declaration.declarations.forEach((declarator, index) => {
55
+ if (declarator.id.type === "Identifier" && (declarator.id.name === "loader" || declarator.id.name === "generateStaticParams")) {
56
+ const declaration = path.get("declaration.declarations." + index);
57
+ Array.isArray(declaration) || (declaration.remove(), removed[declarator.id.name] = !0);
58
+ }
59
+ });
60
+ }
61
+ });
62
+ const removedFunctions = Object.keys(removed).filter((key) => removed[key]);
63
+ if (removedFunctions.length) {
64
+ (0, import_babel_dead_code_elimination.deadCodeElimination)(ast, referenced);
65
+ const out = generate(ast);
66
+ return {
67
+ code: out.code + `
68
+
69
+ ` + // TODO ideally put it back in same place as it was
70
+ removedFunctions.map((key) => key === "loader" ? import_constants.EMPTY_LOADER_STRING : "export function generateStaticParams() {};").join(`
71
+ `),
72
+ map: out.map
73
+ };
74
+ }
75
+ }
76
+ //# sourceMappingURL=clientTreeShakePlugin.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 constants_exports = {};
16
+ __export(constants_exports, {
17
+ EMPTY_LOADER_STRING: () => EMPTY_LOADER_STRING,
18
+ LoaderDataCache: () => LoaderDataCache
19
+ });
20
+ module.exports = __toCommonJS(constants_exports);
21
+ const EMPTY_LOADER_STRING = 'export function loader() {return "__vxrn__loader__"};', LoaderDataCache = {};
22
+ //# sourceMappingURL=constants.js.map
@@ -90,7 +90,8 @@ function createFileSystemRouter(options) {
90
90
  }
91
91
  }) : html;
92
92
  } catch (err) {
93
- console.error("Error in handleSSR:", err);
93
+ console.error(`SSR error while loading file ${route.file} from URL ${url.href}
94
+ `, err);
94
95
  const title = `Error rendering ${url.pathname} on server`,
95
96
  message = err instanceof Error ? err.message : `${err}`,
96
97
  stack = err instanceof Error ? err.stack : "";