reroute-js 1.0.0-alpha.6 → 1.0.0-alpha.7
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 +5 -3
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +103 -32
- package/cli/bin.js.map +5 -5
- 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 +99 -28
- package/core/index.js.map +5 -5
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +7 -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 +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 +4 -3
- package/core/src/i18n/resolve.d.ts.map +1 -1
- package/core/src/i18n/types.d.ts +5 -1
- package/core/src/i18n/types.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 +3 -2
- 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 +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 +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 +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 +106 -33
- package/elysia/index.js.map +7 -7
- 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 +2 -2
- package/elysia/src/libs/i18n.d.ts.map +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/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/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 +1 -1
- 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 +7 -24
- 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/i18n/LocaleProvider.d.ts +1 -1
- package/react/src/i18n/LocaleProvider.d.ts.map +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 +2 -2
- package/telemetry/server.js.map +5 -5
- 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/README.md
CHANGED
|
@@ -670,7 +670,9 @@ src/client/routes/blog/content/
|
|
|
670
670
|
- Flat files under `content/` are the default locale; nest under `content/{locale}/` for translations
|
|
671
671
|
- Collections without locale folders behave as before
|
|
672
672
|
- Default-locale prefix (`/blog/en-US/...`) 302s to the unprefixed URL
|
|
673
|
-
-
|
|
673
|
+
- A locale segment in the URL always wins over cookie / `Accept-Language`
|
|
674
|
+
- `setLocale()` writes `?lang=` and the server 302s to the canonical content URL (and sets the cookie). That is the only way to leave a URL that already has a locale in the path
|
|
675
|
+
- Optional negotiate: `Accept-Language` / cookie can 302 **unprefixed** content URLs to a localized path (`i18n.redirectContentOnNegotiate`, default `true`)
|
|
674
676
|
|
|
675
677
|
### UI Strings
|
|
676
678
|
|
|
@@ -1165,8 +1167,8 @@ export default defineConfig({
|
|
|
1165
1167
|
Your site now supports:
|
|
1166
1168
|
- `.txt` and `.md` extensions on any route (e.g., `/blog/post.txt`, `/about.md`)
|
|
1167
1169
|
- Accept header content negotiation (`Accept: text/plain`, `Accept: text/markdown`)
|
|
1168
|
-
- `/llms.txt` - Index of all content
|
|
1169
|
-
- `/llms-full.txt` - Complete site content in one file
|
|
1170
|
+
- `/llms.txt` - Index of all content: title, description, and link per page
|
|
1171
|
+
- `/llms-full.txt` - Complete site content in one file (optional; large)
|
|
1170
1172
|
|
|
1171
1173
|
#### How It Works
|
|
1172
1174
|
|
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 v1.0.0-alpha.
|
|
4
|
+
* reroute-js v1.0.0-alpha.7
|
|
5
5
|
*
|
|
6
6
|
* @license MIT
|
|
7
7
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -68,7 +68,7 @@ async function getVersionString() {
|
|
|
68
68
|
}
|
|
69
69
|
async function getVersion() {
|
|
70
70
|
if (true) {
|
|
71
|
-
return "1.0.0-alpha.
|
|
71
|
+
return "1.0.0-alpha.7";
|
|
72
72
|
}
|
|
73
73
|
const possiblePaths = [
|
|
74
74
|
path.join(import.meta.dir, "../../../../package.json"),
|
|
@@ -86,7 +86,7 @@ async function getVersion() {
|
|
|
86
86
|
}
|
|
87
87
|
async function getCommit() {
|
|
88
88
|
if (true) {
|
|
89
|
-
return "
|
|
89
|
+
return "19dcaf7";
|
|
90
90
|
}
|
|
91
91
|
return "dev";
|
|
92
92
|
}
|
|
@@ -818,9 +818,30 @@ function hreflangTags(baseUrl, collection, name, locales, defaultLocale) {
|
|
|
818
818
|
var init_pathname = () => {};
|
|
819
819
|
|
|
820
820
|
// packages/core/src/i18n/resolve.ts
|
|
821
|
+
function canonicalLocale(value, availableLocales) {
|
|
822
|
+
return availableLocales.find((l) => l.toLowerCase() === value.toLowerCase()) || value;
|
|
823
|
+
}
|
|
824
|
+
function parseLangParam(search, isAvailable, availableLocales) {
|
|
825
|
+
if (!search)
|
|
826
|
+
return;
|
|
827
|
+
const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
|
|
828
|
+
const raw = params.get("lang") ?? undefined;
|
|
829
|
+
if (!isAvailable(raw))
|
|
830
|
+
return;
|
|
831
|
+
return canonicalLocale(raw, availableLocales);
|
|
832
|
+
}
|
|
833
|
+
function stripLangParam(search) {
|
|
834
|
+
if (!search)
|
|
835
|
+
return "";
|
|
836
|
+
const params = new URLSearchParams(search.startsWith("?") ? search.slice(1) : search);
|
|
837
|
+
params.delete("lang");
|
|
838
|
+
const rest = params.toString();
|
|
839
|
+
return rest ? `?${rest}` : "";
|
|
840
|
+
}
|
|
821
841
|
function resolveLocale(input) {
|
|
822
842
|
const {
|
|
823
843
|
pathname,
|
|
844
|
+
search,
|
|
824
845
|
cookieHeader,
|
|
825
846
|
acceptLanguage,
|
|
826
847
|
availableLocales,
|
|
@@ -831,14 +852,32 @@ function resolveLocale(input) {
|
|
|
831
852
|
const parsed = parseContentPath(pathname, availableLocales, collections);
|
|
832
853
|
const availableLower = new Set(availableLocales.map((l) => l.toLowerCase()));
|
|
833
854
|
const isAvailable = (locale) => !!locale && availableLower.has(locale.toLowerCase());
|
|
855
|
+
const routingPathname = parsed?.routingPathname ?? pathname.split("?")[0];
|
|
856
|
+
const restSearch = stripLangParam(search);
|
|
857
|
+
const queryLocale = parseLangParam(search, isAvailable, availableLocales);
|
|
858
|
+
if (queryLocale) {
|
|
859
|
+
const target = parsed ? localizeContentHref(parsed.collection, parsed.name, queryLocale, defaultLocale) : routingPathname;
|
|
860
|
+
return {
|
|
861
|
+
locale: queryLocale,
|
|
862
|
+
routingPathname,
|
|
863
|
+
fromPath: false,
|
|
864
|
+
fromQuery: true,
|
|
865
|
+
redirectTo: `${target}${restSearch}`,
|
|
866
|
+
parsed: parsed ? {
|
|
867
|
+
...parsed,
|
|
868
|
+
locale: queryLocale === defaultLocale ? undefined : queryLocale
|
|
869
|
+
} : undefined
|
|
870
|
+
};
|
|
871
|
+
}
|
|
834
872
|
if (parsed?.locale && isAvailable(parsed.locale)) {
|
|
835
|
-
const locale =
|
|
873
|
+
const locale = canonicalLocale(parsed.locale, availableLocales);
|
|
836
874
|
if (locale === defaultLocale && parsed.pathname !== parsed.routingPathname) {
|
|
837
875
|
return {
|
|
838
876
|
locale,
|
|
839
877
|
routingPathname: parsed.routingPathname,
|
|
840
878
|
fromPath: true,
|
|
841
|
-
|
|
879
|
+
fromQuery: false,
|
|
880
|
+
redirectTo: `${parsed.routingPathname}${restSearch}`,
|
|
842
881
|
parsed: { ...parsed, locale }
|
|
843
882
|
};
|
|
844
883
|
}
|
|
@@ -846,17 +885,18 @@ function resolveLocale(input) {
|
|
|
846
885
|
locale,
|
|
847
886
|
routingPathname: parsed.routingPathname,
|
|
848
887
|
fromPath: true,
|
|
888
|
+
fromQuery: false,
|
|
849
889
|
parsed: { ...parsed, locale }
|
|
850
890
|
};
|
|
851
891
|
}
|
|
852
|
-
const routingPathname = parsed?.routingPathname ?? pathname.split("?")[0];
|
|
853
892
|
const cookieLocale = parseCookieValue(cookieHeader, cookieName);
|
|
854
893
|
if (isAvailable(cookieLocale)) {
|
|
855
|
-
const locale =
|
|
894
|
+
const locale = canonicalLocale(cookieLocale, availableLocales);
|
|
856
895
|
return {
|
|
857
896
|
locale,
|
|
858
897
|
routingPathname,
|
|
859
898
|
fromPath: false,
|
|
899
|
+
fromQuery: false,
|
|
860
900
|
parsed: parsed ? { ...parsed, locale: undefined } : undefined
|
|
861
901
|
};
|
|
862
902
|
}
|
|
@@ -865,13 +905,14 @@ function resolveLocale(input) {
|
|
|
865
905
|
locale: negotiated,
|
|
866
906
|
routingPathname,
|
|
867
907
|
fromPath: false,
|
|
908
|
+
fromQuery: false,
|
|
868
909
|
parsed: parsed ? { ...parsed, locale: undefined } : undefined
|
|
869
910
|
};
|
|
870
911
|
}
|
|
871
912
|
function contentNegotiateRedirect(resolution, defaultLocale, enabled) {
|
|
872
913
|
if (!enabled)
|
|
873
914
|
return;
|
|
874
|
-
if (resolution.fromPath)
|
|
915
|
+
if (resolution.fromPath || resolution.fromQuery)
|
|
875
916
|
return;
|
|
876
917
|
if (resolution.locale === defaultLocale)
|
|
877
918
|
return;
|
|
@@ -4502,6 +4543,25 @@ __export(exports_index_generator, {
|
|
|
4502
4543
|
generateLLMsIndex: () => generateLLMsIndex
|
|
4503
4544
|
});
|
|
4504
4545
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
4546
|
+
function oneLine(value) {
|
|
4547
|
+
return value.replace(/\s+/g, " ").trim();
|
|
4548
|
+
}
|
|
4549
|
+
function stringField(record, key) {
|
|
4550
|
+
const value = record?.[key];
|
|
4551
|
+
if (typeof value !== "string")
|
|
4552
|
+
return;
|
|
4553
|
+
const trimmed = oneLine(value);
|
|
4554
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
4555
|
+
}
|
|
4556
|
+
function metaFromUnknown(meta) {
|
|
4557
|
+
if (!meta || typeof meta !== "object")
|
|
4558
|
+
return {};
|
|
4559
|
+
const record = meta;
|
|
4560
|
+
return {
|
|
4561
|
+
title: stringField(record, "title") ?? stringField(record, "name"),
|
|
4562
|
+
description: stringField(record, "description") ?? stringField(record, "excerpt")
|
|
4563
|
+
};
|
|
4564
|
+
}
|
|
4505
4565
|
async function discoverStaticRoutes(cwd, isWatchMode) {
|
|
4506
4566
|
const routes = [];
|
|
4507
4567
|
try {
|
|
@@ -4518,8 +4578,11 @@ async function discoverStaticRoutes(cwd, isWatchMode) {
|
|
|
4518
4578
|
if (pattern.includes("[404]") || pattern.includes("[layout]") || pattern.includes("[skeleton]") || pattern.includes(":")) {
|
|
4519
4579
|
continue;
|
|
4520
4580
|
}
|
|
4581
|
+
const { title, description } = metaFromUnknown(route?.meta);
|
|
4521
4582
|
routes.push({
|
|
4522
|
-
path: pattern
|
|
4583
|
+
path: pattern,
|
|
4584
|
+
title,
|
|
4585
|
+
description
|
|
4523
4586
|
});
|
|
4524
4587
|
}
|
|
4525
4588
|
}
|
|
@@ -4542,11 +4605,13 @@ function createRouteEntriesFromItems(items, collection) {
|
|
|
4542
4605
|
for (const item of items) {
|
|
4543
4606
|
const href = String(item.href || "");
|
|
4544
4607
|
if (href) {
|
|
4545
|
-
const
|
|
4608
|
+
const fromMeta = metaFromUnknown(item.meta);
|
|
4609
|
+
const title = fromMeta.title || (typeof item.name === "string" ? item.name : undefined);
|
|
4546
4610
|
routes.push({
|
|
4547
4611
|
path: href,
|
|
4548
4612
|
section: collection,
|
|
4549
|
-
title
|
|
4613
|
+
title,
|
|
4614
|
+
description: fromMeta.description
|
|
4550
4615
|
});
|
|
4551
4616
|
}
|
|
4552
4617
|
}
|
|
@@ -4612,9 +4677,13 @@ function createEntriesFromArray(array, routePath) {
|
|
|
4612
4677
|
continue;
|
|
4613
4678
|
const identifier = extractIdentifier(item);
|
|
4614
4679
|
if (identifier) {
|
|
4680
|
+
const fromItem = metaFromUnknown(item);
|
|
4681
|
+
const fromMeta = metaFromUnknown(item.meta);
|
|
4615
4682
|
entries.push({
|
|
4616
4683
|
path: `${routePath}/${identifier}`,
|
|
4617
|
-
section: routePath.split("/").filter(Boolean)[0]
|
|
4684
|
+
section: routePath.split("/").filter(Boolean)[0],
|
|
4685
|
+
title: fromItem.title ?? fromMeta.title,
|
|
4686
|
+
description: fromItem.description ?? fromMeta.description
|
|
4618
4687
|
});
|
|
4619
4688
|
}
|
|
4620
4689
|
}
|
|
@@ -4720,13 +4789,21 @@ function formatRouteUrl(routePath, baseUrl) {
|
|
|
4720
4789
|
function getRouteTitle(route) {
|
|
4721
4790
|
return route.title || (route.path === "/" ? "Home" : route.path.split("/").pop() || "Page");
|
|
4722
4791
|
}
|
|
4723
|
-
function
|
|
4792
|
+
function formatIndexLine(route, url, summaries) {
|
|
4793
|
+
const link = `- [${getRouteTitle(route)}](${url})`;
|
|
4794
|
+
if (!(summaries && route.description))
|
|
4795
|
+
return link;
|
|
4796
|
+
return `${link}: ${route.description}`;
|
|
4797
|
+
}
|
|
4798
|
+
function summariesEnabled(llmsConfig) {
|
|
4799
|
+
return llmsConfig?.indexSummaries !== false;
|
|
4800
|
+
}
|
|
4801
|
+
function addRootRoutes(parts, rootRoutes, baseUrl, isScoped, llmsConfig) {
|
|
4724
4802
|
if (isScoped || rootRoutes.length === 0)
|
|
4725
4803
|
return;
|
|
4804
|
+
const summaries = summariesEnabled(llmsConfig);
|
|
4726
4805
|
for (const route of rootRoutes) {
|
|
4727
|
-
|
|
4728
|
-
const url = formatRouteUrl(route.path, baseUrl);
|
|
4729
|
-
parts.push(`- [${title}](${url})`);
|
|
4806
|
+
parts.push(formatIndexLine(route, formatRouteUrl(route.path, baseUrl), summaries));
|
|
4730
4807
|
}
|
|
4731
4808
|
parts.push("");
|
|
4732
4809
|
}
|
|
@@ -4737,10 +4814,9 @@ function addCollectionSection(parts, collection, routes, baseUrl, llmsConfig) {
|
|
|
4737
4814
|
const sectionName = collection.charAt(0).toUpperCase() + collection.slice(1);
|
|
4738
4815
|
parts.push(`## ${sectionName}`);
|
|
4739
4816
|
parts.push("");
|
|
4817
|
+
const summaries = summariesEnabled(llmsConfig);
|
|
4740
4818
|
for (const route of filteredRoutes) {
|
|
4741
|
-
|
|
4742
|
-
const url = `${baseUrl}${route.path}.txt`;
|
|
4743
|
-
parts.push(`- [${title}](${url})`);
|
|
4819
|
+
parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
|
|
4744
4820
|
}
|
|
4745
4821
|
parts.push("");
|
|
4746
4822
|
}
|
|
@@ -4758,10 +4834,9 @@ function addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targe
|
|
|
4758
4834
|
const sectionName = routeSection?.charAt(0).toUpperCase() + routeSection?.slice(1) || "Content";
|
|
4759
4835
|
parts.push(`## ${sectionName}`);
|
|
4760
4836
|
parts.push("");
|
|
4837
|
+
const summaries = summariesEnabled(llmsConfig);
|
|
4761
4838
|
for (const route of filteredRoutes) {
|
|
4762
|
-
|
|
4763
|
-
const url = `${baseUrl}${route.path}.txt`;
|
|
4764
|
-
parts.push(`- [${title}](${url})`);
|
|
4839
|
+
parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
|
|
4765
4840
|
}
|
|
4766
4841
|
parts.push("");
|
|
4767
4842
|
}
|
|
@@ -4775,10 +4850,9 @@ function addStaticSection(parts, section, routes, baseUrl, isScoped, targetColle
|
|
|
4775
4850
|
const sectionName = section.charAt(0).toUpperCase() + section.slice(1);
|
|
4776
4851
|
parts.push(`## ${sectionName}`);
|
|
4777
4852
|
parts.push("");
|
|
4853
|
+
const summaries = summariesEnabled(llmsConfig);
|
|
4778
4854
|
for (const route of filteredRoutes) {
|
|
4779
|
-
|
|
4780
|
-
const url = `${baseUrl}${route.path}.txt`;
|
|
4781
|
-
parts.push(`- [${title}](${url})`);
|
|
4855
|
+
parts.push(formatIndexLine(route, `${baseUrl}${route.path}.txt`, summaries));
|
|
4782
4856
|
}
|
|
4783
4857
|
parts.push("");
|
|
4784
4858
|
}
|
|
@@ -4792,7 +4866,7 @@ async function generateLLMsIndex(options) {
|
|
|
4792
4866
|
const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
4793
4867
|
const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
|
|
4794
4868
|
const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
|
|
4795
|
-
addRootRoutes(parts, rootRoutes, baseUrl, isScoped);
|
|
4869
|
+
addRootRoutes(parts, rootRoutes, baseUrl, isScoped, llmsConfig);
|
|
4796
4870
|
for (const [collection, routes] of collectionsMap.entries()) {
|
|
4797
4871
|
if (routes.length > 0) {
|
|
4798
4872
|
addCollectionSection(parts, collection, routes, baseUrl, llmsConfig);
|
|
@@ -4811,9 +4885,6 @@ async function generateLLMsIndex(options) {
|
|
|
4811
4885
|
parts.push("---");
|
|
4812
4886
|
parts.push("");
|
|
4813
4887
|
parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
|
|
4814
|
-
if (!isScoped && baseUrl) {
|
|
4815
|
-
parts.push(`Full dump: ${baseUrl}/llms-full.txt`);
|
|
4816
|
-
}
|
|
4817
4888
|
return parts.join(`
|
|
4818
4889
|
`);
|
|
4819
4890
|
}
|
|
@@ -107085,7 +107156,7 @@ async function getVersionString2() {
|
|
|
107085
107156
|
}
|
|
107086
107157
|
async function getVersion2() {
|
|
107087
107158
|
if (true) {
|
|
107088
|
-
return "1.0.0-alpha.
|
|
107159
|
+
return "1.0.0-alpha.7";
|
|
107089
107160
|
}
|
|
107090
107161
|
const possiblePaths = [
|
|
107091
107162
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -107102,10 +107173,10 @@ async function getVersion2() {
|
|
|
107102
107173
|
}
|
|
107103
107174
|
async function getCommit2() {
|
|
107104
107175
|
if (true) {
|
|
107105
|
-
return "
|
|
107176
|
+
return "19dcaf7";
|
|
107106
107177
|
}
|
|
107107
107178
|
return "dev";
|
|
107108
107179
|
}
|
|
107109
107180
|
main();
|
|
107110
107181
|
|
|
107111
|
-
//# debugId=
|
|
107182
|
+
//# debugId=958B942751A1FF3B64756E2164756E21
|