vike
Version:
The Framework *You* Control - Next.js & Nuxt alternative for unprecedented flexibility and dependability.
33 lines (32 loc) • 1.31 kB
JavaScript
import '../assertEnvServer.js';
// Used by vike:build:pluginProdBuildEntry
export { setGlobalContext_prodBuildEntry } from '../runtime/globalContext.js';
// Used by vite-plugin-vercel
export { route, getPagesAndRoutes };
import { route as routeInternal } from '../../shared-server-client/route/index.js';
import { getGlobalContextServerInternal, initGlobalContext_getPagesAndRoutes } from '../runtime/globalContext.js';
import { setNodeEnvProductionIfUndefined } from '../../utils/assertSetup.js';
/**
* Used by {@link https://github.com/magne4000/vite-plugin-vercel|vite-plugin-vercel} to compute some rewrite rules and extract { isr } configs.
*
* TO-DO/eventually: remove
*/
async function getPagesAndRoutes() {
setNodeEnvProductionIfUndefined();
await initGlobalContext_getPagesAndRoutes();
const { globalContext } = await getGlobalContextServerInternal();
const {
//
_pageRoutes: pageRoutes, _pageFilesAll: pageFilesAll, _pageConfigs: pageConfigs, _allPageIds: allPageIds, } = globalContext;
return {
pageRoutes,
pageFilesAll,
pageConfigs,
allPageIds,
};
}
async function route(pageContext) {
const pageContextFromRoute = await routeInternal(pageContext);
// Old interface
return { pageContextAddendum: pageContextFromRoute };
}