UNPKG

one

Version:

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

23 lines (22 loc) 979 B
import { getRouteExportsFromEntry } from "../server/routeExportsFromEntry.mjs"; import { toAbsoluteUrl } from "../utils/toAbsolute.mjs"; const serverEntries = /* @__PURE__ */new Map(); function loadServerEntry(serverEntry) { let loading = serverEntries.get(serverEntry); if (!loading) { loading = import(toAbsoluteUrl(serverEntry)); serverEntries.set(serverEntry, loading); } return loading; } async function getRouteExports(serverEntry, routerRoot, routeFile) { const entry = await loadServerEntry(serverEntry); const exported = await getRouteExportsFromEntry(entry, routerRoot, routeFile); if (!exported) { const routes = entry?.default?.options?.routes ?? entry?.default?.default?.options?.routes; throw new Error(`[one] route ${routeFile} is missing from the built server entry route map (looked in: ${Object.keys(routes ?? {}).join(", ")})`); } return exported; } export { getRouteExports }; //# sourceMappingURL=serverRouteModules.mjs.map