reroute-js 0.34.8 → 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 +175 -71
- package/cli/bin.js.map +6 -6
- 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 +171 -67
- package/core/index.js.map +6 -6
- 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 +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/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 +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 +181 -81
- package/elysia/index.js.map +10 -10
- 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 +2 -2
- package/telemetry/server.js.map +3 -3
- 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
|
}
|
|
@@ -3424,9 +3424,9 @@ async function discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConf
|
|
|
3424
3424
|
}
|
|
3425
3425
|
return collectionsMap;
|
|
3426
3426
|
}
|
|
3427
|
-
async function loadRouteModule(
|
|
3427
|
+
async function loadRouteModule(cwd, routePath, isWatchMode) {
|
|
3428
3428
|
try {
|
|
3429
|
-
const abs = join2(
|
|
3429
|
+
const abs = join2(cwd, "src", "client", "routes", routePath);
|
|
3430
3430
|
const modUrl = `${pathToFileURL6(abs).href}${isWatchMode ? `?t=${Date.now()}` : ""}`;
|
|
3431
3431
|
return await import(modUrl);
|
|
3432
3432
|
} catch {
|
|
@@ -3459,24 +3459,47 @@ function createEntriesFromArray(array, routePath) {
|
|
|
3459
3459
|
}
|
|
3460
3460
|
return entries;
|
|
3461
3461
|
}
|
|
3462
|
-
async function discoverSSRDataRoutes(
|
|
3462
|
+
async function discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode) {
|
|
3463
3463
|
const ssrDataRoutes = new Map;
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
const arrays = findArraysInData(result);
|
|
3474
|
-
for (const array of arrays) {
|
|
3475
|
-
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)
|
|
3469
|
+
continue;
|
|
3470
|
+
const ssr = bundledRoute?.ssr;
|
|
3471
|
+
const dataFn = ssr?.data;
|
|
3472
|
+
if (typeof dataFn !== "function")
|
|
3476
3473
|
continue;
|
|
3477
|
-
const
|
|
3478
|
-
|
|
3479
|
-
|
|
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
|
+
}
|
|
3480
3503
|
}
|
|
3481
3504
|
}
|
|
3482
3505
|
}
|
|
@@ -3599,12 +3622,12 @@ function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, t
|
|
|
3599
3622
|
parts.push("");
|
|
3600
3623
|
}
|
|
3601
3624
|
async function generateLLMsIndex(options) {
|
|
3602
|
-
const { cwd,
|
|
3625
|
+
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
3603
3626
|
const parts = [];
|
|
3604
3627
|
addIndexHeader(parts, llmsConfig);
|
|
3605
3628
|
const staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);
|
|
3606
3629
|
const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
3607
|
-
const ssrDataRoutes = await discoverSSRDataRoutes(cwd,
|
|
3630
|
+
const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
|
|
3608
3631
|
const isSingleCollection = collections2.length === 1;
|
|
3609
3632
|
const targetCollection = isSingleCollection ? collections2[0] : null;
|
|
3610
3633
|
const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
|
|
@@ -3653,7 +3676,7 @@ function buildHeader(baseUrl, llmsConfig) {
|
|
|
3653
3676
|
}
|
|
3654
3677
|
return parts;
|
|
3655
3678
|
}
|
|
3656
|
-
async function discoverAllRoutes(cwd,
|
|
3679
|
+
async function discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig) {
|
|
3657
3680
|
const {
|
|
3658
3681
|
discoverStaticRoutes: discoverStaticRoutes2,
|
|
3659
3682
|
discoverCollectionRoutes: discoverCollectionRoutes2,
|
|
@@ -3661,7 +3684,7 @@ async function discoverAllRoutes(cwd, clientDir, collections2, isWatchMode, llms
|
|
|
3661
3684
|
} = await Promise.resolve().then(() => (init_index_generator(), exports_index_generator));
|
|
3662
3685
|
const staticRoutes = await discoverStaticRoutes2(cwd, isWatchMode);
|
|
3663
3686
|
const collectionsMap = await discoverCollectionRoutes2(cwd, collections2, isWatchMode, llmsConfig);
|
|
3664
|
-
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd,
|
|
3687
|
+
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode);
|
|
3665
3688
|
const allRoutes = [];
|
|
3666
3689
|
for (const route of staticRoutes) {
|
|
3667
3690
|
if (!shouldExcludeRoute(route.path, llmsConfig?.excludeRoutes)) {
|
|
@@ -3751,9 +3774,9 @@ function buildFooter(parts) {
|
|
|
3751
3774
|
parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
|
|
3752
3775
|
}
|
|
3753
3776
|
async function generateLLMsFullContent(options) {
|
|
3754
|
-
const { cwd,
|
|
3777
|
+
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
3755
3778
|
const parts = buildHeader(baseUrl, llmsConfig);
|
|
3756
|
-
const allRoutes = await discoverAllRoutes(cwd,
|
|
3779
|
+
const allRoutes = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
3757
3780
|
const maxItems = llmsConfig?.maxItems || 1e4;
|
|
3758
3781
|
const routesToProcess = allRoutes.slice(0, maxItems);
|
|
3759
3782
|
const extracted = await extractRouteContents(routesToProcess, options);
|
|
@@ -4170,30 +4193,58 @@ async function discoverCollectionContent(cwd, collection, isWatchMode, baseUrl)
|
|
|
4170
4193
|
}
|
|
4171
4194
|
return entries;
|
|
4172
4195
|
}
|
|
4173
|
-
async function discoverSSRDataRoutes2(
|
|
4196
|
+
async function discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig) {
|
|
4174
4197
|
const ssrDataRoutes = new Map;
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
|
|
4181
|
-
const
|
|
4182
|
-
|
|
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;
|
|
4183
4208
|
const dataFn = ssr?.data;
|
|
4184
4209
|
if (typeof dataFn === "function") {
|
|
4185
|
-
|
|
4186
|
-
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
|
|
4191
|
-
|
|
4192
|
-
|
|
4193
|
-
|
|
4194
|
-
|
|
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 {}
|
|
4195
4222
|
}
|
|
4196
|
-
}
|
|
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
|
+
}
|
|
4197
4248
|
}
|
|
4198
4249
|
return ssrDataRoutes;
|
|
4199
4250
|
}
|
|
@@ -4303,7 +4354,7 @@ function createEntryFromItem(item, routePattern, baseUrl, sitemapConfig) {
|
|
|
4303
4354
|
}
|
|
4304
4355
|
return entry;
|
|
4305
4356
|
}
|
|
4306
|
-
async function discoverSitemapData(cwd,
|
|
4357
|
+
async function discoverSitemapData(cwd, collections2, baseUrl, isWatchMode, sitemapConfig) {
|
|
4307
4358
|
const { staticRoutes, dynamicRoutes } = await discoverRoutes(cwd, isWatchMode);
|
|
4308
4359
|
const collectionsMap = new Map;
|
|
4309
4360
|
for (const collection of collections2) {
|
|
@@ -4312,7 +4363,7 @@ async function discoverSitemapData(cwd, clientDir, collections2, baseUrl, isWatc
|
|
|
4312
4363
|
collectionsMap.set(collection, entries);
|
|
4313
4364
|
}
|
|
4314
4365
|
}
|
|
4315
|
-
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd,
|
|
4366
|
+
const ssrDataRoutes = await discoverSSRDataRoutes2(cwd, staticRoutes, isWatchMode, baseUrl, sitemapConfig);
|
|
4316
4367
|
return {
|
|
4317
4368
|
staticRoutes,
|
|
4318
4369
|
dynamicRoutes,
|
|
@@ -4427,10 +4478,10 @@ async function discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl
|
|
|
4427
4478
|
sortByPubDate(items);
|
|
4428
4479
|
return items;
|
|
4429
4480
|
}
|
|
4430
|
-
async function discoverSSRDataFeedItems(
|
|
4481
|
+
async function discoverSSRDataFeedItems(cwd, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
|
|
4431
4482
|
const items = [];
|
|
4432
4483
|
try {
|
|
4433
|
-
const abs = join2(
|
|
4484
|
+
const abs = join2(cwd, "src", "client", "routes", routePath);
|
|
4434
4485
|
const mod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
4435
4486
|
const ssr = mod?.ssr;
|
|
4436
4487
|
const dataFn = ssr?.data;
|
|
@@ -4566,7 +4617,7 @@ function createRSSItemFromData(item, routePattern, baseUrl, rssConfig) {
|
|
|
4566
4617
|
}
|
|
4567
4618
|
return rssItem;
|
|
4568
4619
|
}
|
|
4569
|
-
async function discoverRSSData(cwd,
|
|
4620
|
+
async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfig) {
|
|
4570
4621
|
const collectionsMap = new Map;
|
|
4571
4622
|
for (const collection of collections2) {
|
|
4572
4623
|
const items = await discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl, rssConfig);
|
|
@@ -4575,18 +4626,48 @@ async function discoverRSSData(cwd, clientDir, collections2, baseUrl, isWatchMod
|
|
|
4575
4626
|
}
|
|
4576
4627
|
}
|
|
4577
4628
|
const ssrDataFeeds = new Map;
|
|
4578
|
-
const
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
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
|
+
}
|
|
4583
4656
|
}
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
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
|
+
}
|
|
4587
4668
|
}
|
|
4588
4669
|
}
|
|
4589
|
-
const layoutFeeds = await discoverLayoutFeedItems(cwd,
|
|
4670
|
+
const layoutFeeds = await discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig);
|
|
4590
4671
|
for (const [pattern, items] of layoutFeeds.entries()) {
|
|
4591
4672
|
const existing = ssrDataFeeds.get(pattern) || [];
|
|
4592
4673
|
ssrDataFeeds.set(pattern, [...existing, ...items]);
|
|
@@ -4610,13 +4691,13 @@ async function loadLayouts(cwd, isWatchMode) {
|
|
|
4610
4691
|
return;
|
|
4611
4692
|
}
|
|
4612
4693
|
}
|
|
4613
|
-
async function processLayoutForRSS(layout,
|
|
4694
|
+
async function processLayoutForRSS(layout, cwd, isWatchMode, baseUrl, rssConfig) {
|
|
4614
4695
|
const pattern = String(layout?.pattern || "/");
|
|
4615
4696
|
const path3 = String(layout?.path || "");
|
|
4616
4697
|
if (!path3)
|
|
4617
4698
|
return null;
|
|
4618
4699
|
try {
|
|
4619
|
-
const abs = join2(
|
|
4700
|
+
const abs = join2(cwd, "src", "client", "routes", path3);
|
|
4620
4701
|
const layoutMod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
4621
4702
|
const ssr = layoutMod?.ssr;
|
|
4622
4703
|
const dataFn = ssr?.data;
|
|
@@ -4635,16 +4716,39 @@ async function processLayoutForRSS(layout, clientDir, isWatchMode, baseUrl, rssC
|
|
|
4635
4716
|
} catch {}
|
|
4636
4717
|
return null;
|
|
4637
4718
|
}
|
|
4638
|
-
async function discoverLayoutFeedItems(cwd,
|
|
4719
|
+
async function discoverLayoutFeedItems(cwd, isWatchMode, baseUrl, rssConfig) {
|
|
4639
4720
|
const layoutFeeds = new Map;
|
|
4640
4721
|
const layouts2 = await loadLayouts(cwd, isWatchMode);
|
|
4641
4722
|
if (!Array.isArray(layouts2)) {
|
|
4642
4723
|
return layoutFeeds;
|
|
4643
4724
|
}
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
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
|
+
}
|
|
4648
4752
|
}
|
|
4649
4753
|
}
|
|
4650
4754
|
return layoutFeeds;
|
|
@@ -105477,7 +105581,7 @@ async function getVersionString2() {
|
|
|
105477
105581
|
}
|
|
105478
105582
|
async function getVersion2() {
|
|
105479
105583
|
if (true) {
|
|
105480
|
-
return "0.34.
|
|
105584
|
+
return "0.34.9";
|
|
105481
105585
|
}
|
|
105482
105586
|
const possiblePaths = [
|
|
105483
105587
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -105494,10 +105598,10 @@ async function getVersion2() {
|
|
|
105494
105598
|
}
|
|
105495
105599
|
async function getCommit2() {
|
|
105496
105600
|
if (true) {
|
|
105497
|
-
return "
|
|
105601
|
+
return "58d33f1";
|
|
105498
105602
|
}
|
|
105499
105603
|
return "dev";
|
|
105500
105604
|
}
|
|
105501
105605
|
main();
|
|
105502
105606
|
|
|
105503
|
-
//# debugId=
|
|
105607
|
+
//# debugId=D0C606DE313168C464756E2164756E21
|