UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

18 lines (17 loc) 830 B
import FSExtra from "fs-extra"; import { writeFile } from "node:fs/promises"; import { dirname } from "node:path"; import { globbedRoutesToRouteContext } from "../router/useViteRoutes.native.js"; import { globDir } from "../utils/globDir.native.js"; import { getTypedRoutesDeclarationFile } from "./getTypedRoutesDeclarationFile.native.js"; async function generateRouteTypes(outFile, routerRoot) { var routePaths = globDir(routerRoot), routes = routePaths.reduce(function (acc, cur) { return acc[cur] = {}, acc; }, {}), context = globbedRoutesToRouteContext(routes, routerRoot), declarations = getTypedRoutesDeclarationFile(context); await FSExtra.ensureDir(dirname(outFile)), await writeFile(outFile, declarations); } export { generateRouteTypes }; //# sourceMappingURL=generateRouteTypes.native.js.map