one 1.1.309 → 1.1.310
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/Root.cjs +212 -0
- package/dist/cjs/{Route.js → Route.cjs} +34 -19
- package/dist/cjs/{cleanUrl.js → cleanUrl.cjs} +27 -18
- package/dist/cjs/cli/label-process.cjs +31 -0
- package/dist/cjs/cli/{main.js → main.cjs} +28 -16
- package/dist/cjs/cli/{prebuild.js → prebuild.cjs} +25 -15
- package/dist/cjs/cli/run.cjs +70 -0
- package/dist/cjs/cli/{runAndroid.js → runAndroid.cjs} +25 -15
- package/dist/cjs/cli/{runIos.js → runIos.cjs} +25 -15
- package/dist/cjs/cli.cjs +258 -0
- package/dist/cjs/clientLoaderResolver.cjs +35 -0
- package/dist/cjs/config.cjs +32 -0
- package/dist/cjs/constants.cjs +30 -0
- package/dist/cjs/{createApp.js → createApp.cjs} +33 -17
- package/dist/cjs/createApp.native.cjs +38 -0
- package/dist/cjs/createApp.native.cjs.map +6 -0
- package/dist/cjs/{createHandleRequest.js → createHandleRequest.cjs} +60 -49
- package/dist/cjs/createRoute.cjs +42 -0
- package/dist/cjs/fallbackViews/{Sitemap.js → Sitemap.cjs} +35 -16
- package/dist/cjs/fallbackViews/{Unmatched.js → Unmatched.cjs} +32 -17
- package/dist/cjs/fork/NavigationContainer.cjs +105 -0
- package/dist/cjs/fork/NavigationContainer.native.cjs +103 -0
- package/dist/cjs/fork/NavigationContainer.native.cjs.map +6 -0
- package/dist/cjs/fork/createMemoryHistory.cjs +136 -0
- package/dist/cjs/fork/{extractPathFromURL.js → extractPathFromURL.cjs} +30 -21
- package/dist/cjs/fork/findFocusedRoute.cjs +30 -0
- package/dist/cjs/fork/{getPathFromState.js → getPathFromState.cjs} +120 -113
- package/dist/cjs/fork/getStateFromPath.cjs +366 -0
- package/dist/cjs/fork/useLinking.cjs +215 -0
- package/dist/cjs/fork/useLinking.native.cjs +126 -0
- package/dist/cjs/fork/useLinking.native.cjs.map +6 -0
- package/dist/cjs/fork/validatePathConfig.cjs +44 -0
- package/dist/cjs/{getLinkingConfig.js → getLinkingConfig.cjs} +21 -15
- package/dist/cjs/{getReactNavigationConfig.js → getReactNavigationConfig.cjs} +33 -32
- package/dist/cjs/getRoutes.cjs +276 -0
- package/dist/cjs/{getURL.js → getURL.cjs} +16 -11
- package/dist/cjs/getURL.native.cjs +48 -0
- package/dist/cjs/getURL.native.cjs.map +6 -0
- package/dist/cjs/head/Head.android.cjs +28 -0
- package/dist/cjs/head/Head.android.cjs.map +6 -0
- package/dist/cjs/head/Head.cjs +30 -0
- package/dist/cjs/head/Head.ios.cjs +210 -0
- package/dist/cjs/head/Head.ios.cjs.map +6 -0
- package/dist/cjs/head/HeadModule.cjs +27 -0
- package/dist/cjs/head/index.cjs +18 -0
- package/dist/cjs/head/types.cjs +16 -0
- package/dist/cjs/head/url.cjs +50 -0
- package/dist/cjs/{hooks.js → hooks.cjs} +52 -40
- package/dist/cjs/{imperative-api.js → imperative-api.cjs} +26 -19
- package/dist/cjs/import-mode/index.android.cjs +26 -0
- package/dist/cjs/import-mode/index.android.cjs.map +6 -0
- package/dist/cjs/import-mode/index.cjs +26 -0
- package/dist/cjs/import-mode/index.ios.cjs +26 -0
- package/dist/cjs/import-mode/index.ios.cjs.map +6 -0
- package/dist/cjs/import-mode/index.native.cjs +26 -0
- package/dist/cjs/import-mode/index.native.cjs.map +6 -0
- package/dist/cjs/import-mode/index.web.cjs +26 -0
- package/dist/cjs/{index.js → index.cjs} +50 -14
- package/dist/cjs/interfaces/router.cjs +27 -0
- package/dist/cjs/layouts/Drawer.cjs +31 -0
- package/dist/cjs/layouts/Stack.cjs +31 -0
- package/dist/cjs/layouts/Tabs.cjs +64 -0
- package/dist/cjs/layouts/withLayoutContext.cjs +91 -0
- package/dist/cjs/link/Link.cjs +120 -0
- package/dist/cjs/link/Redirect.cjs +39 -0
- package/dist/cjs/link/href.cjs +58 -0
- package/dist/cjs/link/linking.cjs +89 -0
- package/dist/cjs/link/path.cjs +69 -0
- package/dist/cjs/link/useLinkTo.cjs +54 -0
- package/dist/cjs/link/useLoadedNavigation.cjs +60 -0
- package/dist/cjs/{matchers.js → matchers.cjs} +16 -11
- package/dist/cjs/platform.cjs +26 -0
- package/dist/cjs/polyfills-mobile.cjs +33 -0
- package/dist/cjs/polyfills-server.cjs +25 -0
- package/dist/cjs/render.cjs +47 -0
- package/dist/cjs/render.native.cjs +28 -0
- package/dist/cjs/render.native.cjs.map +6 -0
- package/dist/cjs/router/RouterStore.cjs +16 -0
- package/dist/cjs/router/constants.cjs +26 -0
- package/dist/cjs/router/{getNormalizedStatePath.js → getNormalizedStatePath.cjs} +25 -23
- package/dist/cjs/router/lastAction.cjs +31 -0
- package/dist/cjs/router/{router.js → router.cjs} +104 -78
- package/dist/cjs/router/serverLocationContext.cjs +27 -0
- package/dist/cjs/router/{useInitializeOneRouter.js → useInitializeOneRouter.cjs} +26 -16
- package/dist/cjs/serve.cjs +185 -0
- package/dist/cjs/server/{createRoutesManifest.js → createRoutesManifest.cjs} +22 -16
- package/dist/cjs/server/{getServerManifest.js → getServerManifest.cjs} +58 -31
- package/dist/cjs/{server-render.js → server-render.cjs} +28 -17
- package/dist/cjs/sortRoutes.cjs +62 -0
- package/dist/cjs/typed-routes/generateRouteTypes.cjs +48 -0
- package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.js → getTypedRoutesDeclarationFile.cjs} +37 -40
- package/dist/cjs/types.cjs +16 -0
- package/dist/cjs/{useFocusEffect.js → useFocusEffect.cjs} +33 -24
- package/dist/cjs/useLoader.cjs +114 -0
- package/dist/cjs/useNavigation.cjs +68 -0
- package/dist/cjs/useScreens.cjs +233 -0
- package/dist/cjs/{useViteRoutes.js → useViteRoutes.cjs} +36 -24
- package/dist/cjs/utils/assertIsReady.cjs +28 -0
- package/dist/cjs/utils/dynamicImport.cjs +27 -0
- package/dist/cjs/utils/existsAsync.cjs +33 -0
- package/dist/cjs/utils/getPageExport.cjs +32 -0
- package/dist/cjs/utils/{globDir.js → globDir.cjs} +23 -15
- package/dist/cjs/utils/{hashString.js → hashString.cjs} +22 -14
- package/dist/cjs/utils/isResponse.cjs +28 -0
- package/dist/cjs/utils/isStatus.cjs +28 -0
- package/dist/cjs/utils/promiseWithResolvers.cjs +37 -0
- package/dist/cjs/utils/rand.cjs +26 -0
- package/dist/cjs/utils/redirect.cjs +34 -0
- package/dist/cjs/utils/removeSearch.cjs +28 -0
- package/dist/cjs/utils/removeUndefined.cjs +30 -0
- package/dist/cjs/utils/{url.js → url.cjs} +16 -11
- package/dist/cjs/utils/weakKey.cjs +30 -0
- package/dist/cjs/utils/weakMemo.cjs +34 -0
- package/dist/cjs/views/EmptyRoute.cjs +30 -0
- package/dist/cjs/views/{ErrorBoundary.js → ErrorBoundary.cjs} +30 -16
- package/dist/cjs/views/LoadProgressBar.cjs +90 -0
- package/dist/cjs/views/Navigator.cjs +149 -0
- package/dist/cjs/views/{PreloadLinks.js → PreloadLinks.cjs} +20 -13
- package/dist/cjs/views/PreloadLinks.native.cjs +28 -0
- package/dist/cjs/views/PreloadLinks.native.cjs.map +6 -0
- package/dist/cjs/views/{RootErrorBoundary.js → RootErrorBoundary.cjs} +28 -16
- package/dist/cjs/views/Screen.cjs +39 -0
- package/dist/cjs/views/ScrollRestoration.cjs +74 -0
- package/dist/cjs/views/Try.cjs +68 -0
- package/dist/cjs/vite/build.cjs +425 -0
- package/dist/cjs/vite/{clientTreeShakePlugin.js → clientTreeShakePlugin.cjs} +53 -35
- package/dist/cjs/vite/constants.cjs +28 -0
- package/dist/cjs/vite/{createFileSystemRouter.js → createFileSystemRouter.cjs} +117 -84
- package/dist/cjs/vite/{customNodeExternals.js → customNodeExternals.cjs} +32 -20
- package/dist/cjs/vite/ensureTsConfig.cjs +68 -0
- package/dist/cjs/vite/findDepsToOptimize.cjs +74 -0
- package/dist/cjs/vite/{fixDependenciesPlugin.js → fixDependenciesPlugin.cjs} +17 -12
- package/dist/cjs/vite/generateTypesForRoutes.cjs +45 -0
- package/dist/cjs/vite/{getManifest.js → getManifest.cjs} +18 -12
- package/dist/cjs/vite/{headers.js → headers.cjs} +19 -14
- package/dist/cjs/vite/headers.native.cjs +32 -0
- package/dist/cjs/vite/headers.native.cjs.map +6 -0
- package/dist/cjs/vite/{loadEnv.js → loadEnv.cjs} +27 -16
- package/dist/cjs/vite/makePluginWebOnly.cjs +31 -0
- package/dist/cjs/vite/one.cjs +256 -0
- package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.js → removeReactNativeWebAnimatedPlugin.cjs} +32 -25
- package/dist/cjs/vite/replaceLoader.cjs +37 -0
- package/dist/cjs/vite/resolveAPIRequest.cjs +90 -0
- package/dist/cjs/vite/server.cjs +13 -0
- package/dist/cjs/vite/types.cjs +16 -0
- package/dist/cjs/vite/{virtualEntryPlugin.js → virtualEntryPlugin.cjs} +28 -20
- package/dist/cjs/vite/{vitePluginSsrCss.js → vitePluginSsrCss.cjs} +56 -50
- package/dist/cjs/vite.cjs +40 -0
- package/dist/cjs/zero/getQueryKey.cjs +29 -0
- package/dist/cjs/zero/isZeroQuery.cjs +28 -0
- package/dist/cjs/zero/resolveQuery.cjs +41 -0
- package/dist/cjs/zero/{subscribeToQuery.js → subscribeToQuery.cjs} +16 -11
- package/dist/cjs/zero/types.cjs +16 -0
- package/dist/cjs/zero/useQuery.cjs +58 -0
- package/dist/cjs/zero/{useQueryZero.js → useQueryZero.cjs} +21 -15
- package/dist/cjs/zero.cjs +30 -0
- package/package.json +10 -10
- package/dist/cjs/Root.js +0 -182
- package/dist/cjs/cli/label-process.js +0 -25
- package/dist/cjs/cli/run.js +0 -52
- package/dist/cjs/cli.js +0 -209
- package/dist/cjs/clientLoaderResolver.js +0 -32
- package/dist/cjs/config.js +0 -27
- package/dist/cjs/constants.js +0 -23
- package/dist/cjs/createRoute.js +0 -37
- package/dist/cjs/fork/NavigationContainer.js +0 -85
- package/dist/cjs/fork/createMemoryHistory.js +0 -100
- package/dist/cjs/fork/findFocusedRoute.js +0 -26
- package/dist/cjs/fork/getStateFromPath.js +0 -381
- package/dist/cjs/fork/useLinking.js +0 -182
- package/dist/cjs/fork/validatePathConfig.js +0 -46
- package/dist/cjs/getRoutes.js +0 -294
- package/dist/cjs/head/Head.js +0 -23
- package/dist/cjs/head/HeadModule.js +0 -22
- package/dist/cjs/head/index.js +0 -15
- package/dist/cjs/head/types.js +0 -14
- package/dist/cjs/head/url.js +0 -52
- package/dist/cjs/import-mode/index.js +0 -21
- package/dist/cjs/import-mode/index.web.js +0 -21
- package/dist/cjs/interfaces/router.js +0 -23
- package/dist/cjs/layouts/Drawer.js +0 -24
- package/dist/cjs/layouts/Stack.js +0 -24
- package/dist/cjs/layouts/Tabs.js +0 -52
- package/dist/cjs/layouts/withLayoutContext.js +0 -77
- package/dist/cjs/link/Link.js +0 -98
- package/dist/cjs/link/Redirect.js +0 -31
- package/dist/cjs/link/href.js +0 -50
- package/dist/cjs/link/linking.js +0 -82
- package/dist/cjs/link/path.js +0 -65
- package/dist/cjs/link/useLinkTo.js +0 -42
- package/dist/cjs/link/useLoadedNavigation.js +0 -50
- package/dist/cjs/platform.js +0 -21
- package/dist/cjs/polyfills-mobile.js +0 -26
- package/dist/cjs/polyfills-server.js +0 -23
- package/dist/cjs/render.js +0 -44
- package/dist/cjs/router/RouterStore.js +0 -14
- package/dist/cjs/router/constants.js +0 -21
- package/dist/cjs/router/lastAction.js +0 -25
- package/dist/cjs/router/serverLocationContext.js +0 -22
- package/dist/cjs/serve.js +0 -175
- package/dist/cjs/sortRoutes.js +0 -64
- package/dist/cjs/typed-routes/generateRouteTypes.js +0 -33
- package/dist/cjs/types.js +0 -14
- package/dist/cjs/useLoader.js +0 -97
- package/dist/cjs/useNavigation.js +0 -60
- package/dist/cjs/useScreens.js +0 -176
- package/dist/cjs/utils/assertIsReady.js +0 -26
- package/dist/cjs/utils/dynamicImport.js +0 -24
- package/dist/cjs/utils/existsAsync.js +0 -28
- package/dist/cjs/utils/getPageExport.js +0 -27
- package/dist/cjs/utils/isResponse.js +0 -23
- package/dist/cjs/utils/isStatus.js +0 -23
- package/dist/cjs/utils/promiseWithResolvers.js +0 -26
- package/dist/cjs/utils/rand.js +0 -21
- package/dist/cjs/utils/redirect.js +0 -28
- package/dist/cjs/utils/removeSearch.js +0 -23
- package/dist/cjs/utils/removeUndefined.js +0 -26
- package/dist/cjs/utils/weakKey.js +0 -24
- package/dist/cjs/utils/weakMemo.js +0 -30
- package/dist/cjs/views/EmptyRoute.js +0 -25
- package/dist/cjs/views/LoadProgressBar.js +0 -83
- package/dist/cjs/views/Navigator.js +0 -101
- package/dist/cjs/views/Screen.js +0 -29
- package/dist/cjs/views/ScrollRestoration.js +0 -70
- package/dist/cjs/views/Try.js +0 -44
- package/dist/cjs/vite/build.js +0 -376
- package/dist/cjs/vite/constants.js +0 -22
- package/dist/cjs/vite/ensureTsConfig.js +0 -66
- package/dist/cjs/vite/findDepsToOptimize.js +0 -66
- package/dist/cjs/vite/generateTypesForRoutes.js +0 -36
- package/dist/cjs/vite/makePluginWebOnly.js +0 -27
- package/dist/cjs/vite/one.js +0 -255
- package/dist/cjs/vite/replaceLoader.js +0 -34
- package/dist/cjs/vite/resolveAPIRequest.js +0 -71
- package/dist/cjs/vite/server.js +0 -16
- package/dist/cjs/vite/types.js +0 -14
- package/dist/cjs/vite.js +0 -28
- package/dist/cjs/zero/getQueryKey.js +0 -24
- package/dist/cjs/zero/isZeroQuery.js +0 -23
- package/dist/cjs/zero/resolveQuery.js +0 -38
- package/dist/cjs/zero/types.js +0 -14
- package/dist/cjs/zero/useQuery.js +0 -47
- package/dist/cjs/zero.js +0 -23
- /package/dist/cjs/{Root.js.map → Root.cjs.map} +0 -0
- /package/dist/cjs/{Route.js.map → Route.cjs.map} +0 -0
- /package/dist/cjs/{cleanUrl.js.map → cleanUrl.cjs.map} +0 -0
- /package/dist/cjs/cli/{label-process.js.map → label-process.cjs.map} +0 -0
- /package/dist/cjs/cli/{main.js.map → main.cjs.map} +0 -0
- /package/dist/cjs/cli/{prebuild.js.map → prebuild.cjs.map} +0 -0
- /package/dist/cjs/cli/{run.js.map → run.cjs.map} +0 -0
- /package/dist/cjs/cli/{runAndroid.js.map → runAndroid.cjs.map} +0 -0
- /package/dist/cjs/cli/{runIos.js.map → runIos.cjs.map} +0 -0
- /package/dist/cjs/{cli.js.map → cli.cjs.map} +0 -0
- /package/dist/cjs/{clientLoaderResolver.js.map → clientLoaderResolver.cjs.map} +0 -0
- /package/dist/cjs/{config.js.map → config.cjs.map} +0 -0
- /package/dist/cjs/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/{createApp.js.map → createApp.cjs.map} +0 -0
- /package/dist/cjs/{createHandleRequest.js.map → createHandleRequest.cjs.map} +0 -0
- /package/dist/cjs/{createRoute.js.map → createRoute.cjs.map} +0 -0
- /package/dist/cjs/fallbackViews/{Sitemap.js.map → Sitemap.cjs.map} +0 -0
- /package/dist/cjs/fallbackViews/{Unmatched.js.map → Unmatched.cjs.map} +0 -0
- /package/dist/cjs/fork/{NavigationContainer.js.map → NavigationContainer.cjs.map} +0 -0
- /package/dist/cjs/fork/{createMemoryHistory.js.map → createMemoryHistory.cjs.map} +0 -0
- /package/dist/cjs/fork/{extractPathFromURL.js.map → extractPathFromURL.cjs.map} +0 -0
- /package/dist/cjs/fork/{findFocusedRoute.js.map → findFocusedRoute.cjs.map} +0 -0
- /package/dist/cjs/fork/{getPathFromState.js.map → getPathFromState.cjs.map} +0 -0
- /package/dist/cjs/fork/{getStateFromPath.js.map → getStateFromPath.cjs.map} +0 -0
- /package/dist/cjs/fork/{useLinking.js.map → useLinking.cjs.map} +0 -0
- /package/dist/cjs/fork/{validatePathConfig.js.map → validatePathConfig.cjs.map} +0 -0
- /package/dist/cjs/{getLinkingConfig.js.map → getLinkingConfig.cjs.map} +0 -0
- /package/dist/cjs/{getReactNavigationConfig.js.map → getReactNavigationConfig.cjs.map} +0 -0
- /package/dist/cjs/{getRoutes.js.map → getRoutes.cjs.map} +0 -0
- /package/dist/cjs/{getURL.js.map → getURL.cjs.map} +0 -0
- /package/dist/cjs/head/{Head.js.map → Head.cjs.map} +0 -0
- /package/dist/cjs/head/{HeadModule.js.map → HeadModule.cjs.map} +0 -0
- /package/dist/cjs/head/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/head/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/head/{url.js.map → url.cjs.map} +0 -0
- /package/dist/cjs/{hooks.js.map → hooks.cjs.map} +0 -0
- /package/dist/cjs/{imperative-api.js.map → imperative-api.cjs.map} +0 -0
- /package/dist/cjs/import-mode/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/import-mode/{index.web.js.map → index.web.cjs.map} +0 -0
- /package/dist/cjs/{index.js.map → index.cjs.map} +0 -0
- /package/dist/cjs/interfaces/{router.js.map → router.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Drawer.js.map → Drawer.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Stack.js.map → Stack.cjs.map} +0 -0
- /package/dist/cjs/layouts/{Tabs.js.map → Tabs.cjs.map} +0 -0
- /package/dist/cjs/layouts/{withLayoutContext.js.map → withLayoutContext.cjs.map} +0 -0
- /package/dist/cjs/link/{Link.js.map → Link.cjs.map} +0 -0
- /package/dist/cjs/link/{Redirect.js.map → Redirect.cjs.map} +0 -0
- /package/dist/cjs/link/{href.js.map → href.cjs.map} +0 -0
- /package/dist/cjs/link/{linking.js.map → linking.cjs.map} +0 -0
- /package/dist/cjs/link/{path.js.map → path.cjs.map} +0 -0
- /package/dist/cjs/link/{useLinkTo.js.map → useLinkTo.cjs.map} +0 -0
- /package/dist/cjs/link/{useLoadedNavigation.js.map → useLoadedNavigation.cjs.map} +0 -0
- /package/dist/cjs/{matchers.js.map → matchers.cjs.map} +0 -0
- /package/dist/cjs/{platform.js.map → platform.cjs.map} +0 -0
- /package/dist/cjs/{polyfills-mobile.js.map → polyfills-mobile.cjs.map} +0 -0
- /package/dist/cjs/{polyfills-server.js.map → polyfills-server.cjs.map} +0 -0
- /package/dist/cjs/{render.js.map → render.cjs.map} +0 -0
- /package/dist/cjs/router/{RouterStore.js.map → RouterStore.cjs.map} +0 -0
- /package/dist/cjs/router/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/router/{getNormalizedStatePath.js.map → getNormalizedStatePath.cjs.map} +0 -0
- /package/dist/cjs/router/{lastAction.js.map → lastAction.cjs.map} +0 -0
- /package/dist/cjs/router/{router.js.map → router.cjs.map} +0 -0
- /package/dist/cjs/router/{serverLocationContext.js.map → serverLocationContext.cjs.map} +0 -0
- /package/dist/cjs/router/{useInitializeOneRouter.js.map → useInitializeOneRouter.cjs.map} +0 -0
- /package/dist/cjs/{serve.js.map → serve.cjs.map} +0 -0
- /package/dist/cjs/server/{createRoutesManifest.js.map → createRoutesManifest.cjs.map} +0 -0
- /package/dist/cjs/server/{getServerManifest.js.map → getServerManifest.cjs.map} +0 -0
- /package/dist/cjs/{server-render.js.map → server-render.cjs.map} +0 -0
- /package/dist/cjs/{sortRoutes.js.map → sortRoutes.cjs.map} +0 -0
- /package/dist/cjs/typed-routes/{generateRouteTypes.js.map → generateRouteTypes.cjs.map} +0 -0
- /package/dist/cjs/typed-routes/{getTypedRoutesDeclarationFile.js.map → getTypedRoutesDeclarationFile.cjs.map} +0 -0
- /package/dist/cjs/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/{useFocusEffect.js.map → useFocusEffect.cjs.map} +0 -0
- /package/dist/cjs/{useLoader.js.map → useLoader.cjs.map} +0 -0
- /package/dist/cjs/{useNavigation.js.map → useNavigation.cjs.map} +0 -0
- /package/dist/cjs/{useScreens.js.map → useScreens.cjs.map} +0 -0
- /package/dist/cjs/{useViteRoutes.js.map → useViteRoutes.cjs.map} +0 -0
- /package/dist/cjs/utils/{assertIsReady.js.map → assertIsReady.cjs.map} +0 -0
- /package/dist/cjs/utils/{dynamicImport.js.map → dynamicImport.cjs.map} +0 -0
- /package/dist/cjs/utils/{existsAsync.js.map → existsAsync.cjs.map} +0 -0
- /package/dist/cjs/utils/{getPageExport.js.map → getPageExport.cjs.map} +0 -0
- /package/dist/cjs/utils/{globDir.js.map → globDir.cjs.map} +0 -0
- /package/dist/cjs/utils/{hashString.js.map → hashString.cjs.map} +0 -0
- /package/dist/cjs/utils/{isResponse.js.map → isResponse.cjs.map} +0 -0
- /package/dist/cjs/utils/{isStatus.js.map → isStatus.cjs.map} +0 -0
- /package/dist/cjs/utils/{promiseWithResolvers.js.map → promiseWithResolvers.cjs.map} +0 -0
- /package/dist/cjs/utils/{rand.js.map → rand.cjs.map} +0 -0
- /package/dist/cjs/utils/{redirect.js.map → redirect.cjs.map} +0 -0
- /package/dist/cjs/utils/{removeSearch.js.map → removeSearch.cjs.map} +0 -0
- /package/dist/cjs/utils/{removeUndefined.js.map → removeUndefined.cjs.map} +0 -0
- /package/dist/cjs/utils/{url.js.map → url.cjs.map} +0 -0
- /package/dist/cjs/utils/{weakKey.js.map → weakKey.cjs.map} +0 -0
- /package/dist/cjs/utils/{weakMemo.js.map → weakMemo.cjs.map} +0 -0
- /package/dist/cjs/views/{EmptyRoute.js.map → EmptyRoute.cjs.map} +0 -0
- /package/dist/cjs/views/{ErrorBoundary.js.map → ErrorBoundary.cjs.map} +0 -0
- /package/dist/cjs/views/{LoadProgressBar.js.map → LoadProgressBar.cjs.map} +0 -0
- /package/dist/cjs/views/{Navigator.js.map → Navigator.cjs.map} +0 -0
- /package/dist/cjs/views/{PreloadLinks.js.map → PreloadLinks.cjs.map} +0 -0
- /package/dist/cjs/views/{RootErrorBoundary.js.map → RootErrorBoundary.cjs.map} +0 -0
- /package/dist/cjs/views/{Screen.js.map → Screen.cjs.map} +0 -0
- /package/dist/cjs/views/{ScrollRestoration.js.map → ScrollRestoration.cjs.map} +0 -0
- /package/dist/cjs/views/{Try.js.map → Try.cjs.map} +0 -0
- /package/dist/cjs/vite/{build.js.map → build.cjs.map} +0 -0
- /package/dist/cjs/vite/{clientTreeShakePlugin.js.map → clientTreeShakePlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{constants.js.map → constants.cjs.map} +0 -0
- /package/dist/cjs/vite/{createFileSystemRouter.js.map → createFileSystemRouter.cjs.map} +0 -0
- /package/dist/cjs/vite/{customNodeExternals.js.map → customNodeExternals.cjs.map} +0 -0
- /package/dist/cjs/vite/{ensureTsConfig.js.map → ensureTsConfig.cjs.map} +0 -0
- /package/dist/cjs/vite/{findDepsToOptimize.js.map → findDepsToOptimize.cjs.map} +0 -0
- /package/dist/cjs/vite/{fixDependenciesPlugin.js.map → fixDependenciesPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{generateTypesForRoutes.js.map → generateTypesForRoutes.cjs.map} +0 -0
- /package/dist/cjs/vite/{getManifest.js.map → getManifest.cjs.map} +0 -0
- /package/dist/cjs/vite/{headers.js.map → headers.cjs.map} +0 -0
- /package/dist/cjs/vite/{loadEnv.js.map → loadEnv.cjs.map} +0 -0
- /package/dist/cjs/vite/{makePluginWebOnly.js.map → makePluginWebOnly.cjs.map} +0 -0
- /package/dist/cjs/vite/{one.js.map → one.cjs.map} +0 -0
- /package/dist/cjs/vite/{removeReactNativeWebAnimatedPlugin.js.map → removeReactNativeWebAnimatedPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{replaceLoader.js.map → replaceLoader.cjs.map} +0 -0
- /package/dist/cjs/vite/{resolveAPIRequest.js.map → resolveAPIRequest.cjs.map} +0 -0
- /package/dist/cjs/vite/{server.js.map → server.cjs.map} +0 -0
- /package/dist/cjs/vite/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/vite/{virtualEntryPlugin.js.map → virtualEntryPlugin.cjs.map} +0 -0
- /package/dist/cjs/vite/{vitePluginSsrCss.js.map → vitePluginSsrCss.cjs.map} +0 -0
- /package/dist/cjs/{vite.js.map → vite.cjs.map} +0 -0
- /package/dist/cjs/zero/{getQueryKey.js.map → getQueryKey.cjs.map} +0 -0
- /package/dist/cjs/zero/{isZeroQuery.js.map → isZeroQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{resolveQuery.js.map → resolveQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{subscribeToQuery.js.map → subscribeToQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{types.js.map → types.cjs.map} +0 -0
- /package/dist/cjs/zero/{useQuery.js.map → useQuery.cjs.map} +0 -0
- /package/dist/cjs/zero/{useQueryZero.js.map → useQueryZero.cjs.map} +0 -0
- /package/dist/cjs/{zero.js.map → zero.cjs.map} +0 -0
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var getStateFromPath_exports = {};
|
|
33
|
+
__export(getStateFromPath_exports, {
|
|
34
|
+
default: () => getStateFromPath,
|
|
35
|
+
getMatchableRouteConfigs: () => getMatchableRouteConfigs,
|
|
36
|
+
getUrlWithReactNavigationConcessions: () => getUrlWithReactNavigationConcessions,
|
|
37
|
+
stripBaseUrl: () => stripBaseUrl
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(getStateFromPath_exports);
|
|
40
|
+
var import_escape_string_regexp = __toESM(require("escape-string-regexp"), 1),
|
|
41
|
+
import_matchers = require("../matchers.cjs"),
|
|
42
|
+
import_findFocusedRoute = require("./findFocusedRoute.cjs"),
|
|
43
|
+
import_validatePathConfig = __toESM(require("./validatePathConfig.cjs"), 1);
|
|
44
|
+
function getUrlWithReactNavigationConcessions(path, baseUrl = process.env.EXPO_BASE_URL) {
|
|
45
|
+
let parsed;
|
|
46
|
+
try {
|
|
47
|
+
parsed = new URL(path, baseUrl || "http://phony.example");
|
|
48
|
+
} catch (err) {
|
|
49
|
+
return console.warn(`Error parsing url ${path}: ${err?.message}`), {
|
|
50
|
+
nonstandardPathname: path,
|
|
51
|
+
inputPathnameWithoutHash: path.replace(/#.*$/g, ""),
|
|
52
|
+
url: null
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const pathname = parsed.pathname;
|
|
56
|
+
return {
|
|
57
|
+
// The slashes are at the end, not the beginning
|
|
58
|
+
nonstandardPathname: stripBaseUrl(pathname, baseUrl).replace(/^\/+/g, "").replace(/\/+$/g, "") + "/",
|
|
59
|
+
url: parsed
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
function getStateFromPath(path, options) {
|
|
63
|
+
const {
|
|
64
|
+
initialRoutes,
|
|
65
|
+
configs
|
|
66
|
+
} = getMatchableRouteConfigs(options);
|
|
67
|
+
return getStateFromPathWithConfigs(path, configs, initialRoutes);
|
|
68
|
+
}
|
|
69
|
+
function getMatchableRouteConfigs(options) {
|
|
70
|
+
options && (0, import_validatePathConfig.default)(options);
|
|
71
|
+
const screens = options?.screens;
|
|
72
|
+
if (!screens) throw Error("You must pass a 'screens' object to 'getStateFromPath' to generate a path.");
|
|
73
|
+
const initialRoutes = [];
|
|
74
|
+
options?.initialRouteName && initialRoutes.push({
|
|
75
|
+
initialRouteName: options.initialRouteName,
|
|
76
|
+
parentScreens: []
|
|
77
|
+
});
|
|
78
|
+
const converted = Object.keys(screens).flatMap(key => createNormalizedConfigs(key, screens, [], initialRoutes)).flat(),
|
|
79
|
+
resolvedInitialPatterns = initialRoutes.map(route => joinPaths(...route.parentScreens, route.initialRouteName)),
|
|
80
|
+
configs = converted.map(config => ({
|
|
81
|
+
...config,
|
|
82
|
+
// TODO: Probably a safer way to do this
|
|
83
|
+
// Mark initial routes to give them potential priority over other routes that match.
|
|
84
|
+
isInitial: resolvedInitialPatterns.includes(config.routeNames.join("/"))
|
|
85
|
+
})).sort(sortConfigs);
|
|
86
|
+
return assertConfigDuplicates(configs), {
|
|
87
|
+
configs,
|
|
88
|
+
initialRoutes
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function assertConfigDuplicates(configs) {
|
|
92
|
+
configs.reduce((acc, config) => {
|
|
93
|
+
const indexedKey = config.regex?.toString() ?? config.pattern,
|
|
94
|
+
alpha = acc[indexedKey];
|
|
95
|
+
if (alpha && !alpha.hasChildren && !config.hasChildren) {
|
|
96
|
+
const a = alpha.routeNames,
|
|
97
|
+
b = config.routeNames;
|
|
98
|
+
if (!(a.length > b.length ? b.every((it, i) => a[i] === it) : a.every((it, i) => b[i] === it))) {
|
|
99
|
+
const last = config.pattern.split("/").pop();
|
|
100
|
+
if (!last?.match(/^\*not-found$/)) {
|
|
101
|
+
const routeType = last?.startsWith(":") ? "dynamic route" : last?.startsWith("*") ? "dynamic-rest route" : "route";
|
|
102
|
+
throw new Error(`The ${routeType} pattern '${config.pattern || "/"}' resolves to both '${alpha.userReadableName}' and '${config.userReadableName}'. Patterns must be unique and cannot resolve to more than one route.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return Object.assign(acc, {
|
|
107
|
+
[indexedKey]: config
|
|
108
|
+
});
|
|
109
|
+
}, {});
|
|
110
|
+
}
|
|
111
|
+
function sortConfigs(a, b) {
|
|
112
|
+
if (a.pattern === b.pattern) return b.routeNames.join(">").localeCompare(a.routeNames.join(">"));
|
|
113
|
+
if (a.pattern.startsWith(b.pattern) &&
|
|
114
|
+
// NOTE: This is a hack to make sure that `*` is always at the end
|
|
115
|
+
b.screen !== "index") return -1;
|
|
116
|
+
if (b.pattern.startsWith(a.pattern) && a.screen !== "index") return 1;
|
|
117
|
+
const aParts = a.pattern.split("/").filter(part => (0, import_matchers.matchGroupName)(part) == null);
|
|
118
|
+
(a.screen === "index" || a.screen.match(/\/index$/)) && aParts.push("index");
|
|
119
|
+
const bParts = b.pattern.split("/").filter(part => (0, import_matchers.matchGroupName)(part) == null);
|
|
120
|
+
(b.screen === "index" || b.screen.match(/\/index$/)) && bParts.push("index");
|
|
121
|
+
for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
|
|
122
|
+
if (aParts[i] == null) return 1;
|
|
123
|
+
if (bParts[i] == null) return -1;
|
|
124
|
+
const aWildCard = aParts[i].startsWith("*"),
|
|
125
|
+
bWildCard = bParts[i].startsWith("*");
|
|
126
|
+
if (aWildCard && bWildCard) {
|
|
127
|
+
const aNotFound = aParts[i].match(/^[*]not-found$/),
|
|
128
|
+
bNotFound = bParts[i].match(/^[*]not-found$/);
|
|
129
|
+
if (aNotFound && bNotFound) continue;
|
|
130
|
+
if (aNotFound) return 1;
|
|
131
|
+
if (bNotFound) return -1;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (aWildCard) return 1;
|
|
135
|
+
if (bWildCard) return -1;
|
|
136
|
+
const aSlug = aParts[i].startsWith(":"),
|
|
137
|
+
bSlug = bParts[i].startsWith(":");
|
|
138
|
+
if (aSlug && bSlug) {
|
|
139
|
+
const aNotFound = aParts[i].match(/^[*]not-found$/),
|
|
140
|
+
bNotFound = bParts[i].match(/^[*]not-found$/);
|
|
141
|
+
if (aNotFound && bNotFound) continue;
|
|
142
|
+
if (aNotFound) return 1;
|
|
143
|
+
if (bNotFound) return -1;
|
|
144
|
+
continue;
|
|
145
|
+
}
|
|
146
|
+
if (aSlug) return 1;
|
|
147
|
+
if (bSlug) return -1;
|
|
148
|
+
}
|
|
149
|
+
return a.isInitial && !b.isInitial ? -1 : !a.isInitial && b.isInitial ? 1 : bParts.length - aParts.length;
|
|
150
|
+
}
|
|
151
|
+
function getStateFromEmptyPathWithConfigs(path, hash, configs, initialRoutes) {
|
|
152
|
+
const leafNodes = configs.filter(config => !config.hasChildren).map(value => ({
|
|
153
|
+
...value,
|
|
154
|
+
// Collapse all levels of group segments before testing.
|
|
155
|
+
// This enables `app/(one)/(two)/index.js` to be matched.
|
|
156
|
+
path: (0, import_matchers.stripGroupSegmentsFromPath)(value.path)
|
|
157
|
+
})),
|
|
158
|
+
match = leafNodes.find(config =>
|
|
159
|
+
// NOTE: Test leaf node index routes that either don't have a regex or match an empty string.
|
|
160
|
+
config.path === "" && (!config.regex || config.regex.test(""))) ?? leafNodes.find(config =>
|
|
161
|
+
// NOTE: Test leaf node dynamic routes that match an empty string.
|
|
162
|
+
config.path.startsWith(":") && config.regex.test("")) ??
|
|
163
|
+
// NOTE: Test leaf node deep dynamic routes that match a slash.
|
|
164
|
+
// This should be done last to enable dynamic routes having a higher priority.
|
|
165
|
+
leafNodes.find(config => config.path.startsWith("*") && config.regex.test("/"));
|
|
166
|
+
if (!match) return;
|
|
167
|
+
const routes = match.routeNames.map(name => match._route ? {
|
|
168
|
+
name,
|
|
169
|
+
_route: match._route
|
|
170
|
+
} : {
|
|
171
|
+
name
|
|
172
|
+
});
|
|
173
|
+
return createNestedStateObject(path, hash, routes, configs, initialRoutes);
|
|
174
|
+
}
|
|
175
|
+
function getStateFromPathWithConfigs(path, configs, initialRoutes, baseUrl = process.env.EXPO_BASE_URL) {
|
|
176
|
+
const formattedPaths = getUrlWithReactNavigationConcessions(path);
|
|
177
|
+
if (!formattedPaths.url) {
|
|
178
|
+
console.warn(`No url found for ${path}`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
let cleanPath = stripBaseUrl((0, import_matchers.stripGroupSegmentsFromPath)(formattedPaths.url.pathname), baseUrl) + formattedPaths.url.search;
|
|
182
|
+
if (path.startsWith("/") || (cleanPath = cleanPath.slice(1)), formattedPaths.nonstandardPathname === "/") return getStateFromEmptyPathWithConfigs(cleanPath, formattedPaths.url.hash.slice(1), configs, initialRoutes);
|
|
183
|
+
const routes = matchAgainstConfigs(formattedPaths.nonstandardPathname, configs);
|
|
184
|
+
if (routes != null) return createNestedStateObject(cleanPath, formattedPaths.url.hash.slice(1), routes, configs, initialRoutes);
|
|
185
|
+
}
|
|
186
|
+
const joinPaths = (...paths) => [].concat(...paths.map(p => p.split("/"))).filter(Boolean).join("/");
|
|
187
|
+
function matchAgainstConfigs(remaining, configs) {
|
|
188
|
+
let routes,
|
|
189
|
+
remainingPath = remaining;
|
|
190
|
+
for (const config of configs) {
|
|
191
|
+
if (!config.regex) continue;
|
|
192
|
+
const match = remainingPath.match(config.regex);
|
|
193
|
+
if (!match) continue;
|
|
194
|
+
const matchedParams = config.pattern?.split("/").filter(p => p.match(/^[:*]/)).reduce((acc, p, i) => p.match(/^\*/) ? {
|
|
195
|
+
...acc,
|
|
196
|
+
[p]: match[(i + 1) * 2]
|
|
197
|
+
//?.replace(/\//, ""),
|
|
198
|
+
} : Object.assign(acc, {
|
|
199
|
+
// The param segments appear every second item starting from 2 in the regex match result.
|
|
200
|
+
// This will only work if we ensure groups aren't included in the match.
|
|
201
|
+
[p]: match[(i + 1) * 2]?.replace(/\//, "")
|
|
202
|
+
}), {}),
|
|
203
|
+
routeFromName = name => {
|
|
204
|
+
const config2 = configs.find(c => c.screen === name);
|
|
205
|
+
if (!config2?.path) return {
|
|
206
|
+
name
|
|
207
|
+
};
|
|
208
|
+
const segments = config2.path.split("/"),
|
|
209
|
+
params = {};
|
|
210
|
+
return segments.filter(p => p.match(/^[:*]/)).forEach(p => {
|
|
211
|
+
let value = matchedParams[p];
|
|
212
|
+
if (value) {
|
|
213
|
+
p.match(/^\*/) && (value = value?.split("/").filter(Boolean));
|
|
214
|
+
const key = p.replace(/^[:*]/, "").replace(/\?$/, "");
|
|
215
|
+
params[key] = config2.parse?.[key] ? config2.parse[key](value) : value;
|
|
216
|
+
}
|
|
217
|
+
}), params && Object.keys(params).length ? {
|
|
218
|
+
name,
|
|
219
|
+
params
|
|
220
|
+
} : {
|
|
221
|
+
name
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
routes = config.routeNames.map(name => config._route ? {
|
|
225
|
+
...routeFromName(name),
|
|
226
|
+
_route: config._route
|
|
227
|
+
} : {
|
|
228
|
+
...routeFromName(name)
|
|
229
|
+
});
|
|
230
|
+
const combinedParams = routes.reduce((acc, r) => Object.assign(acc, r.params), {}),
|
|
231
|
+
hasCombinedParams = Object.keys(combinedParams).length > 0;
|
|
232
|
+
routes = routes.map(r => (hasCombinedParams && (r.params = combinedParams), r)), remainingPath = remainingPath.replace(match[1], "");
|
|
233
|
+
break;
|
|
234
|
+
}
|
|
235
|
+
return routes;
|
|
236
|
+
}
|
|
237
|
+
function equalHeritage(a, b) {
|
|
238
|
+
if (a.length !== b.length) return !1;
|
|
239
|
+
for (let i = 0; i < a.length; i++) if (a[i].localeCompare(b[i]) !== 0) return !1;
|
|
240
|
+
return !0;
|
|
241
|
+
}
|
|
242
|
+
const createNormalizedConfigs = (screen, routeConfig, routeNames = [], initials = [], parentScreens = [], parentPattern) => {
|
|
243
|
+
const configs = [];
|
|
244
|
+
routeNames.push(screen), parentScreens.push(screen);
|
|
245
|
+
const config = routeConfig[screen];
|
|
246
|
+
if (typeof config == "string") {
|
|
247
|
+
const pattern = parentPattern ? joinPaths(parentPattern, config) : config;
|
|
248
|
+
configs.push(createConfigItem(screen, routeNames, pattern, config, !1));
|
|
249
|
+
} else if (typeof config == "object") {
|
|
250
|
+
let pattern;
|
|
251
|
+
const {
|
|
252
|
+
_route
|
|
253
|
+
} = config;
|
|
254
|
+
if (typeof config.path == "string") {
|
|
255
|
+
if (config.exact && config.path === void 0) throw new Error("A 'path' needs to be specified when specifying 'exact: true'. If you don't want this screen in the URL, specify it as empty string, e.g. `path: ''`.");
|
|
256
|
+
pattern = config.exact !== !0 ? joinPaths(parentPattern || "", config.path || "") : config.path || "", configs.push(createConfigItem(screen, routeNames, pattern, config.path, config.screens ? !!Object.keys(config.screens)?.length : !1, config.parse, _route));
|
|
257
|
+
}
|
|
258
|
+
config.screens && (config.initialRouteName && initials.push({
|
|
259
|
+
initialRouteName: config.initialRouteName,
|
|
260
|
+
parentScreens
|
|
261
|
+
}), Object.keys(config.screens).forEach(nestedConfig => {
|
|
262
|
+
const result = createNormalizedConfigs(nestedConfig, config.screens, routeNames, initials, [...parentScreens], pattern ?? parentPattern);
|
|
263
|
+
configs.push(...result);
|
|
264
|
+
}));
|
|
265
|
+
}
|
|
266
|
+
return routeNames.pop(), configs;
|
|
267
|
+
};
|
|
268
|
+
function formatRegexPattern(it) {
|
|
269
|
+
return it = it.replace(" ", "%20"), it.startsWith(":") ? `(([^/]+\\/)${it.endsWith("?") ? "?" : ""})` : it.startsWith("*") ? `((.*\\/)${it.endsWith("?") ? "?" : ""})` : (0, import_matchers.matchGroupName)(it) != null ? `(?:${(0, import_escape_string_regexp.default)(it)}\\/)?` : (0, import_escape_string_regexp.default)(it) + "\\/";
|
|
270
|
+
}
|
|
271
|
+
const createConfigItem = (screen, routeNames, pattern, path, hasChildren, parse, _route) => {
|
|
272
|
+
pattern = pattern.split("/").filter(Boolean).join("/");
|
|
273
|
+
const regex = pattern ? new RegExp(`^(${pattern.split("/").map(formatRegexPattern).join("")})$`) : void 0;
|
|
274
|
+
return {
|
|
275
|
+
screen,
|
|
276
|
+
regex,
|
|
277
|
+
pattern,
|
|
278
|
+
path,
|
|
279
|
+
// The routeNames array is mutated, so copy it to keep the current state
|
|
280
|
+
routeNames: [...routeNames],
|
|
281
|
+
parse,
|
|
282
|
+
userReadableName: [...routeNames.slice(0, -1), path || screen].join("/"),
|
|
283
|
+
hasChildren: !!hasChildren,
|
|
284
|
+
_route
|
|
285
|
+
};
|
|
286
|
+
},
|
|
287
|
+
findParseConfigForRoute = (routeName, routeConfigs) => {
|
|
288
|
+
for (const config of routeConfigs) if (routeName === config.routeNames[config.routeNames.length - 1]) return config.parse;
|
|
289
|
+
},
|
|
290
|
+
findInitialRoute = (routeName, parentScreens, initialRoutes) => {
|
|
291
|
+
for (const config of initialRoutes) if (equalHeritage(parentScreens, config.parentScreens)) return routeName !== config.initialRouteName ? config.initialRouteName : void 0;
|
|
292
|
+
},
|
|
293
|
+
createStateObject = (route, isEmpty, initialRoute) => isEmpty ? initialRoute ? {
|
|
294
|
+
index: 1,
|
|
295
|
+
routes: [{
|
|
296
|
+
name: initialRoute
|
|
297
|
+
}, route]
|
|
298
|
+
} : {
|
|
299
|
+
routes: [route]
|
|
300
|
+
} : initialRoute ? {
|
|
301
|
+
index: 1,
|
|
302
|
+
routes: [{
|
|
303
|
+
name: initialRoute
|
|
304
|
+
}, {
|
|
305
|
+
...route,
|
|
306
|
+
state: {
|
|
307
|
+
routes: []
|
|
308
|
+
}
|
|
309
|
+
}]
|
|
310
|
+
} : {
|
|
311
|
+
routes: [{
|
|
312
|
+
...route,
|
|
313
|
+
state: {
|
|
314
|
+
routes: []
|
|
315
|
+
}
|
|
316
|
+
}]
|
|
317
|
+
},
|
|
318
|
+
createNestedStateObject = (path, hash, routes, routeConfigs, initialRoutes) => {
|
|
319
|
+
let route = routes.shift();
|
|
320
|
+
const parentScreens = [];
|
|
321
|
+
let initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
|
322
|
+
parentScreens.push(route.name);
|
|
323
|
+
const state = createStateObject(route, routes.length === 0, initialRoute);
|
|
324
|
+
if (routes.length > 0) {
|
|
325
|
+
let nestedState = state;
|
|
326
|
+
for (; route = routes.shift();) {
|
|
327
|
+
initialRoute = findInitialRoute(route.name, parentScreens, initialRoutes);
|
|
328
|
+
const nestedStateIndex = nestedState.index || nestedState.routes.length - 1;
|
|
329
|
+
nestedState.routes[nestedStateIndex].state = createStateObject(route, routes.length === 0, initialRoute), routes.length > 0 && (nestedState = nestedState.routes[nestedStateIndex].state), parentScreens.push(route.name);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
route = (0, import_findFocusedRoute.findFocusedRoute)(state), route.path = path;
|
|
333
|
+
const params = parseQueryParams(route.path, findParseConfigForRoute(route.name, routeConfigs));
|
|
334
|
+
if (params) {
|
|
335
|
+
route.params = Object.assign(/* @__PURE__ */Object.create(null), route.params);
|
|
336
|
+
for (const [name, value] of Object.entries(params)) if (route.params?.[name] && process.env.NODE_ENV !== "production" && console.warn(`Route '/${route.name}' with param '${name}' was specified both in the path and as a param, removing from path`), !route.params?.[name]) {
|
|
337
|
+
route.params[name] = value;
|
|
338
|
+
continue;
|
|
339
|
+
}
|
|
340
|
+
Object.keys(route.params).length === 0 && delete route.params;
|
|
341
|
+
}
|
|
342
|
+
return hash && (route.params = Object.assign(/* @__PURE__ */Object.create(null), route.params), route.params["#"] = hash), state;
|
|
343
|
+
},
|
|
344
|
+
parseQueryParams = (path, parseConfig) => {
|
|
345
|
+
const query = path.split("?")[1],
|
|
346
|
+
searchParams = new URLSearchParams(query),
|
|
347
|
+
params = Object.fromEntries(
|
|
348
|
+
// @ts-ignore: [Symbol.iterator] is indeed, available on every platform.
|
|
349
|
+
searchParams);
|
|
350
|
+
return parseConfig && Object.keys(params).forEach(name => {
|
|
351
|
+
Object.hasOwnProperty.call(parseConfig, name) && typeof params[name] == "string" && (params[name] = parseConfig[name](params[name]));
|
|
352
|
+
}), Object.keys(params).length ? params : void 0;
|
|
353
|
+
},
|
|
354
|
+
baseUrlCache = /* @__PURE__ */new Map();
|
|
355
|
+
function getBaseUrlRegex(baseUrl) {
|
|
356
|
+
if (baseUrlCache.has(baseUrl)) return baseUrlCache.get(baseUrl);
|
|
357
|
+
const regex = new RegExp(`^\\/?${(0, import_escape_string_regexp.default)(baseUrl)}`, "g");
|
|
358
|
+
return baseUrlCache.set(baseUrl, regex), regex;
|
|
359
|
+
}
|
|
360
|
+
function stripBaseUrl(path, baseUrl = process.env.EXPO_BASE_URL) {
|
|
361
|
+
if (process.env.NODE_ENV !== "development" && baseUrl) {
|
|
362
|
+
const reg = getBaseUrlRegex(baseUrl);
|
|
363
|
+
return path.replace(/^\/+/g, "/").replace(reg, "");
|
|
364
|
+
}
|
|
365
|
+
return path;
|
|
366
|
+
}
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf,
|
|
6
|
+
__hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: !0
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
__copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from == "object" || typeof from == "function") for (let key of __getOwnPropNames(from)) !__hasOwnProp.call(to, key) && key !== except && __defProp(to, key, {
|
|
15
|
+
get: () => from[key],
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
26
|
+
value: mod,
|
|
27
|
+
enumerable: !0
|
|
28
|
+
}) : target, mod)),
|
|
29
|
+
__toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
30
|
+
value: !0
|
|
31
|
+
}), mod);
|
|
32
|
+
var useLinking_exports = {};
|
|
33
|
+
__export(useLinking_exports, {
|
|
34
|
+
default: () => useLinking,
|
|
35
|
+
series: () => series
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(useLinking_exports);
|
|
38
|
+
var import_core = require("@react-navigation/core"),
|
|
39
|
+
import_fast_deep_equal = __toESM(require("fast-deep-equal"), 1),
|
|
40
|
+
React = __toESM(require("react"), 1),
|
|
41
|
+
import_createMemoryHistory = __toESM(require("./createMemoryHistory.cjs"), 1),
|
|
42
|
+
import_serverLocationContext = require("../router/serverLocationContext.cjs"),
|
|
43
|
+
import_getPathFromState = require("./getPathFromState.cjs");
|
|
44
|
+
const historyGlobal = (0, import_createMemoryHistory.default)();
|
|
45
|
+
typeof window < "u" && historyGlobal.listen(() => {
|
|
46
|
+
globalThis.__vxrntodopath = window.location.pathname;
|
|
47
|
+
});
|
|
48
|
+
const findMatchingState = (a, b) => {
|
|
49
|
+
if (a === void 0 || b === void 0 || a.key !== b.key) return [void 0, void 0];
|
|
50
|
+
const aHistoryLength = a.history ? a.history.length : a.routes.length,
|
|
51
|
+
bHistoryLength = b.history ? b.history.length : b.routes.length,
|
|
52
|
+
aRoute = a.routes[a.index],
|
|
53
|
+
bRoute = b.routes[b.index],
|
|
54
|
+
aChildState = aRoute.state,
|
|
55
|
+
bChildState = bRoute.state;
|
|
56
|
+
return aHistoryLength !== bHistoryLength || aRoute.key !== bRoute.key || aChildState === void 0 || bChildState === void 0 || aChildState.key !== bChildState.key ? [a, b] : findMatchingState(aChildState, bChildState);
|
|
57
|
+
},
|
|
58
|
+
series = cb => {
|
|
59
|
+
let queue = Promise.resolve();
|
|
60
|
+
return () => {
|
|
61
|
+
queue = queue.then(cb);
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
let linkingHandlers = [];
|
|
65
|
+
function useLinking(ref, {
|
|
66
|
+
independent,
|
|
67
|
+
enabled = !0,
|
|
68
|
+
config,
|
|
69
|
+
getStateFromPath = import_core.getStateFromPath,
|
|
70
|
+
getPathFromState = import_core.getPathFromState,
|
|
71
|
+
getActionFromState = import_core.getActionFromState
|
|
72
|
+
}) {
|
|
73
|
+
React.useEffect(() => {
|
|
74
|
+
if (process.env.NODE_ENV === "production" || independent) return;
|
|
75
|
+
enabled !== !1 && linkingHandlers.length && console.error(["Looks like you have configured linking in multiple places. This is likely an error since deep links should only be handled in one place to avoid conflicts. Make sure that:", "- You don't have multiple NavigationContainers in the app each with 'linking' enabled", "- Only a single instance of the root component is rendered"].join(`
|
|
76
|
+
`).trim());
|
|
77
|
+
const handler = Symbol();
|
|
78
|
+
return enabled !== !1 && linkingHandlers.push(handler), () => {
|
|
79
|
+
const index = linkingHandlers.indexOf(handler);
|
|
80
|
+
index > -1 && linkingHandlers.splice(index, 1);
|
|
81
|
+
};
|
|
82
|
+
}, [enabled, independent]);
|
|
83
|
+
const [history] = React.useState(historyGlobal),
|
|
84
|
+
enabledRef = React.useRef(enabled),
|
|
85
|
+
configRef = React.useRef(config),
|
|
86
|
+
getStateFromPathRef = React.useRef(getStateFromPath),
|
|
87
|
+
getPathFromStateRef = React.useRef(getPathFromState),
|
|
88
|
+
getActionFromStateRef = React.useRef(getActionFromState);
|
|
89
|
+
React.useEffect(() => {
|
|
90
|
+
enabledRef.current = enabled, configRef.current = config, getStateFromPathRef.current = getStateFromPath, getPathFromStateRef.current = getPathFromState, getActionFromStateRef.current = getActionFromState;
|
|
91
|
+
});
|
|
92
|
+
const server = {
|
|
93
|
+
location: React.useContext(import_serverLocationContext.ServerLocationContext)
|
|
94
|
+
},
|
|
95
|
+
getInitialState = React.useCallback(() => {
|
|
96
|
+
let value;
|
|
97
|
+
if (enabledRef.current) {
|
|
98
|
+
const location2 = server?.location ?? (typeof window < "u" ? window.location : void 0),
|
|
99
|
+
path = location2 ? location2.pathname + location2.search : void 0;
|
|
100
|
+
path && (value = getStateFromPathRef.current(path, configRef.current));
|
|
101
|
+
}
|
|
102
|
+
const thenable = {
|
|
103
|
+
// biome-ignore lint/suspicious/noThenProperty: <explanation>
|
|
104
|
+
then(onfulfilled) {
|
|
105
|
+
return Promise.resolve(onfulfilled ? onfulfilled(value) : value);
|
|
106
|
+
},
|
|
107
|
+
catch() {
|
|
108
|
+
return thenable;
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
return thenable;
|
|
112
|
+
}, []),
|
|
113
|
+
previousIndexRef = React.useRef(void 0),
|
|
114
|
+
previousStateRef = React.useRef(void 0),
|
|
115
|
+
pendingPopStatePathRef = React.useRef(void 0);
|
|
116
|
+
return React.useEffect(() => (previousIndexRef.current = history.index, history.listen(() => {
|
|
117
|
+
const navigation = ref.current;
|
|
118
|
+
if (!navigation || !enabled) return;
|
|
119
|
+
const {
|
|
120
|
+
location: location2
|
|
121
|
+
} = window,
|
|
122
|
+
path = location2.pathname + location2.search,
|
|
123
|
+
index = history.index,
|
|
124
|
+
previousIndex = previousIndexRef.current ?? 0;
|
|
125
|
+
previousIndexRef.current = index, pendingPopStatePathRef.current = path;
|
|
126
|
+
const record = history.get(index);
|
|
127
|
+
if (record?.path === path && record?.state) {
|
|
128
|
+
navigation.resetRoot(record.state);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const state = getStateFromPathRef.current(path, configRef.current);
|
|
132
|
+
if (state) {
|
|
133
|
+
const rootState = navigation.getRootState();
|
|
134
|
+
if (state.routes.some(r => !rootState?.routeNames.includes(r.name))) {
|
|
135
|
+
console.warn("The navigation state parsed from the URL contains routes not present in the root navigator. This usually means that the linking configuration doesn't match the navigation structure. See https://reactnavigation.org/docs/configuring-links for more details on how to specify a linking configuration.");
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
if (index > previousIndex) {
|
|
139
|
+
const action = getActionFromStateRef.current(state, configRef.current);
|
|
140
|
+
if (action !== void 0) try {
|
|
141
|
+
navigation.dispatch(action);
|
|
142
|
+
} catch (e) {
|
|
143
|
+
console.warn(`An error occurred when trying to handle the link '${path}': ${typeof e == "object" && e != null && "message" in e ? e.message : e}`);
|
|
144
|
+
} else navigation.resetRoot(state);
|
|
145
|
+
} else navigation.resetRoot(state);
|
|
146
|
+
} else navigation.resetRoot(state);
|
|
147
|
+
})), [enabled, history, ref]), React.useEffect(() => {
|
|
148
|
+
if (!enabled) return;
|
|
149
|
+
const getPathForRoute = (route, state) => {
|
|
150
|
+
if (route?.path) {
|
|
151
|
+
const stateForPath = getStateFromPathRef.current(route.path, configRef.current);
|
|
152
|
+
if (stateForPath) {
|
|
153
|
+
const focusedRoute = (0, import_core.findFocusedRoute)(stateForPath);
|
|
154
|
+
if (focusedRoute && focusedRoute.name === route.name && (0, import_fast_deep_equal.default)(focusedRoute.params, route.params)) return (0, import_getPathFromState.appendBaseUrl)(route.path);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return getPathFromStateRef.current(state, configRef.current);
|
|
158
|
+
};
|
|
159
|
+
if (ref.current) {
|
|
160
|
+
const state = ref.current.getRootState();
|
|
161
|
+
if (state) {
|
|
162
|
+
const route = (0, import_core.findFocusedRoute)(state),
|
|
163
|
+
path = getPathForRoute(route, state);
|
|
164
|
+
previousStateRef.current === void 0 && (previousStateRef.current = state), history.replace({
|
|
165
|
+
path,
|
|
166
|
+
state
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const onStateChange = async () => {
|
|
171
|
+
const navigation = ref.current;
|
|
172
|
+
if (!navigation || !enabled) return;
|
|
173
|
+
const previousState = previousStateRef.current,
|
|
174
|
+
state = navigation.getRootState();
|
|
175
|
+
if (!state) return;
|
|
176
|
+
const pendingPath = pendingPopStatePathRef.current,
|
|
177
|
+
route = (0, import_core.findFocusedRoute)(state),
|
|
178
|
+
path = getPathForRoute(route, state);
|
|
179
|
+
previousStateRef.current = state, pendingPopStatePathRef.current = void 0;
|
|
180
|
+
const [previousFocusedState, focusedState] = findMatchingState(previousState, state);
|
|
181
|
+
if (previousFocusedState && focusedState &&
|
|
182
|
+
// We should only handle push/pop if path changed from what was in last `popstate`
|
|
183
|
+
// Otherwise it's likely a change triggered by `popstate`
|
|
184
|
+
path !== pendingPath) {
|
|
185
|
+
const historyDelta = (focusedState.history ? focusedState.history.length : focusedState.routes.length) - (previousFocusedState.history ? previousFocusedState.history.length : previousFocusedState.routes.length);
|
|
186
|
+
if (historyDelta > 0) history.push({
|
|
187
|
+
path,
|
|
188
|
+
state
|
|
189
|
+
});else if (historyDelta < 0) {
|
|
190
|
+
const nextIndex = history.backIndex({
|
|
191
|
+
path
|
|
192
|
+
}),
|
|
193
|
+
currentIndex = history.index;
|
|
194
|
+
try {
|
|
195
|
+
nextIndex !== -1 && nextIndex < currentIndex &&
|
|
196
|
+
// We should only go back if the entry exists and it's less than current index
|
|
197
|
+
history.get(nextIndex - currentIndex) ? await history.go(nextIndex - currentIndex) : await history.go(historyDelta), history.replace({
|
|
198
|
+
path,
|
|
199
|
+
state
|
|
200
|
+
});
|
|
201
|
+
} catch {}
|
|
202
|
+
} else history.replace({
|
|
203
|
+
path,
|
|
204
|
+
state
|
|
205
|
+
});
|
|
206
|
+
} else history.replace({
|
|
207
|
+
path,
|
|
208
|
+
state
|
|
209
|
+
});
|
|
210
|
+
};
|
|
211
|
+
return ref.current?.addListener("state", series(onStateChange));
|
|
212
|
+
}, [enabled, history, ref]), {
|
|
213
|
+
getInitialState
|
|
214
|
+
};
|
|
215
|
+
}
|