one
Version:
One is a new React Framework that makes Vite serve both native and web.
27 lines (26 loc) • 796 B
JavaScript
import { getRoutes } from "../router/getRoutes.mjs";
import { getServerManifest } from "./getServerManifest.mjs";
function createMockModuleWithContext(map = []) {
const contextModule = key => ({
default() {}
});
Object.defineProperty(contextModule, "keys", {
value: () => map
});
return contextModule;
}
function createRoutesManifest(paths, options) {
const routeTree = getRoutes(createMockModuleWithContext(paths), {
...options,
preserveApiRoutes: true,
ignoreRequireErrors: true,
ignoreEntryPoints: true,
platform: "web"
});
if (!routeTree) {
throw new Error(`No route tree found in paths: ${JSON.stringify(paths)}`);
}
return getServerManifest(routeTree);
}
export { createRoutesManifest };
//# sourceMappingURL=createRoutesManifest.mjs.map