one 1.2.57 → 1.2.58

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (481) hide show
  1. package/dist/cjs/cli/buildPage.cjs +1 -1
  2. package/dist/cjs/cli/buildPage.js +1 -1
  3. package/dist/cjs/cli/buildPage.native.js +1 -1
  4. package/dist/cjs/cli/buildPage.native.js.map +1 -1
  5. package/dist/cjs/cli/dev.cjs +4 -4
  6. package/dist/cjs/cli/dev.js +4 -4
  7. package/dist/cjs/cli/dev.js.map +1 -1
  8. package/dist/cjs/cli/dev.native.js +4 -4
  9. package/dist/cjs/cli/dev.native.js.map +1 -1
  10. package/dist/cjs/createApp.cjs +2 -1
  11. package/dist/cjs/createApp.js +2 -2
  12. package/dist/cjs/createApp.js.map +1 -1
  13. package/dist/cjs/createHandleRequest.test.js +3 -1
  14. package/dist/cjs/createHandleRequest.test.js.map +1 -1
  15. package/dist/cjs/createHandleRequest.test.native.js.map +1 -1
  16. package/dist/cjs/devtools/registry.cjs +30 -0
  17. package/dist/cjs/devtools/registry.js +25 -0
  18. package/dist/cjs/devtools/registry.js.map +6 -0
  19. package/dist/cjs/devtools/registry.native.js +33 -0
  20. package/dist/cjs/devtools/registry.native.js.map +1 -0
  21. package/dist/cjs/fork/createMemoryHistory.cjs +20 -9
  22. package/dist/cjs/fork/createMemoryHistory.js +22 -4
  23. package/dist/cjs/fork/createMemoryHistory.js.map +1 -1
  24. package/dist/cjs/fork/createMemoryHistory.native.js +20 -9
  25. package/dist/cjs/fork/createMemoryHistory.native.js.map +1 -1
  26. package/dist/cjs/fork/useLinking.cjs +11 -5
  27. package/dist/cjs/fork/useLinking.js +6 -6
  28. package/dist/cjs/fork/useLinking.js.map +1 -1
  29. package/dist/cjs/index.cjs +17 -1
  30. package/dist/cjs/index.js +12 -2
  31. package/dist/cjs/index.js.map +1 -1
  32. package/dist/cjs/index.native.js +17 -1
  33. package/dist/cjs/index.native.js.map +1 -1
  34. package/dist/cjs/layouts/withLayoutContext.cjs +34 -15
  35. package/dist/cjs/layouts/withLayoutContext.js +29 -13
  36. package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
  37. package/dist/cjs/layouts/withLayoutContext.native.js +42 -19
  38. package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -1
  39. package/dist/cjs/link/Link.cjs +5 -2
  40. package/dist/cjs/link/Link.js +3 -2
  41. package/dist/cjs/link/Link.js.map +1 -1
  42. package/dist/cjs/link/Link.native.js +6 -1
  43. package/dist/cjs/link/Link.native.js.map +1 -1
  44. package/dist/cjs/link/useLinkTo.cjs +11 -3
  45. package/dist/cjs/link/useLinkTo.js +6 -3
  46. package/dist/cjs/link/useLinkTo.js.map +1 -1
  47. package/dist/cjs/link/useLinkTo.native.js +11 -3
  48. package/dist/cjs/link/useLinkTo.native.js.map +1 -1
  49. package/dist/cjs/router/Route.js.map +1 -1
  50. package/dist/cjs/router/Route.native.js.map +1 -1
  51. package/dist/cjs/router/findRouteNode.cjs +70 -0
  52. package/dist/cjs/router/findRouteNode.js +72 -0
  53. package/dist/cjs/router/findRouteNode.js.map +6 -0
  54. package/dist/cjs/router/findRouteNode.native.js +104 -0
  55. package/dist/cjs/router/findRouteNode.native.js.map +1 -0
  56. package/dist/cjs/router/router.cjs +160 -11
  57. package/dist/cjs/router/router.js +142 -7
  58. package/dist/cjs/router/router.js.map +2 -2
  59. package/dist/cjs/router/router.native.js +241 -57
  60. package/dist/cjs/router/router.native.js.map +1 -1
  61. package/dist/cjs/router/useScreens.cjs +1 -1
  62. package/dist/cjs/router/useScreens.js +1 -1
  63. package/dist/cjs/router/useScreens.js.map +1 -1
  64. package/dist/cjs/router/useScreens.native.js +5 -2
  65. package/dist/cjs/router/useScreens.native.js.map +1 -1
  66. package/dist/cjs/server/oneServe.js.map +1 -1
  67. package/dist/cjs/server/oneServe.native.js.map +1 -1
  68. package/dist/cjs/useBlocker.cjs +158 -0
  69. package/dist/cjs/useBlocker.js +145 -0
  70. package/dist/cjs/useBlocker.js.map +6 -0
  71. package/dist/cjs/useBlocker.native.js +89 -0
  72. package/dist/cjs/useBlocker.native.js.map +1 -0
  73. package/dist/cjs/useLoader.cjs +69 -3
  74. package/dist/cjs/useLoader.js +57 -4
  75. package/dist/cjs/useLoader.js.map +2 -2
  76. package/dist/cjs/useLoader.native.js +90 -6
  77. package/dist/cjs/useLoader.native.js.map +1 -1
  78. package/dist/cjs/useScrollGroup.cjs +37 -0
  79. package/dist/cjs/useScrollGroup.js +30 -0
  80. package/dist/cjs/useScrollGroup.js.map +6 -0
  81. package/dist/cjs/useScrollGroup.native.js +29 -0
  82. package/dist/cjs/useScrollGroup.native.js.map +1 -0
  83. package/dist/cjs/validateParams.cjs +80 -0
  84. package/dist/cjs/validateParams.js +84 -0
  85. package/dist/cjs/validateParams.js.map +6 -0
  86. package/dist/cjs/validateParams.native.js +180 -0
  87. package/dist/cjs/validateParams.native.js.map +1 -0
  88. package/dist/cjs/validateSearch.cjs +104 -0
  89. package/dist/cjs/validateSearch.js +99 -0
  90. package/dist/cjs/validateSearch.js.map +6 -0
  91. package/dist/cjs/validateSearch.native.js +202 -0
  92. package/dist/cjs/validateSearch.native.js.map +1 -0
  93. package/dist/cjs/views/ErrorBoundary.cjs +293 -10
  94. package/dist/cjs/views/ErrorBoundary.js +328 -8
  95. package/dist/cjs/views/ErrorBoundary.js.map +2 -2
  96. package/dist/cjs/views/ErrorBoundary.native.js +159 -4
  97. package/dist/cjs/views/ErrorBoundary.native.js.map +1 -1
  98. package/dist/cjs/views/Navigator.cjs +10 -3
  99. package/dist/cjs/views/Navigator.js +7 -3
  100. package/dist/cjs/views/Navigator.js.map +1 -1
  101. package/dist/cjs/views/Navigator.native.js +12 -3
  102. package/dist/cjs/views/Navigator.native.js.map +1 -1
  103. package/dist/cjs/views/Protected.cjs +36 -0
  104. package/dist/cjs/views/Protected.js +27 -0
  105. package/dist/cjs/views/Protected.js.map +6 -0
  106. package/dist/cjs/views/Protected.native.js +44 -0
  107. package/dist/cjs/views/Protected.native.js.map +1 -0
  108. package/dist/cjs/views/RootErrorBoundary.cjs +193 -8
  109. package/dist/cjs/views/RootErrorBoundary.js +213 -8
  110. package/dist/cjs/views/RootErrorBoundary.js.map +1 -1
  111. package/dist/cjs/views/RootErrorBoundary.native.js +192 -8
  112. package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
  113. package/dist/cjs/views/ScrollBehavior.cjs +49 -11
  114. package/dist/cjs/views/ScrollBehavior.js +47 -11
  115. package/dist/cjs/views/ScrollBehavior.js.map +1 -1
  116. package/dist/cjs/views/ScrollBehavior.native.js +68 -10
  117. package/dist/cjs/views/ScrollBehavior.native.js.map +1 -1
  118. package/dist/cjs/views/SourceInspector.cjs +28 -0
  119. package/dist/cjs/views/SourceInspector.js +23 -0
  120. package/dist/cjs/views/SourceInspector.js.map +6 -0
  121. package/dist/cjs/views/SourceInspector.native.js +32 -0
  122. package/dist/cjs/views/SourceInspector.native.js.map +1 -0
  123. package/dist/cjs/views/Try.cjs +40 -7
  124. package/dist/cjs/views/Try.js +38 -4
  125. package/dist/cjs/views/Try.js.map +1 -1
  126. package/dist/cjs/views/Try.native.js +42 -7
  127. package/dist/cjs/views/Try.native.js.map +1 -1
  128. package/dist/cjs/vite/DevHead.cjs +797 -43
  129. package/dist/cjs/vite/DevHead.js +802 -51
  130. package/dist/cjs/vite/DevHead.js.map +1 -1
  131. package/dist/cjs/vite/DevHead.native.js +783 -1
  132. package/dist/cjs/vite/DevHead.native.js.map +1 -1
  133. package/dist/cjs/vite/one.cjs +7 -1
  134. package/dist/cjs/vite/one.js +7 -2
  135. package/dist/cjs/vite/one.js.map +1 -1
  136. package/dist/cjs/vite/one.native.js +11 -1
  137. package/dist/cjs/vite/one.native.js.map +1 -1
  138. package/dist/cjs/vite/plugins/SSRCSSPlugin.cjs +44 -4
  139. package/dist/cjs/vite/plugins/SSRCSSPlugin.js +48 -4
  140. package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
  141. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js +62 -5
  142. package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  143. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +6 -3
  144. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  145. package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  146. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +5 -1
  147. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
  148. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  149. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
  150. package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  151. package/dist/cjs/vite/plugins/sourceInspectorPlugin.cjs +155 -0
  152. package/dist/cjs/vite/plugins/sourceInspectorPlugin.js +148 -0
  153. package/dist/cjs/vite/plugins/sourceInspectorPlugin.js.map +6 -0
  154. package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js +231 -0
  155. package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
  156. package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +25 -6
  157. package/dist/cjs/vite/plugins/virtualEntryPlugin.js +16 -6
  158. package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
  159. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +26 -7
  160. package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  161. package/dist/esm/cli/buildPage.js +1 -1
  162. package/dist/esm/cli/buildPage.mjs +1 -1
  163. package/dist/esm/cli/buildPage.mjs.map +1 -1
  164. package/dist/esm/cli/buildPage.native.js +1 -1
  165. package/dist/esm/cli/buildPage.native.js.map +1 -1
  166. package/dist/esm/cli/dev.js +4 -4
  167. package/dist/esm/cli/dev.js.map +1 -1
  168. package/dist/esm/cli/dev.mjs +4 -4
  169. package/dist/esm/cli/dev.mjs.map +1 -1
  170. package/dist/esm/cli/dev.native.js +4 -4
  171. package/dist/esm/cli/dev.native.js.map +1 -1
  172. package/dist/esm/createApp.js +2 -2
  173. package/dist/esm/createApp.js.map +1 -1
  174. package/dist/esm/createApp.mjs +2 -1
  175. package/dist/esm/createApp.mjs.map +1 -1
  176. package/dist/esm/createHandleRequest.test.js +3 -1
  177. package/dist/esm/createHandleRequest.test.js.map +1 -1
  178. package/dist/esm/createHandleRequest.test.mjs.map +1 -1
  179. package/dist/esm/createHandleRequest.test.native.js.map +1 -1
  180. package/dist/esm/devtools/registry.js +9 -0
  181. package/dist/esm/devtools/registry.js.map +6 -0
  182. package/dist/esm/devtools/registry.mjs +6 -0
  183. package/dist/esm/devtools/registry.mjs.map +1 -0
  184. package/dist/esm/devtools/registry.native.js +6 -0
  185. package/dist/esm/devtools/registry.native.js.map +1 -0
  186. package/dist/esm/fork/createMemoryHistory.js +22 -4
  187. package/dist/esm/fork/createMemoryHistory.js.map +1 -1
  188. package/dist/esm/fork/createMemoryHistory.mjs +20 -9
  189. package/dist/esm/fork/createMemoryHistory.mjs.map +1 -1
  190. package/dist/esm/fork/createMemoryHistory.native.js +20 -9
  191. package/dist/esm/fork/createMemoryHistory.native.js.map +1 -1
  192. package/dist/esm/fork/useLinking.js +6 -5
  193. package/dist/esm/fork/useLinking.js.map +1 -1
  194. package/dist/esm/fork/useLinking.mjs +11 -5
  195. package/dist/esm/fork/useLinking.mjs.map +1 -1
  196. package/dist/esm/index.js +30 -2
  197. package/dist/esm/index.js.map +1 -1
  198. package/dist/esm/index.mjs +8 -2
  199. package/dist/esm/index.mjs.map +1 -1
  200. package/dist/esm/index.native.js +8 -2
  201. package/dist/esm/index.native.js.map +1 -1
  202. package/dist/esm/layouts/withLayoutContext.js +30 -12
  203. package/dist/esm/layouts/withLayoutContext.js.map +1 -1
  204. package/dist/esm/layouts/withLayoutContext.mjs +34 -15
  205. package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
  206. package/dist/esm/layouts/withLayoutContext.native.js +42 -19
  207. package/dist/esm/layouts/withLayoutContext.native.js.map +1 -1
  208. package/dist/esm/link/Link.js +3 -2
  209. package/dist/esm/link/Link.js.map +1 -1
  210. package/dist/esm/link/Link.mjs +5 -2
  211. package/dist/esm/link/Link.mjs.map +1 -1
  212. package/dist/esm/link/Link.native.js +6 -1
  213. package/dist/esm/link/Link.native.js.map +1 -1
  214. package/dist/esm/link/useLinkTo.js +6 -3
  215. package/dist/esm/link/useLinkTo.js.map +1 -1
  216. package/dist/esm/link/useLinkTo.mjs +11 -3
  217. package/dist/esm/link/useLinkTo.mjs.map +1 -1
  218. package/dist/esm/link/useLinkTo.native.js +11 -3
  219. package/dist/esm/link/useLinkTo.native.js.map +1 -1
  220. package/dist/esm/router/Route.js.map +1 -1
  221. package/dist/esm/router/Route.mjs.map +1 -1
  222. package/dist/esm/router/Route.native.js.map +1 -1
  223. package/dist/esm/router/findRouteNode.js +56 -0
  224. package/dist/esm/router/findRouteNode.js.map +6 -0
  225. package/dist/esm/router/findRouteNode.mjs +44 -0
  226. package/dist/esm/router/findRouteNode.mjs.map +1 -0
  227. package/dist/esm/router/findRouteNode.native.js +75 -0
  228. package/dist/esm/router/findRouteNode.native.js.map +1 -0
  229. package/dist/esm/router/router.js +154 -6
  230. package/dist/esm/router/router.js.map +1 -1
  231. package/dist/esm/router/router.mjs +151 -10
  232. package/dist/esm/router/router.mjs.map +1 -1
  233. package/dist/esm/router/router.native.js +232 -56
  234. package/dist/esm/router/router.native.js.map +1 -1
  235. package/dist/esm/router/useScreens.js +1 -1
  236. package/dist/esm/router/useScreens.js.map +1 -1
  237. package/dist/esm/router/useScreens.mjs +1 -1
  238. package/dist/esm/router/useScreens.mjs.map +1 -1
  239. package/dist/esm/router/useScreens.native.js +5 -2
  240. package/dist/esm/router/useScreens.native.js.map +1 -1
  241. package/dist/esm/server/oneServe.js.map +1 -1
  242. package/dist/esm/server/oneServe.mjs.map +1 -1
  243. package/dist/esm/server/oneServe.native.js.map +1 -1
  244. package/dist/esm/useBlocker.js +122 -0
  245. package/dist/esm/useBlocker.js.map +6 -0
  246. package/dist/esm/useBlocker.mjs +123 -0
  247. package/dist/esm/useBlocker.mjs.map +1 -0
  248. package/dist/esm/useBlocker.native.js +51 -0
  249. package/dist/esm/useBlocker.native.js.map +1 -0
  250. package/dist/esm/useLoader.js +57 -3
  251. package/dist/esm/useLoader.js.map +2 -2
  252. package/dist/esm/useLoader.mjs +69 -4
  253. package/dist/esm/useLoader.mjs.map +1 -1
  254. package/dist/esm/useLoader.native.js +90 -7
  255. package/dist/esm/useLoader.native.js.map +1 -1
  256. package/dist/esm/useScrollGroup.js +16 -0
  257. package/dist/esm/useScrollGroup.js.map +6 -0
  258. package/dist/esm/useScrollGroup.mjs +14 -0
  259. package/dist/esm/useScrollGroup.mjs.map +1 -0
  260. package/dist/esm/useScrollGroup.native.js +3 -0
  261. package/dist/esm/useScrollGroup.native.js.map +1 -0
  262. package/dist/esm/validateParams.js +68 -0
  263. package/dist/esm/validateParams.js.map +6 -0
  264. package/dist/esm/validateParams.mjs +54 -0
  265. package/dist/esm/validateParams.mjs.map +1 -0
  266. package/dist/esm/validateParams.native.js +151 -0
  267. package/dist/esm/validateParams.native.js.map +1 -0
  268. package/dist/esm/validateSearch.js +83 -0
  269. package/dist/esm/validateSearch.js.map +6 -0
  270. package/dist/esm/validateSearch.mjs +77 -0
  271. package/dist/esm/validateSearch.mjs.map +1 -0
  272. package/dist/esm/validateSearch.native.js +172 -0
  273. package/dist/esm/validateSearch.native.js.map +1 -0
  274. package/dist/esm/views/ErrorBoundary.js +325 -7
  275. package/dist/esm/views/ErrorBoundary.js.map +2 -2
  276. package/dist/esm/views/ErrorBoundary.mjs +289 -6
  277. package/dist/esm/views/ErrorBoundary.mjs.map +1 -1
  278. package/dist/esm/views/ErrorBoundary.native.js +159 -4
  279. package/dist/esm/views/ErrorBoundary.native.js.map +1 -1
  280. package/dist/esm/views/Navigator.js +7 -2
  281. package/dist/esm/views/Navigator.js.map +1 -1
  282. package/dist/esm/views/Navigator.mjs +10 -3
  283. package/dist/esm/views/Navigator.mjs.map +1 -1
  284. package/dist/esm/views/Navigator.native.js +12 -3
  285. package/dist/esm/views/Navigator.native.js.map +1 -1
  286. package/dist/esm/views/Protected.js +14 -0
  287. package/dist/esm/views/Protected.js.map +6 -0
  288. package/dist/esm/views/Protected.mjs +11 -0
  289. package/dist/esm/views/Protected.mjs.map +1 -0
  290. package/dist/esm/views/Protected.native.js +16 -0
  291. package/dist/esm/views/Protected.native.js.map +1 -0
  292. package/dist/esm/views/RootErrorBoundary.js +214 -7
  293. package/dist/esm/views/RootErrorBoundary.js.map +1 -1
  294. package/dist/esm/views/RootErrorBoundary.mjs +192 -7
  295. package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
  296. package/dist/esm/views/RootErrorBoundary.native.js +191 -7
  297. package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
  298. package/dist/esm/views/ScrollBehavior.js +47 -11
  299. package/dist/esm/views/ScrollBehavior.js.map +1 -1
  300. package/dist/esm/views/ScrollBehavior.mjs +48 -11
  301. package/dist/esm/views/ScrollBehavior.mjs.map +1 -1
  302. package/dist/esm/views/ScrollBehavior.native.js +67 -10
  303. package/dist/esm/views/ScrollBehavior.native.js.map +1 -1
  304. package/dist/esm/views/SourceInspector.js +7 -0
  305. package/dist/esm/views/SourceInspector.js.map +6 -0
  306. package/dist/esm/views/SourceInspector.mjs +5 -0
  307. package/dist/esm/views/SourceInspector.mjs.map +1 -0
  308. package/dist/esm/views/SourceInspector.native.js +6 -0
  309. package/dist/esm/views/SourceInspector.native.js.map +1 -0
  310. package/dist/esm/views/Try.js +38 -4
  311. package/dist/esm/views/Try.js.map +1 -1
  312. package/dist/esm/views/Try.mjs +40 -7
  313. package/dist/esm/views/Try.mjs.map +1 -1
  314. package/dist/esm/views/Try.native.js +42 -7
  315. package/dist/esm/views/Try.native.js.map +1 -1
  316. package/dist/esm/vite/DevHead.js +802 -51
  317. package/dist/esm/vite/DevHead.js.map +1 -1
  318. package/dist/esm/vite/DevHead.mjs +797 -43
  319. package/dist/esm/vite/DevHead.mjs.map +1 -1
  320. package/dist/esm/vite/DevHead.native.js +782 -0
  321. package/dist/esm/vite/DevHead.native.js.map +1 -1
  322. package/dist/esm/vite/one.js +7 -1
  323. package/dist/esm/vite/one.js.map +1 -1
  324. package/dist/esm/vite/one.mjs +7 -1
  325. package/dist/esm/vite/one.mjs.map +1 -1
  326. package/dist/esm/vite/one.native.js +11 -1
  327. package/dist/esm/vite/one.native.js.map +1 -1
  328. package/dist/esm/vite/plugins/SSRCSSPlugin.js +48 -4
  329. package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
  330. package/dist/esm/vite/plugins/SSRCSSPlugin.mjs +44 -4
  331. package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
  332. package/dist/esm/vite/plugins/SSRCSSPlugin.native.js +61 -4
  333. package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
  334. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +6 -3
  335. package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
  336. package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
  337. package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
  338. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
  339. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
  340. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +5 -1
  341. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
  342. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
  343. package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
  344. package/dist/esm/vite/plugins/sourceInspectorPlugin.js +126 -0
  345. package/dist/esm/vite/plugins/sourceInspectorPlugin.js.map +6 -0
  346. package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs +121 -0
  347. package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs.map +1 -0
  348. package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js +194 -0
  349. package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
  350. package/dist/esm/vite/plugins/virtualEntryPlugin.js +16 -6
  351. package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
  352. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +25 -6
  353. package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
  354. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +26 -7
  355. package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
  356. package/package.json +11 -9
  357. package/src/cli/buildPage.ts +1 -1
  358. package/src/cli/dev.ts +4 -4
  359. package/src/createApp.tsx +11 -1
  360. package/src/createHandleRequest.test.ts +3 -1
  361. package/src/devtools/registry.ts +21 -0
  362. package/src/fork/createMemoryHistory.tsx +43 -11
  363. package/src/fork/useLinking.ts +14 -4
  364. package/src/index.ts +34 -1
  365. package/src/interfaces/router.ts +48 -0
  366. package/src/layouts/withLayoutContext.tsx +48 -8
  367. package/src/link/Link.tsx +7 -2
  368. package/src/link/useLinkTo.tsx +7 -3
  369. package/src/router/Route.tsx +32 -3
  370. package/src/router/findRouteNode.ts +127 -0
  371. package/src/router/router.ts +286 -2
  372. package/src/router/useScreens.tsx +9 -3
  373. package/src/useBlocker.native.ts +153 -0
  374. package/src/useBlocker.ts +340 -0
  375. package/src/useLoader.ts +139 -1
  376. package/src/useScrollGroup.native.ts +7 -0
  377. package/src/useScrollGroup.ts +44 -0
  378. package/src/validateParams.ts +196 -0
  379. package/src/validateSearch.ts +241 -0
  380. package/src/views/ErrorBoundary.tsx +154 -156
  381. package/src/views/ErrorBoundary.web.tsx +321 -0
  382. package/src/views/Navigator.tsx +14 -2
  383. package/src/views/Protected.tsx +62 -0
  384. package/src/views/RootErrorBoundary.tsx +214 -17
  385. package/src/views/ScrollBehavior.tsx +82 -3
  386. package/src/views/SourceInspector.tsx +39 -0
  387. package/src/views/Try.tsx +81 -12
  388. package/src/vite/DevHead.tsx +819 -54
  389. package/src/vite/one.ts +13 -0
  390. package/src/vite/plugins/SSRCSSPlugin.ts +104 -0
  391. package/src/vite/plugins/fileSystemRouterPlugin.tsx +11 -8
  392. package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +4 -0
  393. package/src/vite/plugins/sourceInspectorPlugin.ts +246 -0
  394. package/src/vite/plugins/virtualEntryPlugin.ts +35 -10
  395. package/src/vite/types.ts +28 -0
  396. package/types/Route.d.ts.map +1 -0
  397. package/types/cleanUrl.d.ts.map +1 -0
  398. package/types/cli/run.d.ts.map +1 -0
  399. package/types/createApp.d.ts +5 -0
  400. package/types/createApp.d.ts.map +1 -1
  401. package/types/createRoute.d.ts.map +1 -0
  402. package/types/devtools/registry.d.ts +15 -0
  403. package/types/devtools/registry.d.ts.map +1 -0
  404. package/types/fork/NavigationContainer.native.d.ts.map +1 -0
  405. package/types/fork/createMemoryHistory.d.ts +8 -3
  406. package/types/fork/createMemoryHistory.d.ts.map +1 -1
  407. package/types/fork/useLinking.d.ts.map +1 -1
  408. package/types/getLinkingConfig.d.ts.map +1 -0
  409. package/types/getRoutes.d.ts.map +1 -0
  410. package/types/imperative-api.d.ts.map +1 -0
  411. package/types/index.d.ts +8 -1
  412. package/types/index.d.ts.map +1 -1
  413. package/types/interfaces/router.d.ts +47 -0
  414. package/types/interfaces/router.d.ts.map +1 -1
  415. package/types/layouts/withLayoutContext.d.ts +2 -1
  416. package/types/layouts/withLayoutContext.d.ts.map +1 -1
  417. package/types/link/Link.d.ts.map +1 -1
  418. package/types/link/useLinkTo.d.ts +1 -0
  419. package/types/link/useLinkTo.d.ts.map +1 -1
  420. package/types/matchers.d.ts.map +1 -0
  421. package/types/platform.d.ts.map +1 -0
  422. package/types/router/Route.d.ts +32 -3
  423. package/types/router/Route.d.ts.map +1 -1
  424. package/types/router/findRouteNode.d.ts +31 -0
  425. package/types/router/findRouteNode.d.ts.map +1 -0
  426. package/types/router/router.d.ts +35 -0
  427. package/types/router/router.d.ts.map +1 -1
  428. package/types/router/useScreens.d.ts +2 -0
  429. package/types/router/useScreens.d.ts.map +1 -1
  430. package/types/server/oneServe.d.ts.map +1 -1
  431. package/types/sortRoutes.d.ts.map +1 -0
  432. package/types/useBlocker.d.ts +72 -0
  433. package/types/useBlocker.d.ts.map +1 -0
  434. package/types/useBlocker.native.d.ts +60 -0
  435. package/types/useBlocker.native.d.ts.map +1 -0
  436. package/types/useLoader.d.ts +10 -0
  437. package/types/useLoader.d.ts.map +1 -1
  438. package/types/useNavigation.d.ts.map +1 -0
  439. package/types/useScreens.d.ts.map +1 -0
  440. package/types/useScrollGroup.d.ts +27 -0
  441. package/types/useScrollGroup.d.ts.map +1 -0
  442. package/types/useScrollGroup.native.d.ts +6 -0
  443. package/types/useScrollGroup.native.d.ts.map +1 -0
  444. package/types/useSearch.d.ts.map +1 -0
  445. package/types/useViteRoutes.d.ts.map +1 -0
  446. package/types/validateParams.d.ts +85 -0
  447. package/types/validateParams.d.ts.map +1 -0
  448. package/types/validateSearch.d.ts +107 -0
  449. package/types/validateSearch.d.ts.map +1 -0
  450. package/types/views/ErrorBoundary.d.ts +11 -1
  451. package/types/views/ErrorBoundary.d.ts.map +1 -1
  452. package/types/views/ErrorBoundary.web.d.ts +13 -0
  453. package/types/views/ErrorBoundary.web.d.ts.map +1 -0
  454. package/types/views/Navigator.d.ts.map +1 -1
  455. package/types/views/Protected.d.ts +39 -0
  456. package/types/views/Protected.d.ts.map +1 -0
  457. package/types/views/RootErrorBoundary.d.ts +14 -8
  458. package/types/views/RootErrorBoundary.d.ts.map +1 -1
  459. package/types/views/ScrollBehavior.d.ts +8 -0
  460. package/types/views/ScrollBehavior.d.ts.map +1 -1
  461. package/types/views/ScrollRestoration.d.ts.map +1 -0
  462. package/types/views/SourceInspector.d.ts +35 -0
  463. package/types/views/SourceInspector.d.ts.map +1 -0
  464. package/types/views/Try.d.ts +29 -6
  465. package/types/views/Try.d.ts.map +1 -1
  466. package/types/vite/DevHead.d.ts.map +1 -1
  467. package/types/vite/build.d.ts.map +1 -0
  468. package/types/vite/headers.d.ts.map +1 -0
  469. package/types/vite/headers.native.d.ts.map +1 -0
  470. package/types/vite/one.d.ts.map +1 -1
  471. package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
  472. package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
  473. package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
  474. package/types/vite/plugins/seoPreviewPlugin.d.ts.map +1 -0
  475. package/types/vite/plugins/sourceInspectorPlugin.d.ts +3 -0
  476. package/types/vite/plugins/sourceInspectorPlugin.d.ts.map +1 -0
  477. package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
  478. package/types/vite/resolveAPIRequest.d.ts.map +1 -0
  479. package/types/vite/server.d.ts.map +1 -0
  480. package/types/vite/types.d.ts +24 -0
  481. package/types/vite/types.d.ts.map +1 -1
package/src/vite/one.ts CHANGED
@@ -22,6 +22,7 @@ import { createFileSystemRouterPlugin } from './plugins/fileSystemRouterPlugin'
22
22
  import { fixDependenciesPlugin } from './plugins/fixDependenciesPlugin'
23
23
  import { generateFileSystemRouteTypesPlugin } from './plugins/generateFileSystemRouteTypesPlugin'
24
24
  import { imageDataPlugin } from './plugins/imageDataPlugin'
25
+ import { sourceInspectorPlugin } from './plugins/sourceInspectorPlugin'
25
26
  import { SSRCSSPlugin } from './plugins/SSRCSSPlugin'
26
27
  import { virtualEntryId } from './plugins/virtualEntryConstants'
27
28
  import { createVirtualEntry } from './plugins/virtualEntryPlugin'
@@ -678,5 +679,17 @@ export function one(options: One.PluginOptions = {}): PluginOption {
678
679
  SSRCSSPlugin({
679
680
  entries: [virtualEntryId],
680
681
  }),
682
+
683
+ // Source inspector - show source file location on hover with Shift+Ctrl/Cmd
684
+ ...(() => {
685
+ // devtools defaults to true
686
+ const devtools = options.devtools ?? true
687
+ if (devtools === false) return []
688
+
689
+ // if devtools is true, enable all tools
690
+ // if devtools is object, check individual settings (default true)
691
+ const inspector = devtools === true || (devtools.inspector ?? true)
692
+ return inspector ? sourceInspectorPlugin() : []
693
+ })(),
681
694
  ]
682
695
  }
@@ -3,6 +3,11 @@ import { VIRTUAL_SSR_CSS_ENTRY, VIRTUAL_SSR_CSS_HREF } from '../../constants'
3
3
 
4
4
  // thanks to hi-ogawa https://github.com/hi-ogawa/vite-plugins/tree/main/packages/ssr-css
5
5
 
6
+ // Track if we've pre-warmed routes and cached CSS
7
+ let cssCache: { css: string; timestamp: number } | null = null
8
+ let routesPreWarmed = false
9
+ const CSS_CACHE_TTL = 1000 // 1 second cache for dev mode
10
+
6
11
  export function SSRCSSPlugin(pluginOpts: { entries: string[] }): Plugin {
7
12
  let server: ViteDevServer
8
13
 
@@ -12,12 +17,64 @@ export function SSRCSSPlugin(pluginOpts: { entries: string[] }): Plugin {
12
17
  configureServer(server_) {
13
18
  server = server_
14
19
 
20
+ // Pre-warm route modules on first request to populate the module graph
21
+ // This ensures CSS from all routes is collected even for lazy imports
22
+ const preWarmRoutes = async () => {
23
+ if (routesPreWarmed) return
24
+ routesPreWarmed = true
25
+
26
+ try {
27
+ // Transform the virtual entry to get route module paths
28
+ await server.transformRequest(pluginOpts.entries[0])
29
+
30
+ // Get all route files from the module graph
31
+ const routeFiles = await collectRouteFiles(server, pluginOpts.entries)
32
+
33
+ // Transform each route file to warm its CSS dependencies
34
+ await Promise.all(
35
+ routeFiles.map((file) =>
36
+ server.transformRequest(file).catch(() => {
37
+ // Ignore errors - some routes may have issues
38
+ })
39
+ )
40
+ )
41
+
42
+ if (process.env.ONE_DEBUG) {
43
+ console.log(
44
+ `[one] Pre-warmed ${routeFiles.length} route modules for CSS collection`
45
+ )
46
+ }
47
+ } catch (err) {
48
+ console.error('[one] Error pre-warming routes:', err)
49
+ }
50
+ }
51
+
52
+ // Invalidate CSS cache on HMR
53
+ server.watcher.on('change', () => {
54
+ cssCache = null
55
+ })
56
+
15
57
  // invalidate virtual modules for each direct request
16
58
  server.middlewares.use(async (req, res, next) => {
17
59
  if (req.url?.includes(VIRTUAL_SSR_CSS_HREF)) {
60
+ // Pre-warm routes on first CSS request
61
+ await preWarmRoutes()
62
+
18
63
  invalidateModule(server, '\0' + VIRTUAL_SSR_CSS_ENTRY + '?direct')
19
64
 
65
+ // Use cached CSS if fresh
66
+ const now = Date.now()
67
+ if (cssCache && now - cssCache.timestamp < CSS_CACHE_TTL) {
68
+ res.setHeader('Content-Type', 'text/css')
69
+ res.setHeader('Cache-Control', 'no-store')
70
+ res.setHeader('Vary', '*')
71
+ res.write(cssCache.css)
72
+ res.end()
73
+ return
74
+ }
75
+
20
76
  const code = await collectStyle(server, pluginOpts.entries)
77
+ cssCache = { css: code, timestamp: now }
21
78
 
22
79
  res.setHeader('Content-Type', 'text/css')
23
80
  res.setHeader('Cache-Control', 'no-store')
@@ -175,3 +232,50 @@ async function collectStyleUrls(
175
232
 
176
233
  // cf. https://github.com/vitejs/vite/blob/d6bde8b03d433778aaed62afc2be0630c8131908/packages/vite/src/node/constants.ts#L49C23-L50
177
234
  const CSS_LANGS_RE = /\.(css|less|sass|scss|styl|stylus|pcss|postcss|sss)(?:$|\?)/
235
+
236
+ // Match route files from dynamic imports in virtual entry
237
+ // Vite transforms import.meta.glob to:
238
+ // const routes = { "./path/to/file.tsx": () => import("./path/to/file.tsx") }
239
+ const DYNAMIC_IMPORT_RE = /import\s*\(\s*["'`]([^"'`]+)["'`]\s*\)/g
240
+
241
+ /**
242
+ * Collect all route file paths from the module graph.
243
+ * This is used to pre-warm route modules so their CSS is included.
244
+ */
245
+ async function collectRouteFiles(
246
+ server: ViteDevServer,
247
+ entries: string[]
248
+ ): Promise<string[]> {
249
+ const routeFiles: string[] = []
250
+
251
+ for (const entry of entries) {
252
+ try {
253
+ // Get the transformed code for the entry
254
+ const result = await server.transformRequest(entry)
255
+ if (!result?.code) continue
256
+
257
+ // Extract dynamic import paths from the transformed code
258
+ let match
259
+ while ((match = DYNAMIC_IMPORT_RE.exec(result.code)) !== null) {
260
+ const importPath = match[1]
261
+ // Only include actual route files, not node_modules or virtual
262
+ if (
263
+ importPath &&
264
+ !importPath.includes('node_modules') &&
265
+ !importPath.startsWith('\0') &&
266
+ !importPath.startsWith('virtual:') &&
267
+ (importPath.endsWith('.tsx') ||
268
+ importPath.endsWith('.ts') ||
269
+ importPath.endsWith('.jsx') ||
270
+ importPath.endsWith('.js'))
271
+ ) {
272
+ routeFiles.push(importPath)
273
+ }
274
+ }
275
+ } catch {
276
+ // Ignore errors
277
+ }
278
+ }
279
+
280
+ return routeFiles
281
+ }
@@ -360,15 +360,18 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
360
360
  const appDir = path.join(process.cwd(), getRouterRootFromOneOptions(options))
361
361
 
362
362
  // on change ./app stuff lets reload this to pick up any route changes
363
- const fileWatcherChangeListener = debounce(async (type: string, changedPath: string) => {
364
- if (type === 'add' || type === 'delete') {
365
- // resolve to absolute path since watcher may emit relative paths
366
- const absolutePath = path.resolve(changedPath)
367
- if (absolutePath.startsWith(appDir)) {
368
- handleRequest = createRequestHandler()
363
+ const fileWatcherChangeListener = debounce(
364
+ async (type: string, changedPath: string) => {
365
+ if (type === 'add' || type === 'delete') {
366
+ // resolve to absolute path since watcher may emit relative paths
367
+ const absolutePath = path.resolve(changedPath)
368
+ if (absolutePath.startsWith(appDir)) {
369
+ handleRequest = createRequestHandler()
370
+ }
369
371
  }
370
- }
371
- }, 100)
372
+ },
373
+ 100
374
+ )
372
375
 
373
376
  server.watcher.addListener('all', fileWatcherChangeListener)
374
377
 
@@ -25,6 +25,10 @@ export function generateFileSystemRouteTypesPlugin(options: One.PluginOptions):
25
25
  if (type === 'add' || type === 'delete' || type === 'change') {
26
26
  // resolve to absolute path since watcher may emit relative paths
27
27
  const absolutePath = resolve(path)
28
+ // skip routes.d.ts itself to avoid infinite loop
29
+ if (absolutePath === outFile) {
30
+ return
31
+ }
28
32
  if (absolutePath.startsWith(appDir)) {
29
33
  // generate
30
34
  generateRouteTypes(
@@ -0,0 +1,246 @@
1
+ import path from 'node:path'
2
+ import { parseSync } from 'oxc-parser'
3
+ import { normalizePath } from 'vite'
4
+ import type { Plugin, ViteDevServer } from 'vite'
5
+
6
+ interface JsxLocation {
7
+ /** Position right after the tag name where we insert the attribute */
8
+ insertOffset: number
9
+ /** Traversal index - stable ordering that's the same on server and client */
10
+ index: number
11
+ /** Actual line number for editor navigation */
12
+ line: number
13
+ /** Actual column number for editor navigation */
14
+ column: number
15
+ }
16
+
17
+ /**
18
+ * Parse code with oxc and find all JSX opening elements.
19
+ * Returns insertion points sorted by offset (descending for safe insertion).
20
+ */
21
+ function findJsxElements(code: string, filename: string): JsxLocation[] {
22
+ const result = parseSync(filename, code)
23
+
24
+ if (result.errors.length > 0) {
25
+ return []
26
+ }
27
+
28
+ const locations: JsxLocation[] = []
29
+ let traversalIndex = 0
30
+
31
+ function getJsxName(node: any): string | null {
32
+ if (!node) return null
33
+ if (node.type === 'JSXIdentifier') return node.name
34
+ if (node.type === 'JSXMemberExpression') {
35
+ const obj = getJsxName(node.object)
36
+ return obj ? `${obj}.${node.property?.name}` : null
37
+ }
38
+ return null
39
+ }
40
+
41
+ function getLocation(offset: number): { line: number; column: number } {
42
+ const before = code.slice(0, offset)
43
+ const lines = before.split('\n')
44
+ return {
45
+ line: lines.length,
46
+ column: lines[lines.length - 1]!.length + 1,
47
+ }
48
+ }
49
+
50
+ function walk(node: any): void {
51
+ if (!node || typeof node !== 'object') return
52
+
53
+ if (node.type === 'JSXOpeningElement' && node.name) {
54
+ const tagName = getJsxName(node.name)
55
+
56
+ // Skip Fragment and already-tagged elements
57
+ if (tagName && tagName !== 'Fragment') {
58
+ // Check if already has data-one-source
59
+ const hasSourceAttr = node.attributes?.some(
60
+ (attr: any) =>
61
+ attr.type === 'JSXAttribute' && attr.name?.name === 'data-one-source'
62
+ )
63
+
64
+ if (!hasSourceAttr) {
65
+ // Insert position is right after the tag name
66
+ const nameEnd = node.name.end
67
+ const loc = getLocation(node.start)
68
+
69
+ locations.push({
70
+ insertOffset: nameEnd,
71
+ index: traversalIndex++,
72
+ line: loc.line,
73
+ column: loc.column,
74
+ })
75
+ }
76
+ }
77
+ }
78
+
79
+ // Walk all child nodes in consistent order
80
+ for (const key of Object.keys(node)) {
81
+ if (key === 'parent') continue
82
+ const value = node[key]
83
+ if (Array.isArray(value)) {
84
+ for (const child of value) {
85
+ walk(child)
86
+ }
87
+ } else if (value && typeof value === 'object') {
88
+ walk(value)
89
+ }
90
+ }
91
+ }
92
+
93
+ walk(result.program)
94
+
95
+ // Sort by offset descending so we can insert from end to start without shifting positions
96
+ return locations.sort((a, b) => b.insertOffset - a.insertOffset)
97
+ }
98
+
99
+ /**
100
+ * Transforms JSX to inject data-one-source attributes using oxc-parser.
101
+ * Uses stable traversal indices instead of line numbers to avoid hydration mismatches.
102
+ */
103
+ function injectSourceToJsx(
104
+ code: string,
105
+ id: string
106
+ ): { code: string; map?: null } | undefined {
107
+ const [filePath] = id.split('?')
108
+ if (!filePath) return
109
+
110
+ const location = filePath.replace(normalizePath(process.cwd()), '')
111
+
112
+ // Quick check - skip if no JSX-like content
113
+ if (!code.includes('<') || !code.includes('>')) {
114
+ return
115
+ }
116
+
117
+ const jsxLocations = findJsxElements(code, filePath)
118
+
119
+ if (jsxLocations.length === 0) {
120
+ return
121
+ }
122
+
123
+ // Build source info map for this file
124
+ // Sort by index (ascending) for the map, since jsxLocations is sorted by offset (descending)
125
+ const sourceInfoEntries = [...jsxLocations]
126
+ .sort((a, b) => a.index - b.index)
127
+ .map((jsx) => `${jsx.index}:[${jsx.line},${jsx.column}]`)
128
+ .join(',')
129
+
130
+ // Inject source info registration at the top of the file
131
+ const sourceInfoScript = `globalThis.__oneSourceInfo=globalThis.__oneSourceInfo||{};globalThis.__oneSourceInfo["${location}"]={${sourceInfoEntries}};`
132
+
133
+ let result = code
134
+
135
+ // Insert from end to start to preserve offsets
136
+ for (const jsx of jsxLocations) {
137
+ // Use stable index instead of line:column
138
+ const sourceAttr = ` data-one-source="${location}:${jsx.index}"`
139
+ result =
140
+ result.slice(0, jsx.insertOffset) + sourceAttr + result.slice(jsx.insertOffset)
141
+ }
142
+
143
+ // Add source info at the very beginning of the file
144
+ result = sourceInfoScript + result
145
+
146
+ return { code: result, map: null }
147
+ }
148
+
149
+ async function openInEditor(
150
+ filePath: string,
151
+ line?: string,
152
+ column?: string
153
+ ): Promise<void> {
154
+ try {
155
+ const launch = (await import('launch-editor')).default
156
+ const fullPath = path.join(process.cwd(), filePath)
157
+ const location = `${fullPath}${line ? `:${line}` : ''}${column ? `:${column}` : ''}`
158
+
159
+ launch(location, undefined, (filename: string, errorMessage: string | null) => {
160
+ if (errorMessage) {
161
+ console.warn(
162
+ `[one:source-inspector] Failed to open ${filename} in editor:`,
163
+ errorMessage
164
+ )
165
+ }
166
+ })
167
+ } catch (err) {
168
+ console.warn('[one:source-inspector] Failed to launch editor:', err)
169
+ }
170
+ }
171
+
172
+ export function sourceInspectorPlugin(): Plugin[] {
173
+ return [
174
+ // Transform plugin - injects data-one-source attributes
175
+ {
176
+ name: 'one:source-inspector-transform',
177
+ enforce: 'pre',
178
+ apply: 'serve',
179
+
180
+ transform(code, id) {
181
+ const envName = this.environment?.name
182
+ // Skip native environments only - transform both client and SSR for consistency
183
+ if (envName === 'ios' || envName === 'android') return
184
+
185
+ if (
186
+ id.includes('node_modules') ||
187
+ id.includes('?raw') ||
188
+ id.includes('dist') ||
189
+ id.includes('build')
190
+ ) {
191
+ return
192
+ }
193
+
194
+ if (!id.endsWith('.jsx') && !id.endsWith('.tsx')) return
195
+
196
+ return injectSourceToJsx(code, id)
197
+ },
198
+ },
199
+
200
+ // Note: Inspector UI script is now injected via DevHead.tsx for SSR compatibility
201
+
202
+ // Server plugin - handles open-source requests
203
+ {
204
+ name: 'one:source-inspector-server',
205
+ apply: 'serve',
206
+
207
+ configureServer(server: ViteDevServer) {
208
+ server.middlewares.use(async (req, res, next) => {
209
+ if (!req.url?.startsWith('/__one/open-source')) {
210
+ return next()
211
+ }
212
+
213
+ try {
214
+ const url = new URL(req.url, 'http://localhost')
215
+ const source = url.searchParams.get('source')
216
+
217
+ if (!source) {
218
+ res.statusCode = 400
219
+ res.end('Missing source parameter')
220
+ return
221
+ }
222
+
223
+ // Parse the source - now format is "filePath:index"
224
+ const lastColon = source.lastIndexOf(':')
225
+ const filePath = source.slice(0, lastColon)
226
+ const index = source.slice(lastColon + 1)
227
+
228
+ // Look up actual line/column from source info
229
+ // The client will send these if available
230
+ const line = url.searchParams.get('line')
231
+ const column = url.searchParams.get('column')
232
+
233
+ await openInEditor(filePath, line || undefined, column || undefined)
234
+
235
+ res.statusCode = 200
236
+ res.end('OK')
237
+ } catch (err) {
238
+ console.error('[one:source-inspector] Error:', err)
239
+ res.statusCode = 500
240
+ res.end('Internal server error')
241
+ }
242
+ })
243
+ },
244
+ },
245
+ ]
246
+ }
@@ -56,11 +56,20 @@ function normalizeSetupFile(
56
56
  }
57
57
  }
58
58
 
59
+ type SetupImportResult = {
60
+ /** Import statement to prepend (for native static imports) */
61
+ importStatement: string
62
+ /** Variable declaration for setup promise (for web dynamic imports) */
63
+ promiseDeclaration: string
64
+ /** The variable name to pass to createApp, or empty if no setup */
65
+ promiseVarName: string
66
+ }
67
+
59
68
  function getSetupFileImport(
60
69
  environmentName: string,
61
70
  setupFiles: NormalizedSetupFiles,
62
71
  useStaticImport: boolean
63
- ): string {
72
+ ): SetupImportResult {
64
73
  const envMap: Record<string, keyof NormalizedSetupFiles> = {
65
74
  client: 'client',
66
75
  ssr: 'server',
@@ -69,18 +78,28 @@ function getSetupFileImport(
69
78
  }
70
79
 
71
80
  const key = envMap[environmentName]
72
- if (!key) return ''
81
+ if (!key) return { importStatement: '', promiseDeclaration: '', promiseVarName: '' }
73
82
 
74
83
  const setupFile = setupFiles[key]
75
- if (!setupFile) return ''
84
+ if (!setupFile) return { importStatement: '', promiseDeclaration: '', promiseVarName: '' }
76
85
 
77
86
  // For native, use static import since dynamic import doesn't work
78
- // For web, use top-level await with dynamic import to ensure setup runs before app
79
87
  if (useStaticImport) {
80
- return `import ${JSON.stringify(setupFile)}`
88
+ return {
89
+ importStatement: `import ${JSON.stringify(setupFile)}`,
90
+ promiseDeclaration: '',
91
+ promiseVarName: '',
92
+ }
81
93
  }
82
94
 
83
- return `await import(/* @vite-ignore */ ${JSON.stringify(setupFile)})`
95
+ // For web, use non-blocking dynamic import to avoid circular dependency deadlocks
96
+ // when the setup file's dependencies use Vite's __vite_preload helper.
97
+ // The promise is passed to createApp which awaits it before rendering.
98
+ return {
99
+ importStatement: '',
100
+ promiseDeclaration: `const __oneSetupPromise = import(/* @vite-ignore */ ${JSON.stringify(setupFile)})`,
101
+ promiseVarName: '__oneSetupPromise',
102
+ }
84
103
  }
85
104
 
86
105
  export function createVirtualEntry(options: {
@@ -117,7 +136,7 @@ export function createVirtualEntry(options: {
117
136
  load(id) {
118
137
  if (id === resolvedVirtualEntryId) {
119
138
  const isNative = isNativeEnvironment(this.environment)
120
- const prependCode = getSetupFileImport(
139
+ const setupResult = getSetupFileImport(
121
140
  this.environment.name,
122
141
  setupFiles,
123
142
  isNative
@@ -126,8 +145,13 @@ export function createVirtualEntry(options: {
126
145
  const nativewindImport = configuration.enableNativewind
127
146
  ? `import 'react-native-css-interop/dist/runtime/components'`
128
147
  : ''
148
+ // For web, pass setupPromise to createApp so it awaits before rendering
149
+ const setupPromiseArg = setupResult.promiseVarName
150
+ ? `setupPromise: ${setupResult.promiseVarName},`
151
+ : ''
129
152
  return `
130
- ${prependCode}
153
+ ${setupResult.importStatement}
154
+ ${setupResult.promiseDeclaration}
131
155
  ${nativewindImport}
132
156
 
133
157
  import { createApp, registerPreloadedRoute as _registerPreloadedRoute } from 'one'
@@ -145,6 +169,7 @@ if (typeof window !== 'undefined') {
145
169
 
146
170
  // globbing ${JSON.stringify(routeGlobs)}
147
171
  export default createApp({
172
+ ${setupPromiseArg}
148
173
  routes: import.meta.glob(${JSON.stringify([...routeGlobs, ...ROUTE_WEB_EXCLUSION_GLOB_PATTERNS.map((p) => `!${p}`)])}, { exhaustive: true }),
149
174
  routerRoot: ${JSON.stringify(options.root)},
150
175
  flags: ${JSON.stringify(options.flags)},
@@ -154,13 +179,13 @@ export default createApp({
154
179
 
155
180
  if (id === resolvedVirtualEntryIdNative) {
156
181
  const isNative = isNativeEnvironment(this.environment)
157
- const prependCode = getSetupFileImport(
182
+ const setupResult = getSetupFileImport(
158
183
  this.environment.name,
159
184
  setupFiles,
160
185
  isNative
161
186
  )
162
187
  return `
163
- ${prependCode}
188
+ ${setupResult.importStatement}
164
189
 
165
190
  import { createApp } from 'one'
166
191
 
package/src/vite/types.ts CHANGED
@@ -394,6 +394,34 @@ export namespace One {
394
394
  sitemap?: boolean | SitemapOptions
395
395
  }
396
396
 
397
+ /**
398
+ * Development tools configuration. Set to `true` to enable all devtools,
399
+ * `false` to disable, or an object to configure individual tools.
400
+ *
401
+ * @default true
402
+ */
403
+ devtools?:
404
+ | boolean
405
+ | {
406
+ /**
407
+ * Enable the source inspector.
408
+ * Hold Shift+Ctrl (or Shift+Cmd on Mac) and hover over elements
409
+ * to see their source file location. Click to open in your editor.
410
+ *
411
+ * @default true (when devtools is enabled)
412
+ */
413
+ inspector?: boolean
414
+
415
+ /**
416
+ * Enable the SEO preview panel.
417
+ * Press Alt+S to toggle a panel showing how the page appears in
418
+ * Google search results, Twitter cards, and Open Graph shares.
419
+ *
420
+ * @default true (when devtools is enabled)
421
+ */
422
+ seoPreview?: boolean
423
+ }
424
+
397
425
  server?: VXRNOptions['server']
398
426
 
399
427
  build?: {
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Route.d.ts","sourceRoot":"","sources":["../src/Route.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAc,KAAK,SAAS,EAAE,MAAM,OAAO,CAAA;AAGzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAEnF,MAAM,MAAM,WAAW,GAAG;IACxB,aAAa,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAA;IACvD,OAAO,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,CAAA;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACvC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAA;IAClC,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE;QAC7B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAC3C,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAA;IACzC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE;QACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAA;KAC3C,KAAK,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,EAAE,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,4BAA4B;IAC5B,IAAI,EAAE,GAAG,CAAC,SAAS,CAAA;IACnB,kEAAkE;IAClE,SAAS,EAAE,MAAM,OAAO,CAAC,WAAW,CAAC,CAAA;IACrC,iCAAiC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,oBAAoB;IACpB,QAAQ,EAAE,SAAS,EAAE,CAAA;IACrB,kCAAkC;IAClC,OAAO,EAAE,IAAI,GAAG,iBAAiB,EAAE,CAAA;IACnC,sCAAsC;IACtC,KAAK,EAAE,MAAM,CAAA;IACb,qDAAqD;IACrD,UAAU,EAAE,MAAM,CAAA;IAClB,sBAAsB;IACtB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,wFAAwF;IACxF,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,oLAAoL;IACpL,WAAW,CAAC,EAAE,MAAM,EAAE,CAAA;IACtB,qBAAqB;IACrB,OAAO,CAAC,EAAE,SAAS,EAAE,CAAA;CACtB,CAAA;AAQD,+DAA+D;AAC/D,wBAAgB,YAAY,IAAI,SAAS,GAAG,IAAI,CAE/C;AAED,wBAAgB,aAAa,IAAI,MAAM,CAMtC;AAED,iEAAiE;AACjE,wBAAgB,KAAK,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,2CAEjF"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cleanUrl.d.ts","sourceRoot":"","sources":["../src/cleanUrl.ts"],"names":[],"mappings":"AAqBA,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,UAEjD;AAED,wBAAgB,aAAa,CAC3B,WAAW,EAAE,MAAM,EAEnB,UAAU,UAAW,UAWtB;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,UAKvD"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/cli/run.ts"],"names":[],"mappings":"AAGA,wBAAsB,GAAG,CAAC,IAAI,EAAE;IAC9B,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,aAAa,GAAG,YAAY,CAAA;CACpC,iBAkCA"}
@@ -5,6 +5,11 @@ export type CreateAppProps = {
5
5
  routes: Record<string, () => Promise<unknown>>;
6
6
  routerRoot: string;
7
7
  flags?: One.Flags;
8
+ /**
9
+ * Promise that resolves when the setup file has finished loading.
10
+ * The app will wait for this before rendering to ensure setup code runs first.
11
+ */
12
+ setupPromise?: Promise<unknown>;
8
13
  };
9
14
  export declare function createApp(options: CreateAppProps): Promise<void> | {
10
15
  options: CreateAppProps;
@@ -1 +1 @@
1
- {"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../src/createApp.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAQhB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,CAAA;CAClB,CAAA;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc;;oBAIrB,cAAc;EAmJzC"}
1
+ {"version":3,"file":"createApp.d.ts","sourceRoot":"","sources":["../src/createApp.tsx"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAA;AAQhB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAM7C,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAEvC,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9C,UAAU,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,GAAG,CAAC,KAAK,CAAA;IACjB;;;OAGG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,CAAA;CAChC,CAAA;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,cAAc;;oBAIrB,cAAc;EAwJzC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRoute.d.ts","sourceRoot":"","sources":["../src/createRoute.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAEpD,wBAAgB,WAAW,CAAC,IAAI;;;;;;;;EAS/B;AAkBD,QAAA,MAAM,WAAW;;;;;;;;CAA8B,CAAA;AAE/C,eAAO,MAAM,KAAK,EAAiB;IACjC,IAAI,EAAE;QACJ,GAAG,EAAE,OAAO,WAAW,CAAA;KACxB,CAAA;IACD,aAAa,EAAE,EAAE,CAAA;IACjB,OAAO,EAAE,EAAE,CAAA;CACZ,CAAA"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Simple registry for devtools functions.
3
+ * This avoids circular dependencies by letting modules register their
4
+ * devtools functions instead of router.ts importing them.
5
+ */
6
+ type DevtoolsRegistry = {
7
+ getLoaderTimingHistory?: () => any[];
8
+ };
9
+ export declare const devtoolsRegistry: DevtoolsRegistry;
10
+ /**
11
+ * Register a devtools function. Called by modules like useLoader.ts
12
+ */
13
+ export declare function registerDevtoolsFunction<K extends keyof DevtoolsRegistry>(key: K, fn: DevtoolsRegistry[K]): void;
14
+ export {};
15
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/devtools/registry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,KAAK,gBAAgB,GAAG;IACtB,sBAAsB,CAAC,EAAE,MAAM,GAAG,EAAE,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,gBAAgB,EAAE,gBAAqB,CAAA;AAEpD;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,SAAS,MAAM,gBAAgB,EACvE,GAAG,EAAE,CAAC,EACN,EAAE,EAAE,gBAAgB,CAAC,CAAC,CAAC,QAGxB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NavigationContainer.native.d.ts","sourceRoot":"","sources":["../../src/fork/NavigationContainer.native.tsx"],"names":[],"mappings":"AAEA,OAAO,EAEL,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAM5B,MAAM,wBAAwB,CAAA;AAC/B,OAAO,EAEL,KAAK,oBAAoB,EAEzB,KAAK,cAAc,EACnB,KAAK,KAAK,EAEX,MAAM,0BAA0B,CAAA;AAIjC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,KAAK,KAAK,CAAC,SAAS,SAAS,MAAM,IAAI,wBAAwB,GAAG;IAChE,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,cAAc,CAAC,SAAS,CAAC,CAAA;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,aAAa,CAAC,EAAE,oBAAoB,CAAA;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB,CAAA;AAuGD,QAAA,MAAM,mBAAmB,EAAiD,CACxE,aAA4D,SAAtC,MAAM,GAAG,eAAe,CAAC,aAAa,EAE5D,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,GAAG;IAC5B,GAAG,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAA;CACvD,KACE,KAAK,CAAC,YAAY,CAAA;AAEvB,eAAe,mBAAmB,CAAA"}
@@ -5,13 +5,16 @@
5
5
  * Please refrain from making changes to this file, as it will make merging updates from the upstream harder.
6
6
  * All modifications except formatting should be marked with `// @modified` comment.
7
7
  *
8
- * No modifications currently, copied only in order to use a custom `useLinking` function.
8
+ * Modifications:
9
+ * - Added displayPath field to HistoryRecord for route masking support
10
+ * - Modified push() and replace() to accept displayPath parameter for showing masked URLs in browser
9
11
  */
10
12
  import type { NavigationState } from '@react-navigation/core';
11
13
  type HistoryRecord = {
12
14
  id: string;
13
15
  state: NavigationState;
14
16
  path: string;
17
+ displayPath?: string;
15
18
  };
16
19
  export declare function createMemoryHistory(): {
17
20
  readonly index: number;
@@ -19,13 +22,15 @@ export declare function createMemoryHistory(): {
19
22
  backIndex({ path }: {
20
23
  path: string;
21
24
  }): number;
22
- push({ path, state }: {
25
+ push({ path, state, displayPath, }: {
23
26
  path: string;
24
27
  state: NavigationState;
28
+ displayPath?: string;
25
29
  }): void;
26
- replace({ path, state }: {
30
+ replace({ path, state, displayPath, }: {
27
31
  path: string;
28
32
  state: NavigationState;
33
+ displayPath?: string;
29
34
  }): void;
30
35
  go(n: number): Promise<void> | undefined;
31
36
  listen(listener: () => void): () => void;