reroute-js 0.34.7 → 0.34.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/cli/bin.d.ts +1 -1
- package/cli/bin.js +199 -78
- package/cli/bin.js.map +13 -13
- 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/gen.d.ts.map +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 +194 -74
- package/core/index.js.map +12 -12
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +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/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/full-generator.d.ts.map +1 -1
- package/core/src/llms/index-generator.d.ts +2 -3
- package/core/src/llms/index-generator.d.ts.map +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 +4 -4
- package/core/src/rss/discovery.d.ts.map +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 +3 -3
- package/core/src/sitemap/discovery.d.ts.map +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 +4 -2
- package/core/src/ssr/lib/compute/index.d.ts.map +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 +1 -1
- 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/preload.d.ts.map +1 -1
- package/core/src/ssr/lib/scripts/collections.d.ts +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 +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/stream.d.ts +1 -1
- package/elysia/index.d.ts +1 -1
- package/elysia/index.js +204 -88
- package/elysia/index.js.map +16 -16
- 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/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/rss.d.ts.map +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -2
- package/elysia/src/routes/sitemap.d.ts.map +1 -1
- package/elysia/src/routes/ssr.d.ts +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 +2 -2
- package/react/index.js.map +1 -1
- 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/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 +3 -2
- package/telemetry/server.js.map +10 -10
- 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/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.34.
|
|
4
|
+
* reroute-js v0.34.9
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2025 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.34.
|
|
51
|
+
return "0.34.9";
|
|
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 "58d33f1";
|
|
70
70
|
}
|
|
71
71
|
return "dev";
|
|
72
72
|
}
|
|
@@ -1352,9 +1352,11 @@ function matchPatternUtil(pattern, pathname) {
|
|
|
1352
1352
|
return params;
|
|
1353
1353
|
}
|
|
1354
1354
|
function createBundledRoutesModule(bundledRoutes, bundledLayouts) {
|
|
1355
|
+
const bundledNotFoundRoutes = globalThis.__REROUTE_NOT_FOUND_ROUTES__;
|
|
1355
1356
|
return {
|
|
1356
1357
|
routes: bundledRoutes,
|
|
1357
1358
|
layouts: bundledLayouts,
|
|
1359
|
+
notFoundRoutes: bundledNotFoundRoutes,
|
|
1358
1360
|
matchRoute: (pathname) => {
|
|
1359
1361
|
for (const route of bundledRoutes) {
|
|
1360
1362
|
const pattern = String(route?.pattern || "");
|
|
@@ -2179,8 +2181,10 @@ async function extractRouteMetadata(pathname, clientDir, cwd, isWatchMode, curre
|
|
|
2179
2181
|
let lang;
|
|
2180
2182
|
let statusOverride = currentStatusOverride;
|
|
2181
2183
|
try {
|
|
2182
|
-
const
|
|
2183
|
-
|
|
2184
|
+
const m = await loadRoutesModule(cwd, isWatchMode);
|
|
2185
|
+
if (!m) {
|
|
2186
|
+
return { head, lang, statusOverride: statusOverride || 404 };
|
|
2187
|
+
}
|
|
2184
2188
|
const pathnameOnly = pathname.split("?")[0];
|
|
2185
2189
|
const match = typeof m.matchRoute === "function" ? m.matchRoute(pathnameOnly) : null;
|
|
2186
2190
|
const r = match?.route;
|
|
@@ -2261,6 +2265,7 @@ function extractSSRLang(ssr) {
|
|
|
2261
2265
|
var init_metadata2 = __esm(() => {
|
|
2262
2266
|
init_metadata();
|
|
2263
2267
|
init_meta();
|
|
2268
|
+
init_compute();
|
|
2264
2269
|
init_imports();
|
|
2265
2270
|
});
|
|
2266
2271
|
|
|
@@ -2298,6 +2303,16 @@ async function preloadContentModule(pathname, clientDir, cwd, isWatchMode) {
|
|
|
2298
2303
|
}
|
|
2299
2304
|
async function isContentCollection(clientDir, collection) {
|
|
2300
2305
|
try {
|
|
2306
|
+
const isProduction = clientDir.endsWith(".reroute");
|
|
2307
|
+
if (isProduction) {
|
|
2308
|
+
const collectionFile = join2(clientDir, "collections", `${collection}.js`);
|
|
2309
|
+
try {
|
|
2310
|
+
const s2 = await stat4(collectionFile);
|
|
2311
|
+
return s2?.isFile() ?? false;
|
|
2312
|
+
} catch {
|
|
2313
|
+
return false;
|
|
2314
|
+
}
|
|
2315
|
+
}
|
|
2301
2316
|
const maybeDir = join2(clientDir, "routes", collection, "content");
|
|
2302
2317
|
const s = await stat4(maybeDir);
|
|
2303
2318
|
return typeof s?.isDirectory === "function" ? s.isDirectory() : true;
|
|
@@ -2748,7 +2763,7 @@ async function performSSRSetupInternal(options, streaming) {
|
|
|
2748
2763
|
return css;
|
|
2749
2764
|
});
|
|
2750
2765
|
let statusOverride = preloadResult.statusOverride;
|
|
2751
|
-
if (computeResult.statusContainer.value) {
|
|
2766
|
+
if (computeResult.statusContainer.value !== undefined) {
|
|
2752
2767
|
statusOverride = computeResult.statusContainer.value;
|
|
2753
2768
|
}
|
|
2754
2769
|
const metadataResult = await withSpan("ssr.extract.metadata", async (span) => {
|
|
@@ -2956,10 +2971,10 @@ async function renderSSRDocument(options) {
|
|
|
2956
2971
|
return script;
|
|
2957
2972
|
});
|
|
2958
2973
|
let statusOverride = setup2.preloadStatusOverride;
|
|
2959
|
-
if (setup2.statusContainer.value) {
|
|
2974
|
+
if (setup2.statusContainer.value !== undefined) {
|
|
2960
2975
|
statusOverride = setup2.statusContainer.value;
|
|
2961
2976
|
}
|
|
2962
|
-
if (setup2.metadataResult.statusOverride) {
|
|
2977
|
+
if (setup2.metadataResult.statusOverride !== undefined) {
|
|
2963
2978
|
statusOverride = setup2.metadataResult.statusOverride;
|
|
2964
2979
|
}
|
|
2965
2980
|
const extraHead = setup2.bundlePreload + setup2.preloadExtraHead;
|
|
@@ -3409,9 +3424,9 @@ async function discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConf
|
|
|
3409
3424
|
}
|
|
3410
3425
|
return collectionsMap;
|
|
3411
3426
|
}
|
|
3412
|
-
async function loadRouteModule(
|
|
3427
|
+
async function loadRouteModule(cwd, routePath, isWatchMode) {
|
|
3413
3428
|
try {
|
|
3414
|
-
const abs = join2(
|
|
3429
|
+
const abs = join2(cwd, "src", "client", "routes", routePath);
|
|
3415
3430
|
const modUrl = `${pathToFileURL6(abs).href}${isWatchMode ? `?t=${Date.now()}` : ""}`;
|
|
3416
3431
|
return await import(modUrl);
|
|
3417
3432
|
} catch {
|
|
@@ -3444,24 +3459,47 @@ function createEntriesFromArray(array, routePath) {
|
|
|
3444
3459
|
}
|
|
3445
3460
|
return entries;
|
|
3446
3461
|
}
|
|
3447
|
-
async function discoverSSRDataRoutes(
|
|
3462
|
+
async function discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode) {
|
|
3448
3463
|
const ssrDataRoutes = new Map;
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
const dataFn = ssr?.data;
|
|
3455
|
-
if (typeof dataFn !== "function")
|
|
3456
|
-
continue;
|
|
3457
|
-
const result = await callDataFunction(dataFn, route.path);
|
|
3458
|
-
const arrays = findArraysInData(result);
|
|
3459
|
-
for (const array of arrays) {
|
|
3460
|
-
if (array.length === 0)
|
|
3464
|
+
const bundledRoutes = globalThis.__REROUTE_ROUTES__;
|
|
3465
|
+
if (bundledRoutes && Array.isArray(bundledRoutes)) {
|
|
3466
|
+
for (const route of staticRoutes) {
|
|
3467
|
+
const bundledRoute = bundledRoutes.find((r) => r?.path === route.path);
|
|
3468
|
+
if (!bundledRoute)
|
|
3461
3469
|
continue;
|
|
3462
|
-
const
|
|
3463
|
-
|
|
3464
|
-
|
|
3470
|
+
const ssr = bundledRoute?.ssr;
|
|
3471
|
+
const dataFn = ssr?.data;
|
|
3472
|
+
if (typeof dataFn !== "function")
|
|
3473
|
+
continue;
|
|
3474
|
+
const result = await callDataFunction(dataFn, route.path);
|
|
3475
|
+
const arrays = findArraysInData(result);
|
|
3476
|
+
for (const array of arrays) {
|
|
3477
|
+
if (array.length === 0)
|
|
3478
|
+
continue;
|
|
3479
|
+
const entries = createEntriesFromArray(array, route.path);
|
|
3480
|
+
if (entries.length > 0) {
|
|
3481
|
+
ssrDataRoutes.set(route.path, entries);
|
|
3482
|
+
}
|
|
3483
|
+
}
|
|
3484
|
+
}
|
|
3485
|
+
} else {
|
|
3486
|
+
for (const route of staticRoutes) {
|
|
3487
|
+
const mod = await loadRouteModule(cwd, route.path, isWatchMode);
|
|
3488
|
+
if (!mod)
|
|
3489
|
+
continue;
|
|
3490
|
+
const ssr = mod?.ssr;
|
|
3491
|
+
const dataFn = ssr?.data;
|
|
3492
|
+
if (typeof dataFn !== "function")
|
|
3493
|
+
continue;
|
|
3494
|
+
const result = await callDataFunction(dataFn, route.path);
|
|
3495
|
+
const arrays = findArraysInData(result);
|
|
3496
|
+
for (const array of arrays) {
|
|
3497
|
+
if (array.length === 0)
|
|
3498
|
+
continue;
|
|
3499
|
+
const entries = createEntriesFromArray(array, route.path);
|
|
3500
|
+
if (entries.length > 0) {
|
|
3501
|
+
ssrDataRoutes.set(route.path, entries);
|
|
3502
|
+
}
|
|
3465
3503
|
}
|
|
3466
3504
|
}
|
|
3467
3505
|
}
|
|
@@ -3584,12 +3622,12 @@ function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, t
|
|
|
3584
3622
|
parts.push("");
|
|
3585
3623
|
}
|
|
3586
3624
|
async function generateLLMsIndex(options) {
|
|
3587
|
-
const { cwd,
|
|
3625
|
+
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
3588
3626
|
const parts = [];
|
|
3589
3627
|
addIndexHeader(parts, llmsConfig);
|
|
3590
3628
|
const staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);
|
|
3591
3629
|
const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
3592
|
-
const ssrDataRoutes = await discoverSSRDataRoutes(cwd,
|
|
3630
|
+
const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
|
|
3593
3631
|
const isSingleCollection = collections2.length === 1;
|
|
3594
3632
|
const targetCollection = isSingleCollection ? collections2[0] : null;
|
|
3595
3633
|
const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
|
|
@@ -3638,7 +3676,7 @@ function buildHeader(baseUrl, llmsConfig) {
|
|
|
3638
3676
|
}
|
|
3639
3677
|
return parts;
|
|
3640
3678
|
}
|
|
3641
|
-
async function discoverAllRoutes(cwd,
|
|
3679
|
+
async function discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig) {
|
|
3642
3680
|
const {
|
|
3643
3681
|
discoverStaticRoutes: discoverStaticRoutes2,
|
|
3644
3682
|
discoverCollectionRoutes: discoverCollectionRoutes2,
|
|
@@ -3646,7 +3684,7 @@ async function discoverAllRoutes(cwd, clientDir, collections2, isWatchMode, llms
|
|
|
3646
3684
|
} = await Promise.resolve().then(() => (init_index_generator(), exports_index_generator));
|
|
3647
3685
|
const staticRoutes = await discoverStaticRoutes2(cwd, isWatchMode);
|
|
3648
3686
|
const collectionsMap = await discoverCollectionRoutes2(cwd, collections2, isWatchMode, llmsConfig);
|
|
3649
|
-
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd,
|
|
3687
|
+
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode);
|
|
3650
3688
|
const allRoutes = [];
|
|
3651
3689
|
for (const route of staticRoutes) {
|
|
3652
3690
|
if (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {
|
|
@@ -3736,9 +3774,9 @@ function buildFooter(parts) {
|
|
|
3736
3774
|
parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
|
|
3737
3775
|
}
|
|
3738
3776
|
async function generateLLMsFullContent(options) {
|
|
3739
|
-
const { cwd,
|
|
3777
|
+
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
3740
3778
|
const parts = buildHeader(baseUrl, llmsConfig);
|
|
3741
|
-
const allRoutes = await discoverAllRoutes(cwd,
|
|
3779
|
+
const allRoutes = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
3742
3780
|
const maxItems = llmsConfig?.maxItems || 1e4;
|
|
3743
3781
|
const routesToProcess = allRoutes.slice(0, maxItems);
|
|
3744
3782
|
const extracted = await extractRouteContents(routesToProcess, options);
|
|
@@ -4155,30 +4193,58 @@ async function discoverCollectionContent(cwd, collection, isWatchMode, baseUrl)
|
|
|
4155
4193
|
}
|
|
4156
4194
|
return entries;
|
|
4157
4195
|
}
|
|
4158
|
-
async function discoverSSRDataRoutes2(
|
|
4196
|
+
async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
|
|
4159
4197
|
const ssrDataRoutes = new Map;
|
|
4160
|
-
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
const
|
|
4167
|
-
|
|
4198
|
+
const bundledRoutes = globalThis.__REROUTE_ROUTES__;
|
|
4199
|
+
if (bundledRoutes && Array.isArray(bundledRoutes)) {
|
|
4200
|
+
for (const route of staticRoutes) {
|
|
4201
|
+
if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
|
|
4202
|
+
continue;
|
|
4203
|
+
}
|
|
4204
|
+
const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
|
|
4205
|
+
if (!bundledRoute)
|
|
4206
|
+
continue;
|
|
4207
|
+
const ssr = bundledRoute?.ssr;
|
|
4168
4208
|
const dataFn = ssr?.data;
|
|
4169
4209
|
if (typeof dataFn === "function") {
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4210
|
+
try {
|
|
4211
|
+
const mockSet = { status: 200 };
|
|
4212
|
+
const result = await dataFn({
|
|
4213
|
+
pathname: route.pattern,
|
|
4214
|
+
params: {},
|
|
4215
|
+
set: mockSet
|
|
4216
|
+
});
|
|
4217
|
+
const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
|
|
4218
|
+
if (entries.length > 0) {
|
|
4219
|
+
ssrDataRoutes.set(route.pattern, entries);
|
|
4220
|
+
}
|
|
4221
|
+
} catch {}
|
|
4180
4222
|
}
|
|
4181
|
-
}
|
|
4223
|
+
}
|
|
4224
|
+
} else {
|
|
4225
|
+
for (const route of staticRoutes) {
|
|
4226
|
+
if (sitemapConfig?.excludeDiscovery?.includes(route.pattern)) {
|
|
4227
|
+
continue;
|
|
4228
|
+
}
|
|
4229
|
+
try {
|
|
4230
|
+
const routeModulePath = join2(cwd, "src", "client", "routes", route.path);
|
|
4231
|
+
const mod = await import(Bun.pathToFileURL(routeModulePath).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
4232
|
+
const ssr = mod?.ssr;
|
|
4233
|
+
const dataFn = ssr?.data;
|
|
4234
|
+
if (typeof dataFn === "function") {
|
|
4235
|
+
const mockSet = { status: 200 };
|
|
4236
|
+
const result = await dataFn({
|
|
4237
|
+
pathname: route.pattern,
|
|
4238
|
+
params: {},
|
|
4239
|
+
set: mockSet
|
|
4240
|
+
});
|
|
4241
|
+
const entries = extractEntriesFromData(result, route.pattern, baseUrl, sitemapConfig);
|
|
4242
|
+
if (entries.length > 0) {
|
|
4243
|
+
ssrDataRoutes.set(route.pattern, entries);
|
|
4244
|
+
}
|
|
4245
|
+
}
|
|
4246
|
+
} catch {}
|
|
4247
|
+
}
|
|
4182
4248
|
}
|
|
4183
4249
|
return ssrDataRoutes;
|
|
4184
4250
|
}
|
|
@@ -4288,7 +4354,7 @@ function createEntryFromItem(item, routePattern, baseUrl, sitemapConfig) {
|
|
|
4288
4354
|
}
|
|
4289
4355
|
return entry;
|
|
4290
4356
|
}
|
|
4291
|
-
async function discoverSitemapData(cwd,
|
|
4357
|
+
async function discoverSitemapData(cwd, collections2, baseUrl, isWatchMode, sitemapConfig) {
|
|
4292
4358
|
const { staticRoutes, dynamicRoutes } = await discoverRoutes(cwd, isWatchMode);
|
|
4293
4359
|
const collectionsMap = new Map;
|
|
4294
4360
|
for (const collection of collections2) {
|
|
@@ -4297,7 +4363,7 @@ async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatc
|
|
|
4297
4363
|
collectionsMap.set(collection, entries);
|
|
4298
4364
|
}
|
|
4299
4365
|
}
|
|
4300
|
-
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd,
|
|
4366
|
+
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
|
|
4301
4367
|
return {
|
|
4302
4368
|
staticRoutes,
|
|
4303
4369
|
dynamicRoutes,
|
|
@@ -4412,10 +4478,10 @@ async function discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl
|
|
|
4412
4478
|
sortByPubDate(items);
|
|
4413
4479
|
return items;
|
|
4414
4480
|
}
|
|
4415
|
-
async function discoverSSRDataFeedItems(
|
|
4481
|
+
async function discoverSSRDataFeedItems(cwd, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
|
|
4416
4482
|
const items = [];
|
|
4417
4483
|
try {
|
|
4418
|
-
const abs = join2(
|
|
4484
|
+
const abs = join2(cwd, "src", "client", "routes", routePath);
|
|
4419
4485
|
const mod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
4420
4486
|
const ssr = mod?.ssr;
|
|
4421
4487
|
const dataFn = ssr?.data;
|
|
@@ -4551,7 +4617,7 @@ function createRSSItemFromData(item, routePattern, baseUrl, rssConfig) {
|
|
|
4551
4617
|
}
|
|
4552
4618
|
return rssItem;
|
|
4553
4619
|
}
|
|
4554
|
-
async function discoverRSSData(cwd,
|
|
4620
|
+
async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfig) {
|
|
4555
4621
|
const collectionsMap = new Map;
|
|
4556
4622
|
for (const collection of collections2) {
|
|
4557
4623
|
const items = await discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl, rssConfig);
|
|
@@ -4560,18 +4626,48 @@ async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMod
|
|
|
4560
4626
|
}
|
|
4561
4627
|
}
|
|
4562
4628
|
const ssrDataFeeds = new Map;
|
|
4563
|
-
const
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4629
|
+
const bundledRoutes = globalThis.__REROUTE_ROUTES__;
|
|
4630
|
+
if (bundledRoutes && Array.isArray(bundledRoutes)) {
|
|
4631
|
+
const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
|
|
4632
|
+
const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
|
|
4633
|
+
for (const route of staticRoutes) {
|
|
4634
|
+
if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
|
|
4635
|
+
continue;
|
|
4636
|
+
}
|
|
4637
|
+
const bundledRoute = bundledRoutes.find((r) => r?.pattern === route.pattern);
|
|
4638
|
+
if (!bundledRoute)
|
|
4639
|
+
continue;
|
|
4640
|
+
const ssr = bundledRoute?.ssr;
|
|
4641
|
+
const dataFn = ssr?.data;
|
|
4642
|
+
if (typeof dataFn === "function") {
|
|
4643
|
+
try {
|
|
4644
|
+
const mockSet = { status: 200 };
|
|
4645
|
+
const result = await dataFn({
|
|
4646
|
+
pathname: route.pattern,
|
|
4647
|
+
params: {},
|
|
4648
|
+
set: mockSet
|
|
4649
|
+
});
|
|
4650
|
+
const items = extractRSSItemsFromData(result, route.pattern, baseUrl, rssConfig);
|
|
4651
|
+
if (items.length > 0) {
|
|
4652
|
+
ssrDataFeeds.set(route.pattern, items);
|
|
4653
|
+
}
|
|
4654
|
+
} catch {}
|
|
4655
|
+
}
|
|
4568
4656
|
}
|
|
4569
|
-
|
|
4570
|
-
|
|
4571
|
-
|
|
4657
|
+
} else {
|
|
4658
|
+
const { discoverRoutes: discoverRoutes2 } = await Promise.resolve().then(() => (init_discovery4(), exports_discovery));
|
|
4659
|
+
const { staticRoutes } = await discoverRoutes2(cwd, isWatchMode);
|
|
4660
|
+
for (const route of staticRoutes) {
|
|
4661
|
+
if (rssConfig?.excludeDiscovery?.includes(route.pattern)) {
|
|
4662
|
+
continue;
|
|
4663
|
+
}
|
|
4664
|
+
const items = await discoverSSRDataFeedItems(cwd, route.pattern, route.path, isWatchMode, baseUrl, rssConfig);
|
|
4665
|
+
if (items.length > 0) {
|
|
4666
|
+
ssrDataFeeds.set(route.pattern, items);
|
|
4667
|
+
}
|
|
4572
4668
|
}
|
|
4573
4669
|
}
|
|
4574
|
-
const layoutFeeds = await discoverLayoutFeedItems(cwd,
|
|
4670
|
+
const layoutFeeds = await discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig);
|
|
4575
4671
|
for (const [pattern, items] of layoutFeeds.entries()) {
|
|
4576
4672
|
const existing = ssrDataFeeds.get(pattern) || [];
|
|
4577
4673
|
ssrDataFeeds.set(pattern, [...existing, ...items]);
|
|
@@ -4595,13 +4691,13 @@ async function loadLayouts(cwd, isWatchMode) {
|
|
|
4595
4691
|
return;
|
|
4596
4692
|
}
|
|
4597
4693
|
}
|
|
4598
|
-
async function processLayoutForRSS(layout,
|
|
4694
|
+
async function processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig) {
|
|
4599
4695
|
const pattern = String(layout?.pattern || "/");
|
|
4600
4696
|
const path3 = String(layout?.path || "");
|
|
4601
4697
|
if (!path3)
|
|
4602
4698
|
return null;
|
|
4603
4699
|
try {
|
|
4604
|
-
const abs = join2(
|
|
4700
|
+
const abs = join2(cwd, "src", "client", "routes", path3);
|
|
4605
4701
|
const layoutMod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
4606
4702
|
const ssr = layoutMod?.ssr;
|
|
4607
4703
|
const dataFn = ssr?.data;
|
|
@@ -4620,16 +4716,39 @@ async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssC
|
|
|
4620
4716
|
} catch {}
|
|
4621
4717
|
return null;
|
|
4622
4718
|
}
|
|
4623
|
-
async function discoverLayoutFeedItems(cwd,
|
|
4719
|
+
async function discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig) {
|
|
4624
4720
|
const layoutFeeds = new Map;
|
|
4625
4721
|
const layouts2 = await loadLayouts(cwd, isWatchMode);
|
|
4626
4722
|
if (!Array.isArray(layouts2)) {
|
|
4627
4723
|
return layoutFeeds;
|
|
4628
4724
|
}
|
|
4629
|
-
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4725
|
+
const bundledLayouts = globalThis.__REROUTE_LAYOUTS__;
|
|
4726
|
+
if (bundledLayouts && Array.isArray(bundledLayouts)) {
|
|
4727
|
+
for (const layout of bundledLayouts) {
|
|
4728
|
+
const pattern = String(layout?.pattern || "/");
|
|
4729
|
+
const ssr = layout?.ssr;
|
|
4730
|
+
const dataFn = ssr?.data;
|
|
4731
|
+
if (typeof dataFn === "function") {
|
|
4732
|
+
try {
|
|
4733
|
+
const mockSet = { status: 200 };
|
|
4734
|
+
const result = await dataFn({
|
|
4735
|
+
pathname: pattern,
|
|
4736
|
+
params: {},
|
|
4737
|
+
set: mockSet
|
|
4738
|
+
});
|
|
4739
|
+
const items = extractRSSItemsFromData(result, pattern, baseUrl, rssConfig);
|
|
4740
|
+
if (items.length > 0) {
|
|
4741
|
+
layoutFeeds.set(pattern, items);
|
|
4742
|
+
}
|
|
4743
|
+
} catch {}
|
|
4744
|
+
}
|
|
4745
|
+
}
|
|
4746
|
+
} else {
|
|
4747
|
+
for (const layout of layouts2) {
|
|
4748
|
+
const result = await processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig);
|
|
4749
|
+
if (result) {
|
|
4750
|
+
layoutFeeds.set(result.pattern, result.items);
|
|
4751
|
+
}
|
|
4633
4752
|
}
|
|
4634
4753
|
}
|
|
4635
4754
|
return layoutFeeds;
|
|
@@ -4933,10 +5052,10 @@ async function renderSSRDocumentStream(options) {
|
|
|
4933
5052
|
if (debug)
|
|
4934
5053
|
console.log(`[renderStream] ${pathname} - performSSRSetup: ${(performance.now() - t0).toFixed(2)}ms`);
|
|
4935
5054
|
let statusOverride = setup2.preloadStatusOverride;
|
|
4936
|
-
if (setup2.statusContainer.value) {
|
|
5055
|
+
if (setup2.statusContainer.value !== undefined) {
|
|
4937
5056
|
statusOverride = setup2.statusContainer.value;
|
|
4938
5057
|
}
|
|
4939
|
-
if (setup2.metadataResult.statusOverride) {
|
|
5058
|
+
if (setup2.metadataResult.statusOverride !== undefined) {
|
|
4940
5059
|
statusOverride = setup2.metadataResult.statusOverride;
|
|
4941
5060
|
}
|
|
4942
5061
|
const encoder = new TextEncoder;
|
|
@@ -5156,6 +5275,7 @@ __export(exports_core, {
|
|
|
5156
5275
|
preloadContentModule: () => preloadContentModule,
|
|
5157
5276
|
performSSRSetup: () => performSSRSetup,
|
|
5158
5277
|
mergeLayoutData: () => mergeLayoutData,
|
|
5278
|
+
loadRoutesModule: () => loadRoutesModule,
|
|
5159
5279
|
loadOGImageComponent: () => loadOGImageComponent,
|
|
5160
5280
|
loadIndexHtml: () => loadIndexHtml,
|
|
5161
5281
|
loadConfig: () => loadConfig,
|
|
@@ -6491,6 +6611,7 @@ function matchPattern(pattern: string, pathname: string): Record<string, string>
|
|
|
6491
6611
|
// Set globals for compiled binary support (sitemap/RSS/robots discovery)
|
|
6492
6612
|
(globalThis as any).__REROUTE_ROUTES__ = routes;
|
|
6493
6613
|
(globalThis as any).__REROUTE_LAYOUTS__ = layouts;
|
|
6614
|
+
(globalThis as any).__REROUTE_NOT_FOUND_ROUTES__ = notFoundRoutes;
|
|
6494
6615
|
`;
|
|
6495
6616
|
}
|
|
6496
6617
|
async function buildStreamingWrappersForTree(cwd, routesPath, tree, config2) {
|
|
@@ -105460,7 +105581,7 @@ async function getVersionString2() {
|
|
|
105460
105581
|
}
|
|
105461
105582
|
async function getVersion2() {
|
|
105462
105583
|
if (true) {
|
|
105463
|
-
return "0.34.
|
|
105584
|
+
return "0.34.9";
|
|
105464
105585
|
}
|
|
105465
105586
|
const possiblePaths = [
|
|
105466
105587
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -105477,10 +105598,10 @@ async function getVersion2() {
|
|
|
105477
105598
|
}
|
|
105478
105599
|
async function getCommit2() {
|
|
105479
105600
|
if (true) {
|
|
105480
|
-
return "
|
|
105601
|
+
return "58d33f1";
|
|
105481
105602
|
}
|
|
105482
105603
|
return "dev";
|
|
105483
105604
|
}
|
|
105484
105605
|
main();
|
|
105485
105606
|
|
|
105486
|
-
//# debugId=
|
|
105607
|
+
//# debugId=D0C606DE313168C464756E2164756E21
|