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
@@ -5,6 +5,7 @@ import grabPageServerRes from "./grab-page-server-res";
import grabPageServerPath from "./grab-page-server-path";
import path from "path";
import grabDirNames from "../../../utils/grab-dir-names";
import grabRelativePath from "../../../utils/grab-relative-path";
const { ROOT_DIR } = grabDirNames();
export default async function grabPageCombinedServerRes({ file_path, debug, url, query, routeParams, }) {
const now = Date.now();
@@ -12,7 +13,9 @@ export default async function grabPageCombinedServerRes({ file_path, debug, url,
const { server_file_path: root_server_file_path } = root_file_path
? grabPageServerPath({ file_path: root_file_path })
: {};
const root_server_ctx_map = global.BUNEXT_SSR_BUNDLER_CTX_MAP[root_server_file_path || ""];
const root_server_ctx_map = root_server_file_path
? global.BUNEXT_SSR_BUNDLER_CTX_MAP[grabRelativePath(root_server_file_path)]
: undefined;
const final_root_server_path = root_server_ctx_map?.local_path
? path.join(ROOT_DIR, root_server_ctx_map.path)
: root_server_file_path;
@@ -33,7 +36,9 @@ export default async function grabPageCombinedServerRes({ file_path, debug, url,
log.info(`rootServerRes:`, rootServerRes);
}
const { server_file_path } = grabPageServerPath({ file_path });
const page_server_ctx = global.BUNEXT_SSR_BUNDLER_CTX_MAP[server_file_path || ""];
const page_server_ctx = server_file_path
? global.BUNEXT_SSR_BUNDLER_CTX_MAP[grabRelativePath(server_file_path)]
: undefined;
const final_page_server_path = page_server_ctx?.local_path
? path.join(ROOT_DIR, page_server_ctx.path)
: server_file_path;