@absolutejs/absolute 0.19.0-beta.1000 → 0.19.0-beta.1002

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2544,6 +2544,34 @@ var captureStreamingSlotWarningCallsite = () => {
2544
2544
  return extractCallsiteFromStack(stack);
2545
2545
  };
2546
2546
  var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage().run({ handlerCallsite: metadata?.handlerCallsite, hasWarned: false }, task);
2547
+
2548
+ // src/utils/inlinePageCss.ts
2549
+ var siblingCssCache = new Map;
2550
+ var readSiblingCss = async (siblingJsPath) => {
2551
+ if (!siblingJsPath)
2552
+ return "";
2553
+ const cssPath = siblingJsPath.replace(/\.js$/, ".css");
2554
+ if (cssPath === siblingJsPath)
2555
+ return "";
2556
+ const cached = siblingCssCache.get(cssPath);
2557
+ if (cached !== undefined)
2558
+ return cached;
2559
+ const { readFile: readFile2 } = await import("fs/promises");
2560
+ try {
2561
+ const css = await readFile2(cssPath, "utf-8");
2562
+ siblingCssCache.set(cssPath, css);
2563
+ return css;
2564
+ } catch {
2565
+ siblingCssCache.set(cssPath, "");
2566
+ return "";
2567
+ }
2568
+ };
2569
+ var injectInlineCss = (headTag, css) => {
2570
+ if (!css)
2571
+ return headTag;
2572
+ const styleBlock = `<style data-absolute-page-css>${css}</style>`;
2573
+ return headTag.replace("</head>", `${styleBlock}</head>`);
2574
+ };
2547
2575
  // src/utils/resolveConvention.ts
2548
2576
  import { basename as basename2 } from "path";
2549
2577
  var CONVENTIONS_KEY = "__absoluteConventions";
@@ -2921,10 +2949,13 @@ var handleSveltePageRequest = async (input) => {
2921
2949
  };
2922
2950
  const { renderToReadableStream: renderToReadableStream2 } = await Promise.resolve().then(() => (init_renderToReadableStream(), exports_renderToReadableStream));
2923
2951
  const resolvedPage = await resolvePageComponent();
2952
+ const siblingCss = await readSiblingCss(resolvedPagePath);
2953
+ const cssBlock = siblingCss ? `<style data-absolute-page-css>${siblingCss}</style>` : "";
2954
+ const composedHeadContent = `${cssBlock}${resolvedOptions?.headContent ?? ""}`;
2924
2955
  const stream = await renderToReadableStream2(resolvedPage.component, resolvedProps, {
2925
2956
  bodyContent: resolvedOptions?.bodyContent,
2926
2957
  bootstrapScriptContent: `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(resolvedProps)};${resolvedIndexPath ? `import(${JSON.stringify(resolvedIndexPath)});` : ""}`,
2927
- headContent: resolvedOptions?.headContent
2958
+ headContent: composedHeadContent
2928
2959
  });
2929
2960
  const htmlStream = injectIslandPageContextStream(stream, {
2930
2961
  hasIslands: resolvedPage.hasIslands ? true : undefined
@@ -2954,5 +2985,5 @@ export {
2954
2985
  handleSveltePageRequest
2955
2986
  };
2956
2987
 
2957
- //# debugId=5F5A2646A1B5694564756E2164756E21
2988
+ //# debugId=0BAD901D207A7EDA64756E2164756E21
2958
2989
  //# sourceMappingURL=server.js.map