one 1.1.447 → 1.1.449
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js.map +1 -1
- package/dist/cjs/router/router.js.map +1 -1
- package/dist/cjs/router/router.native.js.map +1 -1
- package/dist/cjs/router/useScreens.js.map +1 -1
- package/dist/cjs/router/useScreens.native.js.map +1 -1
- package/dist/cjs/views/Navigator.cjs +3 -2
- package/dist/cjs/views/Navigator.js +2 -2
- package/dist/cjs/views/Navigator.js.map +1 -1
- package/dist/cjs/views/Navigator.native.js +2 -2
- package/dist/cjs/views/Navigator.native.js.map +2 -2
- package/dist/cjs/views/OneStackRouter.cjs +50 -0
- package/dist/cjs/views/OneStackRouter.js +43 -0
- package/dist/cjs/views/OneStackRouter.js.map +6 -0
- package/dist/cjs/views/OneStackRouter.native.js +38 -0
- package/dist/cjs/views/OneStackRouter.native.js.map +6 -0
- package/dist/esm/Root.native.js +60 -58
- package/dist/esm/Root.native.js.map +1 -6
- package/dist/esm/cli/build.native.js +313 -274
- package/dist/esm/cli/build.native.js.map +1 -6
- package/dist/esm/cli/buildPage.native.js +37 -26
- package/dist/esm/cli/buildPage.native.js.map +1 -6
- package/dist/esm/cli/checkNodeVersion.native.js +2 -4
- package/dist/esm/cli/checkNodeVersion.native.js.map +1 -6
- package/dist/esm/cli/dev.native.js +32 -25
- package/dist/esm/cli/dev.native.js.map +1 -6
- package/dist/esm/cli/label-process.native.js +4 -5
- package/dist/esm/cli/label-process.native.js.map +1 -6
- package/dist/esm/cli/main.native.js +13 -8
- package/dist/esm/cli/main.native.js.map +1 -6
- package/dist/esm/cli/patch.native.js +7 -6
- package/dist/esm/cli/patch.native.js.map +1 -6
- package/dist/esm/cli/prebuild.native.js +5 -5
- package/dist/esm/cli/prebuild.native.js.map +1 -6
- package/dist/esm/cli/runAndroid.native.js +5 -5
- package/dist/esm/cli/runAndroid.native.js.map +1 -6
- package/dist/esm/cli/runIos.native.js +5 -5
- package/dist/esm/cli/runIos.native.js.map +1 -6
- package/dist/esm/cli.native.js +262 -209
- package/dist/esm/cli.native.js.map +1 -6
- package/dist/esm/clientLoaderResolver.native.js +6 -9
- package/dist/esm/clientLoaderResolver.native.js.map +1 -6
- package/dist/esm/config.native.js +8 -9
- package/dist/esm/config.native.js.map +1 -6
- package/dist/esm/constants.native.js +21 -20
- package/dist/esm/constants.native.js.map +1 -6
- package/dist/esm/createApp.native.js +9 -13
- package/dist/esm/createApp.native.js.map +1 -6
- package/dist/esm/createHandleRequest.native.js +73 -75
- package/dist/esm/createHandleRequest.native.js.map +1 -6
- package/dist/esm/createMiddleware.native.js +2 -4
- package/dist/esm/createMiddleware.native.js.map +1 -6
- package/dist/esm/fallbackViews/Sitemap.native.js +3 -6
- package/dist/esm/fallbackViews/Sitemap.native.js.map +1 -6
- package/dist/esm/fallbackViews/Unmatched.native.js +3 -5
- package/dist/esm/fallbackViews/Unmatched.native.js.map +1 -6
- package/dist/esm/fork/NavigationContainer.native.js +61 -49
- package/dist/esm/fork/NavigationContainer.native.js.map +1 -6
- package/dist/esm/fork/_shared.native.js +4 -9
- package/dist/esm/fork/_shared.native.js.map +1 -6
- package/dist/esm/fork/createMemoryHistory.native.js +116 -99
- package/dist/esm/fork/createMemoryHistory.native.js.map +1 -6
- package/dist/esm/fork/extractPathFromURL.native.js +26 -29
- package/dist/esm/fork/extractPathFromURL.native.js.map +1 -6
- package/dist/esm/fork/findFocusedRoute.native.js +5 -6
- package/dist/esm/fork/findFocusedRoute.native.js.map +1 -6
- package/dist/esm/fork/getPathFromState-mods.native.js +22 -16
- package/dist/esm/fork/getPathFromState-mods.native.js.map +1 -6
- package/dist/esm/fork/getPathFromState.native.js +86 -92
- package/dist/esm/fork/getPathFromState.native.js.map +1 -6
- package/dist/esm/fork/getStateFromPath-mods.native.js +104 -118
- package/dist/esm/fork/getStateFromPath-mods.native.js.map +1 -6
- package/dist/esm/fork/getStateFromPath.native.js +243 -229
- package/dist/esm/fork/getStateFromPath.native.js.map +1 -6
- package/dist/esm/fork/useBackButton.native.js +5 -9
- package/dist/esm/fork/useBackButton.native.js.map +1 -6
- package/dist/esm/fork/useDocumentTitle.native.js +2 -5
- package/dist/esm/fork/useDocumentTitle.native.js.map +1 -6
- package/dist/esm/fork/useLinking.native.js +80 -86
- package/dist/esm/fork/useLinking.native.js.map +1 -6
- package/dist/esm/fork/useThenable.native.js +20 -31
- package/dist/esm/fork/useThenable.native.js.map +1 -6
- package/dist/esm/fork/validatePathConfig.native.js +28 -39
- package/dist/esm/fork/validatePathConfig.native.js.map +1 -6
- package/dist/esm/getReactNavigationConfig.native.js +21 -29
- package/dist/esm/getReactNavigationConfig.native.js.map +1 -6
- package/dist/esm/getURL.native.js +4 -4
- package/dist/esm/getURL.native.js.map +1 -6
- package/dist/esm/head/Head.android.js +3 -5
- package/dist/esm/head/Head.android.js.map +1 -6
- package/dist/esm/head/Head.ios.js +132 -144
- package/dist/esm/head/Head.ios.js.map +1 -6
- package/dist/esm/head/Head.native.js +7 -7
- package/dist/esm/head/Head.native.js.map +1 -6
- package/dist/esm/head/HeadModule.native.js +6 -6
- package/dist/esm/head/HeadModule.native.js.map +1 -6
- package/dist/esm/head/index.native.js +2 -2
- package/dist/esm/head/index.native.js.map +1 -6
- package/dist/esm/head/types.native.js +2 -1
- package/dist/esm/head/types.native.js.map +1 -6
- package/dist/esm/head/url.native.js +8 -10
- package/dist/esm/head/url.native.js.map +1 -6
- package/dist/esm/hooks.native.js +34 -54
- package/dist/esm/hooks.native.js.map +1 -6
- package/dist/esm/href.native.js +3 -6
- package/dist/esm/href.native.js.map +1 -6
- package/dist/esm/import-mode/index.android.js +3 -4
- package/dist/esm/import-mode/index.android.js.map +1 -6
- package/dist/esm/import-mode/index.ios.js +3 -4
- package/dist/esm/import-mode/index.ios.js.map +1 -6
- package/dist/esm/import-mode/index.native.js +1 -3
- package/dist/esm/import-mode/index.native.js.map +1 -6
- package/dist/esm/index.native.js +31 -76
- package/dist/esm/index.native.js.map +1 -6
- package/dist/esm/interfaces/router.native.js +2 -4
- package/dist/esm/interfaces/router.native.js.map +1 -6
- package/dist/esm/layouts/Drawer.native.js +6 -7
- package/dist/esm/layouts/Drawer.native.js.map +1 -6
- package/dist/esm/layouts/Stack.native.js +6 -7
- package/dist/esm/layouts/Stack.native.js.map +1 -6
- package/dist/esm/layouts/Tabs.native.js +58 -56
- package/dist/esm/layouts/Tabs.native.js.map +1 -6
- package/dist/esm/layouts/withLayoutContext.native.js +43 -45
- package/dist/esm/layouts/withLayoutContext.native.js.map +1 -6
- package/dist/esm/link/Link.native.js +53 -62
- package/dist/esm/link/Link.native.js.map +1 -6
- package/dist/esm/link/Redirect.native.js +9 -8
- package/dist/esm/link/Redirect.native.js.map +1 -6
- package/dist/esm/link/href.native.js +27 -28
- package/dist/esm/link/href.native.js.map +1 -6
- package/dist/esm/link/linking.native.js +40 -51
- package/dist/esm/link/linking.native.js.map +1 -6
- package/dist/esm/link/path.native.js +19 -28
- package/dist/esm/link/path.native.js.map +1 -6
- package/dist/esm/link/useLinkTo.native.js +20 -22
- package/dist/esm/link/useLinkTo.native.js.map +1 -6
- package/dist/esm/link/useLoadedNavigation.native.js +23 -30
- package/dist/esm/link/useLoadedNavigation.native.js.map +1 -6
- package/dist/esm/polyfills-mobile.native.js +5 -4
- package/dist/esm/polyfills-mobile.native.js.map +1 -6
- package/dist/esm/polyfills-server.native.js +1 -1
- package/dist/esm/polyfills-server.native.js.map +1 -6
- package/dist/esm/render.native.js +1 -3
- package/dist/esm/render.native.js.map +1 -6
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js +13 -14
- package/dist/esm/router/Route.native.js.map +1 -6
- package/dist/esm/router/RouterStore.native.js +2 -1
- package/dist/esm/router/RouterStore.native.js.map +1 -6
- package/dist/esm/router/createRoute.native.js +16 -16
- package/dist/esm/router/createRoute.native.js.map +1 -6
- package/dist/esm/router/filterRootHTML.native.js +20 -14
- package/dist/esm/router/filterRootHTML.native.js.map +1 -6
- package/dist/esm/router/getLinkingConfig.native.js +6 -11
- package/dist/esm/router/getLinkingConfig.native.js.map +1 -6
- package/dist/esm/router/getNormalizedStatePath.native.js +17 -18
- package/dist/esm/router/getNormalizedStatePath.native.js.map +1 -6
- package/dist/esm/router/getRoutes.native.js +234 -254
- package/dist/esm/router/getRoutes.native.js.map +1 -6
- package/dist/esm/router/imperative-api.native.js +4 -6
- package/dist/esm/router/imperative-api.native.js.map +1 -6
- package/dist/esm/router/lastAction.native.js +9 -10
- package/dist/esm/router/lastAction.native.js.map +1 -6
- package/dist/esm/router/matchers.native.js +3 -16
- package/dist/esm/router/matchers.native.js.map +1 -6
- package/dist/esm/router/router.js.map +1 -1
- package/dist/esm/router/router.mjs.map +1 -1
- package/dist/esm/router/router.native.js +131 -154
- package/dist/esm/router/router.native.js.map +1 -6
- package/dist/esm/router/serverLocationContext.native.js +2 -4
- package/dist/esm/router/serverLocationContext.native.js.map +1 -6
- package/dist/esm/router/sortRoutes.native.js +17 -27
- package/dist/esm/router/sortRoutes.native.js.map +1 -6
- package/dist/esm/router/useInitializeOneRouter.native.js +5 -8
- package/dist/esm/router/useInitializeOneRouter.native.js.map +1 -6
- package/dist/esm/router/useNavigation.native.js +19 -23
- package/dist/esm/router/useNavigation.native.js.map +1 -6
- package/dist/esm/router/useScreens.js.map +1 -1
- package/dist/esm/router/useScreens.mjs.map +1 -1
- package/dist/esm/router/useScreens.native.js +166 -137
- package/dist/esm/router/useScreens.native.js.map +1 -6
- package/dist/esm/router/useViteRoutes.native.js +21 -21
- package/dist/esm/router/useViteRoutes.native.js.map +1 -6
- package/dist/esm/serve-worker.native.js +8 -9
- package/dist/esm/serve-worker.native.js.map +1 -6
- package/dist/esm/serve.native.js +27 -14
- package/dist/esm/serve.native.js.map +1 -6
- package/dist/esm/server/ServerContextScript.native.js +15 -18
- package/dist/esm/server/ServerContextScript.native.js.map +1 -6
- package/dist/esm/server/createRoutesManifest.native.js +11 -14
- package/dist/esm/server/createRoutesManifest.native.js.map +1 -6
- package/dist/esm/server/getServerManifest.native.js +75 -65
- package/dist/esm/server/getServerManifest.native.js.map +1 -6
- package/dist/esm/server/oneServe.native.js +153 -105
- package/dist/esm/server/oneServe.native.js.map +1 -6
- package/dist/esm/server/setServerGlobals.native.js +2 -4
- package/dist/esm/server/setServerGlobals.native.js.map +1 -6
- package/dist/esm/server/setupBuildOptions.native.js +2 -4
- package/dist/esm/server/setupBuildOptions.native.js.map +1 -6
- package/dist/esm/server-render.native.js +10 -9
- package/dist/esm/server-render.native.js.map +1 -6
- package/dist/esm/setup.native.js +1 -0
- package/dist/esm/setup.native.js.map +1 -6
- package/dist/esm/typed-routes/generateRouteTypes.native.js +11 -10
- package/dist/esm/typed-routes/generateRouteTypes.native.js.map +1 -6
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js +37 -38
- package/dist/esm/typed-routes/getTypedRoutesDeclarationFile.native.js.map +1 -6
- package/dist/esm/types.native.js +2 -1
- package/dist/esm/types.native.js.map +1 -6
- package/dist/esm/useFocusEffect.native.js +22 -25
- package/dist/esm/useFocusEffect.native.js.map +1 -6
- package/dist/esm/useLoader.native.js +48 -49
- package/dist/esm/useLoader.native.js.map +1 -6
- package/dist/esm/useServerHeadInsertion.native.js +16 -15
- package/dist/esm/useServerHeadInsertion.native.js.map +1 -6
- package/dist/esm/utils/assertIsReady.native.js +3 -6
- package/dist/esm/utils/assertIsReady.native.js.map +1 -6
- package/dist/esm/utils/cleanUrl.native.js +11 -11
- package/dist/esm/utils/cleanUrl.native.js.map +1 -6
- package/dist/esm/utils/dynamicImport.native.js +3 -5
- package/dist/esm/utils/dynamicImport.native.js.map +1 -6
- package/dist/esm/utils/ensureExists.native.js +3 -6
- package/dist/esm/utils/ensureExists.native.js.map +1 -6
- package/dist/esm/utils/existsAsync.native.js +4 -6
- package/dist/esm/utils/existsAsync.native.js.map +1 -6
- package/dist/esm/utils/getHonoPath.native.js +2 -4
- package/dist/esm/utils/getHonoPath.native.js.map +1 -6
- package/dist/esm/utils/getPageExport.native.js +19 -20
- package/dist/esm/utils/getPageExport.native.js.map +1 -6
- package/dist/esm/utils/globDir.native.js +3 -5
- package/dist/esm/utils/globDir.native.js.map +1 -6
- package/dist/esm/utils/hashString.native.js +2 -4
- package/dist/esm/utils/hashString.native.js.map +1 -6
- package/dist/esm/utils/isResponse.native.js +2 -4
- package/dist/esm/utils/isResponse.native.js.map +1 -6
- package/dist/esm/utils/isStatus.native.js +2 -4
- package/dist/esm/utils/isStatus.native.js.map +1 -6
- package/dist/esm/utils/platform.native.js +2 -4
- package/dist/esm/utils/platform.native.js.map +1 -6
- package/dist/esm/utils/promiseWithResolvers.native.js +7 -7
- package/dist/esm/utils/promiseWithResolvers.native.js.map +1 -6
- package/dist/esm/utils/rand.native.js +3 -5
- package/dist/esm/utils/rand.native.js.map +1 -6
- package/dist/esm/utils/redirect.native.js +5 -7
- package/dist/esm/utils/redirect.native.js.map +1 -6
- package/dist/esm/utils/removeSearch.native.js +2 -4
- package/dist/esm/utils/removeSearch.native.js.map +1 -6
- package/dist/esm/utils/removeUndefined.native.js +3 -6
- package/dist/esm/utils/removeUndefined.native.js.map +1 -6
- package/dist/esm/utils/toAbsolute.native.js +3 -5
- package/dist/esm/utils/toAbsolute.native.js.map +1 -6
- package/dist/esm/utils/url.native.js +2 -6
- package/dist/esm/utils/url.native.js.map +1 -6
- package/dist/esm/utils/useConstant.native.js +5 -8
- package/dist/esm/utils/useConstant.native.js.map +1 -6
- package/dist/esm/utils/weakKey.native.js +10 -11
- package/dist/esm/utils/weakKey.native.js.map +1 -6
- package/dist/esm/utils/weakMemo.native.js +8 -8
- package/dist/esm/utils/weakMemo.native.js.map +1 -6
- package/dist/esm/utils/withStaticProperties.native.js +21 -22
- package/dist/esm/utils/withStaticProperties.native.js.map +1 -6
- package/dist/esm/views/EmptyRoute.native.js +3 -5
- package/dist/esm/views/EmptyRoute.native.js.map +1 -6
- package/dist/esm/views/ErrorBoundary.native.js +8 -5
- package/dist/esm/views/ErrorBoundary.native.js.map +1 -6
- package/dist/esm/views/LoadProgressBar.native.js +57 -58
- package/dist/esm/views/LoadProgressBar.native.js.map +1 -6
- package/dist/esm/views/Navigator.js +4 -3
- package/dist/esm/views/Navigator.js.map +1 -1
- package/dist/esm/views/Navigator.mjs +4 -3
- package/dist/esm/views/Navigator.mjs.map +1 -1
- package/dist/esm/views/Navigator.native.js +72 -55
- package/dist/esm/views/Navigator.native.js.map +1 -6
- package/dist/esm/views/OneStackRouter.js +27 -0
- package/dist/esm/views/OneStackRouter.js.map +6 -0
- package/dist/esm/views/OneStackRouter.mjs +27 -0
- package/dist/esm/views/OneStackRouter.mjs.map +1 -0
- package/dist/esm/views/OneStackRouter.native.js +15 -0
- package/dist/esm/views/OneStackRouter.native.js.map +1 -0
- package/dist/esm/views/PreloadLinks.native.js +1 -3
- package/dist/esm/views/PreloadLinks.native.js.map +1 -6
- package/dist/esm/views/RootErrorBoundary.native.js +29 -39
- package/dist/esm/views/RootErrorBoundary.native.js.map +1 -6
- package/dist/esm/views/Screen.native.js +12 -12
- package/dist/esm/views/Screen.native.js.map +1 -6
- package/dist/esm/views/ScrollBehavior.native.js +37 -34
- package/dist/esm/views/ScrollBehavior.native.js.map +1 -6
- package/dist/esm/views/Try.native.js +37 -40
- package/dist/esm/views/Try.native.js.map +1 -6
- package/dist/esm/vite/DevHead.native.js +3 -5
- package/dist/esm/vite/DevHead.native.js.map +1 -6
- package/dist/esm/vite/constants.native.js +5 -7
- package/dist/esm/vite/constants.native.js.map +1 -6
- package/dist/esm/vite/customNodeExternals.native.js +10 -9
- package/dist/esm/vite/customNodeExternals.native.js.map +1 -6
- package/dist/esm/vite/ensureTsConfig.native.js +5 -7
- package/dist/esm/vite/ensureTsConfig.native.js.map +1 -6
- package/dist/esm/vite/findDepsToOptimize.native.js +19 -27
- package/dist/esm/vite/findDepsToOptimize.native.js.map +1 -6
- package/dist/esm/vite/getManifest.native.js +4 -6
- package/dist/esm/vite/getManifest.native.js.map +1 -6
- package/dist/esm/vite/loadConfig.native.js +6 -12
- package/dist/esm/vite/loadConfig.native.js.map +1 -6
- package/dist/esm/vite/makePluginWebOnly.native.js +5 -9
- package/dist/esm/vite/makePluginWebOnly.native.js.map +1 -6
- package/dist/esm/vite/one-server-only.native.js +9 -23
- package/dist/esm/vite/one-server-only.native.js.map +1 -6
- package/dist/esm/vite/one.native.js +169 -180
- package/dist/esm/vite/one.native.js.map +1 -6
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js +51 -60
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js +35 -36
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +127 -102
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/fixDependenciesPlugin.native.js +2 -4
- package/dist/esm/vite/plugins/fixDependenciesPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js +9 -9
- package/dist/esm/vite/plugins/generateFileSystemRouteTypesPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js +11 -14
- package/dist/esm/vite/plugins/removeReactNativeWebAnimatedPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/useDomPlugin.native.js +9 -12
- package/dist/esm/vite/plugins/useDomPlugin.native.js.map +1 -6
- package/dist/esm/vite/plugins/virtualEntryConstants.native.js +9 -10
- package/dist/esm/vite/plugins/virtualEntryConstants.native.js.map +1 -6
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js +11 -18
- package/dist/esm/vite/plugins/virtualEntryPlugin.native.js.map +1 -6
- package/dist/esm/vite/replaceLoader.native.js +11 -10
- package/dist/esm/vite/replaceLoader.native.js.map +1 -6
- package/dist/esm/vite/resolveResponse.native.js +36 -33
- package/dist/esm/vite/resolveResponse.native.js.map +1 -6
- package/dist/esm/vite/types.native.js +2 -1
- package/dist/esm/vite/types.native.js.map +1 -6
- package/dist/esm/vite.native.js +9 -18
- package/dist/esm/vite.native.js.map +1 -6
- package/dist/esm/zero/getQueryKey.native.js +3 -5
- package/dist/esm/zero/getQueryKey.native.js.map +1 -6
- package/dist/esm/zero/isZeroQuery.native.js +2 -4
- package/dist/esm/zero/isZeroQuery.native.js.map +1 -6
- package/dist/esm/zero/resolveQuery.native.js +8 -9
- package/dist/esm/zero/resolveQuery.native.js.map +1 -6
- package/dist/esm/zero/subscribeToQuery.native.js +3 -5
- package/dist/esm/zero/subscribeToQuery.native.js.map +1 -6
- package/dist/esm/zero/types.native.js +2 -1
- package/dist/esm/zero/types.native.js.map +1 -6
- package/dist/esm/zero/useQuery.native.js +14 -13
- package/dist/esm/zero/useQuery.native.js.map +1 -6
- package/dist/esm/zero/useQueryZero.native.js +20 -24
- package/dist/esm/zero/useQueryZero.native.js.map +1 -6
- package/dist/esm/zero.native.js +5 -9
- package/dist/esm/zero.native.js.map +1 -6
- package/package.json +9 -9
- package/src/router/Route.tsx +1 -1
- package/src/router/router.ts +2 -1
- package/src/router/useScreens.tsx +2 -1
- package/src/views/Navigator.tsx +4 -3
- package/src/views/OneStackRouter.tsx +50 -0
- package/types/router/Route.d.ts.map +1 -1
- package/types/router/useScreens.d.ts.map +1 -1
- package/types/views/Navigator.d.ts.map +1 -1
- package/types/views/OneStackRouter.d.ts +3 -0
- package/types/views/OneStackRouter.d.ts.map +1 -0
@@ -4,128 +4,152 @@ import { createRequire } from "node:module";
|
|
4
4
|
import Path, { join, relative, resolve } from "node:path";
|
5
5
|
import { mergeConfig, build as viteBuild } from "vite";
|
6
6
|
import { fillOptions, getOptimizeDeps, loadEnv, rollupRemoveUnusedImportsPlugin, build as vxrnBuild } from "vxrn";
|
7
|
-
import * as constants from "../constants";
|
8
|
-
import { setServerGlobals } from "../server/setServerGlobals";
|
9
|
-
import { toAbsolute } from "../utils/toAbsolute";
|
10
|
-
import { getManifest } from "../vite/getManifest";
|
11
|
-
import { loadUserOneOptions } from "../vite/loadConfig";
|
12
|
-
import { runWithAsyncLocalContext } from "../vite/one-server-only";
|
13
|
-
import { buildPage } from "./buildPage";
|
14
|
-
import { checkNodeVersion } from "./checkNodeVersion";
|
15
|
-
import { labelProcess } from "./label-process";
|
16
|
-
var {
|
17
|
-
|
7
|
+
import * as constants from "../constants.native.js";
|
8
|
+
import { setServerGlobals } from "../server/setServerGlobals.native.js";
|
9
|
+
import { toAbsolute } from "../utils/toAbsolute.native.js";
|
10
|
+
import { getManifest } from "../vite/getManifest.native.js";
|
11
|
+
import { loadUserOneOptions } from "../vite/loadConfig.native.js";
|
12
|
+
import { runWithAsyncLocalContext } from "../vite/one-server-only.native.js";
|
13
|
+
import { buildPage } from "./buildPage.native.js";
|
14
|
+
import { checkNodeVersion } from "./checkNodeVersion.native.js";
|
15
|
+
import { labelProcess } from "./label-process.native.js";
|
16
|
+
var {
|
17
|
+
ensureDir
|
18
|
+
} = FSExtra;
|
19
|
+
process.on("uncaughtException", function (err) {
|
18
20
|
console.error(err?.message || err);
|
19
21
|
});
|
20
22
|
async function build(args) {
|
21
23
|
var _oneOptions_build_server, _oneOptions_build, _oneOptions_web, _options_server;
|
22
24
|
labelProcess("build"), checkNodeVersion(), setServerGlobals();
|
23
|
-
var {
|
25
|
+
var {
|
26
|
+
serverEnv
|
27
|
+
} = await loadEnv("production");
|
24
28
|
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");
|
25
|
-
var {
|
26
|
-
|
27
|
-
build
|
28
|
-
|
29
|
-
|
30
|
-
|
29
|
+
var {
|
30
|
+
oneOptions
|
31
|
+
} = await loadUserOneOptions("build"),
|
32
|
+
manifest = getManifest(),
|
33
|
+
_oneOptions_build_server_outputFormat,
|
34
|
+
serverOutputFormat = (_oneOptions_build_server_outputFormat = (_oneOptions_build = oneOptions.build) === null || _oneOptions_build === void 0 || (_oneOptions_build_server = _oneOptions_build.server) === null || _oneOptions_build_server === void 0 ? void 0 : _oneOptions_build_server.outputFormat) !== null && _oneOptions_build_server_outputFormat !== void 0 ? _oneOptions_build_server_outputFormat : "esm",
|
35
|
+
vxrnOutput = await vxrnBuild({
|
36
|
+
server: oneOptions.server,
|
37
|
+
build: {
|
38
|
+
analyze: !0,
|
39
|
+
server: {
|
40
|
+
outputFormat: serverOutputFormat
|
41
|
+
}
|
31
42
|
}
|
32
|
-
}
|
33
|
-
|
34
|
-
|
35
|
-
return;
|
36
|
-
var options = await fillOptions(vxrnOutput.options), { optimizeDeps } = getOptimizeDeps("build"), apiBuildConfig = mergeConfig(
|
37
|
-
// feels like this should build off the *server* build config not web
|
38
|
-
vxrnOutput.webBuildConfig,
|
43
|
+
}, args);
|
44
|
+
if (!vxrnOutput || args.platform !== "web") return;
|
45
|
+
var options = await fillOptions(vxrnOutput.options),
|
39
46
|
{
|
47
|
+
optimizeDeps
|
48
|
+
} = getOptimizeDeps("build"),
|
49
|
+
apiBuildConfig = mergeConfig(
|
50
|
+
// feels like this should build off the *server* build config not web
|
51
|
+
vxrnOutput.webBuildConfig, {
|
40
52
|
configFile: !1,
|
41
53
|
appType: "custom",
|
42
54
|
optimizeDeps
|
43
|
-
}
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
JSON.stringify(value)
|
49
|
-
];
|
50
|
-
}));
|
55
|
+
}),
|
56
|
+
processEnvDefines = Object.fromEntries(Object.entries(serverEnv).map(function (param) {
|
57
|
+
var [key, value] = param;
|
58
|
+
return [`process.env.${key}`, JSON.stringify(value)];
|
59
|
+
}));
|
51
60
|
async function buildCustomRoutes(subFolder, routes) {
|
52
|
-
var _oneOptions_build_api,
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
61
|
+
var _oneOptions_build_api,
|
62
|
+
_oneOptions_build2,
|
63
|
+
_oneOptions_build_api1,
|
64
|
+
_oneOptions_build1,
|
65
|
+
_oneOptions_build_api2,
|
66
|
+
_oneOptions_build22,
|
67
|
+
input = routes.reduce(function (entries, param) {
|
68
|
+
var {
|
69
|
+
page,
|
70
|
+
file
|
71
|
+
} = param;
|
72
|
+
return entries[page.slice(1) + ".js"] = join("app", file), entries;
|
73
|
+
}, {}),
|
74
|
+
_oneOptions_build_api_outputFormat,
|
75
|
+
outputFormat = (_oneOptions_build_api_outputFormat = oneOptions == null || (_oneOptions_build2 = oneOptions.build) === null || _oneOptions_build2 === void 0 || (_oneOptions_build_api = _oneOptions_build2.api) === null || _oneOptions_build_api === void 0 ? void 0 : _oneOptions_build_api.outputFormat) !== null && _oneOptions_build_api_outputFormat !== void 0 ? _oneOptions_build_api_outputFormat : serverOutputFormat,
|
76
|
+
treeshake = oneOptions == null || (_oneOptions_build1 = oneOptions.build) === null || _oneOptions_build1 === void 0 || (_oneOptions_build_api1 = _oneOptions_build1.api) === null || _oneOptions_build_api1 === void 0 ? void 0 : _oneOptions_build_api1.treeshake,
|
77
|
+
mergedConfig = mergeConfig(apiBuildConfig, {
|
78
|
+
appType: "custom",
|
79
|
+
configFile: !1,
|
80
|
+
// plugins: [
|
81
|
+
// nodeExternals({
|
82
|
+
// exclude: optimizeDeps.include,
|
83
|
+
// }) as any,
|
84
|
+
// ],
|
85
|
+
define: {
|
86
|
+
...processEnvDefines
|
87
|
+
},
|
88
|
+
// dont think this is doing anything
|
89
|
+
ssr: {
|
90
|
+
noExternal: !0,
|
91
|
+
// we patched them to switch to react 19
|
92
|
+
external: ["react", "react-dom"],
|
93
|
+
optimizeDeps
|
94
|
+
},
|
95
|
+
build: {
|
96
|
+
ssr: !0,
|
97
|
+
emptyOutDir: !1,
|
98
|
+
outDir: `dist/${subFolder}`,
|
99
|
+
copyPublicDir: !1,
|
100
|
+
minify: !1,
|
101
|
+
rollupOptions: {
|
102
|
+
treeshake: treeshake ?? {
|
103
|
+
moduleSideEffects: !1
|
104
|
+
},
|
105
|
+
plugins: [
|
87
106
|
// otherwise rollup is leaving commonjs-only top level imports...
|
88
|
-
outputFormat === "esm" ? rollupRemoveUnusedImportsPlugin : null
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
107
|
+
outputFormat === "esm" ? rollupRemoveUnusedImportsPlugin : null].filter(Boolean),
|
108
|
+
// too many issues
|
109
|
+
// treeshake: {
|
110
|
+
// moduleSideEffects: false,
|
111
|
+
// },
|
112
|
+
// prevents it from shaking out the exports
|
113
|
+
preserveEntrySignatures: "strict",
|
114
|
+
input,
|
115
|
+
external: function (id) {
|
116
|
+
return !1;
|
117
|
+
},
|
118
|
+
output: {
|
119
|
+
entryFileNames: "[name]",
|
120
|
+
exports: "auto",
|
121
|
+
...(outputFormat === "esm" ? {
|
122
|
+
format: "esm",
|
123
|
+
esModule: !0
|
124
|
+
} : {
|
125
|
+
format: "cjs",
|
126
|
+
// Preserve folder structure and use .cjs extension
|
127
|
+
entryFileNames: function (chunkInfo) {
|
128
|
+
var name = chunkInfo.name.replace(/\.js$/, ".cjs");
|
129
|
+
return name;
|
130
|
+
},
|
131
|
+
chunkFileNames: function (chunkInfo) {
|
132
|
+
var dir = Path.dirname(chunkInfo.name),
|
133
|
+
name = Path.basename(chunkInfo.name, Path.extname(chunkInfo.name));
|
134
|
+
return Path.join(dir, `${name}-[hash].cjs`);
|
135
|
+
},
|
136
|
+
assetFileNames: function (assetInfo) {
|
137
|
+
var _assetInfo_name,
|
138
|
+
name = (_assetInfo_name = assetInfo.name) !== null && _assetInfo_name !== void 0 ? _assetInfo_name : "",
|
139
|
+
dir = Path.dirname(name),
|
140
|
+
baseName = Path.basename(name, Path.extname(name)),
|
141
|
+
ext = Path.extname(name);
|
142
|
+
return Path.join(dir, `${baseName}-[hash]${ext}`);
|
143
|
+
}
|
144
|
+
})
|
121
145
|
}
|
122
146
|
}
|
123
147
|
}
|
124
|
-
}
|
125
|
-
|
148
|
+
}),
|
149
|
+
userApiBuildConf = (_oneOptions_build22 = oneOptions.build) === null || _oneOptions_build22 === void 0 || (_oneOptions_build_api2 = _oneOptions_build22.api) === null || _oneOptions_build_api2 === void 0 ? void 0 : _oneOptions_build_api2.config,
|
150
|
+
output = await viteBuild(
|
126
151
|
// allow user merging api build config
|
127
|
-
userApiBuildConf ? mergeConfig(mergedConfig, userApiBuildConf) : mergedConfig
|
128
|
-
);
|
152
|
+
userApiBuildConf ? mergeConfig(mergedConfig, userApiBuildConf) : mergedConfig);
|
129
153
|
return output;
|
130
154
|
}
|
131
155
|
manifest.apiRoutes.length && (console.info(`
|
@@ -136,138 +160,140 @@ async function build(args) {
|
|
136
160
|
console.info(`
|
137
161
|
\u{1F528} build middlewares
|
138
162
|
`);
|
139
|
-
var middlewareBuildInfo = await buildCustomRoutes("middlewares", manifest.middlewareRoutes),
|
163
|
+
var middlewareBuildInfo = await buildCustomRoutes("middlewares", manifest.middlewareRoutes),
|
164
|
+
_iteratorNormalCompletion = !0,
|
165
|
+
_didIteratorError = !1,
|
166
|
+
_iteratorError = void 0;
|
140
167
|
try {
|
141
|
-
for (var _loop = function() {
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
168
|
+
for (var _loop = function () {
|
169
|
+
var middleware = _step.value,
|
170
|
+
absoluteRoot = resolve(process.cwd(), options.root),
|
171
|
+
fullPath = join(absoluteRoot, "app", middleware.file),
|
172
|
+
outChunks = middlewareBuildInfo.output.filter(function (x) {
|
173
|
+
return x.type === "chunk";
|
174
|
+
}),
|
175
|
+
chunk = outChunks.find(function (x) {
|
176
|
+
return x.facadeModuleId === fullPath;
|
177
|
+
});
|
178
|
+
if (!chunk) throw new Error("internal err finding middleware");
|
179
|
+
builtMiddlewares[middleware.file] = join("dist", "middlewares", chunk.fileName);
|
180
|
+
}, _iterator = manifest.middlewareRoutes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) _loop();
|
150
181
|
} catch (err) {
|
151
182
|
_didIteratorError = !0, _iteratorError = err;
|
152
183
|
} finally {
|
153
184
|
try {
|
154
185
|
!_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
|
155
186
|
} finally {
|
156
|
-
if (_didIteratorError)
|
157
|
-
throw _iteratorError;
|
187
|
+
if (_didIteratorError) throw _iteratorError;
|
158
188
|
}
|
159
189
|
}
|
160
190
|
}
|
161
191
|
globalThis.require = createRequire(join(import.meta.url, ".."));
|
162
|
-
var assets = [],
|
192
|
+
var assets = [],
|
193
|
+
builtRoutes = [];
|
163
194
|
console.info(`
|
164
195
|
\u{1F528} build static routes
|
165
196
|
`);
|
166
|
-
var staticDir = join("dist/static"),
|
167
|
-
|
168
|
-
|
169
|
-
var outputEntries = [
|
170
|
-
|
171
|
-
|
197
|
+
var staticDir = join("dist/static"),
|
198
|
+
clientDir = join("dist/client");
|
199
|
+
if (await ensureDir(staticDir), !vxrnOutput.serverOutput) throw new Error("No server output");
|
200
|
+
var outputEntries = [...vxrnOutput.serverOutput.entries()],
|
201
|
+
_iteratorNormalCompletion1 = !0,
|
202
|
+
_didIteratorError1 = !1,
|
203
|
+
_iteratorError1 = void 0;
|
172
204
|
try {
|
173
|
-
for (var _loop1 = async function() {
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
+
for (var _loop1 = async function () {
|
206
|
+
var [index, output] = _step1.value,
|
207
|
+
_vxrnOutput_buildArgs,
|
208
|
+
_foundRoute_layouts,
|
209
|
+
_exported_generateStaticParams;
|
210
|
+
if (output.type === "asset") return assets.push(output), "continue";
|
211
|
+
var id = output.facadeModuleId || "",
|
212
|
+
file = Path.basename(id);
|
213
|
+
if (!id || file[0] === "_" || file.includes("entry-server") || id.includes("+api") || !id.includes("/app/")) return "continue";
|
214
|
+
var relativeId = relative(process.cwd(), id).replace("app/", "/"),
|
215
|
+
onlyBuild = (_vxrnOutput_buildArgs = vxrnOutput.buildArgs) === null || _vxrnOutput_buildArgs === void 0 ? void 0 : _vxrnOutput_buildArgs.only;
|
216
|
+
if (onlyBuild && !MicroMatch.contains(relativeId, onlyBuild)) return "continue";
|
217
|
+
var clientManifestKey = Object.keys(vxrnOutput.clientManifest).find(function (key) {
|
218
|
+
return id.endsWith(key);
|
219
|
+
}) || "";
|
220
|
+
if (!clientManifestKey) return "continue";
|
221
|
+
var clientManifestEntry = vxrnOutput.clientManifest[clientManifestKey],
|
222
|
+
foundRoute = manifest.pageRoutes.find(function (route2) {
|
223
|
+
return route2.file && clientManifestKey.replace(/^app/, "") === route2.file.slice(1);
|
224
|
+
});
|
225
|
+
if (!foundRoute) return "continue";
|
226
|
+
function collectImports(param) {
|
227
|
+
var {
|
228
|
+
imports = [],
|
229
|
+
css
|
230
|
+
} = param,
|
231
|
+
{
|
232
|
+
type = "js"
|
233
|
+
} = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
234
|
+
return [...new Set([...(type === "js" ? imports : css || []), ...imports.flatMap(function (name) {
|
235
|
+
var found = vxrnOutput.clientManifest[name];
|
236
|
+
return found || console.warn("No found imports", name, vxrnOutput.clientManifest), collectImports(found, {
|
237
|
+
type
|
238
|
+
});
|
239
|
+
})].flat().filter(function (x) {
|
205
240
|
return x && (type === "css" || x.endsWith(".js"));
|
206
|
-
}).map(function(x) {
|
241
|
+
}).map(function (x) {
|
207
242
|
return type === "css" || x.startsWith("assets/") ? x : `assets/${x.slice(1)}`;
|
208
|
-
}))
|
209
|
-
];
|
210
|
-
}
|
211
|
-
clientManifestEntry || console.warn(`No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(vxrnOutput.clientManifest, null, 2)}`);
|
212
|
-
var entryImports = collectImports(clientManifestEntry || {}), _foundRoute_layouts_flatMap, layoutEntries = (_foundRoute_layouts_flatMap = (_foundRoute_layouts = foundRoute.layouts) === null || _foundRoute_layouts === void 0 ? void 0 : _foundRoute_layouts.flatMap(function(layout) {
|
213
|
-
var clientKey = `app${layout.contextKey.slice(1)}`;
|
214
|
-
return vxrnOutput.clientManifest[clientKey];
|
215
|
-
})) !== null && _foundRoute_layouts_flatMap !== void 0 ? _foundRoute_layouts_flatMap : [], layoutImports = layoutEntries.flatMap(function(entry) {
|
216
|
-
return [
|
217
|
-
entry.file,
|
218
|
-
...collectImports(entry)
|
219
|
-
];
|
220
|
-
}), preloadSetupFilePreloads = function() {
|
221
|
-
if (oneOptions.setupFile) {
|
222
|
-
var needle = oneOptions.setupFile.replace(/^\.\//, "");
|
223
|
-
for (var file2 in vxrnOutput.clientManifest)
|
224
|
-
if (file2 === needle) {
|
225
|
-
var entry = vxrnOutput.clientManifest[file2];
|
226
|
-
return [
|
227
|
-
entry.file
|
228
|
-
];
|
229
|
-
}
|
243
|
+
}))];
|
230
244
|
}
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
245
|
+
clientManifestEntry || console.warn(`No client manifest entry found: ${clientManifestKey} in manifest ${JSON.stringify(vxrnOutput.clientManifest, null, 2)}`);
|
246
|
+
var entryImports = collectImports(clientManifestEntry || {}),
|
247
|
+
_foundRoute_layouts_flatMap,
|
248
|
+
layoutEntries = (_foundRoute_layouts_flatMap = (_foundRoute_layouts = foundRoute.layouts) === null || _foundRoute_layouts === void 0 ? void 0 : _foundRoute_layouts.flatMap(function (layout) {
|
249
|
+
var clientKey = `app${layout.contextKey.slice(1)}`;
|
250
|
+
return vxrnOutput.clientManifest[clientKey];
|
251
|
+
})) !== null && _foundRoute_layouts_flatMap !== void 0 ? _foundRoute_layouts_flatMap : [],
|
252
|
+
layoutImports = layoutEntries.flatMap(function (entry) {
|
253
|
+
return [entry.file, ...collectImports(entry)];
|
254
|
+
}),
|
255
|
+
preloadSetupFilePreloads = function () {
|
256
|
+
if (oneOptions.setupFile) {
|
257
|
+
var needle = oneOptions.setupFile.replace(/^\.\//, "");
|
258
|
+
for (var file2 in vxrnOutput.clientManifest) if (file2 === needle) {
|
259
|
+
var entry = vxrnOutput.clientManifest[file2];
|
260
|
+
return [entry.file];
|
261
|
+
}
|
262
|
+
}
|
263
|
+
return [];
|
264
|
+
}(),
|
265
|
+
preloads = [... /* @__PURE__ */new Set([...preloadSetupFilePreloads,
|
235
266
|
// add the route entry js (like ./app/index.ts)
|
236
267
|
clientManifestEntry.file,
|
237
268
|
// add the virtual entry
|
238
|
-
vxrnOutput.clientManifest["virtual:one-entry"].file,
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
process.env.DEBUG && console.info("[one] building routes", {
|
255
|
-
foundRoute,
|
256
|
-
layoutEntries,
|
257
|
-
allEntries,
|
258
|
-
allCSS
|
259
|
-
});
|
260
|
-
var serverJsPath = join("dist/server", output.fileName), exported = void 0;
|
261
|
-
try {
|
262
|
-
exported = await import(toAbsolute(serverJsPath));
|
263
|
-
} catch (err) {
|
264
|
-
throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
|
265
|
-
cause: err
|
269
|
+
vxrnOutput.clientManifest["virtual:one-entry"].file, ...entryImports, ...layoutImports])].map(function (path) {
|
270
|
+
return `/${path}`;
|
271
|
+
}),
|
272
|
+
allEntries = [clientManifestEntry, ...layoutEntries],
|
273
|
+
allCSS = allEntries.flatMap(function (entry) {
|
274
|
+
return collectImports(entry, {
|
275
|
+
type: "css"
|
276
|
+
});
|
277
|
+
}).map(function (path) {
|
278
|
+
return `/${path}`;
|
279
|
+
});
|
280
|
+
process.env.DEBUG && console.info("[one] building routes", {
|
281
|
+
foundRoute,
|
282
|
+
layoutEntries,
|
283
|
+
allEntries,
|
284
|
+
allCSS
|
266
285
|
});
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
286
|
+
var serverJsPath = join("dist/server", output.fileName),
|
287
|
+
exported = void 0;
|
288
|
+
try {
|
289
|
+
exported = await import(toAbsolute(serverJsPath));
|
290
|
+
} catch (err) {
|
291
|
+
throw console.error("Error importing page (original error)", err), new Error(`Error importing page: ${serverJsPath}`, {
|
292
|
+
cause: err
|
293
|
+
});
|
294
|
+
}
|
295
|
+
var isDynamic = !!Object.keys(foundRoute.routeKeys).length;
|
296
|
+
if (foundRoute.type === "ssg" && isDynamic && !foundRoute.page.includes("+not-found") && !foundRoute.page.includes("_sitemap") && !exported.generateStaticParams) throw new Error(`[one] Error: Missing generateStaticParams
|
271
297
|
|
272
298
|
Route ${foundRoute.page} of type ${foundRoute.type} must export generateStaticParams so build can complete.
|
273
299
|
|
@@ -275,48 +301,52 @@ async function build(args) {
|
|
275
301
|
https://onestack.dev/docs/routing-exports#generatestaticparams
|
276
302
|
|
277
303
|
`);
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
console.info(`
|
304
|
+
var _ref,
|
305
|
+
paramsList = (_ref = await ((_exported_generateStaticParams = exported.generateStaticParams) === null || _exported_generateStaticParams === void 0 ? void 0 : _exported_generateStaticParams.call(exported))) !== null && _ref !== void 0 ? _ref : [{}];
|
306
|
+
console.info(`
|
282
307
|
[build] page ${relativeId} (with ${paramsList.length} routes)
|
283
308
|
`), process.env.DEBUG && console.info("paramsList", JSON.stringify(paramsList, null, 2));
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
var params = _step4.value, cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""), path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg");
|
288
|
-
console.info(` \u21A6 route ${path}`);
|
289
|
-
var built = await runWithAsyncLocalContext(async function() {
|
290
|
-
return await buildPage(vxrnOutput.serverEntry, path, relativeId, params, foundRoute, clientManifestEntry, staticDir, clientDir, builtMiddlewares, serverJsPath, preloads, allCSS);
|
291
|
-
});
|
292
|
-
builtRoutes.push(built);
|
293
|
-
}, _iterator4 = paramsList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = !0) await _loop2();
|
294
|
-
} catch (err) {
|
295
|
-
_didIteratorError4 = !0, _iteratorError4 = err;
|
296
|
-
} finally {
|
309
|
+
var _iteratorNormalCompletion4 = !0,
|
310
|
+
_didIteratorError4 = !1,
|
311
|
+
_iteratorError4 = void 0;
|
297
312
|
try {
|
298
|
-
|
313
|
+
for (var _loop2 = async function () {
|
314
|
+
var params = _step4.value,
|
315
|
+
cleanId = relativeId.replace(/\+(spa|ssg|ssr)\.tsx?$/, ""),
|
316
|
+
path = getPathnameFromFilePath(cleanId, params, foundRoute.type === "ssg");
|
317
|
+
console.info(` \u21A6 route ${path}`);
|
318
|
+
var built = await runWithAsyncLocalContext(async function () {
|
319
|
+
return await buildPage(vxrnOutput.serverEntry, path, relativeId, params, foundRoute, clientManifestEntry, staticDir, clientDir, builtMiddlewares, serverJsPath, preloads, allCSS);
|
320
|
+
});
|
321
|
+
builtRoutes.push(built);
|
322
|
+
}, _iterator4 = paramsList[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = !0) await _loop2();
|
323
|
+
} catch (err) {
|
324
|
+
_didIteratorError4 = !0, _iteratorError4 = err;
|
299
325
|
} finally {
|
300
|
-
|
301
|
-
|
326
|
+
try {
|
327
|
+
!_iteratorNormalCompletion4 && _iterator4.return != null && _iterator4.return();
|
328
|
+
} finally {
|
329
|
+
if (_didIteratorError4) throw _iteratorError4;
|
330
|
+
}
|
302
331
|
}
|
303
|
-
}
|
304
|
-
}, _iterator1 = outputEntries[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) await _loop1();
|
332
|
+
}, _iterator1 = outputEntries[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = !0) await _loop1();
|
305
333
|
} catch (err) {
|
306
334
|
_didIteratorError1 = !0, _iteratorError1 = err;
|
307
335
|
} finally {
|
308
336
|
try {
|
309
337
|
!_iteratorNormalCompletion1 && _iterator1.return != null && _iterator1.return();
|
310
338
|
} finally {
|
311
|
-
if (_didIteratorError1)
|
312
|
-
throw _iteratorError1;
|
339
|
+
if (_didIteratorError1) throw _iteratorError1;
|
313
340
|
}
|
314
341
|
}
|
315
342
|
await moveAllFiles(staticDir, clientDir), await FSExtra.rm(staticDir, {
|
316
343
|
force: !0,
|
317
344
|
recursive: !0
|
318
345
|
});
|
319
|
-
var routeMap = {},
|
346
|
+
var routeMap = {},
|
347
|
+
_iteratorNormalCompletion2 = !0,
|
348
|
+
_didIteratorError2 = !1,
|
349
|
+
_iteratorError2 = void 0;
|
320
350
|
try {
|
321
351
|
for (var _iterator2 = builtRoutes[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
|
322
352
|
var route = _step2.value;
|
@@ -328,11 +358,13 @@ async function build(args) {
|
|
328
358
|
try {
|
329
359
|
!_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
|
330
360
|
} finally {
|
331
|
-
if (_didIteratorError2)
|
332
|
-
throw _iteratorError2;
|
361
|
+
if (_didIteratorError2) throw _iteratorError2;
|
333
362
|
}
|
334
363
|
}
|
335
|
-
var routeToBuildInfo = {},
|
364
|
+
var routeToBuildInfo = {},
|
365
|
+
_iteratorNormalCompletion3 = !0,
|
366
|
+
_didIteratorError3 = !1,
|
367
|
+
_iteratorError3 = void 0;
|
336
368
|
try {
|
337
369
|
for (var _iterator3 = builtRoutes[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = !0) {
|
338
370
|
var route1 = _step3.value;
|
@@ -344,16 +376,21 @@ async function build(args) {
|
|
344
376
|
try {
|
345
377
|
!_iteratorNormalCompletion3 && _iterator3.return != null && _iterator3.return();
|
346
378
|
} finally {
|
347
|
-
if (_didIteratorError3)
|
348
|
-
throw _iteratorError3;
|
379
|
+
if (_didIteratorError3) throw _iteratorError3;
|
349
380
|
}
|
350
381
|
}
|
351
382
|
function createBuildManifestRoute(route2) {
|
352
|
-
var {
|
353
|
-
|
354
|
-
|
383
|
+
var {
|
384
|
+
layouts,
|
385
|
+
...built
|
386
|
+
} = route2,
|
387
|
+
buildInfo = builtRoutes.find(function (x) {
|
388
|
+
return x.routeFile === route2.file;
|
389
|
+
});
|
355
390
|
if (built.middlewares && buildInfo?.middlewares) {
|
356
|
-
var _iteratorNormalCompletion4 = !0,
|
391
|
+
var _iteratorNormalCompletion4 = !0,
|
392
|
+
_didIteratorError4 = !1,
|
393
|
+
_iteratorError4 = void 0;
|
357
394
|
try {
|
358
395
|
for (var _iterator4 = built.middlewares.entries()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = !0) {
|
359
396
|
var [index, mw] = _step4.value;
|
@@ -365,8 +402,7 @@ async function build(args) {
|
|
365
402
|
try {
|
366
403
|
!_iteratorNormalCompletion4 && _iterator4.return != null && _iterator4.return();
|
367
404
|
} finally {
|
368
|
-
if (_didIteratorError4)
|
369
|
-
throw _iteratorError4;
|
405
|
+
if (_didIteratorError4) throw _iteratorError4;
|
370
406
|
}
|
371
407
|
}
|
372
408
|
}
|
@@ -385,16 +421,20 @@ async function build(args) {
|
|
385
421
|
}))
|
386
422
|
};
|
387
423
|
await FSExtra.writeJSON(toAbsolute("dist/buildInfo.json"), buildInfoForWriting);
|
388
|
-
var postBuildLogs = [],
|
424
|
+
var postBuildLogs = [],
|
425
|
+
_oneOptions_web_deploy,
|
426
|
+
platform = (_oneOptions_web_deploy = (_oneOptions_web = oneOptions.web) === null || _oneOptions_web === void 0 ? void 0 : _oneOptions_web.deploy) !== null && _oneOptions_web_deploy !== void 0 ? _oneOptions_web_deploy : (_options_server = options.server) === null || _options_server === void 0 ? void 0 : _options_server.platform;
|
389
427
|
switch (platform) {
|
390
|
-
case "vercel":
|
391
|
-
|
428
|
+
case "vercel":
|
429
|
+
{
|
430
|
+
await FSExtra.writeFile(join(options.root, "dist", "index.js"), `import { serve } from 'one/serve'
|
392
431
|
export const handler = await serve()
|
393
432
|
export const { GET, POST, PUT, PATCH, OPTIONS } = handler`), postBuildLogs.push(`wrote vercel entry to: ${join(".", "dist", "index.js")}`), postBuildLogs.push("point vercel outputDirectory to dist");
|
394
|
-
|
395
|
-
|
396
|
-
case "cloudflare":
|
397
|
-
|
433
|
+
break;
|
434
|
+
}
|
435
|
+
case "cloudflare":
|
436
|
+
{
|
437
|
+
await FSExtra.writeFile(join(options.root, "dist", "worker.js"), `import { serve } from 'one/serve-worker'
|
398
438
|
|
399
439
|
const buildInfo = ${JSON.stringify(buildInfoForWriting)}
|
400
440
|
|
@@ -405,12 +445,12 @@ export default {
|
|
405
445
|
}`), await FSExtra.writeFile(join(options.root, "dist", "wrangler.toml"), `assets = { directory = "client" }
|
406
446
|
compatibility_date = "2024-12-05"
|
407
447
|
`);
|
408
|
-
|
409
|
-
|
448
|
+
break;
|
449
|
+
}
|
410
450
|
}
|
411
451
|
process.env.VXRN_ANALYZE_BUNDLE && postBuildLogs.push(`client build report: ${toAbsolute("dist/report.html")}`), postBuildLogs.length && (console.info(`
|
412
452
|
|
413
|
-
`), postBuildLogs.forEach(function(log) {
|
453
|
+
`), postBuildLogs.forEach(function (log) {
|
414
454
|
console.info(` \xB7 ${log}`);
|
415
455
|
})), console.info(`
|
416
456
|
|
@@ -429,7 +469,11 @@ async function moveAllFiles(src, dest) {
|
|
429
469
|
}
|
430
470
|
}
|
431
471
|
function getPathnameFromFilePath(path) {
|
432
|
-
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
472
|
+
var params = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {},
|
473
|
+
strict = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1,
|
474
|
+
dirname = Path.dirname(path).replace(/\([^\/]+\)/gi, ""),
|
475
|
+
file = Path.basename(path),
|
476
|
+
fileName = file.replace(/\.[a-z]+$/, "");
|
433
477
|
function paramsError(part) {
|
434
478
|
throw new Error(`[one] Params doesn't fit route:
|
435
479
|
|
@@ -440,24 +484,21 @@ function getPathnameFromFilePath(path) {
|
|
440
484
|
|
441
485
|
${JSON.stringify(params, null, 2)}`);
|
442
486
|
}
|
443
|
-
var nameWithParams = function() {
|
444
|
-
if (fileName === "index")
|
445
|
-
return "/";
|
487
|
+
var nameWithParams = function () {
|
488
|
+
if (fileName === "index") return "/";
|
446
489
|
if (fileName.startsWith("[...")) {
|
447
490
|
var part = fileName.replace("[...", "").replace("]", "");
|
448
491
|
if (!params[part]) {
|
449
|
-
if (strict)
|
450
|
-
throw paramsError(part);
|
492
|
+
if (strict) throw paramsError(part);
|
451
493
|
return "/*";
|
452
494
|
}
|
453
495
|
return `/${params[part]}`;
|
454
496
|
}
|
455
|
-
return `/${fileName.split("/").map(function(part2) {
|
497
|
+
return `/${fileName.split("/").map(function (part2) {
|
456
498
|
if (part2[0] === "[") {
|
457
499
|
var found = params[part2.slice(1, part2.length - 1)];
|
458
500
|
if (!found) {
|
459
|
-
if (strict)
|
460
|
-
throw paramsError(part2);
|
501
|
+
if (strict) throw paramsError(part2);
|
461
502
|
return ":" + part2.replace("[", "").replace("]", "");
|
462
503
|
}
|
463
504
|
return found;
|
@@ -467,7 +508,5 @@ ${JSON.stringify(params, null, 2)}`);
|
|
467
508
|
}();
|
468
509
|
return `${dirname}${nameWithParams}`.replace(/\/\/+/gi, "/");
|
469
510
|
}
|
470
|
-
export {
|
471
|
-
|
472
|
-
};
|
473
|
-
//# sourceMappingURL=build.js.map
|
511
|
+
export { build };
|
512
|
+
//# sourceMappingURL=build.native.js.map
|