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