full site update
This commit is contained in:
10
node_modules/astro/dist/prefetch/index.js
generated
vendored
10
node_modules/astro/dist/prefetch/index.js
generated
vendored
@@ -125,7 +125,7 @@ function prefetch(url, opts) {
|
||||
prefetchedUrls.add(url);
|
||||
if (clientPrerender && HTMLScriptElement.supports?.("speculationrules")) {
|
||||
debug?.(`[astro] Prefetching ${url} with <script type="speculationrules">`);
|
||||
appendSpeculationRules(url);
|
||||
appendSpeculationRules(url, opts?.eagerness ?? "immediate");
|
||||
} else if (document.createElement("link").relList?.supports?.("prefetch") && opts?.with !== "fetch") {
|
||||
debug?.(`[astro] Prefetching ${url} with <link rel="prefetch">`);
|
||||
const link = document.createElement("link");
|
||||
@@ -182,14 +182,15 @@ function onPageLoad(cb) {
|
||||
cb();
|
||||
});
|
||||
}
|
||||
function appendSpeculationRules(url) {
|
||||
function appendSpeculationRules(url, eagerness) {
|
||||
const script = document.createElement("script");
|
||||
script.type = "speculationrules";
|
||||
script.textContent = JSON.stringify({
|
||||
prerender: [
|
||||
{
|
||||
source: "list",
|
||||
urls: [url]
|
||||
urls: [url],
|
||||
eagerness
|
||||
}
|
||||
],
|
||||
// Currently, adding `prefetch` is required to fallback if `prerender` fails.
|
||||
@@ -198,7 +199,8 @@ function appendSpeculationRules(url) {
|
||||
prefetch: [
|
||||
{
|
||||
source: "list",
|
||||
urls: [url]
|
||||
urls: [url],
|
||||
eagerness
|
||||
}
|
||||
]
|
||||
});
|
||||
|
Reference in New Issue
Block a user