reroute-js 0.43.9 → 0.44.0
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/cli/bin.d.ts +1 -1
- package/cli/bin.js +79 -41
- package/cli/bin.js.map +10 -10
- 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/tailwind.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.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 +75 -37
- package/core/index.js.map +10 -10
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +6 -1
- 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 +2 -2
- package/core/src/content/metadata.d.ts.map +1 -1
- package/core/src/index.d.ts +1 -1
- 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 +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/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/collections.d.ts +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/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 +2 -2
- package/core/src/ssr/lib/metadata.d.ts.map +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/scripts/collections.d.ts +1 -1
- package/core/src/ssr/lib/scripts/data.d.ts +2 -2
- package/core/src/ssr/lib/scripts/data.d.ts.map +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 +4 -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 +13 -2
- package/core/src/ssr/lib/types.d.ts.map +1 -1
- package/core/src/ssr/render.d.ts +3 -1
- package/core/src/ssr/render.d.ts.map +1 -1
- package/core/src/ssr/stream.d.ts +3 -1
- package/core/src/ssr/stream.d.ts.map +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +83 -40
- package/elysia/index.js.map +13 -13
- 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/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/og.d.ts +1 -1
- package/elysia/src/routes/og.d.ts.map +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 +3 -1
- package/elysia/src/routes/ssr.d.ts.map +1 -1
- package/elysia/src/routes/static.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 +22 -6
- 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/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/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/head.d.ts.map +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 +2 -2
- package/telemetry/server.js.map +8 -8
- 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/cli/bin.d.ts
CHANGED
package/cli/bin.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
// @bun
|
|
3
3
|
/**
|
|
4
|
-
* reroute-js v0.
|
|
4
|
+
* reroute-js v0.44.0
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -48,7 +48,7 @@ async function getVersionString() {
|
|
|
48
48
|
}
|
|
49
49
|
async function getVersion() {
|
|
50
50
|
if (true) {
|
|
51
|
-
return "0.
|
|
51
|
+
return "0.44.0";
|
|
52
52
|
}
|
|
53
53
|
const possiblePaths = [
|
|
54
54
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -66,7 +66,7 @@ async function getVersion() {
|
|
|
66
66
|
}
|
|
67
67
|
async function getCommit() {
|
|
68
68
|
if (true) {
|
|
69
|
-
return "
|
|
69
|
+
return "d8856f1";
|
|
70
70
|
}
|
|
71
71
|
return "dev";
|
|
72
72
|
}
|
|
@@ -475,11 +475,12 @@ async function getContentMeta(absPath, isWatchMode) {
|
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
}
|
|
478
|
-
function buildHeadFromMeta(meta, ogConfig) {
|
|
478
|
+
function buildHeadFromMeta(meta, ogConfig, titleSuffix) {
|
|
479
479
|
if (!meta || typeof meta !== "object")
|
|
480
480
|
return "";
|
|
481
481
|
const parts = [];
|
|
482
|
-
const
|
|
482
|
+
const rawTitle = typeof meta.title === "string" ? meta.title : undefined;
|
|
483
|
+
const title = rawTitle && titleSuffix && !rawTitle.endsWith(titleSuffix) ? `${rawTitle}${titleSuffix}` : rawTitle;
|
|
483
484
|
const description = typeof meta.description === "string" ? meta.description : typeof meta.excerpt === "string" ? meta.excerpt : undefined;
|
|
484
485
|
if (title)
|
|
485
486
|
parts.push(`<title>${escapeHtml(title)}</title>`);
|
|
@@ -2237,7 +2238,7 @@ function generateGlobalOGTags(ogConfig) {
|
|
|
2237
2238
|
function escapeHtml2(input) {
|
|
2238
2239
|
return input.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
2239
2240
|
}
|
|
2240
|
-
async function extractPageMetadata(pathname, clientDir, cwd, isWatchMode, currentStatusOverride, ogImageConfig, ogConfig, baseUrl, autoCanonical, ssrData) {
|
|
2241
|
+
async function extractPageMetadata(pathname, clientDir, cwd, isWatchMode, currentStatusOverride, ogImageConfig, ogConfig, baseUrl, autoCanonical, ssrData, titleSuffix) {
|
|
2241
2242
|
let perPageHead = "";
|
|
2242
2243
|
let pageLang;
|
|
2243
2244
|
let statusOverride = currentStatusOverride;
|
|
@@ -2246,7 +2247,7 @@ async function extractPageMetadata(pathname, clientDir, cwd, isWatchMode, curren
|
|
|
2246
2247
|
}, (lang) => {
|
|
2247
2248
|
if (!pageLang)
|
|
2248
2249
|
pageLang = lang;
|
|
2249
|
-
}, ogConfig);
|
|
2250
|
+
}, ogConfig, titleSuffix);
|
|
2250
2251
|
const shouldGenerateCanonical = autoCanonical !== false && baseUrl !== undefined;
|
|
2251
2252
|
if (shouldGenerateCanonical) {
|
|
2252
2253
|
const canonicalTag = generateCanonicalUrl(baseUrl, pathname);
|
|
@@ -2276,8 +2277,8 @@ ${ogMetaTags}`;
|
|
|
2276
2277
|
perPageHead += head;
|
|
2277
2278
|
}, (lang) => {
|
|
2278
2279
|
pageLang = lang;
|
|
2279
|
-
}, ogConfig);
|
|
2280
|
-
const routeResult = await extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, statusOverride, ssrData, ogConfig);
|
|
2280
|
+
}, ogConfig, titleSuffix);
|
|
2281
|
+
const routeResult = await extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, statusOverride, ssrData, ogConfig, titleSuffix);
|
|
2281
2282
|
perPageHead += routeResult.head;
|
|
2282
2283
|
if (routeResult.lang)
|
|
2283
2284
|
pageLang = routeResult.lang;
|
|
@@ -2289,16 +2290,16 @@ ${ogMetaTags}`;
|
|
|
2289
2290
|
ssrExport: routeResult.ssrExport
|
|
2290
2291
|
};
|
|
2291
2292
|
}
|
|
2292
|
-
async function processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig) {
|
|
2293
|
+
async function processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig, titleSuffix) {
|
|
2293
2294
|
if (typeof layout?.path !== "string")
|
|
2294
2295
|
return;
|
|
2295
2296
|
try {
|
|
2296
2297
|
const abs = join2(clientDir, "routes", String(layout.path));
|
|
2297
2298
|
const { meta, ssr } = await loadModuleMetaAndSSR(layout, abs, isWatchMode);
|
|
2298
2299
|
if (meta)
|
|
2299
|
-
addHead(buildHeadFromMeta(meta, ogConfig));
|
|
2300
|
+
addHead(buildHeadFromMeta(meta, ogConfig, titleSuffix));
|
|
2300
2301
|
if (ssr) {
|
|
2301
|
-
const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
|
|
2302
|
+
const ssrHead = extractSSRHead(ssr, undefined, ogConfig, undefined, meta);
|
|
2302
2303
|
if (ssrHead)
|
|
2303
2304
|
addHead(`
|
|
2304
2305
|
${ssrHead}`);
|
|
@@ -2308,16 +2309,16 @@ ${ssrHead}`);
|
|
|
2308
2309
|
}
|
|
2309
2310
|
} catch {}
|
|
2310
2311
|
}
|
|
2311
|
-
async function extractLayoutMetadata(pathname, clientDir, cwd, isWatchMode, addHead, setLang, ogConfig) {
|
|
2312
|
+
async function extractLayoutMetadata(pathname, clientDir, cwd, isWatchMode, addHead, setLang, ogConfig, titleSuffix) {
|
|
2312
2313
|
try {
|
|
2313
2314
|
const m = await loadRoutesModule(cwd, isWatchMode);
|
|
2314
2315
|
const matchingLayouts = getMatchingLayouts(pathname, m?.layouts);
|
|
2315
2316
|
for (const layout of matchingLayouts) {
|
|
2316
|
-
await processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig);
|
|
2317
|
+
await processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig, titleSuffix);
|
|
2317
2318
|
}
|
|
2318
2319
|
} catch {}
|
|
2319
2320
|
}
|
|
2320
|
-
function extractContentMetadata(pathname, addHead, setLang, ogConfig) {
|
|
2321
|
+
function extractContentMetadata(pathname, addHead, setLang, ogConfig, titleSuffix) {
|
|
2321
2322
|
try {
|
|
2322
2323
|
const parts = pathname.split("/").filter(Boolean);
|
|
2323
2324
|
if (parts.length < 2)
|
|
@@ -2327,8 +2328,8 @@ function extractContentMetadata(pathname, addHead, setLang, ogConfig) {
|
|
|
2327
2328
|
const exp = g.__REROUTE_SSR_EXPORTS__?.[key];
|
|
2328
2329
|
const meta = exp?.meta;
|
|
2329
2330
|
const ssr = exp?.ssr;
|
|
2330
|
-
addHead(buildHeadFromMeta(meta, ogConfig));
|
|
2331
|
-
const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
|
|
2331
|
+
addHead(buildHeadFromMeta(meta, ogConfig, titleSuffix));
|
|
2332
|
+
const ssrHead = extractSSRHead(ssr, undefined, ogConfig, undefined, meta);
|
|
2332
2333
|
if (ssrHead)
|
|
2333
2334
|
addHead(`
|
|
2334
2335
|
${ssrHead}`);
|
|
@@ -2337,7 +2338,27 @@ ${ssrHead}`);
|
|
|
2337
2338
|
setLang(lang);
|
|
2338
2339
|
} catch {}
|
|
2339
2340
|
}
|
|
2340
|
-
|
|
2341
|
+
function getContentMetaFromExports(pathname) {
|
|
2342
|
+
try {
|
|
2343
|
+
const parts = pathname.split("/").filter(Boolean);
|
|
2344
|
+
if (parts.length < 2)
|
|
2345
|
+
return;
|
|
2346
|
+
const slug = parts[1];
|
|
2347
|
+
const key = `${parts[0]}:${slug}`;
|
|
2348
|
+
const g = globalThis;
|
|
2349
|
+
const exp = g.__REROUTE_SSR_EXPORTS__?.[key];
|
|
2350
|
+
const meta = exp?.meta;
|
|
2351
|
+
if (!meta)
|
|
2352
|
+
return;
|
|
2353
|
+
if (!meta.slug) {
|
|
2354
|
+
return { ...meta, slug };
|
|
2355
|
+
}
|
|
2356
|
+
return meta;
|
|
2357
|
+
} catch {
|
|
2358
|
+
return;
|
|
2359
|
+
}
|
|
2360
|
+
}
|
|
2361
|
+
async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode, statusOverride, ssrData, ogConfig, titleSuffix) {
|
|
2341
2362
|
const pathnameOnly = pathname.split("?")[0];
|
|
2342
2363
|
const match = typeof m.matchRoute === "function" ? m.matchRoute(pathnameOnly) : null;
|
|
2343
2364
|
const r = match?.route;
|
|
@@ -2350,7 +2371,7 @@ async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode,
|
|
|
2350
2371
|
const { meta, ssr } = await loadModuleMetaAndSSR(r, abs, isWatchMode);
|
|
2351
2372
|
let head = "";
|
|
2352
2373
|
if (meta)
|
|
2353
|
-
head += buildHeadFromMeta(meta, ogConfig);
|
|
2374
|
+
head += buildHeadFromMeta(meta, ogConfig, titleSuffix);
|
|
2354
2375
|
if (ssr) {
|
|
2355
2376
|
let routeData = ssrData && typeof ssrData === "object" ? ssrData[pathname] : undefined;
|
|
2356
2377
|
if (routeData && typeof routeData === "object" && "then" in routeData) {
|
|
@@ -2361,7 +2382,9 @@ async function extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode,
|
|
|
2361
2382
|
routeData = undefined;
|
|
2362
2383
|
}
|
|
2363
2384
|
}
|
|
2364
|
-
const
|
|
2385
|
+
const contentMeta = getContentMetaFromExports(pathnameOnly);
|
|
2386
|
+
const headMeta = contentMeta || meta;
|
|
2387
|
+
const ssrHead = extractSSRHead(ssr, routeData, ogConfig, head, headMeta);
|
|
2365
2388
|
if (ssrHead)
|
|
2366
2389
|
head += `
|
|
2367
2390
|
${ssrHead}`;
|
|
@@ -2377,7 +2400,7 @@ ${ssrHead}`;
|
|
|
2377
2400
|
}
|
|
2378
2401
|
return { head: "", statusOverride };
|
|
2379
2402
|
}
|
|
2380
|
-
async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, currentStatusOverride, ssrData, ogConfig) {
|
|
2403
|
+
async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, currentStatusOverride, ssrData, ogConfig, titleSuffix) {
|
|
2381
2404
|
let head = "";
|
|
2382
2405
|
let lang;
|
|
2383
2406
|
let statusOverride = currentStatusOverride;
|
|
@@ -2394,7 +2417,7 @@ async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, curre
|
|
|
2394
2417
|
statusOverride = statusOverride || 404;
|
|
2395
2418
|
}
|
|
2396
2419
|
if (r && typeof r.path === "string") {
|
|
2397
|
-
const result = await extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode, statusOverride, ssrData, ogConfig);
|
|
2420
|
+
const result = await extractMatchedRouteMetadata(pathname, clientDir, m, isWatchMode, statusOverride, ssrData, ogConfig, titleSuffix);
|
|
2398
2421
|
head = result.head;
|
|
2399
2422
|
lang = result.lang;
|
|
2400
2423
|
statusOverride = result.statusOverride;
|
|
@@ -2402,7 +2425,7 @@ async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, curre
|
|
|
2402
2425
|
} else {
|
|
2403
2426
|
head += await extractNotFoundMetadata(pathname, clientDir, m, isWatchMode, (l) => {
|
|
2404
2427
|
lang = l;
|
|
2405
|
-
}, ogConfig);
|
|
2428
|
+
}, ogConfig, titleSuffix);
|
|
2406
2429
|
}
|
|
2407
2430
|
} catch {}
|
|
2408
2431
|
return { head, lang, statusOverride, ssrExport };
|
|
@@ -2422,7 +2445,7 @@ function findBestNotFoundRoute(list, pathname) {
|
|
|
2422
2445
|
}
|
|
2423
2446
|
return chosen;
|
|
2424
2447
|
}
|
|
2425
|
-
async function extractNotFoundMetadata(pathname, clientDir, routesModule, isWatchMode, setLang, ogConfig) {
|
|
2448
|
+
async function extractNotFoundMetadata(pathname, clientDir, routesModule, isWatchMode, setLang, ogConfig, titleSuffix) {
|
|
2426
2449
|
let head = "";
|
|
2427
2450
|
try {
|
|
2428
2451
|
const list = routesModule?.notFoundRoutes;
|
|
@@ -2433,8 +2456,8 @@ async function extractNotFoundMetadata(pathname, clientDir, routesModule, isWatc
|
|
|
2433
2456
|
const abs = join2(clientDir, "routes", String(chosen.path));
|
|
2434
2457
|
const { meta, ssr } = await loadModuleMetaAndSSR(chosen, abs, isWatchMode);
|
|
2435
2458
|
if (meta)
|
|
2436
|
-
head += buildHeadFromMeta(meta, ogConfig);
|
|
2437
|
-
const ssrHead = extractSSRHead(ssr, undefined, ogConfig);
|
|
2459
|
+
head += buildHeadFromMeta(meta, ogConfig, titleSuffix);
|
|
2460
|
+
const ssrHead = extractSSRHead(ssr, undefined, ogConfig, undefined, meta);
|
|
2438
2461
|
if (ssrHead)
|
|
2439
2462
|
head += `
|
|
2440
2463
|
${ssrHead}`;
|
|
@@ -2497,13 +2520,13 @@ function generateMissingOGTags(head, ogConfig) {
|
|
|
2497
2520
|
${additionalTags.join(`
|
|
2498
2521
|
`)}` : "";
|
|
2499
2522
|
}
|
|
2500
|
-
function extractSSRHead(ssr, data, ogConfig, existingHead) {
|
|
2523
|
+
function extractSSRHead(ssr, data, ogConfig, existingHead, meta) {
|
|
2501
2524
|
if (!ssr)
|
|
2502
2525
|
return "";
|
|
2503
2526
|
let headContent = "";
|
|
2504
2527
|
if (typeof ssr.head === "function") {
|
|
2505
2528
|
try {
|
|
2506
|
-
const result = ssr.head({ data });
|
|
2529
|
+
const result = ssr.head({ data, meta });
|
|
2507
2530
|
if (typeof result === "string")
|
|
2508
2531
|
headContent = result;
|
|
2509
2532
|
else if (Array.isArray(result))
|
|
@@ -2567,7 +2590,6 @@ async function preloadContentModule(pathname, clientDir, cwd, isWatchMode) {
|
|
|
2567
2590
|
extraHead += `
|
|
2568
2591
|
<link rel="modulepreload" href="${modulePath}" />`;
|
|
2569
2592
|
hydrationScript += `<script>
|
|
2570
|
-
// Mark that this content module needs to be preloaded
|
|
2571
2593
|
(globalThis.__REROUTE_CONTENT_PRELOAD__ ||= []).push({src:'${modulePath}',key:'${key}'});
|
|
2572
2594
|
</script>`;
|
|
2573
2595
|
} catch {}
|
|
@@ -2883,7 +2905,19 @@ function createTraceContextScript(traceContext) {
|
|
|
2883
2905
|
return "";
|
|
2884
2906
|
}
|
|
2885
2907
|
}
|
|
2886
|
-
function
|
|
2908
|
+
function createTitleSuffixScript(titleSuffix) {
|
|
2909
|
+
if (!titleSuffix) {
|
|
2910
|
+
return "";
|
|
2911
|
+
}
|
|
2912
|
+
try {
|
|
2913
|
+
const suffixJson = escapeJsonForScript(JSON.stringify(titleSuffix));
|
|
2914
|
+
return `<script>(function(){try{var w=(typeof window!=='undefined'?window:globalThis);w.__REROUTE_TITLE_SUFFIX__=${suffixJson};}catch(e){}})();</script>`;
|
|
2915
|
+
} catch (error) {
|
|
2916
|
+
console.error("[reroute] Failed to serialize title suffix:", error);
|
|
2917
|
+
return "";
|
|
2918
|
+
}
|
|
2919
|
+
}
|
|
2920
|
+
function createDataScript(ssrData, errorMsg, pathname, browserTelemetryConfig, traceContext, titleSuffix) {
|
|
2887
2921
|
let script = "";
|
|
2888
2922
|
script += createContentCaptureScript();
|
|
2889
2923
|
if (pathname) {
|
|
@@ -2891,6 +2925,7 @@ function createDataScript(ssrData, errorMsg, pathname, browserTelemetryConfig, t
|
|
|
2891
2925
|
}
|
|
2892
2926
|
script += createTelemetryConfigScript(browserTelemetryConfig);
|
|
2893
2927
|
script += createTraceContextScript(traceContext);
|
|
2928
|
+
script += createTitleSuffixScript(titleSuffix);
|
|
2894
2929
|
if (ssrData && Object.keys(ssrData).length > 0) {
|
|
2895
2930
|
try {
|
|
2896
2931
|
const duplicatedData = duplicateQueryParamData(ssrData);
|
|
@@ -3077,7 +3112,7 @@ async function performSSRSetupInternal(options, streaming) {
|
|
|
3077
3112
|
statusOverride = computeResult.statusContainer.value;
|
|
3078
3113
|
}
|
|
3079
3114
|
const metadataResult = await withSpan("ssr.extract.metadata", async (span) => {
|
|
3080
|
-
const result = await extractPageMetadata(pathname, clientDir, cwd, isWatchMode, statusOverride, ogConfig, options.ogMetaConfig, options.baseUrl, options.autoCanonical, computeResult.data);
|
|
3115
|
+
const result = await extractPageMetadata(pathname, clientDir, cwd, isWatchMode, statusOverride, ogConfig, options.ogMetaConfig, options.baseUrl, options.autoCanonical, computeResult.data, options.titleSuffix);
|
|
3081
3116
|
span.setAttributes({
|
|
3082
3117
|
"reroute.pathname": pathname,
|
|
3083
3118
|
"reroute.metadata.exists": !!result.perPageHead
|
|
@@ -3113,10 +3148,10 @@ function generateCollectionScripts(byCollectionForSSR) {
|
|
|
3113
3148
|
} catch {}
|
|
3114
3149
|
return "";
|
|
3115
3150
|
}
|
|
3116
|
-
function generateHydrationScripts(ssrData, isWatchMode, ssrError, collectionScripts = "", preloadScript = "", bundleUrl = "", pathname = "", browserTelemetryConfig, traceContext) {
|
|
3151
|
+
function generateHydrationScripts(ssrData, isWatchMode, ssrError, collectionScripts = "", preloadScript = "", bundleUrl = "", pathname = "", browserTelemetryConfig, traceContext, titleSuffix) {
|
|
3117
3152
|
let scripts = preloadScript;
|
|
3118
3153
|
scripts += collectionScripts;
|
|
3119
|
-
scripts += createDataScript(ssrData, isWatchMode ? ssrError : undefined, pathname, browserTelemetryConfig, traceContext);
|
|
3154
|
+
scripts += createDataScript(ssrData, isWatchMode ? ssrError : undefined, pathname, browserTelemetryConfig, traceContext, titleSuffix);
|
|
3120
3155
|
scripts += createFeedsScript();
|
|
3121
3156
|
scripts += createLlmsScript();
|
|
3122
3157
|
if (bundleUrl) {
|
|
@@ -3252,7 +3287,8 @@ async function renderSSRDocument(options) {
|
|
|
3252
3287
|
autoCanonical: options.autoCanonical,
|
|
3253
3288
|
cachedCollections: options.cachedCollections,
|
|
3254
3289
|
cachedTailwindCSS: options.cachedTailwindCSS,
|
|
3255
|
-
headers: options.headers
|
|
3290
|
+
headers: options.headers,
|
|
3291
|
+
titleSuffix: options.titleSuffix
|
|
3256
3292
|
}, false);
|
|
3257
3293
|
const duplicatedData = duplicateQueryParamData(setup2.ssrData);
|
|
3258
3294
|
setGlobalSSRData(duplicatedData);
|
|
@@ -3278,7 +3314,7 @@ async function renderSSRDocument(options) {
|
|
|
3278
3314
|
const browserTelemetryConfig = serializeBrowserTelemetryConfig2(browserTelemetryConfigRaw);
|
|
3279
3315
|
const traceContext = getTraceContextForInjection(options.parentSpan);
|
|
3280
3316
|
const hydrationScript = await withSpan("ssr.generate.scripts", async (span) => {
|
|
3281
|
-
const script = generateHydrationScripts(setup2.ssrData, isWatchMode, setup2.ssrError, collectionScripts, setup2.preloadHydrationScript, bundleUrl, pathname, browserTelemetryConfig, traceContext);
|
|
3317
|
+
const script = generateHydrationScripts(setup2.ssrData, isWatchMode, setup2.ssrError, collectionScripts, setup2.preloadHydrationScript, bundleUrl, pathname, browserTelemetryConfig, traceContext, options.titleSuffix);
|
|
3282
3318
|
span.setAttribute("reroute.scripts.size", script.length);
|
|
3283
3319
|
return script;
|
|
3284
3320
|
});
|
|
@@ -5317,7 +5353,8 @@ async function renderSSRDocumentStream(options) {
|
|
|
5317
5353
|
cachedCollections: options.cachedCollections,
|
|
5318
5354
|
cachedTailwindCSS: options.cachedTailwindCSS,
|
|
5319
5355
|
debug,
|
|
5320
|
-
headers: options.headers
|
|
5356
|
+
headers: options.headers,
|
|
5357
|
+
titleSuffix: options.titleSuffix
|
|
5321
5358
|
}, true);
|
|
5322
5359
|
if (debug)
|
|
5323
5360
|
console.log(`[renderStream] ${pathname} - performSSRSetup: ${(performance.now() - t0).toFixed(2)}ms`);
|
|
@@ -5387,7 +5424,8 @@ async function renderSSRDocumentStream(options) {
|
|
|
5387
5424
|
traceContext,
|
|
5388
5425
|
parentSpan: options.parentSpan,
|
|
5389
5426
|
timeout: options.timeout,
|
|
5390
|
-
ssrExport: setup2.metadataResult.ssrExport
|
|
5427
|
+
ssrExport: setup2.metadataResult.ssrExport,
|
|
5428
|
+
titleSuffix: options.titleSuffix
|
|
5391
5429
|
});
|
|
5392
5430
|
if (debug)
|
|
5393
5431
|
console.log(`[renderStream] ${pathname} - returning stream: ${(performance.now() - t0).toFixed(2)}ms`);
|
|
@@ -5491,7 +5529,7 @@ function buildStreamingScripts(ctx) {
|
|
|
5491
5529
|
ssrDataSnapshot[key] = value;
|
|
5492
5530
|
}
|
|
5493
5531
|
}
|
|
5494
|
-
const dataScript = createDataScript(ssrDataSnapshot, ctx.isWatchMode ? ctx.ssrError : undefined, ctx.pathname, ctx.browserTelemetryConfig, ctx.traceContext);
|
|
5532
|
+
const dataScript = createDataScript(ssrDataSnapshot, ctx.isWatchMode ? ctx.ssrError : undefined, ctx.pathname, ctx.browserTelemetryConfig, ctx.traceContext, ctx.titleSuffix);
|
|
5495
5533
|
const feedsScript = createFeedsScript();
|
|
5496
5534
|
const llmsScript = createLlmsScript();
|
|
5497
5535
|
let allScripts = dataScript + feedsScript + llmsScript + collectionScripts + ctx.preloadHydrationScript;
|
|
@@ -105983,7 +106021,7 @@ async function getVersionString2() {
|
|
|
105983
106021
|
}
|
|
105984
106022
|
async function getVersion2() {
|
|
105985
106023
|
if (true) {
|
|
105986
|
-
return "0.
|
|
106024
|
+
return "0.44.0";
|
|
105987
106025
|
}
|
|
105988
106026
|
const possiblePaths = [
|
|
105989
106027
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -106000,10 +106038,10 @@ async function getVersion2() {
|
|
|
106000
106038
|
}
|
|
106001
106039
|
async function getCommit2() {
|
|
106002
106040
|
if (true) {
|
|
106003
|
-
return "
|
|
106041
|
+
return "d8856f1";
|
|
106004
106042
|
}
|
|
106005
106043
|
return "dev";
|
|
106006
106044
|
}
|
|
106007
106045
|
main();
|
|
106008
106046
|
|
|
106009
|
-
//# debugId=
|
|
106047
|
+
//# debugId=55146EFC3E42BFA964756E2164756E21
|