diff --git a/src/functions/bundler/all-pages-bun-bundler.ts b/src/functions/bundler/all-pages-bun-bundler.ts
index 3725b67..33530b5 100644
--- a/src/functions/bundler/all-pages-bun-bundler.ts
+++ b/src/functions/bundler/all-pages-bun-bundler.ts
@@ -124,7 +124,10 @@ export default async function allPagesBunBundler(params?: Params) {
}
if (artifacts?.[0]) {
- await recordArtifacts({ artifacts });
+ await recordArtifacts({
+ artifacts,
+ page_file_paths,
+ });
}
const elapsed = (performance.now() - buildStart).toFixed(0);
diff --git a/src/functions/bundler/grab-client-hydration-script.tsx b/src/functions/bundler/grab-client-hydration-script.tsx
index b297e54..6317089 100644
--- a/src/functions/bundler/grab-client-hydration-script.tsx
+++ b/src/functions/bundler/grab-client-hydration-script.tsx
@@ -4,6 +4,7 @@ import grabDirNames from "../../utils/grab-dir-names";
import AppNames from "../../utils/grab-app-names";
import grabConstants from "../../utils/grab-constants";
import pagePathTransform from "../../utils/page-path-transform";
+import grabRootFilePath from "../server/web-pages/grab-root-file-path";
const { PAGES_DIR } = grabDirNames();
@@ -20,25 +21,23 @@ export default async function grabClientHydrationScript({
ClientWindowPagePropsName,
} = grabConstants();
+ const { root_file_path } = grabRootFilePath();
+
const target_path = pagePathTransform({ page_path: page_local_path });
-
- const root_component_path = path.join(
- PAGES_DIR,
- `${AppNames["RootPagesComponentName"]}.tsx`,
- );
-
- const does_root_exist = existsSync(root_component_path);
+ const target_root_path = root_file_path
+ ? pagePathTransform({ page_path: root_file_path })
+ : undefined;
let txt = ``;
txt += `import { hydrateRoot } from "react-dom/client";\n`;
- if (does_root_exist) {
- txt += `import Root from "${root_component_path}";\n`;
+ if (target_root_path) {
+ txt += `import Root from "${target_root_path}";\n`;
}
txt += `import Page from "${target_path}";\n\n`;
txt += `const pageProps = window.${ClientWindowPagePropsName} || {};\n`;
- if (does_root_exist) {
+ if (target_root_path) {
txt += `const component =
) - : ""; - - let html = `\n`; - html += `\n`; - html += `
\n`; - html += ` \n`; - html += ` \n`; - - if (meta) { - html += ` ${grabWebMetaHTML({ meta })}\n`; - } - - if (bundledMap?.css_path) { - html += ` \n`; - } - const serializedProps = (EJSON.stringify(pageProps || {}) || "{}").replace( /<\//g, "<\\/", ); - html += ` \n`; - if (bundledMap?.path) { - const dev = isDevelopment(); - const devSuffix = dev ? "?dev" : ""; - const importMap = JSON.stringify({ - imports: { - react: `https://esm.sh/react@${_reactVersion}${devSuffix}`, - "react-dom": `https://esm.sh/react-dom@${_reactVersion}${devSuffix}`, - "react-dom/client": `https://esm.sh/react-dom@${_reactVersion}/client${devSuffix}`, - "react/jsx-runtime": `https://esm.sh/react@${_reactVersion}/jsx-runtime${devSuffix}`, - "react/jsx-dev-runtime": `https://esm.sh/react@${_reactVersion}/jsx-dev-runtime${devSuffix}`, - }, - }); - html += ` \n`; - html += ` \n`; - } + const page_hydration_script = await grabWebPageHydrationScript(); + const root_meta = root_module?.meta + ? typeof root_module.meta == "function" && routeParams + ? await root_module.meta({ ctx: routeParams, serverRes: pageProps }) + : typeof root_module.meta == "function" + ? undefined + : root_module.meta + : undefined; + const page_meta = module?.meta + ? typeof module.meta == "function" && routeParams + ? await module.meta({ ctx: routeParams, serverRes: pageProps }) + : typeof module.meta == "function" + ? undefined + : module.meta + : undefined; - if (isDevelopment()) { - html += `\n`; - } + const html_props = { + ...module?.html_props, + ...root_module?.html_props, + }; - if (headHTML) { - html += ` ${headHTML}\n`; - } + const Head = module?.Head; + const RootHead = root_module?.Head; - html += ` \n`; - html += `