30 lines
834 B
JavaScript
30 lines
834 B
JavaScript
import grabDirNames from "../utils/grab-dir-names";
|
|
import {} from "fs";
|
|
import init from "./init";
|
|
import isDevelopment from "../utils/is-development";
|
|
import { log } from "../utils/log";
|
|
import cron from "./server/cron";
|
|
import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
|
|
const { PAGES_DIR } = grabDirNames();
|
|
export default async function bunextInit() {
|
|
global.HMR_CONTROLLERS = [];
|
|
global.BUNDLER_CTX_MAP = {};
|
|
global.BUNDLER_REBUILDS = 0;
|
|
global.PAGE_FILES = [];
|
|
global.SKIPPED_BROWSER_MODULES = new Set();
|
|
await init();
|
|
log.banner();
|
|
const router = new Bun.FileSystemRouter({
|
|
style: "nextjs",
|
|
dir: PAGES_DIR,
|
|
});
|
|
global.ROUTER = router;
|
|
const is_dev = isDevelopment();
|
|
if (is_dev) {
|
|
watcherEsbuildCTX();
|
|
}
|
|
else {
|
|
cron();
|
|
}
|
|
}
|