one 1.2.52 → 1.2.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/cli/build.cjs +11 -5
- package/dist/cjs/cli/build.js +11 -4
- package/dist/cjs/cli/build.js.map +1 -1
- package/dist/cjs/cli/build.native.js +9 -2
- package/dist/cjs/cli/build.native.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.test.js.map +1 -1
- package/dist/cjs/cli/generateSitemap.test.native.js.map +1 -1
- package/dist/cjs/createApp.cjs +11 -11
- package/dist/cjs/createApp.js +5 -4
- package/dist/cjs/createApp.js.map +1 -1
- package/dist/cjs/getDevServer.native.js.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/cjs/index.js +3 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js +3 -0
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/cjs/metro-config/getViteMetroPluginOptions.cjs +2 -2
- package/dist/cjs/metro-config/getViteMetroPluginOptions.js +1 -1
- package/dist/cjs/metro-config/getViteMetroPluginOptions.js.map +1 -1
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js +2 -2
- package/dist/cjs/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/cjs/router/Route.js.map +1 -1
- package/dist/cjs/router/Route.native.js.map +1 -1
- package/dist/cjs/router/getRoutes.cjs +2 -2
- package/dist/cjs/router/getRoutes.js +1 -2
- package/dist/cjs/router/getRoutes.js.map +1 -1
- package/dist/cjs/router/getRoutes.native.js.map +1 -1
- package/dist/cjs/router/matchers.test.js +7 -1
- package/dist/cjs/router/matchers.test.js.map +1 -1
- package/dist/cjs/router/matchers.test.native.js.map +1 -1
- package/dist/cjs/router/useScreens.js +25 -5
- package/dist/cjs/router/useScreens.js.map +1 -1
- package/dist/cjs/router/useScreens.native.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.cjs +1 -1
- package/dist/cjs/router/useViteRoutes.js +1 -1
- package/dist/cjs/router/useViteRoutes.js.map +1 -1
- package/dist/cjs/router/useViteRoutes.native.js.map +1 -1
- package/dist/cjs/server/getServerManifest.js +3 -1
- package/dist/cjs/server/getServerManifest.js.map +1 -1
- package/dist/cjs/server/getServerManifest.native.js.map +1 -1
- package/dist/cjs/server/oneServe.js +7 -2
- package/dist/cjs/server/oneServe.js.map +1 -1
- package/dist/cjs/server/oneServe.native.js.map +1 -1
- package/dist/cjs/typed-routes/generateRouteTypes.cjs +2 -2
- package/dist/cjs/typed-routes/generateRouteTypes.js +1 -1
- package/dist/cjs/typed-routes/generateRouteTypes.js.map +1 -1
- package/dist/cjs/typed-routes/generateRouteTypes.native.js +2 -2
- package/dist/cjs/typed-routes/generateRouteTypes.native.js.map +1 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.cjs +2 -2
- package/dist/cjs/typed-routes/injectRouteHelpers.js +1 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.js.map +1 -1
- package/dist/cjs/typed-routes/injectRouteHelpers.native.js +2 -2
- package/dist/cjs/typed-routes/injectRouteHelpers.native.js.map +1 -1
- package/dist/cjs/ui/TabSlot.cjs +1 -1
- package/dist/cjs/ui/TabSlot.js +1 -1
- package/dist/cjs/ui/TabSlot.js.map +1 -1
- package/dist/cjs/ui/TabSlot.native.js +2 -2
- package/dist/cjs/ui/TabSlot.native.js.map +1 -1
- package/dist/cjs/ui/TabTrigger.cjs +1 -1
- package/dist/cjs/ui/TabTrigger.js +1 -1
- package/dist/cjs/ui/TabTrigger.js.map +1 -1
- package/dist/cjs/ui/TabTrigger.native.js +1 -1
- package/dist/cjs/ui/TabTrigger.native.js.map +1 -1
- package/dist/cjs/ui/Tabs.cjs +7 -7
- package/dist/cjs/ui/Tabs.js +5 -2
- package/dist/cjs/ui/Tabs.js.map +1 -1
- package/dist/cjs/ui/Tabs.native.js +7 -7
- package/dist/cjs/ui/Tabs.native.js.map +1 -1
- package/dist/cjs/ui/common.cjs +1 -1
- package/dist/cjs/ui/common.js +1 -1
- package/dist/cjs/ui/common.js.map +1 -1
- package/dist/cjs/ui/common.native.js +1 -1
- package/dist/cjs/ui/common.native.js.map +1 -1
- package/dist/cjs/useLoader.cjs +1 -0
- package/dist/cjs/useLoader.js +1 -0
- package/dist/cjs/useLoader.js.map +1 -1
- package/dist/cjs/useLoader.native.js +1 -0
- package/dist/cjs/useLoader.native.js.map +1 -1
- package/dist/cjs/utils/promiseWithResolvers.cjs +4 -5
- package/dist/cjs/utils/promiseWithResolvers.js +2 -1
- package/dist/cjs/utils/promiseWithResolvers.js.map +1 -1
- package/dist/cjs/utils/promiseWithResolvers.native.js.map +1 -1
- package/dist/cjs/utils/trackLoaderDependencies.cjs +51 -0
- package/dist/cjs/utils/trackLoaderDependencies.js +40 -0
- package/dist/cjs/utils/trackLoaderDependencies.js.map +6 -0
- package/dist/cjs/utils/trackLoaderDependencies.native.js +57 -0
- package/dist/cjs/utils/trackLoaderDependencies.native.js.map +1 -0
- package/dist/cjs/utils/watchFile.cjs +35 -0
- package/dist/cjs/utils/watchFile.js +30 -0
- package/dist/cjs/utils/watchFile.js.map +6 -0
- package/dist/cjs/utils/watchFile.native.js +39 -0
- package/dist/cjs/utils/watchFile.native.js.map +1 -0
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.js.map +1 -1
- package/dist/cjs/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/cjs/vercel/build/config/vc-build-output-config-base.cjs +2 -0
- package/dist/cjs/vercel/build/config/vc-build-output-config-base.js +2 -0
- package/dist/cjs/vercel/build/config/vc-build-output-config-base.js.map +1 -1
- package/dist/cjs/vercel/build/config/vc-build-output-config-base.native.js +2 -0
- package/dist/cjs/vercel/build/config/vc-build-output-config-base.native.js.map +1 -1
- package/dist/cjs/vite/DevHead.cjs +22 -0
- package/dist/cjs/vite/DevHead.js +26 -0
- package/dist/cjs/vite/DevHead.js.map +1 -1
- package/dist/cjs/vite/one.cjs +5 -4
- package/dist/cjs/vite/one.js +2 -1
- package/dist/cjs/vite/one.js.map +1 -1
- package/dist/cjs/vite/one.native.js +5 -4
- package/dist/cjs/vite/one.native.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.cjs +7 -7
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js +2 -3
- package/dist/cjs/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js +4 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/cjs/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.cjs +34 -7
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js +43 -7
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.js.map +2 -2
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js +82 -21
- package/dist/cjs/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/cjs/vite/plugins/imageDataPlugin.cjs +107 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.js +85 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.js.map +6 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.native.js +115 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.native.js.map +1 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.test.cjs +214 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.test.js +184 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.test.js.map +6 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.test.native.js +228 -0
- package/dist/cjs/vite/plugins/imageDataPlugin.test.native.js.map +1 -0
- package/dist/cjs/zero/useQuery.cjs +2 -2
- package/dist/cjs/zero/useQuery.js +1 -2
- package/dist/cjs/zero/useQuery.js.map +1 -1
- package/dist/cjs/zero/useQuery.native.js.map +1 -1
- package/dist/esm/cli/build.js +11 -4
- package/dist/esm/cli/build.js.map +1 -1
- package/dist/esm/cli/build.mjs +10 -4
- package/dist/esm/cli/build.mjs.map +1 -1
- package/dist/esm/cli/build.native.js +8 -1
- package/dist/esm/cli/build.native.js.map +1 -1
- package/dist/esm/cli/buildPage.js +1 -1
- package/dist/esm/cli/buildPage.js.map +1 -1
- package/dist/esm/cli/buildPage.mjs +1 -1
- package/dist/esm/cli/buildPage.mjs.map +1 -1
- package/dist/esm/cli/buildPage.native.js +1 -1
- package/dist/esm/cli/buildPage.native.js.map +1 -1
- package/dist/esm/cli/generateSitemap.test.js +1 -1
- package/dist/esm/cli/generateSitemap.test.js.map +1 -1
- package/dist/esm/cli/generateSitemap.test.mjs +1 -1
- package/dist/esm/cli/generateSitemap.test.mjs.map +1 -1
- package/dist/esm/cli/generateSitemap.test.native.js +1 -1
- package/dist/esm/cli/generateSitemap.test.native.js.map +1 -1
- package/dist/esm/createApp.js +5 -4
- package/dist/esm/createApp.js.map +1 -1
- package/dist/esm/createApp.mjs +11 -11
- package/dist/esm/createApp.mjs.map +1 -1
- package/dist/esm/getDevServer.native.js.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +3 -2
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +3 -2
- package/dist/esm/index.native.js.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.js +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.js.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.mjs.map +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js +1 -1
- package/dist/esm/metro-config/getViteMetroPluginOptions.native.js.map +1 -1
- package/dist/esm/router/Route.js.map +1 -1
- package/dist/esm/router/Route.mjs.map +1 -1
- package/dist/esm/router/Route.native.js.map +1 -1
- package/dist/esm/router/getRoutes.js +1 -2
- package/dist/esm/router/getRoutes.js.map +1 -1
- package/dist/esm/router/getRoutes.mjs +2 -2
- package/dist/esm/router/getRoutes.mjs.map +1 -1
- package/dist/esm/router/getRoutes.native.js.map +1 -1
- package/dist/esm/router/matchers.test.js +7 -1
- package/dist/esm/router/matchers.test.js.map +1 -1
- package/dist/esm/router/matchers.test.mjs.map +1 -1
- package/dist/esm/router/matchers.test.native.js.map +1 -1
- package/dist/esm/router/router.js +1 -1
- package/dist/esm/router/router.js.map +1 -1
- package/dist/esm/router/router.mjs +1 -1
- package/dist/esm/router/router.mjs.map +1 -1
- package/dist/esm/router/router.native.js +1 -1
- package/dist/esm/router/router.native.js.map +1 -1
- package/dist/esm/router/useScreens.js +25 -5
- 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.map +1 -1
- package/dist/esm/router/useViteRoutes.js +1 -1
- package/dist/esm/router/useViteRoutes.js.map +1 -1
- package/dist/esm/router/useViteRoutes.mjs +1 -1
- package/dist/esm/router/useViteRoutes.mjs.map +1 -1
- package/dist/esm/router/useViteRoutes.native.js.map +1 -1
- package/dist/esm/serve-worker.js +1 -1
- package/dist/esm/serve-worker.mjs +1 -1
- package/dist/esm/serve-worker.mjs.map +1 -1
- package/dist/esm/serve-worker.native.js +1 -1
- package/dist/esm/serve-worker.native.js.map +1 -1
- package/dist/esm/server/getServerManifest.js +3 -1
- package/dist/esm/server/getServerManifest.js.map +1 -1
- package/dist/esm/server/getServerManifest.mjs.map +1 -1
- package/dist/esm/server/getServerManifest.native.js.map +1 -1
- package/dist/esm/server/oneServe.js +7 -2
- package/dist/esm/server/oneServe.js.map +1 -1
- package/dist/esm/server/oneServe.mjs.map +1 -1
- package/dist/esm/server/oneServe.native.js.map +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.js +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.js.map +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.mjs +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.mjs.map +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.native.js +1 -1
- package/dist/esm/typed-routes/generateRouteTypes.native.js.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.js +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.js.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.mjs +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.mjs.map +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.native.js +1 -1
- package/dist/esm/typed-routes/injectRouteHelpers.native.js.map +1 -1
- package/dist/esm/ui/Slot.js.map +1 -1
- package/dist/esm/ui/Slot.mjs.map +1 -1
- package/dist/esm/ui/Slot.native.js.map +1 -1
- package/dist/esm/ui/TabList.js +1 -1
- package/dist/esm/ui/TabList.js.map +1 -1
- package/dist/esm/ui/TabList.mjs +1 -1
- package/dist/esm/ui/TabList.mjs.map +1 -1
- package/dist/esm/ui/TabList.native.js +1 -1
- package/dist/esm/ui/TabList.native.js.map +1 -1
- package/dist/esm/ui/TabRouter.js.map +1 -1
- package/dist/esm/ui/TabRouter.mjs.map +1 -1
- package/dist/esm/ui/TabRouter.native.js.map +1 -1
- package/dist/esm/ui/TabSlot.js +2 -2
- package/dist/esm/ui/TabSlot.js.map +1 -1
- package/dist/esm/ui/TabSlot.mjs +2 -2
- package/dist/esm/ui/TabSlot.mjs.map +1 -1
- package/dist/esm/ui/TabSlot.native.js +2 -2
- package/dist/esm/ui/TabSlot.native.js.map +1 -1
- package/dist/esm/ui/TabTrigger.js +3 -3
- package/dist/esm/ui/TabTrigger.js.map +1 -1
- package/dist/esm/ui/TabTrigger.mjs +2 -2
- package/dist/esm/ui/TabTrigger.mjs.map +1 -1
- package/dist/esm/ui/TabTrigger.native.js +2 -2
- package/dist/esm/ui/TabTrigger.native.js.map +1 -1
- package/dist/esm/ui/Tabs.js +10 -7
- package/dist/esm/ui/Tabs.js.map +1 -1
- package/dist/esm/ui/Tabs.mjs +6 -6
- package/dist/esm/ui/Tabs.mjs.map +1 -1
- package/dist/esm/ui/Tabs.native.js +6 -6
- package/dist/esm/ui/Tabs.native.js.map +1 -1
- package/dist/esm/ui/common.js +3 -3
- package/dist/esm/ui/common.js.map +1 -1
- package/dist/esm/ui/common.mjs +1 -1
- package/dist/esm/ui/common.mjs.map +1 -1
- package/dist/esm/ui/common.native.js +1 -1
- package/dist/esm/ui/common.native.js.map +1 -1
- package/dist/esm/ui/useComponent.js +1 -1
- package/dist/esm/ui/useComponent.js.map +1 -1
- package/dist/esm/ui/useComponent.mjs +1 -1
- package/dist/esm/ui/useComponent.mjs.map +1 -1
- package/dist/esm/ui/useComponent.native.js +1 -1
- package/dist/esm/ui/useComponent.native.js.map +1 -1
- package/dist/esm/useLoader.js +1 -0
- package/dist/esm/useLoader.js.map +1 -1
- package/dist/esm/useLoader.mjs +1 -0
- package/dist/esm/useLoader.mjs.map +1 -1
- package/dist/esm/useLoader.native.js +1 -0
- package/dist/esm/useLoader.native.js.map +1 -1
- package/dist/esm/utils/cleanUrl.js +1 -1
- package/dist/esm/utils/cleanUrl.mjs +1 -1
- package/dist/esm/utils/cleanUrl.mjs.map +1 -1
- package/dist/esm/utils/cleanUrl.native.js +1 -1
- package/dist/esm/utils/cleanUrl.native.js.map +1 -1
- package/dist/esm/utils/promiseWithResolvers.js +2 -1
- package/dist/esm/utils/promiseWithResolvers.js.map +1 -1
- package/dist/esm/utils/promiseWithResolvers.mjs +4 -5
- package/dist/esm/utils/promiseWithResolvers.mjs.map +1 -1
- package/dist/esm/utils/promiseWithResolvers.native.js.map +1 -1
- package/dist/esm/utils/trackLoaderDependencies.js +25 -0
- package/dist/esm/utils/trackLoaderDependencies.js.map +6 -0
- package/dist/esm/utils/trackLoaderDependencies.mjs +28 -0
- package/dist/esm/utils/trackLoaderDependencies.mjs.map +1 -0
- package/dist/esm/utils/trackLoaderDependencies.native.js +31 -0
- package/dist/esm/utils/trackLoaderDependencies.native.js.map +1 -0
- package/dist/esm/utils/watchFile.js +14 -0
- package/dist/esm/utils/watchFile.js.map +6 -0
- package/dist/esm/utils/watchFile.mjs +11 -0
- package/dist/esm/utils/watchFile.mjs.map +1 -0
- package/dist/esm/utils/watchFile.native.js +12 -0
- package/dist/esm/utils/watchFile.native.js.map +1 -0
- package/dist/esm/vercel/build/buildVercelOutputDirectory.js.map +1 -1
- package/dist/esm/vercel/build/buildVercelOutputDirectory.mjs.map +1 -1
- package/dist/esm/vercel/build/buildVercelOutputDirectory.native.js.map +1 -1
- package/dist/esm/vercel/build/config/vc-build-output-config-base.js +2 -0
- package/dist/esm/vercel/build/config/vc-build-output-config-base.js.map +1 -1
- package/dist/esm/vercel/build/config/vc-build-output-config-base.mjs +2 -0
- package/dist/esm/vercel/build/config/vc-build-output-config-base.mjs.map +1 -1
- package/dist/esm/vercel/build/config/vc-build-output-config-base.native.js +2 -0
- package/dist/esm/vercel/build/config/vc-build-output-config-base.native.js.map +1 -1
- package/dist/esm/vite/DevHead.js +26 -0
- package/dist/esm/vite/DevHead.js.map +1 -1
- package/dist/esm/vite/DevHead.mjs +22 -0
- package/dist/esm/vite/DevHead.mjs.map +1 -1
- package/dist/esm/vite/one.js +4 -2
- package/dist/esm/vite/one.js.map +1 -1
- package/dist/esm/vite/one.mjs +4 -3
- package/dist/esm/vite/one.mjs.map +1 -1
- package/dist/esm/vite/one.native.js +4 -3
- package/dist/esm/vite/one.native.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.js +2 -3
- package/dist/esm/vite/plugins/SSRCSSPlugin.js.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs +7 -7
- package/dist/esm/vite/plugins/SSRCSSPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/SSRCSSPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js +4 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.js.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/clientTreeShakePlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js +43 -6
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.js.map +2 -2
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs +34 -7
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.mjs.map +1 -1
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js +82 -21
- package/dist/esm/vite/plugins/fileSystemRouterPlugin.native.js.map +1 -1
- package/dist/esm/vite/plugins/imageDataPlugin.js +62 -0
- package/dist/esm/vite/plugins/imageDataPlugin.js.map +6 -0
- package/dist/esm/vite/plugins/imageDataPlugin.mjs +73 -0
- package/dist/esm/vite/plugins/imageDataPlugin.mjs.map +1 -0
- package/dist/esm/vite/plugins/imageDataPlugin.native.js +78 -0
- package/dist/esm/vite/plugins/imageDataPlugin.native.js.map +1 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.js +165 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.js.map +6 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.mjs +193 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.mjs.map +1 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.native.js +204 -0
- package/dist/esm/vite/plugins/imageDataPlugin.test.native.js.map +1 -0
- package/dist/esm/zero/useQuery.js +1 -2
- package/dist/esm/zero/useQuery.js.map +1 -1
- package/dist/esm/zero/useQuery.mjs +2 -2
- package/dist/esm/zero/useQuery.mjs.map +1 -1
- package/dist/esm/zero/useQuery.native.js.map +1 -1
- package/package.json +14 -10
- package/src/cli/build.ts +18 -3
- package/src/cli/buildPage.ts +1 -1
- package/src/cli/generateSitemap.test.ts +2 -2
- package/src/createApp.native.tsx +1 -1
- package/src/createApp.tsx +5 -3
- package/src/createMiddleware.ts +1 -1
- package/src/getDevServer.native.ts +0 -2
- package/src/index.ts +20 -1
- package/src/interfaces/router.ts +6 -2
- package/src/metro-config/getViteMetroPluginOptions.ts +2 -2
- package/src/router/Route.tsx +5 -1
- package/src/router/getRoutes.ts +1 -1
- package/src/router/matchers.test.ts +8 -2
- package/src/router/router.ts +1 -1
- package/src/router/useScreens.tsx +19 -3
- package/src/router/useViteRoutes.tsx +1 -1
- package/src/serve-worker.ts +1 -1
- package/src/server/getServerManifest.ts +3 -1
- package/src/server/oneServe.ts +9 -4
- package/src/typed-routes/generateRouteTypes.ts +2 -2
- package/src/typed-routes/injectRouteHelpers.ts +1 -1
- package/src/ui/Slot.tsx +3 -3
- package/src/ui/TabList.tsx +2 -2
- package/src/ui/TabRouter.tsx +2 -2
- package/src/ui/TabSlot.tsx +2 -3
- package/src/ui/TabTrigger.tsx +8 -9
- package/src/ui/Tabs.tsx +15 -13
- package/src/ui/common.tsx +5 -6
- package/src/ui/useComponent.tsx +1 -1
- package/src/useLoader.ts +4 -0
- package/src/utils/cleanUrl.ts +1 -1
- package/src/utils/promiseWithResolvers.ts +1 -1
- package/src/utils/trackLoaderDependencies.ts +53 -0
- package/src/utils/watchFile.ts +19 -0
- package/src/vercel/build/buildVercelOutputDirectory.ts +1 -1
- package/src/vercel/build/config/vc-build-output-config-base.ts +2 -0
- package/src/vite/DevHead.tsx +23 -0
- package/src/vite/one.ts +5 -2
- package/src/vite/plugins/SSRCSSPlugin.ts +2 -2
- package/src/vite/plugins/clientTreeShakePlugin.ts +4 -1
- package/src/vite/plugins/fileSystemRouterPlugin.tsx +76 -3
- package/src/vite/plugins/imageDataPlugin.test.ts +316 -0
- package/src/vite/plugins/imageDataPlugin.ts +120 -0
- package/src/vite/types.ts +1 -1
- package/src/zero/useQuery.ts +1 -1
- package/types/cli/build.d.ts.map +1 -1
- package/types/createApp.d.ts.map +1 -1
- package/types/createMiddleware.d.ts +1 -2
- package/types/createMiddleware.d.ts.map +1 -1
- package/types/env.d.ts +23 -0
- package/types/getDevServer.native.d.ts.map +1 -1
- package/types/index.d.ts +19 -1
- package/types/index.d.ts.map +1 -1
- package/types/interfaces/router.d.ts.map +1 -1
- package/types/layouts/Drawer.d.ts +2 -2
- package/types/layouts/Stack.d.ts +2 -2
- package/types/layouts/Tabs.d.ts +2 -2
- package/types/metro-config/getViteMetroPluginOptions.d.ts.map +1 -1
- package/types/router/Route.d.ts.map +1 -1
- package/types/serve-worker.d.ts +1 -1
- package/types/server/getServerManifest.d.ts.map +1 -1
- package/types/server/oneServe.d.ts.map +1 -1
- package/types/ui/Slot.d.ts +1 -1
- package/types/ui/Slot.d.ts.map +1 -1
- package/types/ui/TabList.d.ts +1 -1
- package/types/ui/TabList.d.ts.map +1 -1
- package/types/ui/TabRouter.d.ts +1 -1
- package/types/ui/TabRouter.d.ts.map +1 -1
- package/types/ui/TabSlot.d.ts.map +1 -1
- package/types/ui/TabTrigger.d.ts +3 -3
- package/types/ui/TabTrigger.d.ts.map +1 -1
- package/types/ui/Tabs.d.ts +17 -2
- package/types/ui/Tabs.d.ts.map +1 -1
- package/types/ui/common.d.ts +2 -2
- package/types/ui/common.d.ts.map +1 -1
- package/types/ui/useComponent.d.ts.map +1 -1
- package/types/useLoader.d.ts.map +1 -1
- package/types/utils/trackLoaderDependencies.d.ts +6 -0
- package/types/utils/trackLoaderDependencies.d.ts.map +1 -0
- package/types/utils/watchFile.d.ts +8 -0
- package/types/utils/watchFile.d.ts.map +1 -0
- package/types/vercel/build/config/vc-build-output-config-base.d.ts.map +1 -1
- package/types/vite/DevHead.d.ts.map +1 -1
- package/types/vite/one.d.ts.map +1 -1
- package/types/vite/plugins/clientTreeShakePlugin.d.ts.map +1 -1
- package/types/vite/plugins/fileSystemRouterPlugin.d.ts.map +1 -1
- package/types/vite/plugins/imageDataPlugin.d.ts +3 -0
- package/types/vite/plugins/imageDataPlugin.d.ts.map +1 -0
- package/types/vite/plugins/imageDataPlugin.test.d.ts +2 -0
- package/types/vite/plugins/imageDataPlugin.test.d.ts.map +1 -0
- package/types/vite/types.d.ts +1 -1
- package/types/vite/types.d.ts.map +1 -1
package/src/serve-worker.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { ensureExists } from './utils/ensureExists'
|
|
|
5
5
|
import type { One } from './vite/types'
|
|
6
6
|
|
|
7
7
|
// Re-export static HTML fetcher utilities for worker use
|
|
8
|
-
export {
|
|
8
|
+
export { getFetchStaticHtml, setFetchStaticHtml } from './server/staticHtmlFetcher'
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* Lazy import functions for route modules.
|
|
@@ -237,7 +237,9 @@ function getPathMeta(route: string) {
|
|
|
237
237
|
cleanedKey = getSafeRouteKey()
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
urlPathParts.push({
|
|
240
|
+
urlPathParts.push({
|
|
241
|
+
content: repeat ? '/*' : `/:${name}${optional ? '?' : ''}`,
|
|
242
|
+
})
|
|
241
243
|
routeKeys[cleanedKey] = name
|
|
242
244
|
|
|
243
245
|
return repeat
|
package/src/server/oneServe.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Hono, MiddlewareHandler } from 'hono'
|
|
2
|
-
import type { BlankEnv } from 'hono/types'
|
|
3
1
|
import { readFile } from 'node:fs/promises'
|
|
4
2
|
import { extname, join, resolve } from 'node:path'
|
|
3
|
+
import type { Hono, MiddlewareHandler } from 'hono'
|
|
4
|
+
import type { BlankEnv } from 'hono/types'
|
|
5
5
|
import {
|
|
6
6
|
CSS_PRELOAD_JS_POSTFIX,
|
|
7
7
|
LOADER_JS_POSTFIX_UNCACHED,
|
|
@@ -232,7 +232,10 @@ url: ${url}`)
|
|
|
232
232
|
if (html) {
|
|
233
233
|
const headers = new Headers()
|
|
234
234
|
headers.set('content-type', 'text/html')
|
|
235
|
-
return new Response(html, {
|
|
235
|
+
return new Response(html, {
|
|
236
|
+
headers,
|
|
237
|
+
status: route.isNotFound ? 404 : 200,
|
|
238
|
+
})
|
|
236
239
|
}
|
|
237
240
|
}
|
|
238
241
|
}
|
|
@@ -256,7 +259,9 @@ url: ${url}`)
|
|
|
256
259
|
// If there's no matching not-found or dynamic route, it's very likely that One won't handle it and will fallback to VxRN serving the static asset so it will also work.
|
|
257
260
|
// Note: serveStaticAssets is optional - workers handle static assets via platform config
|
|
258
261
|
if (options?.serveStaticAssets) {
|
|
259
|
-
const staticAssetResponse = await options.serveStaticAssets({
|
|
262
|
+
const staticAssetResponse = await options.serveStaticAssets({
|
|
263
|
+
context,
|
|
264
|
+
})
|
|
260
265
|
if (staticAssetResponse) {
|
|
261
266
|
return await runMiddlewares(
|
|
262
267
|
requestHandlers,
|
|
@@ -2,12 +2,12 @@ import { writeFile } from 'node:fs/promises'
|
|
|
2
2
|
import { dirname, join } from 'node:path'
|
|
3
3
|
import FSExtra from 'fs-extra'
|
|
4
4
|
import micromatch from 'micromatch'
|
|
5
|
+
import { removeSupportedExtensions } from '../router/matchers'
|
|
5
6
|
import { globbedRoutesToRouteContext } from '../router/useViteRoutes'
|
|
6
7
|
import { globDir } from '../utils/globDir'
|
|
7
8
|
import type { One } from '../vite/types'
|
|
8
9
|
import { getTypedRoutesDeclarationFile } from './getTypedRoutesDeclarationFile'
|
|
9
|
-
import {
|
|
10
|
-
import { removeSupportedExtensions } from '../router/matchers'
|
|
10
|
+
import { type InjectMode, injectRouteHelpers } from './injectRouteHelpers'
|
|
11
11
|
|
|
12
12
|
export async function generateRouteTypes(
|
|
13
13
|
outFile: string,
|
package/src/ui/Slot.tsx
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Slot as RUISlot } from '@radix-ui/react-slot'
|
|
2
2
|
import {
|
|
3
|
-
forwardRef,
|
|
4
|
-
useMemo,
|
|
5
|
-
type ForwardRefExoticComponent,
|
|
6
3
|
type Component,
|
|
4
|
+
type ForwardRefExoticComponent,
|
|
5
|
+
forwardRef,
|
|
7
6
|
type RefAttributes,
|
|
7
|
+
useMemo,
|
|
8
8
|
} from 'react'
|
|
9
9
|
import { StyleSheet, type ViewProps } from 'react-native'
|
|
10
10
|
|
package/src/ui/TabList.tsx
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import {
|
|
1
|
+
import type { ComponentProps, ReactElement } from 'react'
|
|
2
|
+
import { StyleSheet, View, type ViewProps } from 'react-native'
|
|
3
3
|
|
|
4
4
|
import { ViewSlot } from './common'
|
|
5
5
|
|
package/src/ui/TabRouter.tsx
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
type CommonNavigationAction,
|
|
3
3
|
type ParamListBase,
|
|
4
|
+
type TabActionType as RNTabActionType,
|
|
4
5
|
TabRouter as RNTabRouter,
|
|
6
|
+
type TabRouterOptions as RNTabRouterOptions,
|
|
5
7
|
type Router,
|
|
6
|
-
type TabActionType as RNTabActionType,
|
|
7
8
|
type TabNavigationState,
|
|
8
|
-
type TabRouterOptions as RNTabRouterOptions,
|
|
9
9
|
} from '@react-navigation/native'
|
|
10
10
|
|
|
11
11
|
import type { TriggerMap } from './common'
|
package/src/ui/TabSlot.tsx
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { type ComponentProps, type ReactElement, useState } from 'react'
|
|
2
2
|
import { Platform, StyleSheet } from 'react-native'
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { Screen, ScreenContainer } from 'react-native-screens'
|
|
4
|
+
import { useNavigatorContext } from '../views/Navigator'
|
|
5
5
|
import { TabContext, type TabsDescriptor } from './TabContext'
|
|
6
6
|
import type { TabListProps } from './TabList'
|
|
7
|
-
import { useNavigatorContext } from '../views/Navigator'
|
|
8
7
|
|
|
9
8
|
export type TabSlotProps = ComponentProps<typeof ScreenContainer> & {
|
|
10
9
|
/**
|
package/src/ui/TabTrigger.tsx
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import { Slot } from '@radix-ui/react-slot'
|
|
2
2
|
import type { TabNavigationState } from '@react-navigation/native'
|
|
3
3
|
import {
|
|
4
|
+
type ComponentProps,
|
|
5
|
+
type ReactElement,
|
|
4
6
|
type ReactNode,
|
|
5
7
|
use,
|
|
6
|
-
type ReactElement,
|
|
7
|
-
type ComponentProps,
|
|
8
8
|
useCallback,
|
|
9
9
|
} from 'react'
|
|
10
10
|
import {
|
|
11
|
-
type
|
|
12
|
-
StyleSheet,
|
|
11
|
+
type GestureResponderEvent,
|
|
13
12
|
Pressable,
|
|
14
13
|
type PressableProps,
|
|
15
|
-
|
|
14
|
+
StyleSheet,
|
|
15
|
+
type View,
|
|
16
16
|
} from 'react-native'
|
|
17
|
-
|
|
18
|
-
import { TabTriggerMapContext } from './TabContext'
|
|
19
|
-
import type { TriggerMap } from './common'
|
|
20
17
|
import { appendBaseUrl } from '../fork/getPathFromState-mods'
|
|
18
|
+
import type { OneRouter } from '../interfaces/router'
|
|
21
19
|
import { router } from '../router/imperative-api'
|
|
22
20
|
import { stripGroupSegmentsFromPath } from '../router/matchers'
|
|
23
|
-
import type { OneRouter } from '../interfaces/router'
|
|
24
21
|
import { useNavigatorContext } from '../views/Navigator'
|
|
22
|
+
import type { TriggerMap } from './common'
|
|
23
|
+
import { TabTriggerMapContext } from './TabContext'
|
|
25
24
|
|
|
26
25
|
type PressablePropsWithoutFunctionChildren = Omit<PressableProps, 'children'> & {
|
|
27
26
|
children?: ReactNode | undefined
|
package/src/ui/Tabs.tsx
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { RouterFactory } from '@react-navigation/native'
|
|
1
2
|
import {
|
|
2
3
|
type DefaultNavigatorOptions,
|
|
3
4
|
LinkingContext,
|
|
@@ -11,33 +12,31 @@ import {
|
|
|
11
12
|
Children,
|
|
12
13
|
type ComponentProps,
|
|
13
14
|
Fragment,
|
|
15
|
+
isValidElement,
|
|
16
|
+
type PropsWithChildren,
|
|
14
17
|
type ReactElement,
|
|
15
18
|
type ReactNode,
|
|
16
|
-
isValidElement,
|
|
17
19
|
use,
|
|
18
20
|
useMemo,
|
|
19
|
-
type PropsWithChildren,
|
|
20
21
|
} from 'react'
|
|
21
|
-
import { StyleSheet, type ViewProps
|
|
22
|
-
|
|
22
|
+
import { StyleSheet, View, type ViewProps } from 'react-native'
|
|
23
|
+
import { useRouteInfo } from '../hooks'
|
|
24
|
+
import { resolveHref } from '../link/href'
|
|
25
|
+
import { useContextKey, useRouteNode } from '../router/Route'
|
|
26
|
+
import { shouldLinkExternally } from '../utils/url'
|
|
27
|
+
import { NavigatorContext } from '../views/Navigator'
|
|
28
|
+
import { type ScreenTrigger, triggersToScreens, ViewSlot } from './common'
|
|
23
29
|
import {
|
|
24
30
|
type ExpoTabsScreenOptions,
|
|
25
31
|
type TabNavigationEventMap,
|
|
26
|
-
TabTriggerMapContext,
|
|
27
32
|
type TabsContextValue,
|
|
33
|
+
TabTriggerMapContext,
|
|
28
34
|
} from './TabContext'
|
|
29
35
|
import { isTabList } from './TabList'
|
|
30
36
|
import { ExpoTabRouter, type ExpoTabRouterOptions } from './TabRouter'
|
|
31
37
|
import { isTabSlot } from './TabSlot'
|
|
32
38
|
import { isTabTrigger } from './TabTrigger'
|
|
33
|
-
import { ViewSlot, type ScreenTrigger, triggersToScreens } from './common'
|
|
34
39
|
import { useComponent } from './useComponent'
|
|
35
|
-
import { useRouteNode, useContextKey } from '../router/Route'
|
|
36
|
-
import { useRouteInfo } from '../hooks'
|
|
37
|
-
import { resolveHref } from '../link/href'
|
|
38
|
-
import { shouldLinkExternally } from '../utils/url'
|
|
39
|
-
import { NavigatorContext } from '../views/Navigator'
|
|
40
|
-
import type { RouterFactory } from '@react-navigation/native'
|
|
41
40
|
|
|
42
41
|
type NavigatorContextValue = {
|
|
43
42
|
contextKey: string
|
|
@@ -140,7 +139,10 @@ export type UseTabsWithTriggersOptions = UseTabsOptions & {
|
|
|
140
139
|
*/
|
|
141
140
|
export function useTabsWithChildren(options: UseTabsWithChildrenOptions) {
|
|
142
141
|
const { children, ...rest } = options
|
|
143
|
-
return useTabsWithTriggers({
|
|
142
|
+
return useTabsWithTriggers({
|
|
143
|
+
triggers: parseTriggersFromChildren(children),
|
|
144
|
+
...rest,
|
|
145
|
+
})
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
/**
|
package/src/ui/common.tsx
CHANGED
|
@@ -4,19 +4,18 @@ import type {
|
|
|
4
4
|
PartialRoute,
|
|
5
5
|
Route,
|
|
6
6
|
} from '@react-navigation/native'
|
|
7
|
-
|
|
8
|
-
import
|
|
7
|
+
import type { OneRouter } from '../interfaces/router'
|
|
8
|
+
import { resolveHref } from '../link/href'
|
|
9
9
|
import type { UrlObject } from '../router/getNormalizedStatePath'
|
|
10
10
|
import type { RouteNode } from '../router/Route'
|
|
11
|
-
import { resolveHref } from '../link/href'
|
|
12
11
|
import { sortRoutesWithInitial } from '../router/sortRoutes'
|
|
13
|
-
import type { OneRouter } from '../interfaces/router'
|
|
14
|
-
import { Slot } from './Slot'
|
|
15
12
|
import {
|
|
16
|
-
Screen,
|
|
17
13
|
createGetIdForRoute,
|
|
18
14
|
getQualifiedRouteComponent,
|
|
15
|
+
Screen,
|
|
19
16
|
} from '../router/useScreens'
|
|
17
|
+
import { Slot } from './Slot'
|
|
18
|
+
import type { ExpoTabActionType } from './TabRouter'
|
|
20
19
|
|
|
21
20
|
export const ViewSlot = Slot
|
|
22
21
|
|
package/src/ui/useComponent.tsx
CHANGED
package/src/useLoader.ts
CHANGED
|
@@ -71,6 +71,10 @@ export async function refetchLoader(pathname: string): Promise<void> {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
if (typeof window !== 'undefined') {
|
|
75
|
+
;(window as any).__oneRefetchLoader = refetchLoader
|
|
76
|
+
}
|
|
77
|
+
|
|
74
78
|
export function useLoaderState<
|
|
75
79
|
Loader extends Function = any,
|
|
76
80
|
Returned = Loader extends (p: any) => any ? ReturnType<Loader> : unknown,
|
package/src/utils/cleanUrl.ts
CHANGED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { AsyncLocalStorage } from 'node:async_hooks'
|
|
2
|
+
import { _registerWatchFileImpl } from './watchFile'
|
|
3
|
+
|
|
4
|
+
export type LoaderResult<T> = {
|
|
5
|
+
result: T
|
|
6
|
+
dependencies: Set<string>
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const LOADER_DEPS_KEY = '__oneLoaderDepsContext'
|
|
10
|
+
|
|
11
|
+
type LoaderDepsStore = {
|
|
12
|
+
deps: Set<string>
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const LOADER_DEPS_STORE = {
|
|
16
|
+
get current(): AsyncLocalStorage<LoaderDepsStore> {
|
|
17
|
+
if (globalThis[LOADER_DEPS_KEY]) return globalThis[LOADER_DEPS_KEY]
|
|
18
|
+
const als = new AsyncLocalStorage<LoaderDepsStore>()
|
|
19
|
+
globalThis[LOADER_DEPS_KEY] = als
|
|
20
|
+
return als
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const debugLoaderDeps = process.env.ONE_DEBUG_LOADER_DEPS
|
|
25
|
+
|
|
26
|
+
function watchFileImpl(path: string): void {
|
|
27
|
+
const store = LOADER_DEPS_STORE.current.getStore()
|
|
28
|
+
if (store) {
|
|
29
|
+
store.deps.add(path)
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
_registerWatchFileImpl(watchFileImpl)
|
|
34
|
+
|
|
35
|
+
export async function trackLoaderDependencies<T>(
|
|
36
|
+
fn: () => T | Promise<T>
|
|
37
|
+
): Promise<LoaderResult<Awaited<T>>> {
|
|
38
|
+
const deps = new Set<string>()
|
|
39
|
+
const context = LOADER_DEPS_STORE.current
|
|
40
|
+
|
|
41
|
+
const result = await context.run({ deps }, async () => {
|
|
42
|
+
return await fn()
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
if (debugLoaderDeps && deps.size > 0) {
|
|
46
|
+
console.info('[loader-deps] tracked dependencies:', [...deps])
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return {
|
|
50
|
+
result,
|
|
51
|
+
dependencies: deps,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const WATCH_FILE_KEY = '__oneWatchFile'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Register a file dependency for loader HMR.
|
|
5
|
+
* No-op on client, registers file path for watching on server.
|
|
6
|
+
*/
|
|
7
|
+
export function watchFile(path: string): void {
|
|
8
|
+
if (typeof window !== 'undefined') return
|
|
9
|
+
|
|
10
|
+
const impl = globalThis[WATCH_FILE_KEY] as ((path: string) => void) | undefined
|
|
11
|
+
if (impl) {
|
|
12
|
+
impl(path)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export function _registerWatchFileImpl(impl: (path: string) => void): void {
|
|
18
|
+
globalThis[WATCH_FILE_KEY] = impl
|
|
19
|
+
}
|
|
@@ -229,7 +229,7 @@ export { wrappedMiddlewareFunction as default }
|
|
|
229
229
|
// Replace :param with capture groups for dynamic segments
|
|
230
230
|
// The loader URL pattern uses the actual param value, not :param
|
|
231
231
|
// e.g., /dynamic/123 -> /assets/dynamic_123_12345_vxrn_loader.js
|
|
232
|
-
|
|
232
|
+
const loaderPattern = cleanPath.replace(/:([^_]+)/g, '(?<$1>[^_]+)')
|
|
233
233
|
|
|
234
234
|
// Match the loader file pattern: {path}_{cacheKey}_vxrn_loader.js
|
|
235
235
|
// Also handle _refetch_ pattern for cache busting
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// https://vercel.com/docs/build-output-api/v3/configuration#config.json-supported-properties
|
|
3
3
|
export const vercelBuildOutputConfigBase = {
|
|
4
4
|
version: 3,
|
|
5
|
+
// Note: cleanUrls is NOT supported in the Build Output API config.json
|
|
6
|
+
// Users must add "cleanUrls": true to their vercel.json at project root
|
|
5
7
|
// https://vercel.com/docs/build-output-api/v3/configuration#routes
|
|
6
8
|
routes: [
|
|
7
9
|
// Not sure if we really need this, but having this seems to break the 'rewrite's we will add to handle dynamic routes.
|
package/src/vite/DevHead.tsx
CHANGED
|
@@ -38,6 +38,29 @@ export function DevHead() {
|
|
|
38
38
|
}
|
|
39
39
|
// Dispatch a window event that triggers re-render in route components
|
|
40
40
|
window.dispatchEvent(new CustomEvent('one-hmr-update'));
|
|
41
|
+
});`,
|
|
42
|
+
}}
|
|
43
|
+
/>
|
|
44
|
+
<script
|
|
45
|
+
type="module"
|
|
46
|
+
dangerouslySetInnerHTML={{
|
|
47
|
+
__html: `import { createHotContext } from "/@vite/client";
|
|
48
|
+
const hot = createHotContext("/__one_loader_hmr");
|
|
49
|
+
hot.on("one:loader-data-update", async (data) => {
|
|
50
|
+
// Refetch loader data for all affected routes (no full page reload)
|
|
51
|
+
if (data?.routePaths && window.__oneRefetchLoader) {
|
|
52
|
+
const currentPath = window.location.pathname.replace(/\\/$/, '') || '/';
|
|
53
|
+
for (const routePath of data.routePaths) {
|
|
54
|
+
// Only refetch if we're on an affected route
|
|
55
|
+
if (routePath === currentPath) {
|
|
56
|
+
try {
|
|
57
|
+
await window.__oneRefetchLoader(routePath);
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error('[one] Error refetching loader:', err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
41
64
|
});`,
|
|
42
65
|
}}
|
|
43
66
|
/>
|
package/src/vite/one.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import events from 'node:events'
|
|
2
|
+
import path from 'node:path'
|
|
1
3
|
import { configureVXRNCompilerPlugin } from '@vxrn/compiler'
|
|
2
4
|
import { resolvePath } from '@vxrn/resolve'
|
|
3
5
|
import type {
|
|
4
6
|
ExpoManifestRequestHandlerPluginPluginOptions,
|
|
5
7
|
MetroPluginOptions,
|
|
6
8
|
} from '@vxrn/vite-plugin-metro'
|
|
7
|
-
import events from 'node:events'
|
|
8
|
-
import path from 'node:path'
|
|
9
9
|
import type { Plugin, PluginOption } from 'vite'
|
|
10
10
|
import { barrel } from 'vite-plugin-barrel'
|
|
11
11
|
import tsconfigPaths from 'vite-tsconfig-paths'
|
|
@@ -21,6 +21,7 @@ import { clientTreeShakePlugin } from './plugins/clientTreeShakePlugin'
|
|
|
21
21
|
import { createFileSystemRouterPlugin } from './plugins/fileSystemRouterPlugin'
|
|
22
22
|
import { fixDependenciesPlugin } from './plugins/fixDependenciesPlugin'
|
|
23
23
|
import { generateFileSystemRouteTypesPlugin } from './plugins/generateFileSystemRouteTypesPlugin'
|
|
24
|
+
import { imageDataPlugin } from './plugins/imageDataPlugin'
|
|
24
25
|
import { SSRCSSPlugin } from './plugins/SSRCSSPlugin'
|
|
25
26
|
import { virtualEntryId } from './plugins/virtualEntryConstants'
|
|
26
27
|
import { createVirtualEntry } from './plugins/virtualEntryPlugin'
|
|
@@ -158,6 +159,8 @@ export function one(options: One.PluginOptions = {}): PluginOption {
|
|
|
158
159
|
: ['@tamagui/lucide-icons'],
|
|
159
160
|
}) as any),
|
|
160
161
|
|
|
162
|
+
imageDataPlugin(),
|
|
163
|
+
|
|
161
164
|
{
|
|
162
165
|
name: 'one-define-client-env',
|
|
163
166
|
async config(userConfig) {
|
|
@@ -17,7 +17,7 @@ export function SSRCSSPlugin(pluginOpts: { entries: string[] }): Plugin {
|
|
|
17
17
|
if (req.url?.includes(VIRTUAL_SSR_CSS_HREF)) {
|
|
18
18
|
invalidateModule(server, '\0' + VIRTUAL_SSR_CSS_ENTRY + '?direct')
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
const code = await collectStyle(server, pluginOpts.entries)
|
|
21
21
|
|
|
22
22
|
res.setHeader('Content-Type', 'text/css')
|
|
23
23
|
res.setHeader('Cache-Control', 'no-store')
|
|
@@ -112,7 +112,7 @@ export async function collectStyle(server: ViteDevServer, entries: string[]) {
|
|
|
112
112
|
buffer.byteLength
|
|
113
113
|
)
|
|
114
114
|
|
|
115
|
-
|
|
115
|
+
const processed = transform({
|
|
116
116
|
filename: 'code.css',
|
|
117
117
|
code: codeOut,
|
|
118
118
|
...server.config.css.lightningcss,
|
|
@@ -51,7 +51,10 @@ export async function transformTreeShakeClient(code: string, id: string) {
|
|
|
51
51
|
let ast: any
|
|
52
52
|
try {
|
|
53
53
|
// `as any` because babel-dead-code-elimination using @types and it conflicts :/
|
|
54
|
-
ast = parse(code, {
|
|
54
|
+
ast = parse(code, {
|
|
55
|
+
sourceType: 'module',
|
|
56
|
+
plugins: ['typescript', 'jsx'],
|
|
57
|
+
}) as any
|
|
55
58
|
} catch (error) {
|
|
56
59
|
// If there's a syntax error, skip transformation and let Vite handle the error
|
|
57
60
|
// This prevents the dev server from crashing on syntax errors
|
|
@@ -11,6 +11,7 @@ import { getRouterRootFromOneOptions } from '../../utils/getRouterRootFromOneOpt
|
|
|
11
11
|
import { isResponse } from '../../utils/isResponse'
|
|
12
12
|
import { isStatusRedirect } from '../../utils/isStatus'
|
|
13
13
|
import { promiseWithResolvers } from '../../utils/promiseWithResolvers'
|
|
14
|
+
import { trackLoaderDependencies } from '../../utils/trackLoaderDependencies'
|
|
14
15
|
import { LoaderDataCache } from '../../vite/constants'
|
|
15
16
|
import { replaceLoader } from '../../vite/replaceLoader'
|
|
16
17
|
import type { One } from '../../vite/types'
|
|
@@ -18,6 +19,7 @@ import { setServerContext } from '../one-server-only'
|
|
|
18
19
|
import { virtalEntryIdClient, virtualEntryId } from './virtualEntryConstants'
|
|
19
20
|
|
|
20
21
|
const debugRouter = process.env.ONE_DEBUG_ROUTER
|
|
22
|
+
const debugLoaderDeps = process.env.ONE_DEBUG_LOADER_DEPS
|
|
21
23
|
|
|
22
24
|
// server needs better dep optimization
|
|
23
25
|
const USE_SERVER_ENV = false //!!process.env.USE_SERVER_ENV
|
|
@@ -28,6 +30,10 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
28
30
|
let runner: ModuleRunner
|
|
29
31
|
let server: ViteDevServer
|
|
30
32
|
|
|
33
|
+
// Track file dependencies from loaders for hot reload
|
|
34
|
+
// Maps file path -> set of route paths that depend on it
|
|
35
|
+
const loaderFileDependencies = new Map<string, Set<string>>()
|
|
36
|
+
|
|
31
37
|
let handleRequest = createRequestHandler()
|
|
32
38
|
// handle only one at a time in dev mode to avoid "Detected multiple renderers concurrently" errors
|
|
33
39
|
let renderPromise: Promise<void> | null = null
|
|
@@ -72,7 +78,28 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
72
78
|
globalThis['__vxrnresetState']?.()
|
|
73
79
|
|
|
74
80
|
const exported = routeFile === '' ? {} : await runner.import(routeFile)
|
|
75
|
-
|
|
81
|
+
|
|
82
|
+
// Track file dependencies from loader for hot reload
|
|
83
|
+
let loaderData: any
|
|
84
|
+
if (exported.loader) {
|
|
85
|
+
const tracked = await trackLoaderDependencies(() =>
|
|
86
|
+
exported.loader(loaderProps)
|
|
87
|
+
)
|
|
88
|
+
loaderData = tracked.result
|
|
89
|
+
|
|
90
|
+
// Register dependencies: map file path -> route paths that depend on it
|
|
91
|
+
const routePath = loaderProps?.path || '/'
|
|
92
|
+
for (const dep of tracked.dependencies) {
|
|
93
|
+
if (!loaderFileDependencies.has(dep)) {
|
|
94
|
+
loaderFileDependencies.set(dep, new Set())
|
|
95
|
+
server?.watcher.add(dep)
|
|
96
|
+
if (debugLoaderDeps) {
|
|
97
|
+
console.info(` ⓵ [loader-dep] watching: ${dep}`)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
loaderFileDependencies.get(dep)!.add(routePath)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
76
103
|
|
|
77
104
|
// biome-ignore lint/security/noGlobalEval: needed to set server env at runtime
|
|
78
105
|
eval(`process.env.TAMAGUI_IS_SERVER = '1'`)
|
|
@@ -164,7 +191,28 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
164
191
|
}
|
|
165
192
|
|
|
166
193
|
const exported = await runner.import(routeFile)
|
|
167
|
-
|
|
194
|
+
|
|
195
|
+
// Track file dependencies from loader for hot reload
|
|
196
|
+
let loaderData: any
|
|
197
|
+
if (exported.loader) {
|
|
198
|
+
const tracked = await trackLoaderDependencies(() =>
|
|
199
|
+
exported.loader(loaderProps)
|
|
200
|
+
)
|
|
201
|
+
loaderData = tracked.result
|
|
202
|
+
|
|
203
|
+
// Register dependencies: map file path -> route paths that depend on it
|
|
204
|
+
const routePath = loaderProps?.path || '/'
|
|
205
|
+
for (const dep of tracked.dependencies) {
|
|
206
|
+
if (!loaderFileDependencies.has(dep)) {
|
|
207
|
+
loaderFileDependencies.set(dep, new Set())
|
|
208
|
+
server?.watcher.add(dep)
|
|
209
|
+
if (debugLoaderDeps) {
|
|
210
|
+
console.info(` ⓵ [loader-dep] watching: ${dep}`)
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
loaderFileDependencies.get(dep)!.add(routePath)
|
|
214
|
+
}
|
|
215
|
+
}
|
|
168
216
|
|
|
169
217
|
if (loaderData) {
|
|
170
218
|
// add loader back in!
|
|
@@ -299,6 +347,7 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
299
347
|
|
|
300
348
|
configureServer(serverIn) {
|
|
301
349
|
server = serverIn
|
|
350
|
+
|
|
302
351
|
// change this to .server to test using the indepedently scoped env
|
|
303
352
|
runner = createServerModuleRunner(
|
|
304
353
|
USE_SERVER_ENV ? server.environments.server : server.environments.ssr
|
|
@@ -319,6 +368,28 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
319
368
|
|
|
320
369
|
server.watcher.addListener('all', fileWatcherChangeListener)
|
|
321
370
|
|
|
371
|
+
// Watch for changes to loader dependencies (files read via fs in loaders)
|
|
372
|
+
const loaderDepChangeListener = debounce((path: string) => {
|
|
373
|
+
const absolutePath = resolve(path)
|
|
374
|
+
const routePaths = loaderFileDependencies.get(absolutePath)
|
|
375
|
+
if (routePaths && routePaths.size > 0) {
|
|
376
|
+
if (debugLoaderDeps) {
|
|
377
|
+
console.info(
|
|
378
|
+
` ⓵ [loader-dep] changed: ${absolutePath}, triggering loader refetch for routes:`,
|
|
379
|
+
[...routePaths]
|
|
380
|
+
)
|
|
381
|
+
}
|
|
382
|
+
// Send custom HMR event with affected route paths for hot reload (no full page reload)
|
|
383
|
+
server.hot.send({
|
|
384
|
+
type: 'custom',
|
|
385
|
+
event: 'one:loader-data-update',
|
|
386
|
+
data: { routePaths: [...routePaths] },
|
|
387
|
+
})
|
|
388
|
+
}
|
|
389
|
+
}, 100)
|
|
390
|
+
|
|
391
|
+
server.watcher.on('change', loaderDepChangeListener)
|
|
392
|
+
|
|
322
393
|
// Instead of adding the middleware here, we return a function that Vite
|
|
323
394
|
// will call after adding its own middlewares. We want our code to run after
|
|
324
395
|
// Vite's transform middleware so that we can focus on handling the requests
|
|
@@ -347,7 +418,9 @@ export function createFileSystemRouterPlugin(options: One.PluginOptions): Plugin
|
|
|
347
418
|
console.info(`[one] ↪ redirect ${url.pathname} → ${destination}`)
|
|
348
419
|
}
|
|
349
420
|
|
|
350
|
-
res.writeHead(redirect.permanent ? 301 : 302, {
|
|
421
|
+
res.writeHead(redirect.permanent ? 301 : 302, {
|
|
422
|
+
Location: destination,
|
|
423
|
+
})
|
|
351
424
|
res.end()
|
|
352
425
|
return
|
|
353
426
|
}
|