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

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.
package/dist/vue/index.js CHANGED
@@ -3621,6 +3621,34 @@ init_constants();
3621
3621
  import { readdir } from "fs/promises";
3622
3622
  import { basename as basename2, dirname as dirname2 } from "path";
3623
3623
 
3624
+ // src/utils/inlinePageCss.ts
3625
+ var siblingCssCache = new Map;
3626
+ var readSiblingCss = async (siblingJsPath) => {
3627
+ if (!siblingJsPath)
3628
+ return "";
3629
+ const cssPath = siblingJsPath.replace(/\.js$/, ".css");
3630
+ if (cssPath === siblingJsPath)
3631
+ return "";
3632
+ const cached = siblingCssCache.get(cssPath);
3633
+ if (cached !== undefined)
3634
+ return cached;
3635
+ const { readFile } = await import("fs/promises");
3636
+ try {
3637
+ const css = await readFile(cssPath, "utf-8");
3638
+ siblingCssCache.set(cssPath, css);
3639
+ return css;
3640
+ } catch {
3641
+ siblingCssCache.set(cssPath, "");
3642
+ return "";
3643
+ }
3644
+ };
3645
+ var injectInlineCss = (headTag, css) => {
3646
+ if (!css)
3647
+ return headTag;
3648
+ const styleBlock = `<style data-absolute-page-css>${css}</style>`;
3649
+ return headTag.replace("</head>", `${styleBlock}</head>`);
3650
+ };
3651
+
3624
3652
  // src/core/islandPageContext.ts
3625
3653
  init_constants();
3626
3654
  var BOOTSTRAP_MANIFEST_KEY = "BootstrapClient";
@@ -4298,9 +4326,11 @@ var getSsrOnlyHmrShim = () => {
4298
4326
  };
4299
4327
  var handleVuePageRequest = async (input) => {
4300
4328
  const passedPageComponent = input.Page;
4301
- const resolvedHeadTag = input.headTag ?? "<head></head>";
4329
+ const userHeadTag = input.headTag ?? "<head></head>";
4302
4330
  const resolvedOptions = input;
4303
4331
  const resolvedPagePath = input.pagePath;
4332
+ const siblingCss = await readSiblingCss(resolvedPagePath);
4333
+ const resolvedHeadTag = injectInlineCss(userHeadTag, siblingCss);
4304
4334
  const maybeProps = input.props;
4305
4335
  const clientMode = input.client ?? "auto";
4306
4336
  const resolvedIndexPath = input.indexPath;
@@ -4794,5 +4824,5 @@ export {
4794
4824
  Image
4795
4825
  };
4796
4826
 
4797
- //# debugId=2928A14B2A25AA1264756E2164756E21
4827
+ //# debugId=11F1676B8E6878B264756E2164756E21
4798
4828
  //# sourceMappingURL=index.js.map