reroute-js 1.0.0-alpha.7 → 1.0.0-alpha.9
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/README.md +2 -0
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +198 -36
- package/cli/bin.js.map +12 -11
- package/cli/index.d.ts +1 -1
- package/cli/index.js +4 -4
- package/cli/index.js.map +1 -1
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +1 -1
- package/cli/src/commands/dev.d.ts +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/theme.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/start.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +194 -32
- package/core/index.js.map +12 -11
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +26 -2
- package/core/src/config.d.ts.map +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/i18n/catalog.d.ts +1 -1
- package/core/src/i18n/discover.d.ts +1 -1
- package/core/src/i18n/index.d.ts +1 -1
- package/core/src/i18n/messages.d.ts +1 -1
- package/core/src/i18n/negotiate.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts +1 -1
- package/core/src/i18n/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/discovery.d.ts +35 -0
- package/core/src/llms/discovery.d.ts.map +1 -0
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +4 -1
- package/core/src/llms/index.d.ts.map +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/generator.d.ts.map +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/cleanup.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +17 -1
- package/core/src/ssr/lib/collections.d.ts.map +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/content-path.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +1 -1
- package/core/src/ssr/lib/mime.d.ts +1 -1
- package/core/src/ssr/lib/modules.d.ts +1 -1
- package/core/src/ssr/lib/path.d.ts +1 -1
- package/core/src/ssr/lib/preload.d.ts +1 -1
- package/core/src/ssr/lib/route-match.d.ts +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +2 -2
- package/core/src/ssr/lib/scripts/collections.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +1 -1
- package/core/src/ssr/lib/scripts/escape.d.ts +1 -1
- package/core/src/ssr/lib/scripts/feeds.d.ts +1 -1
- package/core/src/ssr/lib/scripts/index.d.ts +1 -1
- package/core/src/ssr/lib/seed.d.ts +1 -1
- package/core/src/ssr/lib/serialize.d.ts +1 -1
- package/core/src/ssr/lib/setup.d.ts +2 -2
- package/core/src/ssr/lib/setup.d.ts.map +1 -1
- package/core/src/ssr/lib/styles.d.ts +1 -1
- package/core/src/ssr/lib/template.d.ts +1 -1
- package/core/src/ssr/lib/types.d.ts +1 -1
- package/core/src/ssr/render.d.ts +1 -1
- package/core/src/ssr/render.d.ts.map +1 -1
- package/core/src/ssr/stream.d.ts +1 -1
- package/core/src/ssr/stream.d.ts.map +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +222 -50
- package/elysia/index.js.map +15 -14
- package/elysia/src/index.d.ts +1 -1
- package/elysia/src/libs/assets.d.ts +1 -1
- package/elysia/src/libs/cache.d.ts +1 -1
- package/elysia/src/libs/caching.d.ts +1 -1
- package/elysia/src/libs/http.d.ts +1 -1
- package/elysia/src/libs/i18n.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/plugin.d.ts.map +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts.map +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +4 -2
- package/elysia/src/routes/ssr.d.ts.map +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/routes/themeCssRefresh.d.ts +1 -1
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +8 -5
- package/react/index.js.map +3 -3
- package/react/src/components/ClientOnly.d.ts +1 -1
- package/react/src/components/ContentRoute.d.ts +1 -1
- package/react/src/components/Image.d.ts +1 -1
- package/react/src/components/LazyRoute.d.ts +1 -1
- package/react/src/components/Link.d.ts +1 -1
- package/react/src/components/Markdown.d.ts +1 -1
- package/react/src/components/Outlet.d.ts +1 -1
- package/react/src/components/index.d.ts +1 -1
- package/react/src/hooks/index.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts +1 -1
- package/react/src/hooks/useContent.d.ts.map +1 -1
- package/react/src/hooks/useData.d.ts +1 -1
- package/react/src/hooks/useFeed.d.ts +1 -1
- package/react/src/hooks/useLayoutData.d.ts +1 -1
- package/react/src/hooks/useLlms.d.ts +1 -1
- package/react/src/hooks/useNavigate.d.ts +1 -1
- package/react/src/hooks/useParams.d.ts +1 -1
- package/react/src/hooks/useRouter.d.ts +1 -1
- package/react/src/hooks/useSearch.d.ts +1 -1
- package/react/src/hooks/useSearchParams.d.ts +1 -1
- package/react/src/hooks/useToc.d.ts +1 -1
- package/react/src/i18n/LocaleProvider.d.ts +1 -1
- package/react/src/i18n/helpers.d.ts +1 -1
- package/react/src/i18n/index.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +2 -2
- package/telemetry/react.js.map +1 -1
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +25 -10
- package/telemetry/server.js.map +11 -9
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/elysia/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v1.0.0-alpha.
|
|
2
|
+
* reroute-js v1.0.0-alpha.9
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -1150,6 +1150,21 @@ function setGlobalCollections(byCollectionForSSR) {
|
|
|
1150
1150
|
globalThis.__REROUTE_COLLECTIONS__ = byCollectionForSSR;
|
|
1151
1151
|
} catch {}
|
|
1152
1152
|
}
|
|
1153
|
+
function resetSSRContentResults() {
|
|
1154
|
+
try {
|
|
1155
|
+
globalThis.__REROUTE_SSR_RESULTS__ = {};
|
|
1156
|
+
} catch {}
|
|
1157
|
+
}
|
|
1158
|
+
function takeSSRContentResults() {
|
|
1159
|
+
try {
|
|
1160
|
+
const g = globalThis;
|
|
1161
|
+
const results = g.__REROUTE_SSR_RESULTS__;
|
|
1162
|
+
g.__REROUTE_SSR_RESULTS__ = {};
|
|
1163
|
+
return results;
|
|
1164
|
+
} catch {
|
|
1165
|
+
return;
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1153
1168
|
var init_collections = __esm(() => {
|
|
1154
1169
|
init_imports();
|
|
1155
1170
|
});
|
|
@@ -3270,23 +3285,34 @@ function parseAccessTracking(accessedCollections) {
|
|
|
3270
3285
|
}
|
|
3271
3286
|
return usage;
|
|
3272
3287
|
}
|
|
3273
|
-
function
|
|
3288
|
+
function processCapturedResults(capturedResults, byCollectionForSSR) {
|
|
3274
3289
|
const subset = {};
|
|
3275
3290
|
const partial = {};
|
|
3276
3291
|
try {
|
|
3277
3292
|
const g = globalThis;
|
|
3278
|
-
const ssrResults = g.__REROUTE_SSR_RESULTS__;
|
|
3279
|
-
if (ssrResults
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3293
|
+
const ssrResults = capturedResults ?? g.__REROUTE_SSR_RESULTS__;
|
|
3294
|
+
if (!ssrResults || typeof ssrResults !== "object")
|
|
3295
|
+
return;
|
|
3296
|
+
for (const [collection, items] of Object.entries(ssrResults)) {
|
|
3297
|
+
if (Array.isArray(items) && items.length > 0) {
|
|
3298
|
+
subset[collection] = items;
|
|
3299
|
+
const full = byCollectionForSSR?.[collection] || [];
|
|
3300
|
+
partial[collection] = items.length < full.length;
|
|
3286
3301
|
}
|
|
3287
|
-
return { subset, partial };
|
|
3288
3302
|
}
|
|
3289
|
-
} catch {
|
|
3303
|
+
} catch {
|
|
3304
|
+
return;
|
|
3305
|
+
}
|
|
3306
|
+
if (Object.keys(subset).length === 0)
|
|
3307
|
+
return;
|
|
3308
|
+
return { subset, partial };
|
|
3309
|
+
}
|
|
3310
|
+
function processCollections(accessedCollections, byCollectionForSSR, capturedResults) {
|
|
3311
|
+
const captured = processCapturedResults(capturedResults, byCollectionForSSR);
|
|
3312
|
+
if (captured)
|
|
3313
|
+
return captured;
|
|
3314
|
+
const subset = {};
|
|
3315
|
+
const partial = {};
|
|
3290
3316
|
const sortByDate = (order) => (a, b) => {
|
|
3291
3317
|
const da = a?.meta?.date ? Date.parse(String(a.meta.date)) : 0;
|
|
3292
3318
|
const db = b?.meta?.date ? Date.parse(String(b.meta.date)) : 0;
|
|
@@ -3575,6 +3601,7 @@ async function performSSRSetupInternal(options, streaming, timeoutState) {
|
|
|
3575
3601
|
});
|
|
3576
3602
|
assertNotTimedOut();
|
|
3577
3603
|
resetSSRAccessTracking();
|
|
3604
|
+
resetSSRContentResults();
|
|
3578
3605
|
const bundlePreload = createBundlePreload(bundleUrl);
|
|
3579
3606
|
const preloadResult = await withSpan("ssr.preload", async (span) => {
|
|
3580
3607
|
span.setAttribute("pathname", pathname);
|
|
@@ -3650,12 +3677,12 @@ async function performSSRSetupInternal(options, streaming, timeoutState) {
|
|
|
3650
3677
|
pending: computeResult.pending
|
|
3651
3678
|
};
|
|
3652
3679
|
}
|
|
3653
|
-
function generateCollectionScripts(byCollectionForSSR) {
|
|
3680
|
+
function generateCollectionScripts(byCollectionForSSR, capturedResults) {
|
|
3654
3681
|
try {
|
|
3655
3682
|
const g = globalThis;
|
|
3656
3683
|
const acc = g.__REROUTE_SSR_ACCESSED__;
|
|
3657
3684
|
if (acc) {
|
|
3658
|
-
const { subset, partial } = processCollections(acc, byCollectionForSSR);
|
|
3685
|
+
const { subset, partial } = processCollections(acc, byCollectionForSSR, capturedResults);
|
|
3659
3686
|
if (Object.keys(subset).length > 0) {
|
|
3660
3687
|
return createCollectionScript(subset, partial);
|
|
3661
3688
|
}
|
|
@@ -3807,13 +3834,16 @@ async function renderSSRDocument(options) {
|
|
|
3807
3834
|
}, false);
|
|
3808
3835
|
const duplicatedData = duplicateQueryParamData(setup2.ssrData);
|
|
3809
3836
|
setGlobalSSRData(duplicatedData);
|
|
3837
|
+
let capturedResults;
|
|
3810
3838
|
const appHtml = await withSpan("ssr.render.react", async (span) => {
|
|
3811
3839
|
const componentWithPathname = cloneElement(rootComponent, {
|
|
3812
3840
|
pathname,
|
|
3813
3841
|
searchParams
|
|
3814
3842
|
});
|
|
3815
3843
|
span.setAttribute("reroute.pathname", pathname);
|
|
3844
|
+
resetSSRContentResults();
|
|
3816
3845
|
const html3 = renderToString(componentWithPathname);
|
|
3846
|
+
capturedResults = takeSSRContentResults();
|
|
3817
3847
|
span.setAttribute("reroute.html.final.size", html3.length);
|
|
3818
3848
|
return html3;
|
|
3819
3849
|
});
|
|
@@ -3822,7 +3852,7 @@ async function renderSSRDocument(options) {
|
|
|
3822
3852
|
span.setAttribute("reroute.template.size", template2.length);
|
|
3823
3853
|
return template2;
|
|
3824
3854
|
});
|
|
3825
|
-
const collectionScripts = generateCollectionScripts(setup2.byCollectionForSSR);
|
|
3855
|
+
const collectionScripts = generateCollectionScripts(setup2.byCollectionForSSR, capturedResults);
|
|
3826
3856
|
const config = await loadConfig(cwd);
|
|
3827
3857
|
const browserTelemetryConfigRaw = config.telemetry?.browser;
|
|
3828
3858
|
const { serializeBrowserTelemetryConfig: serializeBrowserTelemetryConfig2 } = await Promise.resolve().then(() => exports_serialize);
|
|
@@ -3840,7 +3870,7 @@ async function renderSSRDocument(options) {
|
|
|
3840
3870
|
if (setup2.metadataResult.statusOverride !== undefined) {
|
|
3841
3871
|
statusOverride = setup2.metadataResult.statusOverride;
|
|
3842
3872
|
}
|
|
3843
|
-
const extraHead = setup2.bundlePreload + setup2.preloadExtraHead;
|
|
3873
|
+
const extraHead = appendLlmsAlternateHead(setup2.bundlePreload + setup2.preloadExtraHead, pathname, statusOverride || 200, config.llms);
|
|
3844
3874
|
const combinedHead = dedent([
|
|
3845
3875
|
dedent(head) || "",
|
|
3846
3876
|
dedent(extraHead),
|
|
@@ -3870,6 +3900,7 @@ async function renderSSRDocument(options) {
|
|
|
3870
3900
|
var init_render = __esm(() => {
|
|
3871
3901
|
init_server2();
|
|
3872
3902
|
init_config();
|
|
3903
|
+
init_discovery3();
|
|
3873
3904
|
init_lib();
|
|
3874
3905
|
init_html();
|
|
3875
3906
|
});
|
|
@@ -4196,6 +4227,112 @@ var init_extractor = __esm(() => {
|
|
|
4196
4227
|
init_render();
|
|
4197
4228
|
});
|
|
4198
4229
|
|
|
4230
|
+
// packages/core/src/llms/discovery.ts
|
|
4231
|
+
function yesNo(value) {
|
|
4232
|
+
return value === false ? "no" : "yes";
|
|
4233
|
+
}
|
|
4234
|
+
function formatContentSignal(policy, whenUndefined = "omit") {
|
|
4235
|
+
if (policy === false)
|
|
4236
|
+
return;
|
|
4237
|
+
if (policy === undefined && whenUndefined === "omit")
|
|
4238
|
+
return;
|
|
4239
|
+
const resolved = {
|
|
4240
|
+
search: true,
|
|
4241
|
+
aiInput: true,
|
|
4242
|
+
aiTrain: true,
|
|
4243
|
+
...policy
|
|
4244
|
+
};
|
|
4245
|
+
return `ai-train=${yesNo(resolved.aiTrain)}, search=${yesNo(resolved.search)}, ai-input=${yesNo(resolved.aiInput)}`;
|
|
4246
|
+
}
|
|
4247
|
+
function markdownTwinPath(pathname) {
|
|
4248
|
+
const path2 = pathname.split("?")[0];
|
|
4249
|
+
if (path2 === "/" || path2 === "")
|
|
4250
|
+
return "/index.md";
|
|
4251
|
+
return `${path2.replace(/\/$/, "")}.md`;
|
|
4252
|
+
}
|
|
4253
|
+
function shouldAdvertiseMarkdownTwin(pathname, llmsConfig) {
|
|
4254
|
+
if (!llmsConfig?.enabled)
|
|
4255
|
+
return false;
|
|
4256
|
+
if (llmsConfig.enableMarkdownExtension === false)
|
|
4257
|
+
return false;
|
|
4258
|
+
if (shouldExcludeRoute(pathname, llmsConfig.excludeRoutes))
|
|
4259
|
+
return false;
|
|
4260
|
+
return true;
|
|
4261
|
+
}
|
|
4262
|
+
function llmsAlternateLinkTag(pathname, llmsConfig) {
|
|
4263
|
+
if (!shouldAdvertiseMarkdownTwin(pathname, llmsConfig))
|
|
4264
|
+
return "";
|
|
4265
|
+
return `<link rel="alternate" type="text/markdown" href="${markdownTwinPath(pathname)}" />`;
|
|
4266
|
+
}
|
|
4267
|
+
function mergeVary(existing, token) {
|
|
4268
|
+
const parts = (existing ?? "").split(",").map((part) => part.trim()).filter(Boolean);
|
|
4269
|
+
if (!parts.some((part) => part.toLowerCase() === token.toLowerCase())) {
|
|
4270
|
+
parts.push(token);
|
|
4271
|
+
}
|
|
4272
|
+
return parts.join(", ");
|
|
4273
|
+
}
|
|
4274
|
+
function appendLinkValues(existing, values) {
|
|
4275
|
+
const current = (existing ?? "").split(",").map((part) => part.trim()).filter(Boolean);
|
|
4276
|
+
for (const value of values) {
|
|
4277
|
+
if (!current.includes(value))
|
|
4278
|
+
current.push(value);
|
|
4279
|
+
}
|
|
4280
|
+
return current.join(", ");
|
|
4281
|
+
}
|
|
4282
|
+
function buildLlmsDiscovery(pathname, llmsConfig) {
|
|
4283
|
+
if (!llmsConfig?.enabled)
|
|
4284
|
+
return null;
|
|
4285
|
+
const linkValues = [];
|
|
4286
|
+
if (shouldAdvertiseMarkdownTwin(pathname, llmsConfig)) {
|
|
4287
|
+
linkValues.push(`<${markdownTwinPath(pathname)}>; rel="alternate"; type="text/markdown"`);
|
|
4288
|
+
}
|
|
4289
|
+
if (llmsConfig.enableIndex !== false) {
|
|
4290
|
+
linkValues.push('</llms.txt>; rel="llms-txt"');
|
|
4291
|
+
}
|
|
4292
|
+
const contentSignal = formatContentSignal(llmsConfig.contentSignal, "default");
|
|
4293
|
+
const vary = llmsConfig.enableContentNegotiation !== false ? "Accept" : undefined;
|
|
4294
|
+
if (linkValues.length === 0 && !contentSignal && !vary)
|
|
4295
|
+
return null;
|
|
4296
|
+
return { linkValues, contentSignal, vary };
|
|
4297
|
+
}
|
|
4298
|
+
function writeHeader(headers2, canonical, value) {
|
|
4299
|
+
const lower = canonical.toLowerCase();
|
|
4300
|
+
if (headers2[lower] !== undefined)
|
|
4301
|
+
headers2[lower] = value;
|
|
4302
|
+
if (headers2[canonical] !== undefined || headers2[lower] === undefined) {
|
|
4303
|
+
headers2[canonical] = value;
|
|
4304
|
+
}
|
|
4305
|
+
}
|
|
4306
|
+
function readHeader(headers2, canonical) {
|
|
4307
|
+
return headers2[canonical] ?? headers2[canonical.toLowerCase()];
|
|
4308
|
+
}
|
|
4309
|
+
function applyLlmsDiscoveryHeaders(headers2, pathname, llmsConfig, status = 200) {
|
|
4310
|
+
if (status < 200 || status >= 300)
|
|
4311
|
+
return;
|
|
4312
|
+
const discovery2 = buildLlmsDiscovery(pathname, llmsConfig);
|
|
4313
|
+
if (!discovery2)
|
|
4314
|
+
return;
|
|
4315
|
+
if (discovery2.linkValues.length > 0) {
|
|
4316
|
+
writeHeader(headers2, "Link", appendLinkValues(readHeader(headers2, "Link"), discovery2.linkValues));
|
|
4317
|
+
}
|
|
4318
|
+
if (discovery2.contentSignal) {
|
|
4319
|
+
writeHeader(headers2, "Content-Signal", discovery2.contentSignal);
|
|
4320
|
+
}
|
|
4321
|
+
if (discovery2.vary) {
|
|
4322
|
+
writeHeader(headers2, "Vary", mergeVary(readHeader(headers2, "Vary"), discovery2.vary));
|
|
4323
|
+
}
|
|
4324
|
+
}
|
|
4325
|
+
function appendLlmsAlternateHead(extraHead, pathname, status, llmsConfig) {
|
|
4326
|
+
if (status !== 200)
|
|
4327
|
+
return extraHead;
|
|
4328
|
+
const tag = llmsAlternateLinkTag(pathname, llmsConfig);
|
|
4329
|
+
return tag ? `${extraHead}
|
|
4330
|
+
${tag}` : extraHead;
|
|
4331
|
+
}
|
|
4332
|
+
var init_discovery3 = __esm(() => {
|
|
4333
|
+
init_extractor();
|
|
4334
|
+
});
|
|
4335
|
+
|
|
4199
4336
|
// packages/core/src/llms/index-generator.ts
|
|
4200
4337
|
var exports_index_generator = {};
|
|
4201
4338
|
__export(exports_index_generator, {
|
|
@@ -4698,6 +4835,7 @@ var init_full_generator = __esm(() => {
|
|
|
4698
4835
|
|
|
4699
4836
|
// packages/core/src/llms/index.ts
|
|
4700
4837
|
var init_llms = __esm(() => {
|
|
4838
|
+
init_discovery3();
|
|
4701
4839
|
init_extractor();
|
|
4702
4840
|
init_full_generator();
|
|
4703
4841
|
init_index_generator();
|
|
@@ -4864,7 +5002,7 @@ async function discoverRobotsData(cwd, isWatchMode, robotsConfig, sitemapConfig,
|
|
|
4864
5002
|
redirectSourcePaths
|
|
4865
5003
|
};
|
|
4866
5004
|
}
|
|
4867
|
-
var
|
|
5005
|
+
var init_discovery4 = () => {};
|
|
4868
5006
|
|
|
4869
5007
|
// packages/core/src/robots/generator.ts
|
|
4870
5008
|
function getEffectivePolicies(policies) {
|
|
@@ -4907,8 +5045,16 @@ function addDisallowDirectives(lines, policy, autoDisallows) {
|
|
|
4907
5045
|
}
|
|
4908
5046
|
}
|
|
4909
5047
|
}
|
|
4910
|
-
function
|
|
5048
|
+
function addContentSignalLine(lines, policy, robotsConfig) {
|
|
5049
|
+
if (policy.userAgent !== "*")
|
|
5050
|
+
return;
|
|
5051
|
+
const value = formatContentSignal(robotsConfig.contentSignal);
|
|
5052
|
+
if (value)
|
|
5053
|
+
lines.push(`Content-Signal: ${value}`);
|
|
5054
|
+
}
|
|
5055
|
+
function addPolicyBlock(lines, policy, autoDisallows, robotsConfig) {
|
|
4911
5056
|
lines.push(`User-agent: ${policy.userAgent}`);
|
|
5057
|
+
addContentSignalLine(lines, policy, robotsConfig);
|
|
4912
5058
|
addAllowDirectives(lines, policy);
|
|
4913
5059
|
addDisallowDirectives(lines, policy, autoDisallows);
|
|
4914
5060
|
if (policy.crawlDelay !== undefined) {
|
|
@@ -4934,7 +5080,7 @@ function generateRobots(discovery2, robotsConfig, sitemapEnabled) {
|
|
|
4934
5080
|
const effectivePolicies = getEffectivePolicies(policies);
|
|
4935
5081
|
const autoDisallows = getAutoDisallows(discovery2);
|
|
4936
5082
|
for (const policy of effectivePolicies) {
|
|
4937
|
-
addPolicyBlock(lines, policy, autoDisallows);
|
|
5083
|
+
addPolicyBlock(lines, policy, autoDisallows, robotsConfig);
|
|
4938
5084
|
}
|
|
4939
5085
|
addGlobalCrawlDelay(lines, crawlDelay, effectivePolicies);
|
|
4940
5086
|
if (customRules) {
|
|
@@ -4946,6 +5092,9 @@ function generateRobots(discovery2, robotsConfig, sitemapEnabled) {
|
|
|
4946
5092
|
`).trim()}
|
|
4947
5093
|
`;
|
|
4948
5094
|
}
|
|
5095
|
+
var init_generator = __esm(() => {
|
|
5096
|
+
init_discovery3();
|
|
5097
|
+
});
|
|
4949
5098
|
|
|
4950
5099
|
// packages/core/src/robots/policies.ts
|
|
4951
5100
|
function blockAICrawlers(crawlers) {
|
|
@@ -5016,7 +5165,8 @@ var init_policies = __esm(() => {
|
|
|
5016
5165
|
|
|
5017
5166
|
// packages/core/src/robots/index.ts
|
|
5018
5167
|
var init_robots = __esm(() => {
|
|
5019
|
-
|
|
5168
|
+
init_discovery4();
|
|
5169
|
+
init_generator();
|
|
5020
5170
|
init_policies();
|
|
5021
5171
|
});
|
|
5022
5172
|
|
|
@@ -5349,7 +5499,7 @@ async function discoverSitemapData(cwd, collections2, baseUrl, isWatchMode, site
|
|
|
5349
5499
|
ssrDataRoutes
|
|
5350
5500
|
};
|
|
5351
5501
|
}
|
|
5352
|
-
var
|
|
5502
|
+
var init_discovery5 = () => {};
|
|
5353
5503
|
|
|
5354
5504
|
// packages/core/src/rss/discovery.ts
|
|
5355
5505
|
import { pathToFileURL as pathToFileURL7 } from "node:url";
|
|
@@ -5617,7 +5767,7 @@ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfi
|
|
|
5617
5767
|
}
|
|
5618
5768
|
const ssrDataFeeds = new Map;
|
|
5619
5769
|
const bundledRoutes = globalThis.__REROUTE_ROUTES__;
|
|
5620
|
-
const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (
|
|
5770
|
+
const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery5(), exports_discovery));
|
|
5621
5771
|
const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
|
|
5622
5772
|
if (bundledRoutes && Array.isArray(bundledRoutes)) {
|
|
5623
5773
|
const routePromises = staticRoutes.map(async (route) => {
|
|
@@ -5674,7 +5824,7 @@ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfi
|
|
|
5674
5824
|
ssrDataFeeds
|
|
5675
5825
|
};
|
|
5676
5826
|
}
|
|
5677
|
-
var
|
|
5827
|
+
var init_discovery6 = () => {};
|
|
5678
5828
|
|
|
5679
5829
|
// packages/core/src/rss/generator.ts
|
|
5680
5830
|
function generateRSSXML(feed, options = {}) {
|
|
@@ -5787,7 +5937,7 @@ function escapeXml(unsafe) {
|
|
|
5787
5937
|
|
|
5788
5938
|
// packages/core/src/rss/index.ts
|
|
5789
5939
|
var init_rss = __esm(() => {
|
|
5790
|
-
|
|
5940
|
+
init_discovery6();
|
|
5791
5941
|
});
|
|
5792
5942
|
|
|
5793
5943
|
// packages/core/src/sitemap/generator.ts
|
|
@@ -5932,12 +6082,12 @@ function escapeXml2(unsafe) {
|
|
|
5932
6082
|
return unsafe.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5933
6083
|
}
|
|
5934
6084
|
var DEFAULT_MAX_URLS = 50000;
|
|
5935
|
-
var
|
|
6085
|
+
var init_generator2 = () => {};
|
|
5936
6086
|
|
|
5937
6087
|
// packages/core/src/sitemap/index.ts
|
|
5938
6088
|
var init_sitemap = __esm(() => {
|
|
5939
|
-
|
|
5940
|
-
|
|
6089
|
+
init_discovery5();
|
|
6090
|
+
init_generator2();
|
|
5941
6091
|
});
|
|
5942
6092
|
|
|
5943
6093
|
// packages/core/src/ssr/stream.ts
|
|
@@ -6015,15 +6165,16 @@ async function renderSSRDocumentStream(options) {
|
|
|
6015
6165
|
const newAttrs = hasLang ? attrs.replace(/lang\s*=\s*("[^"]*"|'[^']*'|[^\s>]+)/i, `lang="${pageLang}"`) : `${attrs} lang="${pageLang}"`;
|
|
6016
6166
|
return `<html${newAttrs}>`;
|
|
6017
6167
|
});
|
|
6018
|
-
const
|
|
6019
|
-
if (/<title[\s\S]*?<\/title>/i.test(
|
|
6168
|
+
const extraHeadBase = setup2.bundlePreload + setup2.preloadExtraHead + setup2.metadataResult.perPageHead;
|
|
6169
|
+
if (/<title[\s\S]*?<\/title>/i.test(extraHeadBase)) {
|
|
6020
6170
|
headWithLang = headWithLang.replace(/<title[\s\S]*?<\/title>/i, "");
|
|
6021
6171
|
}
|
|
6022
|
-
if (/<meta\s+name\s*=\s*['"]description['"][^>]*>/i.test(
|
|
6172
|
+
if (/<meta\s+name\s*=\s*['"]description['"][^>]*>/i.test(extraHeadBase)) {
|
|
6023
6173
|
headWithLang = headWithLang.replace(/<meta\s+name\s*=\s*['"]description['"][^>]*>/i, "");
|
|
6024
6174
|
}
|
|
6025
|
-
headWithLang = removeOverriddenMetaTags(headWithLang,
|
|
6175
|
+
headWithLang = removeOverriddenMetaTags(headWithLang, extraHeadBase);
|
|
6026
6176
|
const config = await loadConfig(cwd);
|
|
6177
|
+
const extraHead = appendLlmsAlternateHead(extraHeadBase, pathname, statusOverride || 200, config.llms);
|
|
6027
6178
|
const browserTelemetryConfigRaw = config.telemetry?.browser;
|
|
6028
6179
|
const { serializeBrowserTelemetryConfig: serializeBrowserTelemetryConfig2 } = await Promise.resolve().then(() => exports_serialize);
|
|
6029
6180
|
const browserTelemetryConfig = serializeBrowserTelemetryConfig2(browserTelemetryConfigRaw);
|
|
@@ -6281,6 +6432,7 @@ function unescapeHtmlEntities(str) {
|
|
|
6281
6432
|
var init_stream = __esm(() => {
|
|
6282
6433
|
init_server2();
|
|
6283
6434
|
init_config();
|
|
6435
|
+
init_discovery3();
|
|
6284
6436
|
init_lib();
|
|
6285
6437
|
init_html();
|
|
6286
6438
|
init_imports();
|
|
@@ -6323,12 +6475,15 @@ __export(exports_core, {
|
|
|
6323
6475
|
acceptsGzip: () => acceptsGzip,
|
|
6324
6476
|
allowAICrawlers: () => allowAICrawlers,
|
|
6325
6477
|
allowSearchCrawlers: () => allowSearchCrawlers,
|
|
6478
|
+
appendLlmsAlternateHead: () => appendLlmsAlternateHead,
|
|
6326
6479
|
applyIndexTemplate: () => applyIndexTemplate,
|
|
6480
|
+
applyLlmsDiscoveryHeaders: () => applyLlmsDiscoveryHeaders,
|
|
6327
6481
|
basename: () => basename,
|
|
6328
6482
|
blockAICrawlers: () => blockAICrawlers,
|
|
6329
6483
|
blockAITrainingCrawlers: () => blockAITrainingCrawlers,
|
|
6330
6484
|
blockSearchCrawlers: () => blockSearchCrawlers,
|
|
6331
6485
|
buildHeadFromMeta: () => buildHeadFromMeta,
|
|
6486
|
+
buildLlmsDiscovery: () => buildLlmsDiscovery,
|
|
6332
6487
|
buildLocaleCookie: () => buildLocaleCookie,
|
|
6333
6488
|
cleanupPathScopedSSRData: () => cleanupPathScopedSSRData,
|
|
6334
6489
|
clearSSRModuleStores: () => clearSSRModuleStores,
|
|
@@ -6374,6 +6529,7 @@ __export(exports_core, {
|
|
|
6374
6529
|
findOGImageForPath: () => findOGImageForPath,
|
|
6375
6530
|
formatAsMarkdown: () => formatAsMarkdown,
|
|
6376
6531
|
formatAsText: () => formatAsText,
|
|
6532
|
+
formatContentSignal: () => formatContentSignal,
|
|
6377
6533
|
formatMessage: () => formatMessage,
|
|
6378
6534
|
generateAtomXML: () => generateAtomXML,
|
|
6379
6535
|
generateCollectionScripts: () => generateCollectionScripts,
|
|
@@ -6405,6 +6561,7 @@ __export(exports_core, {
|
|
|
6405
6561
|
isThenable: () => isThenable,
|
|
6406
6562
|
join: () => join,
|
|
6407
6563
|
listContentFiles: () => listContentFiles,
|
|
6564
|
+
llmsAlternateLinkTag: () => llmsAlternateLinkTag,
|
|
6408
6565
|
loadCollections: () => loadCollections,
|
|
6409
6566
|
loadConfig: () => loadConfig,
|
|
6410
6567
|
loadIndexHtml: () => loadIndexHtml,
|
|
@@ -6414,9 +6571,11 @@ __export(exports_core, {
|
|
|
6414
6571
|
localizeHref: () => localizeHref,
|
|
6415
6572
|
looksLikeLocale: () => looksLikeLocale,
|
|
6416
6573
|
lookupMessage: () => lookupMessage,
|
|
6574
|
+
markdownTwinPath: () => markdownTwinPath,
|
|
6417
6575
|
matchRoutePattern: () => matchRoutePattern,
|
|
6418
6576
|
matchRoutes: () => matchRoutes,
|
|
6419
6577
|
mergeLayoutData: () => mergeLayoutData,
|
|
6578
|
+
mergeVary: () => mergeVary,
|
|
6420
6579
|
negotiateLocale: () => negotiateLocale,
|
|
6421
6580
|
normalizePathname: () => normalizePathname,
|
|
6422
6581
|
parseContentPath: () => parseContentPath,
|
|
@@ -6429,10 +6588,12 @@ __export(exports_core, {
|
|
|
6429
6588
|
renderSSRDocument: () => renderSSRDocument,
|
|
6430
6589
|
renderSSRDocumentStream: () => renderSSRDocumentStream,
|
|
6431
6590
|
resetSSRAccessTracking: () => resetSSRAccessTracking,
|
|
6591
|
+
resetSSRContentResults: () => resetSSRContentResults,
|
|
6432
6592
|
resolveLocale: () => resolveLocale,
|
|
6433
6593
|
seedSSRModuleForPath: () => seedSSRModuleForPath,
|
|
6434
6594
|
setGlobalCollections: () => setGlobalCollections,
|
|
6435
6595
|
setGlobalSSRData: () => setGlobalSSRData,
|
|
6596
|
+
shouldAdvertiseMarkdownTwin: () => shouldAdvertiseMarkdownTwin,
|
|
6436
6597
|
shouldExcludeRoute: () => shouldExcludeRoute,
|
|
6437
6598
|
splitTemplate: () => splitTemplate,
|
|
6438
6599
|
ssrCache: () => ssrCache,
|
|
@@ -6440,6 +6601,7 @@ __export(exports_core, {
|
|
|
6440
6601
|
stripEnd: () => stripEnd,
|
|
6441
6602
|
stripHtmlTags: () => stripHtmlTags,
|
|
6442
6603
|
stripStart: () => stripStart,
|
|
6604
|
+
takeSSRContentResults: () => takeSSRContentResults,
|
|
6443
6605
|
toBytes: () => toBytes,
|
|
6444
6606
|
toOgLocale: () => toOgLocale,
|
|
6445
6607
|
toPromise: () => toPromise
|
|
@@ -7726,13 +7888,17 @@ function registerLLMsRoutes(app, options) {
|
|
|
7726
7888
|
const { ttlMs, ttlMsFull, baseUrl } = defaults;
|
|
7727
7889
|
const llmsCache = new TTLCache(100, ttlMs);
|
|
7728
7890
|
const availableLlms = [];
|
|
7891
|
+
const contentSignal = formatContentSignal(llmsConfig.contentSignal, "default");
|
|
7892
|
+
const signalHeaders = contentSignal ? { "Content-Signal": contentSignal } : {};
|
|
7729
7893
|
const responseOpts = {
|
|
7730
7894
|
maxAge: defaults.maxAge,
|
|
7731
|
-
directive
|
|
7895
|
+
directive,
|
|
7896
|
+
extraHeaders: signalHeaders
|
|
7732
7897
|
};
|
|
7733
7898
|
const responseOptsFull = {
|
|
7734
7899
|
maxAge: defaults.maxAgeFull,
|
|
7735
|
-
directive
|
|
7900
|
+
directive,
|
|
7901
|
+
extraHeaders: signalHeaders
|
|
7736
7902
|
};
|
|
7737
7903
|
availableLlms.push(...getRootLlmsRoutes(llmsConfig));
|
|
7738
7904
|
if (llmsConfig.enableIndex !== false) {
|
|
@@ -7886,7 +8052,7 @@ function registerLLMsRoutes(app, options) {
|
|
|
7886
8052
|
cacheStatus: "HIT"
|
|
7887
8053
|
}) : textResponse(cached, {
|
|
7888
8054
|
...responseOpts,
|
|
7889
|
-
extraHeaders: { Vary: "Accept" },
|
|
8055
|
+
extraHeaders: { ...signalHeaders, Vary: "Accept" },
|
|
7890
8056
|
cacheStatus: "HIT"
|
|
7891
8057
|
});
|
|
7892
8058
|
}
|
|
@@ -7904,7 +8070,7 @@ function registerLLMsRoutes(app, options) {
|
|
|
7904
8070
|
llmsCache.set(cacheKey, content2);
|
|
7905
8071
|
return format === "md" ? markdownResponse(content2, { ...responseOpts, cacheStatus: "MISS" }) : textResponse(content2, {
|
|
7906
8072
|
...responseOpts,
|
|
7907
|
-
extraHeaders: { Vary: "Accept" },
|
|
8073
|
+
extraHeaders: { ...signalHeaders, Vary: "Accept" },
|
|
7908
8074
|
cacheStatus: "MISS"
|
|
7909
8075
|
});
|
|
7910
8076
|
}
|
|
@@ -9109,6 +9275,12 @@ function registerSSRRoutes(app, options) {
|
|
|
9109
9275
|
}
|
|
9110
9276
|
return headers2;
|
|
9111
9277
|
};
|
|
9278
|
+
const attachHtmlHeaders = (headers2, pathname, status, link) => {
|
|
9279
|
+
if (link && !headers2.Link && !headers2.link) {
|
|
9280
|
+
headers2.Link = link;
|
|
9281
|
+
}
|
|
9282
|
+
applyLlmsDiscoveryHeaders(headers2, pathname, options.llmsConfig, status);
|
|
9283
|
+
};
|
|
9112
9284
|
const SSR_HTML_TTL_MS = serverCacheEnabled && serverMaxAge > 0 ? serverMaxAge * 1000 : 0;
|
|
9113
9285
|
const htmlCache = new LRUCache(200);
|
|
9114
9286
|
const makeKey = (pathname, searchParams, acceptEncoding) => {
|
|
@@ -9177,6 +9349,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9177
9349
|
}
|
|
9178
9350
|
set.status = cached.status;
|
|
9179
9351
|
Object.assign(set.headers, cached.headers);
|
|
9352
|
+
attachHtmlHeaders(set.headers, pathname, cached.status);
|
|
9180
9353
|
set.headers["Reroute-Cache"] = "HIT";
|
|
9181
9354
|
return new Response(cached.body);
|
|
9182
9355
|
}
|
|
@@ -9307,9 +9480,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9307
9480
|
...extraHeaders
|
|
9308
9481
|
};
|
|
9309
9482
|
addCacheControl(cacheHeaders, cacheControlHeader);
|
|
9310
|
-
|
|
9311
|
-
cacheHeaders.Link = set.headers.link;
|
|
9312
|
-
}
|
|
9483
|
+
attachHtmlHeaders(cacheHeaders, pathname, status, set.headers.link);
|
|
9313
9484
|
htmlCache.set(ck, {
|
|
9314
9485
|
status,
|
|
9315
9486
|
headers: cacheHeaders,
|
|
@@ -9324,9 +9495,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9324
9495
|
...extraHeaders
|
|
9325
9496
|
};
|
|
9326
9497
|
addCacheControl(resHeaders, cacheControlHeader);
|
|
9327
|
-
|
|
9328
|
-
resHeaders.Link = set.headers.link;
|
|
9329
|
-
}
|
|
9498
|
+
attachHtmlHeaders(resHeaders, pathname, status, set.headers.link);
|
|
9330
9499
|
set.status = status;
|
|
9331
9500
|
response = new Response(body, {
|
|
9332
9501
|
status,
|
|
@@ -9360,9 +9529,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9360
9529
|
"Content-Type": "text/html; charset=utf-8"
|
|
9361
9530
|
};
|
|
9362
9531
|
addCacheControl(cacheHeaders, cacheControlHeader);
|
|
9363
|
-
|
|
9364
|
-
cacheHeaders.Link = set.headers.link;
|
|
9365
|
-
}
|
|
9532
|
+
attachHtmlHeaders(cacheHeaders, pathname, status, set.headers.link);
|
|
9366
9533
|
htmlCache.set(ck, {
|
|
9367
9534
|
status,
|
|
9368
9535
|
headers: cacheHeaders,
|
|
@@ -9381,6 +9548,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9381
9548
|
"Reroute-Cache": "MISS"
|
|
9382
9549
|
};
|
|
9383
9550
|
addCacheControl(resHeaders, cacheControlHeader);
|
|
9551
|
+
attachHtmlHeaders(resHeaders, pathname, status, set.headers.link);
|
|
9384
9552
|
const res = new Response(cachingStream, {
|
|
9385
9553
|
status,
|
|
9386
9554
|
headers: resHeaders
|
|
@@ -9399,6 +9567,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9399
9567
|
"Reroute-Cache": "MISS"
|
|
9400
9568
|
};
|
|
9401
9569
|
addCacheControl(streamHeaders, cacheControlHeader);
|
|
9570
|
+
attachHtmlHeaders(streamHeaders, pathname, status, set.headers.link);
|
|
9402
9571
|
response = new Response(stream2, {
|
|
9403
9572
|
status,
|
|
9404
9573
|
headers: streamHeaders
|
|
@@ -9484,9 +9653,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9484
9653
|
...extraHeaders
|
|
9485
9654
|
};
|
|
9486
9655
|
addCacheControl(resHeaders, cacheControlHeader);
|
|
9487
|
-
|
|
9488
|
-
resHeaders.Link = set.headers.link;
|
|
9489
|
-
}
|
|
9656
|
+
attachHtmlHeaders(resHeaders, pathname, status, set.headers.link);
|
|
9490
9657
|
set.status = status;
|
|
9491
9658
|
response = new Response(body, {
|
|
9492
9659
|
status,
|
|
@@ -9897,12 +10064,16 @@ var reroute = () => async (app) => {
|
|
|
9897
10064
|
}
|
|
9898
10065
|
if (robotsEnabled && robotsConfig) {
|
|
9899
10066
|
try {
|
|
10067
|
+
const robotsWithSignal = robotsConfig.contentSignal !== undefined || !llmsEnabled ? robotsConfig : {
|
|
10068
|
+
...robotsConfig,
|
|
10069
|
+
contentSignal: llmsConfig?.contentSignal ?? {}
|
|
10070
|
+
};
|
|
9900
10071
|
registerRobotsRoute(app, {
|
|
9901
10072
|
cwd,
|
|
9902
10073
|
maxAge: robotsConfig.maxAge ?? browserMaxAge,
|
|
9903
10074
|
isWatchMode,
|
|
9904
10075
|
robotsCache,
|
|
9905
|
-
robotsConfig,
|
|
10076
|
+
robotsConfig: robotsWithSignal,
|
|
9906
10077
|
sitemapConfig,
|
|
9907
10078
|
sitemapEnabled,
|
|
9908
10079
|
redirects: globalConfig.redirects
|
|
@@ -10014,7 +10185,8 @@ var reroute = () => async (app) => {
|
|
|
10014
10185
|
ogMetaConfig: globalConfig.og,
|
|
10015
10186
|
baseUrl,
|
|
10016
10187
|
autoCanonical,
|
|
10017
|
-
titleSuffix
|
|
10188
|
+
titleSuffix,
|
|
10189
|
+
llmsConfig: llmsEnabled ? llmsConfig : undefined
|
|
10018
10190
|
});
|
|
10019
10191
|
} catch (error) {
|
|
10020
10192
|
console.error("[reroute] Failed to register SSR routes:", error);
|
|
@@ -10036,4 +10208,4 @@ export {
|
|
|
10036
10208
|
reroute
|
|
10037
10209
|
};
|
|
10038
10210
|
|
|
10039
|
-
//# debugId=
|
|
10211
|
+
//# debugId=9A63A7812F1BCEAC64756E2164756E21
|