Refactor artifacts to use relative directory for build step and retrieval

This commit is contained in:
2026-09-23 05:08:54 +01:00
parent 2803dfa0be
commit 2335c60cc3
26 changed files with 117 additions and 204 deletions
@@ -10,13 +10,10 @@ import { cpSync, existsSync, mkdirSync, rmSync, writeFileSync } from "fs";
import fullRebuild from "../../server/full-rebuild";
import path from "path";
import cleanupLogsDirs from "../../cleanup-logs-dir";
import grabRelativePath from "../../../utils/grab-relative-path";
const {
BUNX_BUNDLER_ERROR_EXIT_FILE,
BUNX_ERROR_LOGS_DIR,
BUNDLER_CTX_MAP_JSON,
SSR_BUNDLER_CTX_MAP_JSON,
} = grabDirNames();
const { BUNX_BUNDLER_ERROR_EXIT_FILE, BUNX_ERROR_LOGS_DIR, ROOT_DIR } =
grabDirNames();
let build_start = 0;
const MAX_BUILD_STARTS = 2;
@@ -94,16 +91,21 @@ export default function esbuildCTXArtifactTracker({
if (artifacts?.[0] && artifacts.length > 0) {
for (let i = 0; i < artifacts.length; i++) {
const artifact = artifacts[i];
if (
artifact?.local_path &&
global.BUNEXT_BUNDLER_CTX_MAP
) {
global.BUNEXT_BUNDLER_CTX_MAP[artifact.local_path] =
const relative_path = grabRelativePath(
artifact.local_path,
);
global.BUNEXT_BUNDLER_CTX_MAP[relative_path] =
_.merge(
global.BUNEXT_BUNDLER_CTX_MAP[
artifact.local_path
relative_path
],
artifact,
{ ...artifact, local_path: relative_path },
);
}
}