Updates
This commit is contained in:
@@ -5,11 +5,11 @@ import buildOnstartErrorHandler from "../build-on-start-error-handler";
|
||||
import _ from "lodash";
|
||||
import pagesSSRBundler from "../pages-ssr-bundler";
|
||||
import grabDirNames from "../../../utils/grab-dir-names";
|
||||
import { cpSync, existsSync, mkdirSync, rmSync } from "fs";
|
||||
import { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
||||
import fullRebuild from "../../server/full-rebuild";
|
||||
import path from "path";
|
||||
import cleanupLogsDirs from "../../cleanup-logs-dir";
|
||||
const { BUNX_BUNDLER_ERROR_EXIT_FILE, BUNX_ERROR_LOGS_DIR } = grabDirNames();
|
||||
const { BUNX_BUNDLER_ERROR_EXIT_FILE, BUNX_ERROR_LOGS_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, } = grabDirNames();
|
||||
let build_start = 0;
|
||||
const MAX_BUILD_STARTS = 2;
|
||||
export default function esbuildCTXArtifactTracker({ entryToPage, post_build_fn, build_only, }) {
|
||||
|
||||
Vendored
+15
-11
@@ -11,9 +11,14 @@ import watcherEsbuildCTX from "./server/watcher-esbuild-ctx";
|
||||
const dirNames = grabDirNames();
|
||||
const { PAGES_DIR } = dirNames;
|
||||
export default async function bunextInit(params) {
|
||||
const are_modules_aready_built = global.BUNEXT_BUNDLER_CTX_MAP && global.BUNEXT_SSR_BUNDLER_CTX_MAP;
|
||||
global.BUNEXT_HMR_CONTROLLERS = [];
|
||||
global.BUNEXT_BUNDLER_CTX_MAP = {};
|
||||
global.BUNEXT_SSR_BUNDLER_CTX_MAP = {};
|
||||
if (!global.BUNEXT_BUNDLER_CTX_MAP) {
|
||||
global.BUNEXT_BUNDLER_CTX_MAP = {};
|
||||
}
|
||||
if (!global.BUNEXT_SSR_BUNDLER_CTX_MAP) {
|
||||
global.BUNEXT_SSR_BUNDLER_CTX_MAP = {};
|
||||
}
|
||||
// global.BUNEXT_API_ROUTES_BUNDLER_CTX_MAP = {};
|
||||
global.BUNEXT_BUNDLER_REBUILDS = 0;
|
||||
global.BUNEXT_REBUILD_RETRIES = 0;
|
||||
@@ -35,7 +40,7 @@ export default async function bunextInit(params) {
|
||||
const is_dev = isDevelopment();
|
||||
if (params?.build_only) {
|
||||
log.build(`Building Modules ...`);
|
||||
await allPagesESBuildContextBundler();
|
||||
await allPagesESBuildContextBundler({ build_only: params.build_only });
|
||||
}
|
||||
else if (is_dev) {
|
||||
log.build(`Building Modules ...`);
|
||||
@@ -47,14 +52,13 @@ export default async function bunextInit(params) {
|
||||
watcherEsbuildCTX();
|
||||
}
|
||||
else {
|
||||
log.build(`Building Modules ...`);
|
||||
await allPagesESBuildContextBundler({ start: true });
|
||||
if (are_modules_aready_built) {
|
||||
log.success(`All modules already built.`);
|
||||
}
|
||||
else {
|
||||
log.build(`Building Modules ...`);
|
||||
await allPagesESBuildContextBundler({ start: true });
|
||||
}
|
||||
cron();
|
||||
}
|
||||
}
|
||||
// process.on("exit", (code) => {
|
||||
// Bun.spawn([process.execPath, ...process.argv.slice(1)], {
|
||||
// stdio: ["inherit", "inherit", "inherit"],
|
||||
// env: process.env,
|
||||
// });
|
||||
// });
|
||||
|
||||
Vendored
-4
@@ -10,10 +10,6 @@ export default async function () {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
rmSync(dirNames.BUNX_CWD_MODULE_CACHE_DIR, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
if (dirNames.ROOT_DIR.startsWith(dirNames.BUNX_ROOT_DIR) &&
|
||||
!dirNames.ROOT_DIR.includes(`${dirNames.BUNX_ROOT_DIR}/test/`)) {
|
||||
log.error(`Can't Run From this Directory => ${dirNames.ROOT_DIR}`);
|
||||
|
||||
Reference in New Issue
Block a user