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