one 1.2.57 → 1.2.59
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.
- package/dist/cjs/cli/build.cjs +3 -1
- package/dist/cjs/cli/build.js +1 -1
- package/dist/cjs/cli/build.js.map +1 -1
- package/dist/cjs/cli/build.native.js +13 -12
- package/dist/cjs/cli/build.native.js.map +1 -1
- package/dist/cjs/cli/buildPage.cjs +1 -1
- package/dist/cjs/cli/buildPage.js +1 -1
- package/dist/cjs/cli/buildPage.native.js +2 -2
- package/dist/cjs/cli/buildPage.native.js.map +1 -1
- package/dist/cjs/cli/dev.cjs +4 -4
- package/dist/cjs/cli/dev.js +4 -4
- package/dist/cjs/cli/dev.js.map +1 -1
- package/dist/cjs/cli/dev.native.js +4 -4
- package/dist/cjs/cli/dev.native.js.map +1 -1
- package/dist/cjs/cli/generateRoutes.cjs +1 -1
- package/dist/cjs/cli/generateRoutes.js +1 -1
- package/dist/cjs/cli/generateRoutes.native.js +1 -1
- package/dist/cjs/cli/generateRoutes.native.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.native.js +7 -7
- package/dist/cjs/cli/generateSitemap.native.js.map +1 -1
- package/dist/cjs/config.native.js +2 -2
- package/dist/cjs/config.native.js.map +1 -1
- package/dist/cjs/constants.native.js +1 -1
- package/dist/cjs/constants.native.js.map +1 -1
- package/dist/cjs/createApp.cjs +2 -1
- package/dist/cjs/createApp.js +2 -2
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/createHandleRequest.test.js +3 -1
- package/dist/cjs/createHandleRequest.test.js.map +1 -1
- package/dist/cjs/createHandleRequest.test.native.js.map +1 -1
- package/dist/cjs/devtools/registry.cjs +30 -0
- package/dist/cjs/devtools/registry.js +25 -0
- package/dist/cjs/devtools/registry.js.map +6 -0
- package/dist/cjs/devtools/registry.native.js +33 -0
- package/dist/cjs/devtools/registry.native.js.map +1 -0
- package/dist/cjs/fork/NavigationContainer.native.js +5 -5
- package/dist/cjs/fork/NavigationContainer.native.js.map +1 -1
- package/dist/cjs/fork/createMemoryHistory.cjs +20 -9
- package/dist/cjs/fork/createMemoryHistory.js +22 -4
- package/dist/cjs/fork/createMemoryHistory.js.map +1 -1
- package/dist/cjs/fork/createMemoryHistory.native.js +22 -11
- package/dist/cjs/fork/createMemoryHistory.native.js.map +1 -1
- package/dist/cjs/fork/extractPathFromURL.native.js +8 -8
- package/dist/cjs/fork/extractPathFromURL.native.js.map +1 -1
- package/dist/cjs/fork/findFocusedRoute.native.js +2 -3
- package/dist/cjs/fork/findFocusedRoute.native.js.map +1 -1
- package/dist/cjs/fork/getPathFromState-mods.native.js +2 -3
- package/dist/cjs/fork/getPathFromState-mods.native.js.map +1 -1
- package/dist/cjs/fork/getStateFromPath-mods.native.js +3 -3
- package/dist/cjs/fork/getStateFromPath-mods.native.js.map +1 -1
- package/dist/cjs/fork/useLinking.cjs +11 -5
- package/dist/cjs/fork/useLinking.js +6 -6
- package/dist/cjs/fork/useLinking.js.map +1 -1
- package/dist/cjs/fork/useLinking.native.js.map +1 -1
- package/dist/cjs/head/url.native.js +2 -3
- package/dist/cjs/head/url.native.js.map +1 -1
- package/dist/cjs/hooks.js.map +1 -1
- package/dist/cjs/hooks.native.js.map +1 -1
- package/dist/cjs/index.cjs +17 -1
- package/dist/cjs/index.js +12 -2
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +17 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/layouts/withLayoutContext.cjs +34 -15
- package/dist/cjs/layouts/withLayoutContext.js +29 -13
- package/dist/cjs/layouts/withLayoutContext.js.map +1 -1
- package/dist/cjs/layouts/withLayoutContext.native.js +42 -19
- package/dist/cjs/layouts/withLayoutContext.native.js.map +1 -1
- package/dist/cjs/link/Link.cjs +5 -2
- package/dist/cjs/link/Link.js +3 -2
- package/dist/cjs/link/Link.js.map +1 -1
- package/dist/cjs/link/Link.native.js +6 -1
- package/dist/cjs/link/Link.native.js.map +1 -1
- package/dist/cjs/link/href.native.js +2 -2
- package/dist/cjs/link/href.native.js.map +1 -1
- package/dist/cjs/link/useLinkTo.cjs +11 -3
- package/dist/cjs/link/useLinkTo.js +6 -3
- package/dist/cjs/link/useLinkTo.js.map +1 -1
- package/dist/cjs/link/useLinkTo.native.js +11 -3
- package/dist/cjs/link/useLinkTo.native.js.map +1 -1
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js.map +1 -1
- package/dist/cjs/router/findRouteNode.cjs +70 -0
- package/dist/cjs/router/findRouteNode.js +72 -0
- package/dist/cjs/router/findRouteNode.js.map +6 -0
- package/dist/cjs/router/findRouteNode.native.js +104 -0
- package/dist/cjs/router/findRouteNode.native.js.map +1 -0
- package/dist/cjs/router/getRoutes.native.js +3 -3
- package/dist/cjs/router/getRoutes.native.js.map +1 -1
- package/dist/cjs/router/router.cjs +160 -11
- package/dist/cjs/router/router.js +142 -7
- package/dist/cjs/router/router.js.map +2 -2
- package/dist/cjs/router/router.native.js +247 -67
- package/dist/cjs/router/router.native.js.map +1 -1
- package/dist/cjs/router/useNavigation.js.map +1 -1
- package/dist/cjs/router/useNavigation.native.js.map +1 -1
- package/dist/cjs/router/useScreens.cjs +1 -1
- package/dist/cjs/router/useScreens.js +1 -1
- package/dist/cjs/router/useScreens.js.map +1 -1
- package/dist/cjs/router/useScreens.native.js +6 -3
- package/dist/cjs/router/useScreens.native.js.map +1 -1
- package/dist/cjs/router/utils/getNavigateAction.native.js +2 -4
- package/dist/cjs/router/utils/getNavigateAction.native.js.map +1 -1
- package/dist/cjs/server/oneServe.js.map +1 -1
- package/dist/cjs/server/oneServe.native.js +4 -4
- package/dist/cjs/server/oneServe.native.js.map +1 -1
- package/dist/cjs/server/setupBuildOptions.native.js +1 -1
- package/dist/cjs/server/setupBuildOptions.native.js.map +1 -1
- package/dist/cjs/ui/common.native.js +6 -5
- package/dist/cjs/ui/common.native.js.map +1 -1
- package/dist/cjs/useBlocker.cjs +158 -0
- package/dist/cjs/useBlocker.js +145 -0
- package/dist/cjs/useBlocker.js.map +6 -0
- package/dist/cjs/useBlocker.native.js +89 -0
- package/dist/cjs/useBlocker.native.js.map +1 -0
- package/dist/cjs/useFocusEffect.cjs +2 -2
- package/dist/cjs/useFocusEffect.js +2 -2
- package/dist/cjs/useFocusEffect.js.map +1 -1
- package/dist/cjs/useFocusEffect.native.js +2 -2
- package/dist/cjs/useFocusEffect.native.js.map +1 -1
- package/dist/cjs/useLoader.cjs +69 -3
- package/dist/cjs/useLoader.js +57 -4
- package/dist/cjs/useLoader.js.map +2 -2
- package/dist/cjs/useLoader.native.js +90 -6
- package/dist/cjs/useLoader.native.js.map +1 -1
- package/dist/cjs/useScrollGroup.cjs +37 -0
- package/dist/cjs/useScrollGroup.js +30 -0
- package/dist/cjs/useScrollGroup.js.map +6 -0
- package/dist/cjs/useScrollGroup.native.js +29 -0
- package/dist/cjs/useScrollGroup.native.js.map +1 -0
- package/dist/cjs/validateParams.cjs +80 -0
- package/dist/cjs/validateParams.js +84 -0
- package/dist/cjs/validateParams.js.map +6 -0
- package/dist/cjs/validateParams.native.js +180 -0
- package/dist/cjs/validateParams.native.js.map +1 -0
- package/dist/cjs/validateSearch.cjs +104 -0
- package/dist/cjs/validateSearch.js +99 -0
- package/dist/cjs/validateSearch.js.map +6 -0
- package/dist/cjs/validateSearch.native.js +202 -0
- package/dist/cjs/validateSearch.native.js.map +1 -0
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js +2 -2
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/cjs/views/ErrorBoundary.cjs +293 -10
- package/dist/cjs/views/ErrorBoundary.js +328 -8
- package/dist/cjs/views/ErrorBoundary.js.map +2 -2
- package/dist/cjs/views/ErrorBoundary.native.js +159 -4
- package/dist/cjs/views/ErrorBoundary.native.js.map +1 -1
- package/dist/cjs/views/Navigator.cjs +10 -3
- package/dist/cjs/views/Navigator.js +11 -3
- package/dist/cjs/views/Navigator.js.map +1 -1
- package/dist/cjs/views/Navigator.native.js +15 -6
- package/dist/cjs/views/Navigator.native.js.map +1 -1
- package/dist/cjs/views/Protected.cjs +36 -0
- package/dist/cjs/views/Protected.js +27 -0
- package/dist/cjs/views/Protected.js.map +6 -0
- package/dist/cjs/views/Protected.native.js +44 -0
- package/dist/cjs/views/Protected.native.js.map +1 -0
- package/dist/cjs/views/RootErrorBoundary.cjs +193 -8
- package/dist/cjs/views/RootErrorBoundary.js +213 -8
- package/dist/cjs/views/RootErrorBoundary.js.map +1 -1
- package/dist/cjs/views/RootErrorBoundary.native.js +192 -8
- package/dist/cjs/views/RootErrorBoundary.native.js.map +1 -1
- package/dist/cjs/views/ScrollBehavior.cjs +49 -11
- package/dist/cjs/views/ScrollBehavior.js +47 -11
- package/dist/cjs/views/ScrollBehavior.js.map +1 -1
- package/dist/cjs/views/ScrollBehavior.native.js +68 -10
- package/dist/cjs/views/ScrollBehavior.native.js.map +1 -1
- package/dist/cjs/views/SourceInspector.cjs +28 -0
- package/dist/cjs/views/SourceInspector.js +23 -0
- package/dist/cjs/views/SourceInspector.js.map +6 -0
- package/dist/cjs/views/SourceInspector.native.js +32 -0
- package/dist/cjs/views/SourceInspector.native.js.map +1 -0
- package/dist/cjs/views/Try.cjs +40 -7
- package/dist/cjs/views/Try.js +38 -4
- package/dist/cjs/views/Try.js.map +1 -1
- package/dist/cjs/views/Try.native.js +42 -7
- package/dist/cjs/views/Try.native.js.map +1 -1
- package/dist/cjs/vite/DevHead.cjs +797 -43
- package/dist/cjs/vite/DevHead.js +802 -51
- package/dist/cjs/vite/DevHead.js.map +1 -1
- package/dist/cjs/vite/DevHead.native.js +783 -1
- package/dist/cjs/vite/DevHead.native.js.map +1 -1
- package/dist/cjs/vite/one.cjs +7 -1
- package/dist/cjs/vite/one.js +7 -2
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js +17 -7
- package/dist/cjs/vite/one.native.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.cjs +44 -4
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js +48 -4
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js +62 -5
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.cjs +34 -15
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +24 -3
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js +55 -19
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.cjs +129 -0
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.js +129 -0
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.js.map +6 -0
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.native.js +140 -0
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.test.native.js.map +1 -0
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +6 -3
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +3 -3
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.cjs +5 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
- package/dist/cjs/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/sourceInspectorPlugin.cjs +155 -0
- package/dist/cjs/vite/plugins/sourceInspectorPlugin.js +148 -0
- package/dist/cjs/vite/plugins/sourceInspectorPlugin.js.map +6 -0
- package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js +231 -0
- package/dist/cjs/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
- package/dist/cjs/vite/plugins/virtualEntryPlugin.cjs +25 -6
- package/dist/cjs/vite/plugins/virtualEntryPlugin.js +16 -6
- package/dist/cjs/vite/plugins/virtualEntryPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js +26 -7
- package/dist/cjs/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/dist/esm/cli/build.js +1 -1
- package/dist/esm/cli/build.js.map +1 -1
- package/dist/esm/cli/build.mjs +3 -1
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js +13 -12
- package/dist/esm/cli/build.native.js.map +1 -1
- package/dist/esm/cli/buildPage.js +1 -1
- package/dist/esm/cli/buildPage.mjs +1 -1
- package/dist/esm/cli/buildPage.mjs.map +1 -1
- package/dist/esm/cli/buildPage.native.js +2 -2
- package/dist/esm/cli/buildPage.native.js.map +1 -1
- package/dist/esm/cli/dev.js +4 -4
- package/dist/esm/cli/dev.js.map +1 -1
- package/dist/esm/cli/dev.mjs +4 -4
- package/dist/esm/cli/dev.mjs.map +1 -1
- package/dist/esm/cli/dev.native.js +4 -4
- package/dist/esm/cli/dev.native.js.map +1 -1
- package/dist/esm/cli/generateRoutes.js +1 -1
- package/dist/esm/cli/generateRoutes.mjs +1 -1
- package/dist/esm/cli/generateRoutes.mjs.map +1 -1
- package/dist/esm/cli/generateRoutes.native.js +1 -1
- package/dist/esm/cli/generateRoutes.native.js.map +1 -1
- package/dist/esm/cli/generateSitemap.native.js +7 -7
- package/dist/esm/cli/generateSitemap.native.js.map +1 -1
- package/dist/esm/config.native.js +2 -2
- package/dist/esm/config.native.js.map +1 -1
- package/dist/esm/constants.native.js +2 -2
- package/dist/esm/constants.native.js.map +1 -1
- package/dist/esm/createApp.js +2 -2
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/createApp.mjs +2 -1
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/createHandleRequest.test.js +3 -1
- package/dist/esm/createHandleRequest.test.js.map +1 -1
- package/dist/esm/createHandleRequest.test.mjs.map +1 -1
- package/dist/esm/createHandleRequest.test.native.js.map +1 -1
- package/dist/esm/devtools/registry.js +9 -0
- package/dist/esm/devtools/registry.js.map +6 -0
- package/dist/esm/devtools/registry.mjs +6 -0
- package/dist/esm/devtools/registry.mjs.map +1 -0
- package/dist/esm/devtools/registry.native.js +6 -0
- package/dist/esm/devtools/registry.native.js.map +1 -0
- package/dist/esm/fork/NavigationContainer.native.js +5 -5
- package/dist/esm/fork/NavigationContainer.native.js.map +1 -1
- package/dist/esm/fork/createMemoryHistory.js +22 -4
- package/dist/esm/fork/createMemoryHistory.js.map +1 -1
- package/dist/esm/fork/createMemoryHistory.mjs +20 -9
- package/dist/esm/fork/createMemoryHistory.mjs.map +1 -1
- package/dist/esm/fork/createMemoryHistory.native.js +22 -11
- package/dist/esm/fork/createMemoryHistory.native.js.map +1 -1
- package/dist/esm/fork/extractPathFromURL.native.js +8 -8
- package/dist/esm/fork/extractPathFromURL.native.js.map +1 -1
- package/dist/esm/fork/findFocusedRoute.native.js +2 -3
- package/dist/esm/fork/findFocusedRoute.native.js.map +1 -1
- package/dist/esm/fork/getPathFromState-mods.native.js +2 -3
- package/dist/esm/fork/getPathFromState-mods.native.js.map +1 -1
- package/dist/esm/fork/getStateFromPath-mods.native.js +3 -3
- package/dist/esm/fork/getStateFromPath-mods.native.js.map +1 -1
- package/dist/esm/fork/useLinking.js +6 -5
- package/dist/esm/fork/useLinking.js.map +1 -1
- package/dist/esm/fork/useLinking.mjs +11 -5
- package/dist/esm/fork/useLinking.mjs.map +1 -1
- package/dist/esm/fork/useLinking.native.js.map +1 -1
- package/dist/esm/head/url.native.js +2 -3
- package/dist/esm/head/url.native.js.map +1 -1
- package/dist/esm/hooks.js.map +1 -1
- package/dist/esm/hooks.mjs.map +1 -1
- package/dist/esm/hooks.native.js.map +1 -1
- package/dist/esm/index.js +30 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +8 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +8 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/layouts/withLayoutContext.js +30 -12
- package/dist/esm/layouts/withLayoutContext.js.map +1 -1
- package/dist/esm/layouts/withLayoutContext.mjs +34 -15
- package/dist/esm/layouts/withLayoutContext.mjs.map +1 -1
- package/dist/esm/layouts/withLayoutContext.native.js +42 -19
- package/dist/esm/layouts/withLayoutContext.native.js.map +1 -1
- package/dist/esm/link/Link.js +3 -2
- package/dist/esm/link/Link.js.map +1 -1
- package/dist/esm/link/Link.mjs +5 -2
- package/dist/esm/link/Link.mjs.map +1 -1
- package/dist/esm/link/Link.native.js +6 -1
- package/dist/esm/link/Link.native.js.map +1 -1
- package/dist/esm/link/href.native.js +2 -2
- package/dist/esm/link/href.native.js.map +1 -1
- package/dist/esm/link/useLinkTo.js +6 -3
- package/dist/esm/link/useLinkTo.js.map +1 -1
- package/dist/esm/link/useLinkTo.mjs +11 -3
- package/dist/esm/link/useLinkTo.mjs.map +1 -1
- package/dist/esm/link/useLinkTo.native.js +11 -3
- package/dist/esm/link/useLinkTo.native.js.map +1 -1
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js.map +1 -1
- package/dist/esm/router/findRouteNode.js +56 -0
- package/dist/esm/router/findRouteNode.js.map +6 -0
- package/dist/esm/router/findRouteNode.mjs +44 -0
- package/dist/esm/router/findRouteNode.mjs.map +1 -0
- package/dist/esm/router/findRouteNode.native.js +75 -0
- package/dist/esm/router/findRouteNode.native.js.map +1 -0
- package/dist/esm/router/getRoutes.native.js +3 -3
- package/dist/esm/router/getRoutes.native.js.map +1 -1
- package/dist/esm/router/router.js +154 -6
- package/dist/esm/router/router.js.map +1 -1
- package/dist/esm/router/router.mjs +151 -10
- package/dist/esm/router/router.mjs.map +1 -1
- package/dist/esm/router/router.native.js +238 -66
- package/dist/esm/router/router.native.js.map +1 -1
- package/dist/esm/router/useNavigation.js.map +1 -1
- package/dist/esm/router/useNavigation.mjs.map +1 -1
- package/dist/esm/router/useNavigation.native.js.map +1 -1
- package/dist/esm/router/useScreens.js +1 -1
- package/dist/esm/router/useScreens.js.map +1 -1
- package/dist/esm/router/useScreens.mjs +1 -1
- package/dist/esm/router/useScreens.mjs.map +1 -1
- package/dist/esm/router/useScreens.native.js +6 -3
- package/dist/esm/router/useScreens.native.js.map +1 -1
- package/dist/esm/router/utils/getNavigateAction.native.js +2 -4
- package/dist/esm/router/utils/getNavigateAction.native.js.map +1 -1
- package/dist/esm/server/oneServe.js.map +1 -1
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js +4 -4
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/server/setupBuildOptions.native.js +1 -1
- package/dist/esm/server/setupBuildOptions.native.js.map +1 -1
- package/dist/esm/ui/common.native.js +6 -5
- package/dist/esm/ui/common.native.js.map +1 -1
- package/dist/esm/useBlocker.js +122 -0
- package/dist/esm/useBlocker.js.map +6 -0
- package/dist/esm/useBlocker.mjs +123 -0
- package/dist/esm/useBlocker.mjs.map +1 -0
- package/dist/esm/useBlocker.native.js +51 -0
- package/dist/esm/useBlocker.native.js.map +1 -0
- package/dist/esm/useFocusEffect.js +2 -2
- package/dist/esm/useFocusEffect.js.map +1 -1
- package/dist/esm/useFocusEffect.mjs +2 -2
- package/dist/esm/useFocusEffect.mjs.map +1 -1
- package/dist/esm/useFocusEffect.native.js +2 -2
- package/dist/esm/useFocusEffect.native.js.map +1 -1
- package/dist/esm/useLoader.js +57 -3
- package/dist/esm/useLoader.js.map +2 -2
- package/dist/esm/useLoader.mjs +69 -4
- package/dist/esm/useLoader.mjs.map +1 -1
- package/dist/esm/useLoader.native.js +90 -7
- package/dist/esm/useLoader.native.js.map +1 -1
- package/dist/esm/useScrollGroup.js +16 -0
- package/dist/esm/useScrollGroup.js.map +6 -0
- package/dist/esm/useScrollGroup.mjs +14 -0
- package/dist/esm/useScrollGroup.mjs.map +1 -0
- package/dist/esm/useScrollGroup.native.js +3 -0
- package/dist/esm/useScrollGroup.native.js.map +1 -0
- package/dist/esm/validateParams.js +68 -0
- package/dist/esm/validateParams.js.map +6 -0
- package/dist/esm/validateParams.mjs +54 -0
- package/dist/esm/validateParams.mjs.map +1 -0
- package/dist/esm/validateParams.native.js +151 -0
- package/dist/esm/validateParams.native.js.map +1 -0
- package/dist/esm/validateSearch.js +83 -0
- package/dist/esm/validateSearch.js.map +6 -0
- package/dist/esm/validateSearch.mjs +77 -0
- package/dist/esm/validateSearch.mjs.map +1 -0
- package/dist/esm/validateSearch.native.js +172 -0
- package/dist/esm/validateSearch.native.js.map +1 -0
- package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js +2 -2
- package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/esm/views/ErrorBoundary.js +325 -7
- package/dist/esm/views/ErrorBoundary.js.map +2 -2
- package/dist/esm/views/ErrorBoundary.mjs +289 -6
- package/dist/esm/views/ErrorBoundary.mjs.map +1 -1
- package/dist/esm/views/ErrorBoundary.native.js +159 -4
- package/dist/esm/views/ErrorBoundary.native.js.map +1 -1
- package/dist/esm/views/Navigator.js +11 -2
- package/dist/esm/views/Navigator.js.map +1 -1
- package/dist/esm/views/Navigator.mjs +10 -3
- package/dist/esm/views/Navigator.mjs.map +1 -1
- package/dist/esm/views/Navigator.native.js +15 -6
- package/dist/esm/views/Navigator.native.js.map +1 -1
- package/dist/esm/views/Protected.js +14 -0
- package/dist/esm/views/Protected.js.map +6 -0
- package/dist/esm/views/Protected.mjs +11 -0
- package/dist/esm/views/Protected.mjs.map +1 -0
- package/dist/esm/views/Protected.native.js +16 -0
- package/dist/esm/views/Protected.native.js.map +1 -0
- package/dist/esm/views/RootErrorBoundary.js +214 -7
- package/dist/esm/views/RootErrorBoundary.js.map +1 -1
- package/dist/esm/views/RootErrorBoundary.mjs +192 -7
- package/dist/esm/views/RootErrorBoundary.mjs.map +1 -1
- package/dist/esm/views/RootErrorBoundary.native.js +191 -7
- package/dist/esm/views/RootErrorBoundary.native.js.map +1 -1
- package/dist/esm/views/ScrollBehavior.js +47 -11
- package/dist/esm/views/ScrollBehavior.js.map +1 -1
- package/dist/esm/views/ScrollBehavior.mjs +48 -11
- package/dist/esm/views/ScrollBehavior.mjs.map +1 -1
- package/dist/esm/views/ScrollBehavior.native.js +67 -10
- package/dist/esm/views/ScrollBehavior.native.js.map +1 -1
- package/dist/esm/views/SourceInspector.js +7 -0
- package/dist/esm/views/SourceInspector.js.map +6 -0
- package/dist/esm/views/SourceInspector.mjs +5 -0
- package/dist/esm/views/SourceInspector.mjs.map +1 -0
- package/dist/esm/views/SourceInspector.native.js +6 -0
- package/dist/esm/views/SourceInspector.native.js.map +1 -0
- package/dist/esm/views/Try.js +38 -4
- package/dist/esm/views/Try.js.map +1 -1
- package/dist/esm/views/Try.mjs +40 -7
- package/dist/esm/views/Try.mjs.map +1 -1
- package/dist/esm/views/Try.native.js +42 -7
- package/dist/esm/views/Try.native.js.map +1 -1
- package/dist/esm/vite/DevHead.js +802 -51
- package/dist/esm/vite/DevHead.js.map +1 -1
- package/dist/esm/vite/DevHead.mjs +797 -43
- package/dist/esm/vite/DevHead.mjs.map +1 -1
- package/dist/esm/vite/DevHead.native.js +782 -0
- package/dist/esm/vite/DevHead.native.js.map +1 -1
- package/dist/esm/vite/one.js +7 -1
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +7 -1
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +17 -7
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.js +48 -4
- package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs +44 -4
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js +61 -4
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js +24 -3
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs +34 -15
- package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js +55 -19
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.js +130 -0
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.js.map +6 -0
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.mjs +130 -0
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.mjs.map +1 -0
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.native.js +138 -0
- package/dist/esm/vite/plugins/clientTreeShakePlugin.test.native.js.map +1 -0
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +6 -3
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +3 -3
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js +11 -6
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs +5 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +1 -0
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/sourceInspectorPlugin.js +126 -0
- package/dist/esm/vite/plugins/sourceInspectorPlugin.js.map +6 -0
- package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs +121 -0
- package/dist/esm/vite/plugins/sourceInspectorPlugin.mjs.map +1 -0
- package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js +194 -0
- package/dist/esm/vite/plugins/sourceInspectorPlugin.native.js.map +1 -0
- package/dist/esm/vite/plugins/virtualEntryPlugin.js +16 -6
- package/dist/esm/vite/plugins/virtualEntryPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs +25 -6
- package/dist/esm/vite/plugins/virtualEntryPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +26 -7
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -1
- package/package.json +16 -14
- package/src/cli/build.ts +1 -1
- package/src/cli/buildPage.ts +1 -1
- package/src/cli/dev.ts +4 -4
- package/src/cli/generateRoutes.ts +1 -1
- package/src/createApp.tsx +11 -1
- package/src/createHandleRequest.test.ts +3 -1
- package/src/devtools/registry.ts +21 -0
- package/src/fork/createMemoryHistory.tsx +43 -11
- package/src/fork/useLinking.ts +14 -4
- package/src/hooks.tsx +71 -21
- package/src/index.ts +34 -1
- package/src/interfaces/router.ts +48 -0
- package/src/layouts/withLayoutContext.tsx +48 -8
- package/src/link/Link.tsx +7 -2
- package/src/link/useLinkTo.tsx +7 -3
- package/src/router/Route.tsx +32 -3
- package/src/router/findRouteNode.ts +127 -0
- package/src/router/router.ts +291 -2
- package/src/router/useNavigation.ts +12 -3
- package/src/router/useScreens.tsx +9 -3
- package/src/useBlocker.native.ts +153 -0
- package/src/useBlocker.ts +340 -0
- package/src/useFocusEffect.ts +18 -5
- package/src/useLoader.ts +193 -2
- package/src/useScrollGroup.native.ts +7 -0
- package/src/useScrollGroup.ts +35 -0
- package/src/validateParams.ts +196 -0
- package/src/validateSearch.ts +241 -0
- package/src/views/ErrorBoundary.tsx +154 -156
- package/src/views/ErrorBoundary.web.tsx +321 -0
- package/src/views/Navigator.tsx +18 -2
- package/src/views/Protected.tsx +62 -0
- package/src/views/RootErrorBoundary.tsx +214 -17
- package/src/views/ScrollBehavior.tsx +82 -3
- package/src/views/SourceInspector.tsx +39 -0
- package/src/views/Try.tsx +81 -12
- package/src/vite/DevHead.tsx +819 -54
- package/src/vite/one.ts +13 -0
- package/src/vite/plugins/SSRCSSPlugin.ts +104 -0
- package/src/vite/plugins/clientTreeShakePlugin.test.ts +174 -0
- package/src/vite/plugins/clientTreeShakePlugin.ts +50 -4
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +11 -8
- package/src/vite/plugins/generateFileSystemRouteTypesPlugin.tsx +4 -0
- package/src/vite/plugins/sourceInspectorPlugin.ts +246 -0
- package/src/vite/plugins/virtualEntryPlugin.ts +36 -10
- package/src/vite/types.ts +28 -0
- package/types/createApp.d.ts +5 -0
- package/types/createApp.d.ts.map +1 -1
- package/types/devtools/registry.d.ts +15 -0
- package/types/devtools/registry.d.ts.map +1 -0
- package/types/fork/createMemoryHistory.d.ts +8 -3
- package/types/fork/createMemoryHistory.d.ts.map +1 -1
- package/types/fork/useLinking.d.ts.map +1 -1
- package/types/hooks.d.ts +71 -20
- package/types/hooks.d.ts.map +1 -1
- package/types/index.d.ts +8 -1
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/router.d.ts +47 -0
- package/types/interfaces/router.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +15 -11
- package/types/layouts/Drawer.d.ts.map +1 -1
- package/types/layouts/withLayoutContext.d.ts +2 -1
- package/types/layouts/withLayoutContext.d.ts.map +1 -1
- package/types/link/Link.d.ts.map +1 -1
- package/types/link/useLinkTo.d.ts +1 -0
- package/types/link/useLinkTo.d.ts.map +1 -1
- package/types/router/Route.d.ts +32 -3
- package/types/router/Route.d.ts.map +1 -1
- package/types/router/findRouteNode.d.ts +31 -0
- package/types/router/findRouteNode.d.ts.map +1 -0
- package/types/router/router.d.ts +35 -0
- package/types/router/router.d.ts.map +1 -1
- package/types/router/useNavigation.d.ts +12 -3
- package/types/router/useNavigation.d.ts.map +1 -1
- package/types/router/useScreens.d.ts +2 -0
- package/types/router/useScreens.d.ts.map +1 -1
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/ui/TabContext.d.ts +1 -1
- package/types/ui/TabContext.d.ts.map +1 -1
- package/types/ui/Tabs.d.ts +2 -2
- package/types/ui/Tabs.d.ts.map +1 -1
- package/types/useBlocker.d.ts +72 -0
- package/types/useBlocker.d.ts.map +1 -0
- package/types/useBlocker.native.d.ts +60 -0
- package/types/useBlocker.native.d.ts.map +1 -0
- package/types/useFocusEffect.d.ts +17 -4
- package/types/useFocusEffect.d.ts.map +1 -1
- package/types/useLoader.d.ts +63 -0
- package/types/useLoader.d.ts.map +1 -1
- package/types/useScrollGroup.d.ts +18 -0
- package/types/useScrollGroup.d.ts.map +1 -0
- package/types/useScrollGroup.native.d.ts +6 -0
- package/types/useScrollGroup.native.d.ts.map +1 -0
- package/types/validateParams.d.ts +85 -0
- package/types/validateParams.d.ts.map +1 -0
- package/types/validateSearch.d.ts +107 -0
- package/types/validateSearch.d.ts.map +1 -0
- package/types/views/ErrorBoundary.d.ts +11 -1
- package/types/views/ErrorBoundary.d.ts.map +1 -1
- package/types/views/ErrorBoundary.web.d.ts +13 -0
- package/types/views/ErrorBoundary.web.d.ts.map +1 -0
- package/types/views/Navigator.d.ts.map +1 -1
- package/types/views/Protected.d.ts +39 -0
- package/types/views/Protected.d.ts.map +1 -0
- package/types/views/RootErrorBoundary.d.ts +14 -8
- package/types/views/RootErrorBoundary.d.ts.map +1 -1
- package/types/views/ScrollBehavior.d.ts +8 -0
- package/types/views/ScrollBehavior.d.ts.map +1 -1
- package/types/views/SourceInspector.d.ts +35 -0
- package/types/views/SourceInspector.d.ts.map +1 -0
- package/types/views/Try.d.ts +29 -6
- package/types/views/Try.d.ts.map +1 -1
- package/types/vite/DevHead.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/SSRCSSPlugin.d.ts.map +1 -1
- package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
- package/types/vite/plugins/clientTreeShakePlugin.test.d.ts +2 -0
- package/types/vite/plugins/clientTreeShakePlugin.test.d.ts.map +1 -0
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/generateFileSystemRouteTypesPlugin.d.ts.map +1 -1
- package/types/vite/plugins/sourceInspectorPlugin.d.ts +3 -0
- package/types/vite/plugins/sourceInspectorPlugin.d.ts.map +1 -0
- package/types/vite/plugins/virtualEntryPlugin.d.ts.map +1 -1
- package/types/vite/types.d.ts +24 -0
- package/types/vite/types.d.ts.map +1 -1
- package/types/env.d.ts +0 -66
- /package/types/vercel/build/generate/{createSSRServerlessFunction.d.ts → createSsrServerlessFunction.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "one",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.59",
|
|
4
4
|
"license": "BSD-3-Clause",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"setup.mjs",
|
|
@@ -109,12 +109,12 @@
|
|
|
109
109
|
],
|
|
110
110
|
"scripts": {
|
|
111
111
|
"build": "tamagui-build",
|
|
112
|
-
"check": "
|
|
112
|
+
"check": "depcheck",
|
|
113
113
|
"clean": "tamagui-build clean",
|
|
114
114
|
"clean:build": "tamagui-build clean:build",
|
|
115
115
|
"lint": "../../node_modules/.bin/biome check src",
|
|
116
116
|
"lint:fix": "../../node_modules/.bin/biome check --write --unsafe src",
|
|
117
|
-
"test": "
|
|
117
|
+
"test": "bun run vitest --run",
|
|
118
118
|
"typecheck": "tsc --noEmit",
|
|
119
119
|
"watch": "tamagui-build --watch"
|
|
120
120
|
},
|
|
@@ -135,17 +135,17 @@
|
|
|
135
135
|
"@react-navigation/routers": "~7.5.1",
|
|
136
136
|
"@swc/core": "^1.14.0",
|
|
137
137
|
"@ungap/structured-clone": "^1.2.0",
|
|
138
|
-
"@vxrn/color-scheme": "
|
|
139
|
-
"@vxrn/compiler": "
|
|
140
|
-
"@vxrn/resolve": "
|
|
141
|
-
"@vxrn/tslib-lite": "
|
|
142
|
-
"@vxrn/use-isomorphic-layout-effect": "
|
|
143
|
-
"@vxrn/vite-plugin-metro": "
|
|
144
|
-
"babel-dead-code-elimination": "
|
|
138
|
+
"@vxrn/color-scheme": "workspace:*",
|
|
139
|
+
"@vxrn/compiler": "workspace:*",
|
|
140
|
+
"@vxrn/resolve": "workspace:*",
|
|
141
|
+
"@vxrn/tslib-lite": "workspace:*",
|
|
142
|
+
"@vxrn/use-isomorphic-layout-effect": "workspace:*",
|
|
143
|
+
"@vxrn/vite-plugin-metro": "workspace:*",
|
|
144
|
+
"babel-dead-code-elimination": "1.0.10",
|
|
145
145
|
"babel-plugin-module-resolver": "^5.0.2",
|
|
146
146
|
"citty": "^0.1.6",
|
|
147
147
|
"core-js": "^3.38.1",
|
|
148
|
-
"create-vxrn": "
|
|
148
|
+
"create-vxrn": "workspace:*",
|
|
149
149
|
"escape-string-regexp": "^5.0.0",
|
|
150
150
|
"expo-linking": "~8.0.8",
|
|
151
151
|
"expo-modules-core": "~3.0.24",
|
|
@@ -153,9 +153,11 @@
|
|
|
153
153
|
"fast-glob": "^3.3.3",
|
|
154
154
|
"fs-extra": "^11.2.0",
|
|
155
155
|
"hono": "^4.10.7",
|
|
156
|
+
"launch-editor": "^2.10.0",
|
|
156
157
|
"lightningcss": "^1.30.1",
|
|
157
158
|
"micromatch": "^4.0.7",
|
|
158
159
|
"nanoid": "^3.3.7",
|
|
160
|
+
"oxc-parser": "^0.107.0",
|
|
159
161
|
"perfect-debounce": "^1.0.0",
|
|
160
162
|
"picocolors": "^1.0.0",
|
|
161
163
|
"react": "19.1.0",
|
|
@@ -168,10 +170,10 @@
|
|
|
168
170
|
"ts-pattern": "^5.6.2",
|
|
169
171
|
"tsconfig-paths": "^4",
|
|
170
172
|
"use-latest-callback": "^0.2.3",
|
|
171
|
-
"vite": "
|
|
173
|
+
"vite": "7.1.12",
|
|
172
174
|
"vite-plugin-barrel": "^0.4.1",
|
|
173
175
|
"vite-tsconfig-paths": "^5.1.4",
|
|
174
|
-
"vxrn": "
|
|
176
|
+
"vxrn": "workspace:*",
|
|
175
177
|
"ws": "^8.18.0",
|
|
176
178
|
"xxhashjs": "^0.2.2"
|
|
177
179
|
},
|
|
@@ -208,4 +210,4 @@
|
|
|
208
210
|
"publishConfig": {
|
|
209
211
|
"access": "public"
|
|
210
212
|
}
|
|
211
|
-
}
|
|
213
|
+
}
|
package/src/cli/build.ts
CHANGED
package/src/cli/buildPage.ts
CHANGED
package/src/cli/dev.ts
CHANGED
|
@@ -39,17 +39,17 @@ export async function dev(args: {
|
|
|
39
39
|
stop()
|
|
40
40
|
})
|
|
41
41
|
|
|
42
|
-
process.on('SIGINT', () => {
|
|
42
|
+
process.on('SIGINT', async () => {
|
|
43
43
|
try {
|
|
44
|
-
stop()
|
|
44
|
+
await stop()
|
|
45
45
|
} finally {
|
|
46
46
|
process.exit(2)
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
|
|
50
|
-
process.on('SIGTERM', () => {
|
|
50
|
+
process.on('SIGTERM', async () => {
|
|
51
51
|
try {
|
|
52
|
-
stop()
|
|
52
|
+
await stop()
|
|
53
53
|
} finally {
|
|
54
54
|
process.exit(0)
|
|
55
55
|
}
|
|
@@ -39,7 +39,7 @@ export async function run(args: { appDir?: string; typed?: string } = {}) {
|
|
|
39
39
|
if (!existsSync(appDir)) {
|
|
40
40
|
console.error(`Error: App directory not found at ${appDir}`)
|
|
41
41
|
console.error(
|
|
42
|
-
'You can specify a custom directory with:
|
|
42
|
+
'You can specify a custom directory with: npx one generate-routes --appDir=<path>'
|
|
43
43
|
)
|
|
44
44
|
process.exit(1)
|
|
45
45
|
}
|
package/src/createApp.tsx
CHANGED
|
@@ -18,6 +18,11 @@ export type CreateAppProps = {
|
|
|
18
18
|
routes: Record<string, () => Promise<unknown>>
|
|
19
19
|
routerRoot: string
|
|
20
20
|
flags?: One.Flags
|
|
21
|
+
/**
|
|
22
|
+
* Promise that resolves when the setup file has finished loading.
|
|
23
|
+
* The app will wait for this before rendering to ensure setup code runs first.
|
|
24
|
+
*/
|
|
25
|
+
setupPromise?: Promise<unknown>
|
|
21
26
|
}
|
|
22
27
|
|
|
23
28
|
export function createApp(options: CreateAppProps) {
|
|
@@ -143,6 +148,10 @@ export function createApp(options: CreateAppProps) {
|
|
|
143
148
|
const serverContext = getServerContext() || {}
|
|
144
149
|
const routePreloads = serverContext.routePreloads
|
|
145
150
|
|
|
151
|
+
// Wait for setup file to complete first (if provided)
|
|
152
|
+
// This ensures setup code (error handlers, analytics, etc.) runs before the app
|
|
153
|
+
const setupComplete = options.setupPromise || Promise.resolve()
|
|
154
|
+
|
|
146
155
|
// preload routes using build-time mapping (production SSG)
|
|
147
156
|
// for SPA/dev mode, fall back to importing root layout directly
|
|
148
157
|
const preloadPromises = routePreloads
|
|
@@ -153,7 +162,8 @@ export function createApp(options: CreateAppProps) {
|
|
|
153
162
|
})
|
|
154
163
|
: [options.routes[`/${options.routerRoot}/_layout.tsx`]?.()]
|
|
155
164
|
|
|
156
|
-
return
|
|
165
|
+
return setupComplete
|
|
166
|
+
.then(() => Promise.all(preloadPromises))
|
|
157
167
|
.then(() => {
|
|
158
168
|
return resolveClientLoader(serverContext)
|
|
159
169
|
})
|
|
@@ -103,7 +103,9 @@ describe('createHandleRequest', () => {
|
|
|
103
103
|
handlePage: vi.fn().mockResolvedValue('<html></html>'),
|
|
104
104
|
handleLoader: vi.fn().mockResolvedValue('loader data'),
|
|
105
105
|
}
|
|
106
|
-
const { handler } = createHandleRequest(mockHandlersWithLoader, {
|
|
106
|
+
const { handler } = createHandleRequest(mockHandlersWithLoader, {
|
|
107
|
+
routerRoot: '/app',
|
|
108
|
+
})
|
|
107
109
|
// Loader paths are /assets/<path>_<nonce>_vxrn_loader.js - they should reach handleLoader
|
|
108
110
|
// for a matching route (the path /my-page matches the [slug] route)
|
|
109
111
|
await handler(createRequest('/assets/my-page_123_vxrn_loader.js'))
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
|
|
7
|
+
type DevtoolsRegistry = {
|
|
8
|
+
getLoaderTimingHistory?: () => any[]
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const devtoolsRegistry: DevtoolsRegistry = {}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Register a devtools function. Called by modules like useLoader.ts
|
|
15
|
+
*/
|
|
16
|
+
export function registerDevtoolsFunction<K extends keyof DevtoolsRegistry>(
|
|
17
|
+
key: K,
|
|
18
|
+
fn: DevtoolsRegistry[K]
|
|
19
|
+
) {
|
|
20
|
+
devtoolsRegistry[key] = fn
|
|
21
|
+
}
|
|
@@ -5,7 +5,9 @@
|
|
|
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
|
-
*
|
|
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
|
|
|
11
13
|
import type { NavigationState } from '@react-navigation/core'
|
|
@@ -16,8 +18,10 @@ type HistoryRecord = {
|
|
|
16
18
|
id: string
|
|
17
19
|
// Navigation state object for the history entry
|
|
18
20
|
state: NavigationState
|
|
19
|
-
// Path of the history entry
|
|
21
|
+
// Path of the history entry (actual navigation path)
|
|
20
22
|
path: string
|
|
23
|
+
// @modified - Display path for route masking (URL shown in browser)
|
|
24
|
+
displayPath?: string
|
|
21
25
|
}
|
|
22
26
|
|
|
23
27
|
export function createMemoryHistory() {
|
|
@@ -70,7 +74,16 @@ export function createMemoryHistory() {
|
|
|
70
74
|
return -1
|
|
71
75
|
},
|
|
72
76
|
|
|
73
|
-
|
|
77
|
+
// @modified - added displayPath parameter for route masking
|
|
78
|
+
push({
|
|
79
|
+
path,
|
|
80
|
+
state,
|
|
81
|
+
displayPath,
|
|
82
|
+
}: {
|
|
83
|
+
path: string
|
|
84
|
+
state: NavigationState
|
|
85
|
+
displayPath?: string
|
|
86
|
+
}) {
|
|
74
87
|
interrupt()
|
|
75
88
|
|
|
76
89
|
const id = nanoid()
|
|
@@ -79,21 +92,35 @@ export function createMemoryHistory() {
|
|
|
79
92
|
// So we remove any existing entries after the current index to clean them up
|
|
80
93
|
items = items.slice(0, index + 1)
|
|
81
94
|
|
|
82
|
-
items.push({ path, state, id })
|
|
95
|
+
items.push({ path, state, id, displayPath })
|
|
83
96
|
index = items.length - 1
|
|
84
97
|
|
|
98
|
+
// @modified - use displayPath for browser URL if provided (route masking)
|
|
99
|
+
const urlPath = displayPath ?? path
|
|
100
|
+
|
|
85
101
|
if (process.env.ONE_DEBUG_ROUTER) {
|
|
86
|
-
console.info(
|
|
102
|
+
console.info(
|
|
103
|
+
`[one] 📜 history.push path=${path}${displayPath ? ` displayPath=${displayPath}` : ''}`
|
|
104
|
+
)
|
|
87
105
|
}
|
|
88
106
|
|
|
89
107
|
// We pass empty string for title because it's ignored in all browsers except safari
|
|
90
108
|
// We don't store state object in history.state because:
|
|
91
109
|
// - browsers have limits on how big it can be, and we don't control the size
|
|
92
110
|
// - while not recommended, there could be non-serializable data in state
|
|
93
|
-
window.history.pushState({ id }, '',
|
|
111
|
+
window.history.pushState({ id }, '', urlPath)
|
|
94
112
|
},
|
|
95
113
|
|
|
96
|
-
|
|
114
|
+
// @modified - added displayPath parameter for route masking
|
|
115
|
+
replace({
|
|
116
|
+
path,
|
|
117
|
+
state,
|
|
118
|
+
displayPath,
|
|
119
|
+
}: {
|
|
120
|
+
path: string
|
|
121
|
+
state: NavigationState
|
|
122
|
+
displayPath?: string
|
|
123
|
+
}) {
|
|
97
124
|
interrupt()
|
|
98
125
|
|
|
99
126
|
const id = window.history.state?.id ?? nanoid()
|
|
@@ -112,20 +139,25 @@ export function createMemoryHistory() {
|
|
|
112
139
|
// So we need to push the entry as there's nothing to replace
|
|
113
140
|
|
|
114
141
|
pathWithHash = pathWithHash + hash
|
|
115
|
-
items = [{ path: pathWithHash, state, id }]
|
|
142
|
+
items = [{ path: pathWithHash, state, id, displayPath }]
|
|
116
143
|
index = 0
|
|
117
144
|
} else {
|
|
118
145
|
if (items[index].path === path) {
|
|
119
146
|
pathWithHash = pathWithHash + hash
|
|
120
147
|
}
|
|
121
|
-
items[index] = { path, state, id }
|
|
148
|
+
items[index] = { path, state, id, displayPath }
|
|
122
149
|
}
|
|
123
150
|
|
|
151
|
+
// @modified - use displayPath for browser URL if provided (route masking)
|
|
152
|
+
const urlPath = displayPath ? displayPath + hash : pathWithHash
|
|
153
|
+
|
|
124
154
|
if (process.env.ONE_DEBUG_ROUTER) {
|
|
125
|
-
console.info(
|
|
155
|
+
console.info(
|
|
156
|
+
`[one] 📜 history.replace path=${pathWithHash}${displayPath ? ` displayPath=${displayPath}` : ''}`
|
|
157
|
+
)
|
|
126
158
|
}
|
|
127
159
|
|
|
128
|
-
window.history.replaceState({ id }, '',
|
|
160
|
+
window.history.replaceState({ id }, '', urlPath)
|
|
129
161
|
},
|
|
130
162
|
|
|
131
163
|
// `history.go(n)` is asynchronous, there are couple of things to keep in mind:
|
package/src/fork/useLinking.ts
CHANGED
|
@@ -23,6 +23,7 @@ import * as React from 'react'
|
|
|
23
23
|
// @modified - start
|
|
24
24
|
// import { ServerContext } from '@react-navigation/web';
|
|
25
25
|
import { rootState as routerRootState } from '../router/router'
|
|
26
|
+
import { stripGroupSegmentsFromPath } from '../router/matchers'
|
|
26
27
|
import { ServerLocationContext } from '../router/serverLocationContext'
|
|
27
28
|
import { createMemoryHistory } from './createMemoryHistory'
|
|
28
29
|
import { appendBaseUrl } from './getPathFromState-mods'
|
|
@@ -254,7 +255,9 @@ export function useLinking(
|
|
|
254
255
|
// Otherwise, we'll handle it like a regular deep link
|
|
255
256
|
const record = history.get(index)
|
|
256
257
|
|
|
257
|
-
|
|
258
|
+
// @modified - check both actual path and display path for route masking support
|
|
259
|
+
const pathMatches = record?.path === path || record?.displayPath === path
|
|
260
|
+
if (pathMatches && record?.state) {
|
|
258
261
|
if (process.env.ONE_DEBUG_ROUTER) {
|
|
259
262
|
console.info(`[one] 📜 history record found, resetRoot to:`, record.state)
|
|
260
263
|
}
|
|
@@ -461,6 +464,12 @@ export function useLinking(
|
|
|
461
464
|
const route = findFocusedRoute(state)
|
|
462
465
|
const path = getPathForRoute(route, state)
|
|
463
466
|
|
|
467
|
+
// @modified - extract mask from linkOptions for route masking
|
|
468
|
+
const maskHref = (state as any).linkOptions?.mask?.href
|
|
469
|
+
const displayPath = maskHref
|
|
470
|
+
? appendBaseUrl(stripGroupSegmentsFromPath(maskHref) || '/')
|
|
471
|
+
: undefined
|
|
472
|
+
|
|
464
473
|
previousStateRef.current = refState
|
|
465
474
|
pendingPopStatePathRef.current = undefined
|
|
466
475
|
|
|
@@ -488,7 +497,7 @@ export function useLinking(
|
|
|
488
497
|
if (historyDelta > 0) {
|
|
489
498
|
// If history length is increased, we should pushState
|
|
490
499
|
// Note that path might not actually change here, for example, drawer open should pushState
|
|
491
|
-
history.push({ path, state })
|
|
500
|
+
history.push({ path, state, displayPath })
|
|
492
501
|
} else if (historyDelta < 0) {
|
|
493
502
|
// If history length is decreased, i.e. entries were removed, we want to go back
|
|
494
503
|
|
|
@@ -512,18 +521,19 @@ export function useLinking(
|
|
|
512
521
|
}
|
|
513
522
|
|
|
514
523
|
// Store the updated state as well as fix the path if incorrect
|
|
524
|
+
// Don't apply mask when going back - use the actual path
|
|
515
525
|
history.replace({ path, state })
|
|
516
526
|
} catch (e) {
|
|
517
527
|
// The navigation was interrupted
|
|
518
528
|
}
|
|
519
529
|
} else {
|
|
520
530
|
// If history length is unchanged, we want to replaceState
|
|
521
|
-
history.replace({ path, state })
|
|
531
|
+
history.replace({ path, state, displayPath })
|
|
522
532
|
}
|
|
523
533
|
} else {
|
|
524
534
|
// If no common navigation state was found, assume it's a replace
|
|
525
535
|
// This would happen if the user did a reset/conditionally changed navigators
|
|
526
|
-
history.replace({ path, state })
|
|
536
|
+
history.replace({ path, state, displayPath })
|
|
527
537
|
}
|
|
528
538
|
}
|
|
529
539
|
|
package/src/hooks.tsx
CHANGED
|
@@ -7,10 +7,23 @@ import { navigationRef, useStoreRootState, useStoreRouteInfo } from './router/ro
|
|
|
7
7
|
|
|
8
8
|
type SearchParams = OneRouter.SearchParams
|
|
9
9
|
|
|
10
|
+
/**
|
|
11
|
+
* Returns the root navigation state from the NavigationContainer.
|
|
12
|
+
*
|
|
13
|
+
* @returns The root navigation state object
|
|
14
|
+
* @link https://onestack.dev/docs/api/hooks/useRootNavigationState
|
|
15
|
+
*/
|
|
10
16
|
export function useRootNavigationState() {
|
|
11
17
|
return useStoreRootState()
|
|
12
18
|
}
|
|
13
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Returns the current route information including pathname, params, and segments.
|
|
22
|
+
* Automatically handles layout vs page context for accurate route info.
|
|
23
|
+
*
|
|
24
|
+
* @returns Route info object with pathname, params, segments, and more
|
|
25
|
+
* @link https://onestack.dev/docs/api/hooks/useRouteInfo
|
|
26
|
+
*/
|
|
14
27
|
export function useRouteInfo() {
|
|
15
28
|
// This uses the `useStateForPath` hook under the hood, which will be always correct
|
|
16
29
|
// when used in a page, but will not be correct when used in a layout.
|
|
@@ -63,6 +76,19 @@ export function Frozen({ on = false, children }: { on?: boolean; children: React
|
|
|
63
76
|
)
|
|
64
77
|
}
|
|
65
78
|
|
|
79
|
+
/**
|
|
80
|
+
* Returns the imperative router API for programmatic navigation.
|
|
81
|
+
*
|
|
82
|
+
* @returns Router object with navigate, push, replace, back, and more
|
|
83
|
+
* @link https://onestack.dev/docs/api/hooks/useRouter
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```tsx
|
|
87
|
+
* const router = useRouter()
|
|
88
|
+
* router.push('/settings')
|
|
89
|
+
* router.back()
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
66
92
|
export function useRouter(): OneRouter.Router {
|
|
67
93
|
return router
|
|
68
94
|
}
|
|
@@ -76,41 +102,56 @@ export function useUnstableGlobalHref(): string {
|
|
|
76
102
|
}
|
|
77
103
|
|
|
78
104
|
/**
|
|
79
|
-
*
|
|
105
|
+
* Returns route segments as an array matching the file path structure.
|
|
106
|
+
* Segments are not resolved, so dynamic segments appear as `[id]` not their values.
|
|
80
107
|
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
108
|
+
* @returns Array of path segments
|
|
109
|
+
* @link https://onestack.dev/docs/api/hooks/useSegments
|
|
83
110
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```tsx
|
|
113
|
+
* // File: app/users/[id]/settings.tsx
|
|
114
|
+
* // URL: /users/123/settings
|
|
115
|
+
* const segments = useSegments()
|
|
116
|
+
* // Returns: ['users', '[id]', 'settings']
|
|
90
117
|
* ```
|
|
91
|
-
* This can be strictly typed using the following abstract:
|
|
92
118
|
*
|
|
119
|
+
* @example Typed segments
|
|
93
120
|
* ```ts
|
|
94
|
-
*
|
|
121
|
+
* type AppSegments = ['settings'] | ['[user]'] | ['[user]', 'followers']
|
|
122
|
+
* const [first, second] = useSegments<AppSegments>()
|
|
95
123
|
* ```
|
|
96
124
|
*/
|
|
97
125
|
export function useSegments<TSegments extends string[] = string[]>(): TSegments {
|
|
98
126
|
return useRouteInfo().segments as TSegments
|
|
99
127
|
}
|
|
100
128
|
|
|
101
|
-
/**
|
|
129
|
+
/**
|
|
130
|
+
* Returns the current pathname without query parameters or hash.
|
|
131
|
+
*
|
|
132
|
+
* @returns The pathname string (e.g., '/users/123')
|
|
133
|
+
* @link https://onestack.dev/docs/api/hooks/usePathname
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```tsx
|
|
137
|
+
* // URL: /users/123?tab=settings#section
|
|
138
|
+
* const pathname = usePathname()
|
|
139
|
+
* // Returns: '/users/123'
|
|
140
|
+
* ```
|
|
141
|
+
*/
|
|
102
142
|
export function usePathname(): string {
|
|
103
143
|
return useRouteInfo().pathname
|
|
104
144
|
}
|
|
105
145
|
|
|
106
146
|
/**
|
|
107
|
-
*
|
|
108
|
-
* Useful for analytics
|
|
147
|
+
* Returns URL parameters globally, updating even when the route is not focused.
|
|
148
|
+
* Useful for analytics, background sync, or global UI like breadcrumbs.
|
|
109
149
|
*
|
|
110
|
-
*
|
|
111
|
-
* update when the route is focused.
|
|
150
|
+
* For most component use cases, prefer `useParams` which only updates when focused.
|
|
112
151
|
*
|
|
113
|
-
* @
|
|
152
|
+
* @returns Object containing URL parameters
|
|
153
|
+
* @link https://onestack.dev/docs/api/hooks/useActiveParams
|
|
154
|
+
* @see useParams for focus-aware params
|
|
114
155
|
*/
|
|
115
156
|
export function useActiveParams<
|
|
116
157
|
TParams extends object = SearchParams,
|
|
@@ -125,12 +166,21 @@ export const useLocalSearchParams = useParams
|
|
|
125
166
|
export const useGlobalSearchParams = useActiveParams
|
|
126
167
|
|
|
127
168
|
/**
|
|
128
|
-
* Returns
|
|
129
|
-
*
|
|
169
|
+
* Returns URL parameters for the focused route, including dynamic segments and query params.
|
|
170
|
+
* Only updates when this route is focused - ideal for stack navigators.
|
|
171
|
+
*
|
|
172
|
+
* @returns Object containing URL parameters (values are URL-decoded)
|
|
173
|
+
* @link https://onestack.dev/docs/api/hooks/useParams
|
|
174
|
+
* @see useActiveParams for global params that update even when unfocused
|
|
130
175
|
*
|
|
131
|
-
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```tsx
|
|
178
|
+
* // Route: /users/[id].tsx
|
|
179
|
+
* // URL: /users/123?tab=settings
|
|
180
|
+
* const { id, tab } = useParams<{ id: string; tab?: string }>()
|
|
181
|
+
* // id = '123', tab = 'settings'
|
|
182
|
+
* ```
|
|
132
183
|
*/
|
|
133
|
-
|
|
134
184
|
export function useParams<TParams extends object = SearchParams>(): Partial<TParams> {
|
|
135
185
|
const params = React.useContext(RouteParamsContext) ?? {}
|
|
136
186
|
|
package/src/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ export { href } from './href'
|
|
|
71
71
|
// components
|
|
72
72
|
export { Stack } from './layouts/Stack'
|
|
73
73
|
export { Tabs } from './layouts/Tabs'
|
|
74
|
+
export { Protected, type ProtectedProps } from './views/Protected'
|
|
74
75
|
// utilities
|
|
75
76
|
export { withLayoutContext } from './layouts/withLayoutContext'
|
|
76
77
|
export { Link } from './link/Link'
|
|
@@ -86,9 +87,37 @@ export * as routerStore from './router/router'
|
|
|
86
87
|
export { useNavigation } from './router/useNavigation'
|
|
87
88
|
export { registerPreloadedRoute } from './router/useViteRoutes'
|
|
88
89
|
export type { Endpoint, LoaderProps } from './types'
|
|
90
|
+
// navigation blocking
|
|
91
|
+
export {
|
|
92
|
+
useBlocker,
|
|
93
|
+
type Blocker,
|
|
94
|
+
type BlockerFunction,
|
|
95
|
+
type BlockerState,
|
|
96
|
+
} from './useBlocker'
|
|
97
|
+
// route param validation
|
|
98
|
+
export {
|
|
99
|
+
validateParams,
|
|
100
|
+
zodParamValidator,
|
|
101
|
+
ParamValidationError,
|
|
102
|
+
RouteValidationError,
|
|
103
|
+
type ParamValidator,
|
|
104
|
+
type InferParamInput,
|
|
105
|
+
type InferParamOutput,
|
|
106
|
+
type ValidateRouteProps,
|
|
107
|
+
type ValidationResult,
|
|
108
|
+
type RouteValidationFn,
|
|
109
|
+
} from './validateParams'
|
|
110
|
+
// validation state hook
|
|
111
|
+
export { useValidationState, type ValidationState } from './router/router'
|
|
89
112
|
// React Navigation
|
|
90
113
|
export { useFocusEffect } from './useFocusEffect'
|
|
91
|
-
export {
|
|
114
|
+
export {
|
|
115
|
+
getLoaderTimingHistory,
|
|
116
|
+
refetchLoader,
|
|
117
|
+
useLoader,
|
|
118
|
+
useLoaderState,
|
|
119
|
+
type LoaderTimingEntry,
|
|
120
|
+
} from './useLoader'
|
|
92
121
|
export {
|
|
93
122
|
type ServerHeadInsertionCallback,
|
|
94
123
|
useServerHeadInsertion,
|
|
@@ -97,8 +126,12 @@ export { isResponse } from './utils/isResponse'
|
|
|
97
126
|
export { redirect } from './utils/redirect'
|
|
98
127
|
export { watchFile } from './utils/watchFile'
|
|
99
128
|
export { ErrorBoundary } from './views/ErrorBoundary'
|
|
129
|
+
export type { ErrorBoundaryProps, ErrorRouteInfo } from './views/Try'
|
|
100
130
|
export { LoadProgressBar } from './views/LoadProgressBar'
|
|
101
131
|
export { Navigator, Slot } from './views/Navigator'
|
|
102
132
|
export { ScrollBehavior } from './views/ScrollBehavior'
|
|
133
|
+
export { SourceInspector, type SourceInspectorProps } from './views/SourceInspector'
|
|
134
|
+
// scroll position groups
|
|
135
|
+
export { useScrollGroup } from './useScrollGroup'
|
|
103
136
|
// server
|
|
104
137
|
export { getServerData, setResponseHeaders, setServerData } from './vite/one-server-only'
|
package/src/interfaces/router.ts
CHANGED
|
@@ -65,6 +65,41 @@ export namespace OneRouter {
|
|
|
65
65
|
|
|
66
66
|
export type LinkToOptions = {
|
|
67
67
|
scroll?: boolean
|
|
68
|
+
/**
|
|
69
|
+
* Display a different URL in the browser than the actual route.
|
|
70
|
+
* Useful for modals and overlays that should show a clean URL.
|
|
71
|
+
*
|
|
72
|
+
* @example
|
|
73
|
+
* ```tsx
|
|
74
|
+
* // Navigate to /photos/5/modal but show /photos/5 in browser
|
|
75
|
+
* router.navigate('/photos/5/modal', {
|
|
76
|
+
* mask: { href: '/photos/5' }
|
|
77
|
+
* })
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
mask?: {
|
|
81
|
+
/** The URL to display in the browser address bar */
|
|
82
|
+
href: Href
|
|
83
|
+
/**
|
|
84
|
+
* If true, unmask on page reload (show the masked URL in browser).
|
|
85
|
+
* If false (default), keep masking (navigate to actual route on reload).
|
|
86
|
+
*/
|
|
87
|
+
unmaskOnReload?: boolean
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Specify a scroll group for this navigation.
|
|
91
|
+
* Routes within the same scroll group will preserve scroll position
|
|
92
|
+
* when navigating between them.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```tsx
|
|
96
|
+
* // Use scroll group to preserve scroll when switching tabs
|
|
97
|
+
* router.navigate('/dashboard/settings', {
|
|
98
|
+
* scrollGroup: '/dashboard'
|
|
99
|
+
* })
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
scrollGroup?: string
|
|
68
103
|
}
|
|
69
104
|
|
|
70
105
|
type SearchOrHash = `?${string}` | `#${string}`
|
|
@@ -359,6 +394,19 @@ export namespace OneRouter {
|
|
|
359
394
|
/** On web, this sets the HTML `class` directly. On native, this can be used with CSS interop tools like Nativewind. */
|
|
360
395
|
className?: string
|
|
361
396
|
|
|
397
|
+
/**
|
|
398
|
+
* Display a different URL in the browser than the actual route.
|
|
399
|
+
* Useful for modals and overlays that should show a clean URL.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```tsx
|
|
403
|
+
* <Link href="/photos/5/modal" mask="/photos/5">
|
|
404
|
+
* View Photo
|
|
405
|
+
* </Link>
|
|
406
|
+
* ```
|
|
407
|
+
*/
|
|
408
|
+
mask?: Href<T>
|
|
409
|
+
|
|
362
410
|
onPress?: (
|
|
363
411
|
e: React.MouseEvent<HTMLAnchorElement, MouseEvent> | GestureResponderEvent
|
|
364
412
|
) => void
|