Updates
This commit is contained in:
Vendored
+12
-3
@@ -4,7 +4,7 @@ import grabDirNames from "../../utils/grab-dir-names";
|
|||||||
import { rmSync, writeFileSync } from "fs";
|
import { rmSync, writeFileSync } from "fs";
|
||||||
import bunextInit from "../../functions/bunext-init";
|
import bunextInit from "../../functions/bunext-init";
|
||||||
import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler";
|
import pagesSSRBundler from "../../functions/bundler/pages-ssr-bundler";
|
||||||
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, BUNX_CWD_MODULE_CACHE_DIR, } = grabDirNames();
|
const { HYDRATION_DST_DIR, BUNX_CWD_PAGES_REWRITE_DIR, BUNDLER_CTX_MAP_JSON, SSR_BUNDLER_CTX_MAP_JSON, BUNX_CWD_MODULE_CACHE_DIR, ROOT_DIR, } = grabDirNames();
|
||||||
export default function () {
|
export default function () {
|
||||||
return new Command("build")
|
return new Command("build")
|
||||||
.description("Build Project")
|
.description("Build Project")
|
||||||
@@ -22,10 +22,19 @@ export default function () {
|
|||||||
await bunextInit({ build_only: true });
|
await bunextInit({ build_only: true });
|
||||||
// await pagesSSRBundler();
|
// await pagesSSRBundler();
|
||||||
if (global.BUNEXT_BUNDLER_CTX_MAP) {
|
if (global.BUNEXT_BUNDLER_CTX_MAP) {
|
||||||
writeFileSync(BUNDLER_CTX_MAP_JSON, JSON.stringify(global.BUNEXT_BUNDLER_CTX_MAP), "utf-8");
|
let bundler_ctx_json_str = JSON.stringify(global.BUNEXT_BUNDLER_CTX_MAP);
|
||||||
|
if (process.env.BUNEXT_BUILD_ROOT_DIR) {
|
||||||
|
bundler_ctx_json_str = bundler_ctx_json_str.replaceAll(ROOT_DIR, process.env.BUNEXT_BUILD_ROOT_DIR);
|
||||||
|
}
|
||||||
|
writeFileSync(BUNDLER_CTX_MAP_JSON, bundler_ctx_json_str, "utf-8");
|
||||||
}
|
}
|
||||||
if (global.BUNEXT_SSR_BUNDLER_CTX_MAP) {
|
if (global.BUNEXT_SSR_BUNDLER_CTX_MAP) {
|
||||||
writeFileSync(SSR_BUNDLER_CTX_MAP_JSON, JSON.stringify(global.BUNEXT_SSR_BUNDLER_CTX_MAP), "utf-8");
|
let ssr_bundler_ctx_json_str = JSON.stringify(global.BUNEXT_SSR_BUNDLER_CTX_MAP);
|
||||||
|
if (process.env.BUNEXT_BUILD_ROOT_DIR) {
|
||||||
|
ssr_bundler_ctx_json_str =
|
||||||
|
ssr_bundler_ctx_json_str.replaceAll(ROOT_DIR, process.env.BUNEXT_BUILD_ROOT_DIR);
|
||||||
|
}
|
||||||
|
writeFileSync(SSR_BUNDLER_CTX_MAP_JSON, ssr_bundler_ctx_json_str, "utf-8");
|
||||||
}
|
}
|
||||||
log.success("Modules Built Successfully!");
|
log.success("Modules Built Successfully!");
|
||||||
process.exit();
|
process.exit();
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ export default async function grabPageComponent(params) {
|
|||||||
throw new Error(errMsg);
|
throw new Error(errMsg);
|
||||||
}
|
}
|
||||||
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
||||||
|
console.log("bundledMap", bundledMap);
|
||||||
|
console.log("file_path", file_path);
|
||||||
if (!bundledMap?.path) {
|
if (!bundledMap?.path) {
|
||||||
if (does_error_file_exist) {
|
if (does_error_file_exist) {
|
||||||
throw new Error(`Application Error. Please Check your components. ${match?.filePath} likely exists but has no exported module.`);
|
throw new Error(`Application Error. Please Check your components. ${match?.filePath} likely exists but has no exported module.`);
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@moduletrace/bunext",
|
"name": "@moduletrace/bunext",
|
||||||
"version": "1.1.9",
|
"version": "1.1.10",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"module": "index.ts",
|
"module": "index.ts",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ const {
|
|||||||
BUNDLER_CTX_MAP_JSON,
|
BUNDLER_CTX_MAP_JSON,
|
||||||
SSR_BUNDLER_CTX_MAP_JSON,
|
SSR_BUNDLER_CTX_MAP_JSON,
|
||||||
BUNX_CWD_MODULE_CACHE_DIR,
|
BUNX_CWD_MODULE_CACHE_DIR,
|
||||||
|
ROOT_DIR,
|
||||||
} = grabDirNames();
|
} = grabDirNames();
|
||||||
|
|
||||||
export default function () {
|
export default function () {
|
||||||
@@ -32,17 +33,40 @@ export default function () {
|
|||||||
// await pagesSSRBundler();
|
// await pagesSSRBundler();
|
||||||
|
|
||||||
if (global.BUNEXT_BUNDLER_CTX_MAP) {
|
if (global.BUNEXT_BUNDLER_CTX_MAP) {
|
||||||
|
let bundler_ctx_json_str = JSON.stringify(
|
||||||
|
global.BUNEXT_BUNDLER_CTX_MAP,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (process.env.BUNEXT_BUILD_ROOT_DIR) {
|
||||||
|
bundler_ctx_json_str = bundler_ctx_json_str.replaceAll(
|
||||||
|
ROOT_DIR,
|
||||||
|
process.env.BUNEXT_BUILD_ROOT_DIR,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
BUNDLER_CTX_MAP_JSON,
|
BUNDLER_CTX_MAP_JSON,
|
||||||
JSON.stringify(global.BUNEXT_BUNDLER_CTX_MAP),
|
bundler_ctx_json_str,
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global.BUNEXT_SSR_BUNDLER_CTX_MAP) {
|
if (global.BUNEXT_SSR_BUNDLER_CTX_MAP) {
|
||||||
|
let ssr_bundler_ctx_json_str = JSON.stringify(
|
||||||
|
global.BUNEXT_SSR_BUNDLER_CTX_MAP,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (process.env.BUNEXT_BUILD_ROOT_DIR) {
|
||||||
|
ssr_bundler_ctx_json_str =
|
||||||
|
ssr_bundler_ctx_json_str.replaceAll(
|
||||||
|
ROOT_DIR,
|
||||||
|
process.env.BUNEXT_BUILD_ROOT_DIR,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
SSR_BUNDLER_CTX_MAP_JSON,
|
SSR_BUNDLER_CTX_MAP_JSON,
|
||||||
JSON.stringify(global.BUNEXT_SSR_BUNDLER_CTX_MAP),
|
ssr_bundler_ctx_json_str,
|
||||||
"utf-8",
|
"utf-8",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,6 +92,9 @@ export default async function grabPageComponent(
|
|||||||
|
|
||||||
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
let bundledMap = global.BUNEXT_BUNDLER_CTX_MAP[file_path];
|
||||||
|
|
||||||
|
console.log("bundledMap", bundledMap);
|
||||||
|
console.log("file_path", file_path);
|
||||||
|
|
||||||
if (!bundledMap?.path) {
|
if (!bundledMap?.path) {
|
||||||
if (does_error_file_exist) {
|
if (does_error_file_exist) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|||||||
Reference in New Issue
Block a user