First concept

This commit is contained in:
will
2026-04-02 19:13:46 +01:00
commit 1da5da43e1
9785 changed files with 2077949 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
"use client";
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
import { getExpectedRequestStore } from "../../../client/components/request-async-storage.external";
export function PreloadCss(param) {
let { moduleIds } = param;
// Early return in client compilation and only load requestStore on server side
if (typeof window !== "undefined") {
return null;
}
const requestStore = getExpectedRequestStore("next/dynamic css");
const allFiles = [];
// Search the current dynamic call unique key id in react loadable manifest,
// and find the corresponding CSS files to preload
if (requestStore.reactLoadableManifest && moduleIds) {
const manifest = requestStore.reactLoadableManifest;
for (const key of moduleIds){
if (!manifest[key]) continue;
const cssFiles = manifest[key].files.filter((file)=>file.endsWith(".css"));
allFiles.push(...cssFiles);
}
}
if (allFiles.length === 0) {
return null;
}
return /*#__PURE__*/ _jsx(_Fragment, {
children: allFiles.map((file)=>{
return /*#__PURE__*/ _jsx("link", {
// @ts-ignore
precedence: "dynamic",
rel: "stylesheet",
href: requestStore.assetPrefix + "/_next/" + encodeURI(file),
as: "style"
}, file);
})
});
}
//# sourceMappingURL=preload-css.js.map