reroute-js 1.0.0-alpha.4 → 1.0.0-alpha.6
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 +755 -683
- package/cli/bin.js.map +12 -12
- package/cli/index.d.ts +1 -1
- package/cli/index.js +37 -25
- package/cli/index.js.map +3 -3
- 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 +5 -6
- package/cli/src/commands/dev.d.ts.map +1 -1
- package/cli/src/commands/gen.d.ts +4 -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 +2 -1
- package/cli/src/commands/lib/server.d.ts.map +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 +223 -172
- package/core/index.js.map +7 -7
- 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/i18n/catalog.d.ts +1 -1
- package/core/src/i18n/discover.d.ts +1 -1
- package/core/src/i18n/index.d.ts +1 -1
- package/core/src/i18n/messages.d.ts +1 -1
- package/core/src/i18n/negotiate.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts +1 -1
- package/core/src/i18n/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +3 -1
- package/core/src/llms/full-generator.d.ts.map +1 -1
- package/core/src/llms/index-generator.d.ts +3 -1
- 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 +8 -3
- package/core/src/ssr/lib/imports.d.ts.map +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 +6 -1
- package/core/src/ssr/lib/seed.d.ts.map +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 +302 -223
- package/elysia/index.js.map +14 -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/i18n.d.ts +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/plugin.d.ts.map +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +2 -2
- package/elysia/src/routes/content.d.ts.map +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/internal.d.ts.map +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts.map +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/redirects.d.ts +1 -1
- package/elysia/src/routes/robots.d.ts +1 -1
- package/elysia/src/routes/rss.d.ts +1 -1
- package/elysia/src/routes/search.d.ts +1 -1
- package/elysia/src/routes/sitemap.d.ts +1 -1
- package/elysia/src/routes/ssr.d.ts +1 -1
- package/elysia/src/routes/static.d.ts +1 -1
- package/elysia/src/routes/themeCssRefresh.d.ts +17 -0
- package/elysia/src/routes/themeCssRefresh.d.ts.map +1 -0
- package/elysia/src/types.d.ts +1 -1
- package/package.json +1 -1
- package/react/index.d.ts +1 -1
- package/react/index.js +71 -71
- 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/i18n/LocaleProvider.d.ts +1 -1
- package/react/src/i18n/helpers.d.ts +1 -1
- package/react/src/i18n/index.d.ts +1 -1
- package/react/src/index.d.ts +1 -1
- package/react/src/lib/collection.d.ts +1 -1
- package/react/src/lib/content.d.ts +1 -1
- package/react/src/lib/head.d.ts +1 -1
- package/react/src/lib/index.d.ts +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- package/react/src/lib/route-loader.d.ts +1 -1
- package/react/src/providers/ContentProvider.d.ts +1 -1
- package/react/src/providers/RerouteProvider.d.ts +1 -1
- package/react/src/providers/RouterProvider.d.ts +1 -1
- package/react/src/providers/index.d.ts +1 -1
- package/react/src/types/any.d.ts +1 -1
- package/react/src/types/index.d.ts +1 -1
- package/react/src/types/router.d.ts +1 -1
- package/telemetry/react.d.ts +1 -1
- package/telemetry/react.js +16 -16
- package/telemetry/react.js.map +2 -2
- package/telemetry/server.d.ts +1 -1
- package/telemetry/server.js +28 -220
- package/telemetry/server.js.map +7 -6
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/elysia/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v1.0.0-alpha.
|
|
2
|
+
* reroute-js v1.0.0-alpha.6
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2026 stewones <hi@stewan.io>
|
|
@@ -390,14 +390,14 @@ var init_negotiate = () => {};
|
|
|
390
390
|
// packages/core/src/i18n/pathname.ts
|
|
391
391
|
var exports_pathname = {};
|
|
392
392
|
__export(exports_pathname, {
|
|
393
|
-
|
|
394
|
-
parseContentPath: () => parseContentPath,
|
|
395
|
-
normalizePathname: () => normalizePathname,
|
|
396
|
-
looksLikeLocale: () => looksLikeLocale,
|
|
397
|
-
localizeHref: () => localizeHref,
|
|
398
|
-
localizeContentHref: () => localizeContentHref,
|
|
393
|
+
contentKey: () => contentKey,
|
|
399
394
|
hreflangTags: () => hreflangTags,
|
|
400
|
-
|
|
395
|
+
localizeContentHref: () => localizeContentHref,
|
|
396
|
+
localizeHref: () => localizeHref,
|
|
397
|
+
looksLikeLocale: () => looksLikeLocale,
|
|
398
|
+
normalizePathname: () => normalizePathname,
|
|
399
|
+
parseContentPath: () => parseContentPath,
|
|
400
|
+
toOgLocale: () => toOgLocale
|
|
401
401
|
});
|
|
402
402
|
function looksLikeLocale(segment) {
|
|
403
403
|
return /^[a-z]{2}(?:-[A-Za-z0-9]{2,8})*$/i.test(segment);
|
|
@@ -1049,11 +1049,39 @@ function cleanupPathScopedSSRData(pathname) {
|
|
|
1049
1049
|
}
|
|
1050
1050
|
|
|
1051
1051
|
// packages/core/src/ssr/lib/imports.ts
|
|
1052
|
+
import { copyFile, realpath, stat as stat3, unlink } from "node:fs/promises";
|
|
1053
|
+
import { basename as basename2, dirname, extname as extname2, join as join3 } from "node:path";
|
|
1052
1054
|
import { pathToFileURL as pathToFileURL3 } from "node:url";
|
|
1055
|
+
function clearWatchImportCache() {
|
|
1056
|
+
watchImportCache.clear();
|
|
1057
|
+
}
|
|
1058
|
+
function bustCopyPath(absolutePath) {
|
|
1059
|
+
const dir = dirname(absolutePath);
|
|
1060
|
+
const ext = extname2(absolutePath);
|
|
1061
|
+
const base = basename2(absolutePath, ext);
|
|
1062
|
+
const token = `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`;
|
|
1063
|
+
return join3(dir, `${base}.bust-${token}${ext}`);
|
|
1064
|
+
}
|
|
1053
1065
|
async function dynamicImport(absolutePath, isWatchMode) {
|
|
1054
1066
|
const href = pathToFileURL3(absolutePath).href;
|
|
1055
|
-
|
|
1056
|
-
|
|
1067
|
+
if (!isWatchMode) {
|
|
1068
|
+
return await import(href);
|
|
1069
|
+
}
|
|
1070
|
+
const resolved = await realpath(absolutePath);
|
|
1071
|
+
const mtimeMs = (await stat3(resolved)).mtimeMs;
|
|
1072
|
+
const cached = watchImportCache.get(resolved);
|
|
1073
|
+
if (cached && cached.mtimeMs === mtimeMs) {
|
|
1074
|
+
return cached.mod;
|
|
1075
|
+
}
|
|
1076
|
+
const tmp = bustCopyPath(resolved);
|
|
1077
|
+
await copyFile(resolved, tmp);
|
|
1078
|
+
try {
|
|
1079
|
+
const mod = await import(pathToFileURL3(tmp).href);
|
|
1080
|
+
watchImportCache.set(resolved, { mtimeMs, mod });
|
|
1081
|
+
return mod;
|
|
1082
|
+
} finally {
|
|
1083
|
+
await unlink(tmp).catch(() => {});
|
|
1084
|
+
}
|
|
1057
1085
|
}
|
|
1058
1086
|
function isThenable(value) {
|
|
1059
1087
|
return typeof value === "object" && value !== null && typeof value.then === "function";
|
|
@@ -1061,7 +1089,10 @@ function isThenable(value) {
|
|
|
1061
1089
|
function toPromise(input) {
|
|
1062
1090
|
return input instanceof Promise ? input : Promise.resolve(input);
|
|
1063
1091
|
}
|
|
1064
|
-
var
|
|
1092
|
+
var watchImportCache;
|
|
1093
|
+
var init_imports = __esm(() => {
|
|
1094
|
+
watchImportCache = new Map;
|
|
1095
|
+
});
|
|
1065
1096
|
|
|
1066
1097
|
// packages/core/src/ssr/lib/collections.ts
|
|
1067
1098
|
async function loadCollections(cwd, isWatchMode) {
|
|
@@ -1851,7 +1882,7 @@ var init_compute = __esm(() => {
|
|
|
1851
1882
|
});
|
|
1852
1883
|
|
|
1853
1884
|
// packages/core/src/ssr/lib/modules.ts
|
|
1854
|
-
import { readdir as readdir3, stat as
|
|
1885
|
+
import { readdir as readdir3, stat as stat4 } from "node:fs/promises";
|
|
1855
1886
|
async function importContentModuleForPath(pathname, clientDir, cwd, isWatchMode) {
|
|
1856
1887
|
try {
|
|
1857
1888
|
const resolved = resolveContentPathParts(pathname);
|
|
@@ -1909,7 +1940,7 @@ async function tryChunkImport(collection, name, cwd, isWatchMode) {
|
|
|
1909
1940
|
let latestM = 0;
|
|
1910
1941
|
for (const f of matches) {
|
|
1911
1942
|
try {
|
|
1912
|
-
const s = await
|
|
1943
|
+
const s = await stat4(join(chunkDir, f));
|
|
1913
1944
|
if (s.mtimeMs >= latestM) {
|
|
1914
1945
|
latestM = s.mtimeMs;
|
|
1915
1946
|
latest = f;
|
|
@@ -1966,6 +1997,16 @@ function touchModule(key) {
|
|
|
1966
1997
|
evictLRUModule();
|
|
1967
1998
|
}
|
|
1968
1999
|
}
|
|
2000
|
+
function clearSSRModuleStores() {
|
|
2001
|
+
const g = globalThis;
|
|
2002
|
+
if (g.__REROUTE_SSR_MODULES__) {
|
|
2003
|
+
g.__REROUTE_SSR_MODULES__ = {};
|
|
2004
|
+
}
|
|
2005
|
+
if (g.__REROUTE_SSR_EXPORTS__) {
|
|
2006
|
+
g.__REROUTE_SSR_EXPORTS__ = {};
|
|
2007
|
+
}
|
|
2008
|
+
moduleAccessOrder.length = 0;
|
|
2009
|
+
}
|
|
1969
2010
|
async function seedSSRModuleForPath(pathname, clientDir, cwd, isWatchMode) {
|
|
1970
2011
|
try {
|
|
1971
2012
|
const resolved = resolveContentPathParts(pathname);
|
|
@@ -2950,7 +2991,7 @@ var init_metadata2 = __esm(() => {
|
|
|
2950
2991
|
});
|
|
2951
2992
|
|
|
2952
2993
|
// packages/core/src/ssr/lib/preload.ts
|
|
2953
|
-
import { readdir as readdir5, stat as
|
|
2994
|
+
import { readdir as readdir5, stat as stat5 } from "node:fs/promises";
|
|
2954
2995
|
async function preloadContentModule(pathname, clientDir, cwd, isWatchMode) {
|
|
2955
2996
|
let extraHead = "";
|
|
2956
2997
|
let hydrationScript = "";
|
|
@@ -2984,14 +3025,14 @@ async function isContentCollection(clientDir, collection) {
|
|
|
2984
3025
|
if (isProduction) {
|
|
2985
3026
|
const collectionFile = join(clientDir, "collections", `${collection}.js`);
|
|
2986
3027
|
try {
|
|
2987
|
-
const s2 = await
|
|
3028
|
+
const s2 = await stat5(collectionFile);
|
|
2988
3029
|
return s2?.isFile() ?? false;
|
|
2989
3030
|
} catch {
|
|
2990
3031
|
return false;
|
|
2991
3032
|
}
|
|
2992
3033
|
}
|
|
2993
3034
|
const maybeDir = join(clientDir, "routes", collection, "content");
|
|
2994
|
-
const s = await
|
|
3035
|
+
const s = await stat5(maybeDir);
|
|
2995
3036
|
return typeof s?.isDirectory === "function" ? s.isDirectory() : true;
|
|
2996
3037
|
} catch {
|
|
2997
3038
|
return false;
|
|
@@ -3002,7 +3043,7 @@ async function findLatestCandidate(chunkDir, candidates) {
|
|
|
3002
3043
|
let latestM = 0;
|
|
3003
3044
|
for (const candidateName of candidates) {
|
|
3004
3045
|
try {
|
|
3005
|
-
const s = await
|
|
3046
|
+
const s = await stat5(join(chunkDir, candidateName));
|
|
3006
3047
|
if (s.mtimeMs >= latestM) {
|
|
3007
3048
|
latestM = s.mtimeMs;
|
|
3008
3049
|
latest = candidateName;
|
|
@@ -3390,15 +3431,15 @@ var init_scripts = __esm(() => {
|
|
|
3390
3431
|
// packages/core/src/ssr/lib/styles.ts
|
|
3391
3432
|
async function inlineThemeCSS(clientDir, minify = false, isWatchMode = false) {
|
|
3392
3433
|
try {
|
|
3434
|
+
if (isWatchMode) {
|
|
3435
|
+
const timestamp = Date.now();
|
|
3436
|
+
return `<link rel="stylesheet" href="/.reroute/index.css?t=${timestamp}" data-reroute="theme">`;
|
|
3437
|
+
}
|
|
3393
3438
|
const bundledCss = globalThis.__REROUTE_THEME_CSS__;
|
|
3394
3439
|
if (bundledCss) {
|
|
3395
3440
|
const css2 = minify ? minifyCSS(bundledCss) : bundledCss;
|
|
3396
3441
|
return `<style data-reroute="theme">${css2}</style>`;
|
|
3397
3442
|
}
|
|
3398
|
-
if (isWatchMode) {
|
|
3399
|
-
const timestamp = Date.now();
|
|
3400
|
-
return `<link rel="stylesheet" href="/.reroute/index.css?t=${timestamp}" data-reroute="theme">`;
|
|
3401
|
-
}
|
|
3402
3443
|
const candidates = [
|
|
3403
3444
|
join(clientDir, "..", ".reroute", "index.css"),
|
|
3404
3445
|
join(clientDir, "..", "..", ".reroute", "index.css"),
|
|
@@ -4117,10 +4158,10 @@ var init_extractor = __esm(() => {
|
|
|
4117
4158
|
// packages/core/src/llms/index-generator.ts
|
|
4118
4159
|
var exports_index_generator = {};
|
|
4119
4160
|
__export(exports_index_generator, {
|
|
4120
|
-
|
|
4121
|
-
discoverStaticRoutes: () => discoverStaticRoutes,
|
|
4161
|
+
discoverCollectionRoutes: () => discoverCollectionRoutes,
|
|
4122
4162
|
discoverSSRDataRoutes: () => discoverSSRDataRoutes,
|
|
4123
|
-
|
|
4163
|
+
discoverStaticRoutes: () => discoverStaticRoutes,
|
|
4164
|
+
generateLLMsIndex: () => generateLLMsIndex
|
|
4124
4165
|
});
|
|
4125
4166
|
import { pathToFileURL as pathToFileURL6 } from "node:url";
|
|
4126
4167
|
async function discoverStaticRoutes(cwd, isWatchMode) {
|
|
@@ -4341,8 +4382,8 @@ function formatRouteUrl(routePath, baseUrl) {
|
|
|
4341
4382
|
function getRouteTitle(route) {
|
|
4342
4383
|
return route.title || (route.path === "/" ? "Home" : route.path.split("/").pop() || "Page");
|
|
4343
4384
|
}
|
|
4344
|
-
function addRootRoutes(parts, rootRoutes, baseUrl,
|
|
4345
|
-
if (
|
|
4385
|
+
function addRootRoutes(parts, rootRoutes, baseUrl, isScoped) {
|
|
4386
|
+
if (isScoped || rootRoutes.length === 0)
|
|
4346
4387
|
return;
|
|
4347
4388
|
for (const route of rootRoutes) {
|
|
4348
4389
|
const title = getRouteTitle(route);
|
|
@@ -4365,12 +4406,12 @@ function addCollectionSection(parts, collection, routes, baseUrl, llmsConfig) {
|
|
|
4365
4406
|
}
|
|
4366
4407
|
parts.push("");
|
|
4367
4408
|
}
|
|
4368
|
-
function shouldIncludeSection(section,
|
|
4369
|
-
return !
|
|
4409
|
+
function shouldIncludeSection(section, isScoped, targetCollection) {
|
|
4410
|
+
return !isScoped || section === targetCollection;
|
|
4370
4411
|
}
|
|
4371
|
-
function addSSRDataSection(parts, routePattern, routes, baseUrl,
|
|
4412
|
+
function addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targetCollection, llmsConfig) {
|
|
4372
4413
|
const routeSection = routePattern.split("/").filter(Boolean)[0];
|
|
4373
|
-
if (!shouldIncludeSection(routeSection,
|
|
4414
|
+
if (!shouldIncludeSection(routeSection, isScoped, targetCollection)) {
|
|
4374
4415
|
return;
|
|
4375
4416
|
}
|
|
4376
4417
|
const filteredRoutes = routes.filter((r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes));
|
|
@@ -4386,8 +4427,8 @@ function addSSRDataSection(parts, routePattern, routes, baseUrl, isSingleCollect
|
|
|
4386
4427
|
}
|
|
4387
4428
|
parts.push("");
|
|
4388
4429
|
}
|
|
4389
|
-
function addStaticSection(parts, section, routes, baseUrl,
|
|
4390
|
-
if (!shouldIncludeSection(section,
|
|
4430
|
+
function addStaticSection(parts, section, routes, baseUrl, isScoped, targetCollection, collectionsMap, llmsConfig) {
|
|
4431
|
+
if (!shouldIncludeSection(section, isScoped, targetCollection)) {
|
|
4391
4432
|
return;
|
|
4392
4433
|
}
|
|
4393
4434
|
const filteredRoutes = routes.filter((r) => !shouldExcludeRoute(r.path, llmsConfig?.excludeRoutes));
|
|
@@ -4405,15 +4446,15 @@ function addStaticSection(parts, section, routes, baseUrl, isSingleCollection, t
|
|
|
4405
4446
|
}
|
|
4406
4447
|
async function generateLLMsIndex(options) {
|
|
4407
4448
|
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
4449
|
+
const targetCollection = options.targetCollection ?? null;
|
|
4450
|
+
const isScoped = targetCollection !== null;
|
|
4408
4451
|
const parts = [];
|
|
4409
4452
|
addIndexHeader(parts, llmsConfig);
|
|
4410
4453
|
const staticRoutes = await discoverStaticRoutes(cwd, isWatchMode);
|
|
4411
4454
|
const collectionsMap = await discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
4412
4455
|
const ssrDataRoutes = await discoverSSRDataRoutes(cwd, staticRoutes, isWatchMode);
|
|
4413
|
-
const isSingleCollection = collections2.length === 1;
|
|
4414
|
-
const targetCollection = isSingleCollection ? collections2[0] : null;
|
|
4415
4456
|
const { sections, rootRoutes } = groupStaticRoutes(staticRoutes, llmsConfig);
|
|
4416
|
-
addRootRoutes(parts, rootRoutes, baseUrl,
|
|
4457
|
+
addRootRoutes(parts, rootRoutes, baseUrl, isScoped);
|
|
4417
4458
|
for (const [collection, routes] of collectionsMap.entries()) {
|
|
4418
4459
|
if (routes.length > 0) {
|
|
4419
4460
|
addCollectionSection(parts, collection, routes, baseUrl, llmsConfig);
|
|
@@ -4421,17 +4462,20 @@ async function generateLLMsIndex(options) {
|
|
|
4421
4462
|
}
|
|
4422
4463
|
for (const [routePattern, routes] of ssrDataRoutes.entries()) {
|
|
4423
4464
|
if (routes.length > 0) {
|
|
4424
|
-
addSSRDataSection(parts, routePattern, routes, baseUrl,
|
|
4465
|
+
addSSRDataSection(parts, routePattern, routes, baseUrl, isScoped, targetCollection, llmsConfig);
|
|
4425
4466
|
}
|
|
4426
4467
|
}
|
|
4427
4468
|
for (const [section, routes] of sections.entries()) {
|
|
4428
4469
|
if (routes.length > 0) {
|
|
4429
|
-
addStaticSection(parts, section, routes, baseUrl,
|
|
4470
|
+
addStaticSection(parts, section, routes, baseUrl, isScoped, targetCollection, collectionsMap, llmsConfig);
|
|
4430
4471
|
}
|
|
4431
4472
|
}
|
|
4432
4473
|
parts.push("---");
|
|
4433
4474
|
parts.push("");
|
|
4434
4475
|
parts.push("Formats: .txt | .md | Accept: text/plain | Accept: text/markdown");
|
|
4476
|
+
if (!isScoped && baseUrl) {
|
|
4477
|
+
parts.push(`Full dump: ${baseUrl}/llms-full.txt`);
|
|
4478
|
+
}
|
|
4435
4479
|
return parts.join(`
|
|
4436
4480
|
`);
|
|
4437
4481
|
}
|
|
@@ -4489,6 +4533,9 @@ async function discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig) {
|
|
|
4489
4533
|
}
|
|
4490
4534
|
return allRoutes;
|
|
4491
4535
|
}
|
|
4536
|
+
function routeBelongsToCollection(path2, collection) {
|
|
4537
|
+
return path2 === `/${collection}` || path2.startsWith(`/${collection}/`);
|
|
4538
|
+
}
|
|
4492
4539
|
function formatContentBlock(content, routePath, baseUrl) {
|
|
4493
4540
|
const parts = [];
|
|
4494
4541
|
const lines = content.split(`
|
|
@@ -4558,7 +4605,9 @@ function buildFooter(parts) {
|
|
|
4558
4605
|
async function generateLLMsFullContent(options) {
|
|
4559
4606
|
const { cwd, collections: collections2, baseUrl, isWatchMode, llmsConfig } = options;
|
|
4560
4607
|
const parts = buildHeader(baseUrl, llmsConfig);
|
|
4561
|
-
const
|
|
4608
|
+
const discovered = await discoverAllRoutes(cwd, collections2, isWatchMode, llmsConfig);
|
|
4609
|
+
const targetCollection = options.targetCollection;
|
|
4610
|
+
const allRoutes = targetCollection ? discovered.filter((route) => routeBelongsToCollection(route.path, targetCollection)) : discovered;
|
|
4562
4611
|
const maxItems = llmsConfig?.maxItems || 1e4;
|
|
4563
4612
|
const routesToProcess = allRoutes.slice(0, maxItems);
|
|
4564
4613
|
const extracted = await extractRouteContents(routesToProcess, options);
|
|
@@ -4903,10 +4952,10 @@ var init_robots = __esm(() => {
|
|
|
4903
4952
|
// packages/core/src/sitemap/discovery.ts
|
|
4904
4953
|
var exports_discovery = {};
|
|
4905
4954
|
__export(exports_discovery, {
|
|
4906
|
-
|
|
4907
|
-
discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
|
|
4955
|
+
discoverCollectionContent: () => discoverCollectionContent,
|
|
4908
4956
|
discoverRoutes: () => discoverRoutes,
|
|
4909
|
-
|
|
4957
|
+
discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
|
|
4958
|
+
discoverSitemapData: () => discoverSitemapData
|
|
4910
4959
|
});
|
|
4911
4960
|
async function loadRoutesModule2(cwd, isWatchMode) {
|
|
4912
4961
|
let routes = globalThis.__REROUTE_ROUTES__;
|
|
@@ -6190,137 +6239,139 @@ var init_src = __esm(() => {
|
|
|
6190
6239
|
// packages/core/index.ts
|
|
6191
6240
|
var exports_core = {};
|
|
6192
6241
|
__export(exports_core, {
|
|
6193
|
-
|
|
6194
|
-
toOgLocale: () => toOgLocale,
|
|
6195
|
-
toBytes: () => toBytes,
|
|
6196
|
-
stripStart: () => stripStart,
|
|
6197
|
-
stripHtmlTags: () => stripHtmlTags,
|
|
6198
|
-
stripEnd: () => stripEnd,
|
|
6199
|
-
statusCache: () => statusCache,
|
|
6200
|
-
ssrCache: () => ssrCache,
|
|
6201
|
-
splitTemplate: () => splitTemplate,
|
|
6202
|
-
shouldExcludeRoute: () => shouldExcludeRoute,
|
|
6203
|
-
setGlobalSSRData: () => setGlobalSSRData,
|
|
6204
|
-
setGlobalCollections: () => setGlobalCollections,
|
|
6205
|
-
seedSSRModuleForPath: () => seedSSRModuleForPath,
|
|
6206
|
-
resolveLocale: () => resolveLocale,
|
|
6207
|
-
resetSSRAccessTracking: () => resetSSRAccessTracking,
|
|
6208
|
-
renderSSRDocumentStream: () => renderSSRDocumentStream,
|
|
6209
|
-
renderSSRDocument: () => renderSSRDocument,
|
|
6210
|
-
renderOGImageToPNG: () => renderOGImageToPNG,
|
|
6211
|
-
removeOverriddenMetaTags: () => removeOverriddenMetaTags,
|
|
6212
|
-
processCollections: () => processCollections,
|
|
6213
|
-
preloadContentModule: () => preloadContentModule,
|
|
6214
|
-
performSSRSetup: () => performSSRSetup,
|
|
6215
|
-
parseCookieValue: () => parseCookieValue,
|
|
6216
|
-
parseContentPath: () => parseContentPath,
|
|
6217
|
-
normalizePathname: () => normalizePathname,
|
|
6218
|
-
negotiateLocale: () => negotiateLocale,
|
|
6219
|
-
mergeLayoutData: () => mergeLayoutData,
|
|
6220
|
-
matchRoutes: () => matchRoutes,
|
|
6221
|
-
matchRoutePattern: () => matchRoutePattern,
|
|
6222
|
-
lookupMessage: () => lookupMessage,
|
|
6223
|
-
looksLikeLocale: () => looksLikeLocale,
|
|
6224
|
-
localizeHref: () => localizeHref,
|
|
6225
|
-
localizeContentHref: () => localizeContentHref,
|
|
6226
|
-
loadRoutesModule: () => loadRoutesModule,
|
|
6227
|
-
loadOGImageComponent: () => loadOGImageComponent,
|
|
6228
|
-
loadIndexHtml: () => loadIndexHtml,
|
|
6229
|
-
loadConfig: () => loadConfig,
|
|
6230
|
-
loadCollections: () => loadCollections,
|
|
6231
|
-
listContentFiles: () => listContentFiles,
|
|
6232
|
-
join: () => join,
|
|
6233
|
-
isThenable: () => isThenable,
|
|
6234
|
-
isCompressible: () => isCompressible,
|
|
6235
|
-
inlineThemeCSS: () => inlineThemeCSS,
|
|
6236
|
-
importContentModuleForPath: () => importContentModuleForPath,
|
|
6237
|
-
htmlToMarkdown: () => htmlToMarkdown,
|
|
6238
|
-
hreflangTags: () => hreflangTags,
|
|
6239
|
-
gzipIfAccepted: () => gzipIfAccepted,
|
|
6240
|
-
getSitemapExcludedRoutes: () => getSitemapExcludedRoutes,
|
|
6241
|
-
getRedirectSourcePaths: () => getRedirectSourcePaths,
|
|
6242
|
-
getPatternDepth: () => getPatternDepth,
|
|
6243
|
-
getMimeType: () => getMimeType,
|
|
6244
|
-
getMessage: () => getMessage,
|
|
6245
|
-
getMatchingLayouts: () => getMatchingLayouts,
|
|
6246
|
-
getContentMeta: () => getContentMeta,
|
|
6247
|
-
generateSitemapXML: () => generateSitemapXML,
|
|
6248
|
-
generateSitemapIndexXML: () => generateSitemapIndexXML,
|
|
6249
|
-
generateSitemap: () => generateSitemap,
|
|
6250
|
-
generateRobots: () => generateRobots,
|
|
6251
|
-
generateRSSXML: () => generateRSSXML,
|
|
6252
|
-
generateOGImageMetaTags: () => generateOGImageMetaTags,
|
|
6253
|
-
generateLLMsIndex: () => generateLLMsIndex,
|
|
6254
|
-
generateLLMsFullContent: () => generateLLMsFullContent,
|
|
6255
|
-
generateLLMsFooter: () => generateLLMsFooter,
|
|
6256
|
-
generateHydrationScripts: () => generateHydrationScripts,
|
|
6257
|
-
generateFeed: () => generateFeed,
|
|
6258
|
-
generateContentHash: () => generateContentHash,
|
|
6259
|
-
generateCollectionScripts: () => generateCollectionScripts,
|
|
6260
|
-
generateAtomXML: () => generateAtomXML,
|
|
6261
|
-
formatMessage: () => formatMessage,
|
|
6262
|
-
formatAsText: () => formatAsText,
|
|
6263
|
-
formatAsMarkdown: () => formatAsMarkdown,
|
|
6264
|
-
findOGImageForPath: () => findOGImageForPath,
|
|
6265
|
-
extractTitle: () => extractTitle,
|
|
6266
|
-
extractParamsFromPath: () => extractParamsFromPath,
|
|
6267
|
-
extractPageMetadata: () => extractPageMetadata,
|
|
6268
|
-
extractContentForLLMs: () => extractContentForLLMs,
|
|
6269
|
-
extname: () => extname,
|
|
6270
|
-
escapeXml: () => escapeXml2,
|
|
6271
|
-
escapeJsonForScript: () => escapeJsonForScript,
|
|
6272
|
-
dynamicImport: () => dynamicImport,
|
|
6273
|
-
duplicateQueryParamData: () => duplicateQueryParamData,
|
|
6274
|
-
discoverSitemapData: () => discoverSitemapData,
|
|
6275
|
-
discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
|
|
6276
|
-
discoverSSRDataFeedItems: () => discoverSSRDataFeedItems,
|
|
6277
|
-
discoverRoutesForRobots: () => discoverRoutesForRobots,
|
|
6278
|
-
discoverRoutes: () => discoverRoutes,
|
|
6279
|
-
discoverRobotsData: () => discoverRobotsData,
|
|
6280
|
-
discoverRSSData: () => discoverRSSData,
|
|
6281
|
-
discoverI18n: () => discoverI18n,
|
|
6282
|
-
discoverCollections: () => discoverCollections,
|
|
6283
|
-
discoverCollectionContent: () => discoverCollectionContent,
|
|
6284
|
-
defineConfig: () => defineConfig,
|
|
6285
|
-
deduplicateMetaTags: () => deduplicateMetaTags,
|
|
6286
|
-
createTranslator: () => createTranslator,
|
|
6287
|
-
createLlmsScript: () => createLlmsScript,
|
|
6288
|
-
createLayoutDataKey: () => createLayoutDataKey,
|
|
6289
|
-
createLayoutCacheKey: () => createLayoutCacheKey,
|
|
6290
|
-
createFeedsScript: () => createFeedsScript,
|
|
6291
|
-
createDataScript: () => createDataScript,
|
|
6292
|
-
createCollectionScript: () => createCollectionScript,
|
|
6293
|
-
createBundlePreload: () => createBundlePreload,
|
|
6294
|
-
contentNegotiateRedirect: () => contentNegotiateRedirect,
|
|
6295
|
-
contentKey: () => contentKey,
|
|
6296
|
-
computeSSRDataForPath: () => computeSSRDataForPath,
|
|
6297
|
-
computeSSRData: () => computeSSRData,
|
|
6298
|
-
computeRouteData: () => computeRouteData,
|
|
6299
|
-
computeLayoutData: () => computeLayoutData,
|
|
6300
|
-
computeContentData: () => computeContentData,
|
|
6301
|
-
compressStreamIfAccepted: () => compressStreamIfAccepted,
|
|
6302
|
-
compareRouteSpecificity: () => compareRouteSpecificity,
|
|
6303
|
-
cleanupPathScopedSSRData: () => cleanupPathScopedSSRData,
|
|
6304
|
-
buildLocaleCookie: () => buildLocaleCookie,
|
|
6305
|
-
buildHeadFromMeta: () => buildHeadFromMeta,
|
|
6306
|
-
blockSearchCrawlers: () => blockSearchCrawlers,
|
|
6307
|
-
blockAITrainingCrawlers: () => blockAITrainingCrawlers,
|
|
6308
|
-
blockAICrawlers: () => blockAICrawlers,
|
|
6309
|
-
basename: () => basename,
|
|
6310
|
-
applyIndexTemplate: () => applyIndexTemplate,
|
|
6311
|
-
allowSearchCrawlers: () => allowSearchCrawlers,
|
|
6312
|
-
allowAICrawlers: () => allowAICrawlers,
|
|
6313
|
-
acceptsGzip: () => acceptsGzip,
|
|
6314
|
-
acceptsBrotli: () => acceptsBrotli,
|
|
6315
|
-
TTLCache: () => TTLCache,
|
|
6316
|
-
SSRDataCache: () => SSRDataCache,
|
|
6317
|
-
SEARCH_CRAWLERS: () => SEARCH_CRAWLERS,
|
|
6318
|
-
LRUCache: () => LRUCache,
|
|
6319
|
-
DefaultOGTemplate: () => DefaultOGTemplate,
|
|
6320
|
-
DEFAULT_LOCALES_DIR: () => DEFAULT_LOCALES_DIR,
|
|
6321
|
-
DEFAULT_LOCALE: () => DEFAULT_LOCALE,
|
|
6242
|
+
AI_CRAWLERS: () => AI_CRAWLERS,
|
|
6322
6243
|
DEFAULT_COOKIE: () => DEFAULT_COOKIE,
|
|
6323
|
-
|
|
6244
|
+
DEFAULT_LOCALE: () => DEFAULT_LOCALE,
|
|
6245
|
+
DEFAULT_LOCALES_DIR: () => DEFAULT_LOCALES_DIR,
|
|
6246
|
+
DefaultOGTemplate: () => DefaultOGTemplate,
|
|
6247
|
+
LRUCache: () => LRUCache,
|
|
6248
|
+
SEARCH_CRAWLERS: () => SEARCH_CRAWLERS,
|
|
6249
|
+
SSRDataCache: () => SSRDataCache,
|
|
6250
|
+
TTLCache: () => TTLCache,
|
|
6251
|
+
acceptsBrotli: () => acceptsBrotli,
|
|
6252
|
+
acceptsGzip: () => acceptsGzip,
|
|
6253
|
+
allowAICrawlers: () => allowAICrawlers,
|
|
6254
|
+
allowSearchCrawlers: () => allowSearchCrawlers,
|
|
6255
|
+
applyIndexTemplate: () => applyIndexTemplate,
|
|
6256
|
+
basename: () => basename,
|
|
6257
|
+
blockAICrawlers: () => blockAICrawlers,
|
|
6258
|
+
blockAITrainingCrawlers: () => blockAITrainingCrawlers,
|
|
6259
|
+
blockSearchCrawlers: () => blockSearchCrawlers,
|
|
6260
|
+
buildHeadFromMeta: () => buildHeadFromMeta,
|
|
6261
|
+
buildLocaleCookie: () => buildLocaleCookie,
|
|
6262
|
+
cleanupPathScopedSSRData: () => cleanupPathScopedSSRData,
|
|
6263
|
+
clearSSRModuleStores: () => clearSSRModuleStores,
|
|
6264
|
+
clearWatchImportCache: () => clearWatchImportCache,
|
|
6265
|
+
compareRouteSpecificity: () => compareRouteSpecificity,
|
|
6266
|
+
compressStreamIfAccepted: () => compressStreamIfAccepted,
|
|
6267
|
+
computeContentData: () => computeContentData,
|
|
6268
|
+
computeLayoutData: () => computeLayoutData,
|
|
6269
|
+
computeRouteData: () => computeRouteData,
|
|
6270
|
+
computeSSRData: () => computeSSRData,
|
|
6271
|
+
computeSSRDataForPath: () => computeSSRDataForPath,
|
|
6272
|
+
contentKey: () => contentKey,
|
|
6273
|
+
contentNegotiateRedirect: () => contentNegotiateRedirect,
|
|
6274
|
+
createBundlePreload: () => createBundlePreload,
|
|
6275
|
+
createCollectionScript: () => createCollectionScript,
|
|
6276
|
+
createDataScript: () => createDataScript,
|
|
6277
|
+
createFeedsScript: () => createFeedsScript,
|
|
6278
|
+
createLayoutCacheKey: () => createLayoutCacheKey,
|
|
6279
|
+
createLayoutDataKey: () => createLayoutDataKey,
|
|
6280
|
+
createLlmsScript: () => createLlmsScript,
|
|
6281
|
+
createTranslator: () => createTranslator,
|
|
6282
|
+
deduplicateMetaTags: () => deduplicateMetaTags,
|
|
6283
|
+
defineConfig: () => defineConfig,
|
|
6284
|
+
discoverCollectionContent: () => discoverCollectionContent,
|
|
6285
|
+
discoverCollections: () => discoverCollections,
|
|
6286
|
+
discoverI18n: () => discoverI18n,
|
|
6287
|
+
discoverRSSData: () => discoverRSSData,
|
|
6288
|
+
discoverRobotsData: () => discoverRobotsData,
|
|
6289
|
+
discoverRoutes: () => discoverRoutes,
|
|
6290
|
+
discoverRoutesForRobots: () => discoverRoutesForRobots,
|
|
6291
|
+
discoverSSRDataFeedItems: () => discoverSSRDataFeedItems,
|
|
6292
|
+
discoverSSRDataRoutes: () => discoverSSRDataRoutes2,
|
|
6293
|
+
discoverSitemapData: () => discoverSitemapData,
|
|
6294
|
+
duplicateQueryParamData: () => duplicateQueryParamData,
|
|
6295
|
+
dynamicImport: () => dynamicImport,
|
|
6296
|
+
escapeJsonForScript: () => escapeJsonForScript,
|
|
6297
|
+
escapeXml: () => escapeXml2,
|
|
6298
|
+
extname: () => extname,
|
|
6299
|
+
extractContentForLLMs: () => extractContentForLLMs,
|
|
6300
|
+
extractPageMetadata: () => extractPageMetadata,
|
|
6301
|
+
extractParamsFromPath: () => extractParamsFromPath,
|
|
6302
|
+
extractTitle: () => extractTitle,
|
|
6303
|
+
findOGImageForPath: () => findOGImageForPath,
|
|
6304
|
+
formatAsMarkdown: () => formatAsMarkdown,
|
|
6305
|
+
formatAsText: () => formatAsText,
|
|
6306
|
+
formatMessage: () => formatMessage,
|
|
6307
|
+
generateAtomXML: () => generateAtomXML,
|
|
6308
|
+
generateCollectionScripts: () => generateCollectionScripts,
|
|
6309
|
+
generateContentHash: () => generateContentHash,
|
|
6310
|
+
generateFeed: () => generateFeed,
|
|
6311
|
+
generateHydrationScripts: () => generateHydrationScripts,
|
|
6312
|
+
generateLLMsFooter: () => generateLLMsFooter,
|
|
6313
|
+
generateLLMsFullContent: () => generateLLMsFullContent,
|
|
6314
|
+
generateLLMsIndex: () => generateLLMsIndex,
|
|
6315
|
+
generateOGImageMetaTags: () => generateOGImageMetaTags,
|
|
6316
|
+
generateRSSXML: () => generateRSSXML,
|
|
6317
|
+
generateRobots: () => generateRobots,
|
|
6318
|
+
generateSitemap: () => generateSitemap,
|
|
6319
|
+
generateSitemapIndexXML: () => generateSitemapIndexXML,
|
|
6320
|
+
generateSitemapXML: () => generateSitemapXML,
|
|
6321
|
+
getContentMeta: () => getContentMeta,
|
|
6322
|
+
getMatchingLayouts: () => getMatchingLayouts,
|
|
6323
|
+
getMessage: () => getMessage,
|
|
6324
|
+
getMimeType: () => getMimeType,
|
|
6325
|
+
getPatternDepth: () => getPatternDepth,
|
|
6326
|
+
getRedirectSourcePaths: () => getRedirectSourcePaths,
|
|
6327
|
+
getSitemapExcludedRoutes: () => getSitemapExcludedRoutes,
|
|
6328
|
+
gzipIfAccepted: () => gzipIfAccepted,
|
|
6329
|
+
hreflangTags: () => hreflangTags,
|
|
6330
|
+
htmlToMarkdown: () => htmlToMarkdown,
|
|
6331
|
+
importContentModuleForPath: () => importContentModuleForPath,
|
|
6332
|
+
inlineThemeCSS: () => inlineThemeCSS,
|
|
6333
|
+
isCompressible: () => isCompressible,
|
|
6334
|
+
isThenable: () => isThenable,
|
|
6335
|
+
join: () => join,
|
|
6336
|
+
listContentFiles: () => listContentFiles,
|
|
6337
|
+
loadCollections: () => loadCollections,
|
|
6338
|
+
loadConfig: () => loadConfig,
|
|
6339
|
+
loadIndexHtml: () => loadIndexHtml,
|
|
6340
|
+
loadOGImageComponent: () => loadOGImageComponent,
|
|
6341
|
+
loadRoutesModule: () => loadRoutesModule,
|
|
6342
|
+
localizeContentHref: () => localizeContentHref,
|
|
6343
|
+
localizeHref: () => localizeHref,
|
|
6344
|
+
looksLikeLocale: () => looksLikeLocale,
|
|
6345
|
+
lookupMessage: () => lookupMessage,
|
|
6346
|
+
matchRoutePattern: () => matchRoutePattern,
|
|
6347
|
+
matchRoutes: () => matchRoutes,
|
|
6348
|
+
mergeLayoutData: () => mergeLayoutData,
|
|
6349
|
+
negotiateLocale: () => negotiateLocale,
|
|
6350
|
+
normalizePathname: () => normalizePathname,
|
|
6351
|
+
parseContentPath: () => parseContentPath,
|
|
6352
|
+
parseCookieValue: () => parseCookieValue,
|
|
6353
|
+
performSSRSetup: () => performSSRSetup,
|
|
6354
|
+
preloadContentModule: () => preloadContentModule,
|
|
6355
|
+
processCollections: () => processCollections,
|
|
6356
|
+
removeOverriddenMetaTags: () => removeOverriddenMetaTags,
|
|
6357
|
+
renderOGImageToPNG: () => renderOGImageToPNG,
|
|
6358
|
+
renderSSRDocument: () => renderSSRDocument,
|
|
6359
|
+
renderSSRDocumentStream: () => renderSSRDocumentStream,
|
|
6360
|
+
resetSSRAccessTracking: () => resetSSRAccessTracking,
|
|
6361
|
+
resolveLocale: () => resolveLocale,
|
|
6362
|
+
seedSSRModuleForPath: () => seedSSRModuleForPath,
|
|
6363
|
+
setGlobalCollections: () => setGlobalCollections,
|
|
6364
|
+
setGlobalSSRData: () => setGlobalSSRData,
|
|
6365
|
+
shouldExcludeRoute: () => shouldExcludeRoute,
|
|
6366
|
+
splitTemplate: () => splitTemplate,
|
|
6367
|
+
ssrCache: () => ssrCache,
|
|
6368
|
+
statusCache: () => statusCache,
|
|
6369
|
+
stripEnd: () => stripEnd,
|
|
6370
|
+
stripHtmlTags: () => stripHtmlTags,
|
|
6371
|
+
stripStart: () => stripStart,
|
|
6372
|
+
toBytes: () => toBytes,
|
|
6373
|
+
toOgLocale: () => toOgLocale,
|
|
6374
|
+
toPromise: () => toPromise
|
|
6324
6375
|
});
|
|
6325
6376
|
var init_core = __esm(() => {
|
|
6326
6377
|
init_src();
|
|
@@ -6334,7 +6385,7 @@ import { createElement as createElement2 } from "react";
|
|
|
6334
6385
|
|
|
6335
6386
|
// packages/elysia/src/libs/image.ts
|
|
6336
6387
|
import { existsSync } from "node:fs";
|
|
6337
|
-
import { join as
|
|
6388
|
+
import { join as join4 } from "node:path";
|
|
6338
6389
|
import sharp from "sharp";
|
|
6339
6390
|
var imageCache = new Map;
|
|
6340
6391
|
var MAX_CACHE_SIZE = 100;
|
|
@@ -6377,8 +6428,8 @@ async function loadFromDiskCache(cacheKey) {
|
|
|
6377
6428
|
if (!diskCacheDir)
|
|
6378
6429
|
return null;
|
|
6379
6430
|
try {
|
|
6380
|
-
const cachePath =
|
|
6381
|
-
const imagePath =
|
|
6431
|
+
const cachePath = join4(diskCacheDir, `${cacheKey}.json`);
|
|
6432
|
+
const imagePath = join4(diskCacheDir, `${cacheKey}.img`);
|
|
6382
6433
|
if (!(existsSync(cachePath) && existsSync(imagePath))) {
|
|
6383
6434
|
return null;
|
|
6384
6435
|
}
|
|
@@ -6400,8 +6451,8 @@ async function saveToDiskCache(cacheKey, result) {
|
|
|
6400
6451
|
if (!diskCacheDir)
|
|
6401
6452
|
return;
|
|
6402
6453
|
try {
|
|
6403
|
-
const cachePath =
|
|
6404
|
-
const imagePath =
|
|
6454
|
+
const cachePath = join4(diskCacheDir, `${cacheKey}.json`);
|
|
6455
|
+
const imagePath = join4(diskCacheDir, `${cacheKey}.img`);
|
|
6405
6456
|
await Bun.write(cachePath, JSON.stringify({
|
|
6406
6457
|
contentType: result.contentType,
|
|
6407
6458
|
format: result.format,
|
|
@@ -6760,7 +6811,7 @@ function registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isW
|
|
|
6760
6811
|
if (!collectionPath)
|
|
6761
6812
|
throw new NotFoundError3;
|
|
6762
6813
|
const cacheKey = `content:${collectionPath}`;
|
|
6763
|
-
const cached = collectionCache.get(cacheKey);
|
|
6814
|
+
const cached = isWatchMode ? undefined : collectionCache.get(cacheKey);
|
|
6764
6815
|
if (cached) {
|
|
6765
6816
|
if (isOtelAvailable2()) {
|
|
6766
6817
|
const currentSpan = trace3.getActiveSpan();
|
|
@@ -6783,19 +6834,20 @@ function registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isW
|
|
|
6783
6834
|
}
|
|
6784
6835
|
throw new NotFoundError3;
|
|
6785
6836
|
}
|
|
6786
|
-
const
|
|
6787
|
-
const mod = await import(url);
|
|
6837
|
+
const mod = await dynamicImport(collectionFile, isWatchMode);
|
|
6788
6838
|
const items = mod.items ?? [];
|
|
6789
6839
|
const body = JSON.stringify({ collection: collectionPath, items });
|
|
6790
6840
|
const response = new Response(body, {
|
|
6791
6841
|
status: 200,
|
|
6792
6842
|
headers: {
|
|
6793
6843
|
"content-type": "application/json; charset=utf-8",
|
|
6794
|
-
"cache-control": buildCacheControl(maxAge, directive),
|
|
6844
|
+
"cache-control": isWatchMode ? buildDevCacheControl() : buildCacheControl(maxAge, directive),
|
|
6795
6845
|
"Reroute-Cache": "MISS"
|
|
6796
6846
|
}
|
|
6797
6847
|
});
|
|
6798
|
-
|
|
6848
|
+
if (!isWatchMode) {
|
|
6849
|
+
collectionCache.set(cacheKey, response);
|
|
6850
|
+
}
|
|
6799
6851
|
if (isOtelAvailable2()) {
|
|
6800
6852
|
const currentSpan = trace3.getActiveSpan();
|
|
6801
6853
|
currentSpan?.setAttributes({
|
|
@@ -6822,7 +6874,7 @@ function registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isW
|
|
|
6822
6874
|
// packages/elysia/src/routes/image.ts
|
|
6823
6875
|
init_core();
|
|
6824
6876
|
import { existsSync as existsSync2 } from "node:fs";
|
|
6825
|
-
import { join as
|
|
6877
|
+
import { join as join5 } from "node:path";
|
|
6826
6878
|
function parseNumericParam(value) {
|
|
6827
6879
|
if (!value)
|
|
6828
6880
|
return;
|
|
@@ -6869,8 +6921,8 @@ function registerImageRoutes(app, options) {
|
|
|
6869
6921
|
}
|
|
6870
6922
|
function resolveInternalImagePath(url, clientDir2) {
|
|
6871
6923
|
const cleanUrl = url.startsWith("/") ? url.slice(1) : url;
|
|
6872
|
-
const imagePath =
|
|
6873
|
-
const normalizedPath =
|
|
6924
|
+
const imagePath = join5(clientDir2, cleanUrl);
|
|
6925
|
+
const normalizedPath = join5(clientDir2, cleanUrl);
|
|
6874
6926
|
if (!normalizedPath.startsWith(clientDir2)) {
|
|
6875
6927
|
return { error: "Access denied" };
|
|
6876
6928
|
}
|
|
@@ -7021,6 +7073,26 @@ function jsonError(message, status = 500) {
|
|
|
7021
7073
|
});
|
|
7022
7074
|
}
|
|
7023
7075
|
|
|
7076
|
+
// packages/elysia/src/routes/themeCssRefresh.ts
|
|
7077
|
+
function refreshThemeCss() {
|
|
7078
|
+
const href = `/.reroute/index.css?t=${Date.now()}`;
|
|
7079
|
+
const next = document.createElement("link");
|
|
7080
|
+
next.rel = "stylesheet";
|
|
7081
|
+
next.setAttribute("data-reroute", "theme");
|
|
7082
|
+
next.href = href;
|
|
7083
|
+
const existing = document.querySelector('link[data-reroute="theme"]');
|
|
7084
|
+
const style = document.querySelector('style[data-reroute="theme"]');
|
|
7085
|
+
const previous = existing ?? style;
|
|
7086
|
+
if (previous) {
|
|
7087
|
+
previous.removeAttribute("data-reroute");
|
|
7088
|
+
next.onload = () => previous.remove();
|
|
7089
|
+
previous.after(next);
|
|
7090
|
+
return true;
|
|
7091
|
+
}
|
|
7092
|
+
document.head.appendChild(next);
|
|
7093
|
+
return true;
|
|
7094
|
+
}
|
|
7095
|
+
|
|
7024
7096
|
// packages/elysia/src/routes/internal.ts
|
|
7025
7097
|
function parsePathname(p) {
|
|
7026
7098
|
try {
|
|
@@ -7078,20 +7150,24 @@ function registerInternalRoutes(app, opts) {
|
|
|
7078
7150
|
async function handleKeyRequest(pathname, dataKey, headers2) {
|
|
7079
7151
|
const { computeSSRData: computeSSRData2 } = await Promise.resolve().then(() => (init_core(), exports_core));
|
|
7080
7152
|
const cacheKey = `${pathname}:promises`;
|
|
7081
|
-
let promiseData = dataCache?.get(cacheKey);
|
|
7153
|
+
let promiseData = isWatchMode ? undefined : dataCache?.get(cacheKey);
|
|
7082
7154
|
const promiseDataCached = promiseData !== undefined;
|
|
7083
7155
|
if (!promiseData) {
|
|
7084
7156
|
const sp = extractSearchParams(pathname);
|
|
7085
7157
|
const { data } = await computeSSRData2(pathname, clientDir, cwd, isWatchMode, { streaming: true, maxAge }, sp);
|
|
7086
7158
|
promiseData = data;
|
|
7087
|
-
|
|
7159
|
+
if (!isWatchMode) {
|
|
7160
|
+
dataCache?.set(cacheKey, promiseData);
|
|
7161
|
+
}
|
|
7088
7162
|
}
|
|
7089
7163
|
if (promiseData && typeof promiseData === "object") {
|
|
7090
7164
|
const value = promiseData[dataKey];
|
|
7091
7165
|
if (value instanceof Promise) {
|
|
7092
7166
|
const resolved = await value;
|
|
7093
7167
|
const resolvedCacheKey = `${pathname}:${dataKey}:resolved`;
|
|
7094
|
-
|
|
7168
|
+
if (!isWatchMode) {
|
|
7169
|
+
dataCache?.set(resolvedCacheKey, resolved);
|
|
7170
|
+
}
|
|
7095
7171
|
return jsonWithCache({ data: resolved }, dataCacheControl || "no-cache", headers2, promiseDataCached ? "HIT" : "MISS");
|
|
7096
7172
|
}
|
|
7097
7173
|
if (value !== undefined) {
|
|
@@ -7103,7 +7179,7 @@ function registerInternalRoutes(app, opts) {
|
|
|
7103
7179
|
async function handleFullDataRequest(pathname) {
|
|
7104
7180
|
const { computeSSRData: computeSSRData2 } = await Promise.resolve().then(() => (init_core(), exports_core));
|
|
7105
7181
|
const cacheKey = `${pathname}:streaming`;
|
|
7106
|
-
let data = dataCache?.get(cacheKey);
|
|
7182
|
+
let data = isWatchMode ? undefined : dataCache?.get(cacheKey);
|
|
7107
7183
|
const cacheHit = data !== undefined;
|
|
7108
7184
|
if (data === undefined) {
|
|
7109
7185
|
const sp = extractSearchParams(pathname);
|
|
@@ -7114,7 +7190,9 @@ function registerInternalRoutes(app, opts) {
|
|
|
7114
7190
|
console.error("[__reroute_data] Error computing data:", error);
|
|
7115
7191
|
data = null;
|
|
7116
7192
|
}
|
|
7117
|
-
|
|
7193
|
+
if (!isWatchMode) {
|
|
7194
|
+
dataCache?.set(cacheKey, data);
|
|
7195
|
+
}
|
|
7118
7196
|
}
|
|
7119
7197
|
return { data, cacheHit };
|
|
7120
7198
|
}
|
|
@@ -7218,14 +7296,7 @@ function triggerFullReload(reason) {
|
|
|
7218
7296
|
window.location.reload();
|
|
7219
7297
|
}
|
|
7220
7298
|
|
|
7221
|
-
|
|
7222
|
-
const theme = document.querySelector('link[data-reroute="theme"]');
|
|
7223
|
-
if (!(theme instanceof HTMLLinkElement)) return false;
|
|
7224
|
-
const url = new URL(theme.href, location.href);
|
|
7225
|
-
url.searchParams.set('t', String(Date.now()));
|
|
7226
|
-
theme.href = url.toString();
|
|
7227
|
-
return true;
|
|
7228
|
-
}
|
|
7299
|
+
FUNCTION_REFRESH_THEME_CSS
|
|
7229
7300
|
|
|
7230
7301
|
function showRebuildNotice() {
|
|
7231
7302
|
if (rebuildNotice) return;
|
|
@@ -7360,11 +7431,8 @@ function connect() {
|
|
|
7360
7431
|
showRebuildNotice();
|
|
7361
7432
|
} else if (e.data === 'reload:css') {
|
|
7362
7433
|
hideRebuildNotice();
|
|
7363
|
-
|
|
7364
|
-
|
|
7365
|
-
} else {
|
|
7366
|
-
triggerFullReload('Build complete, reloading...');
|
|
7367
|
-
}
|
|
7434
|
+
refreshThemeCss();
|
|
7435
|
+
console.log('[reroute] ✓ Theme CSS refreshed');
|
|
7368
7436
|
} else if (e.data === 'reload' || e.data === 'reload:full') {
|
|
7369
7437
|
triggerFullReload('Build complete, reloading...');
|
|
7370
7438
|
}
|
|
@@ -7385,7 +7453,7 @@ function connect() {
|
|
|
7385
7453
|
|
|
7386
7454
|
restoreScrollPosition();
|
|
7387
7455
|
connect();
|
|
7388
|
-
|
|
7456
|
+
`.replace("FUNCTION_REFRESH_THEME_CSS", refreshThemeCss.toString());
|
|
7389
7457
|
function registerLiveReloadRoutes(app, state) {
|
|
7390
7458
|
console.log("[reroute] Registering SSE endpoint at /__reroute_watch");
|
|
7391
7459
|
app.get("/__reroute_watch", () => {
|
|
@@ -7678,6 +7746,7 @@ function registerLLMsRoutes(app, options) {
|
|
|
7678
7746
|
collections: [collection],
|
|
7679
7747
|
baseUrl,
|
|
7680
7748
|
isWatchMode,
|
|
7749
|
+
targetCollection: collection,
|
|
7681
7750
|
llmsConfig: {
|
|
7682
7751
|
...llmsConfig,
|
|
7683
7752
|
siteName: meta.title,
|
|
@@ -7716,6 +7785,7 @@ function registerLLMsRoutes(app, options) {
|
|
|
7716
7785
|
baseUrl,
|
|
7717
7786
|
isWatchMode,
|
|
7718
7787
|
bundleUrl,
|
|
7788
|
+
targetCollection: collection,
|
|
7719
7789
|
llmsConfig: {
|
|
7720
7790
|
...llmsConfig,
|
|
7721
7791
|
siteName: meta.title,
|
|
@@ -8036,14 +8106,14 @@ function registerOGRoutes(app, options) {
|
|
|
8036
8106
|
}
|
|
8037
8107
|
return;
|
|
8038
8108
|
}
|
|
8039
|
-
function getFontPaths(fontPath, baseDir,
|
|
8109
|
+
function getFontPaths(fontPath, baseDir, join6) {
|
|
8040
8110
|
const fontRelativePath = fontPath.replace(/^(\.\/)?src\/client\/assets\//, "").replace(/^assets\//, "");
|
|
8041
8111
|
return [
|
|
8042
|
-
|
|
8043
|
-
|
|
8044
|
-
|
|
8045
|
-
|
|
8046
|
-
|
|
8112
|
+
join6(clientDir, "assets", fontRelativePath),
|
|
8113
|
+
join6(baseDir, ".reroute", "assets", fontRelativePath),
|
|
8114
|
+
join6(cwd, ".reroute", "assets", fontRelativePath),
|
|
8115
|
+
join6(cwd, fontPath),
|
|
8116
|
+
join6(baseDir, fontPath)
|
|
8047
8117
|
];
|
|
8048
8118
|
}
|
|
8049
8119
|
async function tryLoadFont(font, possiblePaths, existsSync3) {
|
|
@@ -8066,14 +8136,14 @@ function registerOGRoutes(app, options) {
|
|
|
8066
8136
|
if (!ogConfig.fonts || ogConfig.fonts.length === 0) {
|
|
8067
8137
|
return [];
|
|
8068
8138
|
}
|
|
8069
|
-
const { join:
|
|
8139
|
+
const { join: join6, dirname: dirname2 } = await import("node:path");
|
|
8070
8140
|
const { existsSync: existsSync3 } = await import("node:fs");
|
|
8071
8141
|
const isCompiledBinary = typeof Bun !== "undefined" && process.argv[0]?.endsWith(process.argv[1]);
|
|
8072
|
-
const baseDir = isCompiledBinary ?
|
|
8142
|
+
const baseDir = isCompiledBinary ? dirname2(process.argv[1]) : cwd;
|
|
8073
8143
|
const loadedFonts = [];
|
|
8074
8144
|
for (const font of ogConfig.fonts) {
|
|
8075
8145
|
try {
|
|
8076
|
-
const possiblePaths = getFontPaths(font.path, baseDir,
|
|
8146
|
+
const possiblePaths = getFontPaths(font.path, baseDir, join6);
|
|
8077
8147
|
const loadedFont = await tryLoadFont(font, possiblePaths, existsSync3);
|
|
8078
8148
|
if (loadedFont) {
|
|
8079
8149
|
loadedFonts.push(loadedFont);
|
|
@@ -8786,16 +8856,16 @@ function registerSitemapRoutes(app, options) {
|
|
|
8786
8856
|
// packages/elysia/src/routes/ssr.ts
|
|
8787
8857
|
init_core();
|
|
8788
8858
|
init_server2();
|
|
8789
|
-
import { join as
|
|
8859
|
+
import { join as join7 } from "node:path";
|
|
8790
8860
|
import { trace as trace4 } from "@opentelemetry/api";
|
|
8791
8861
|
import { NotFoundError as NotFoundError10 } from "elysia";
|
|
8792
8862
|
|
|
8793
8863
|
// packages/elysia/src/libs/i18n.ts
|
|
8794
8864
|
init_core();
|
|
8795
|
-
import { join as
|
|
8865
|
+
import { join as join6 } from "node:path";
|
|
8796
8866
|
var cachedI18n = null;
|
|
8797
8867
|
async function loadI18nState(cwd) {
|
|
8798
|
-
const path2 =
|
|
8868
|
+
const path2 = join6(cwd, ".reroute", "i18n.json");
|
|
8799
8869
|
try {
|
|
8800
8870
|
const file = Bun.file(path2);
|
|
8801
8871
|
if (!await file.exists()) {
|
|
@@ -8809,8 +8879,8 @@ async function loadI18nState(cwd) {
|
|
|
8809
8879
|
catalogs: {}
|
|
8810
8880
|
};
|
|
8811
8881
|
}
|
|
8812
|
-
const
|
|
8813
|
-
const mtime =
|
|
8882
|
+
const stat6 = await file.stat();
|
|
8883
|
+
const mtime = stat6?.mtime?.getTime?.() ?? Date.now();
|
|
8814
8884
|
if (cachedI18n && cachedI18n.cwd === cwd && cachedI18n.mtime === mtime) {
|
|
8815
8885
|
return cachedI18n.data;
|
|
8816
8886
|
}
|
|
@@ -8832,7 +8902,7 @@ async function loadI18nState(cwd) {
|
|
|
8832
8902
|
async function listContentCollections(cwd) {
|
|
8833
8903
|
try {
|
|
8834
8904
|
const { readdir: readdir6 } = await import("node:fs/promises");
|
|
8835
|
-
const dir =
|
|
8905
|
+
const dir = join6(cwd, ".reroute", "collections");
|
|
8836
8906
|
const entries = await readdir6(dir);
|
|
8837
8907
|
return entries.filter((f) => f.endsWith(".js")).map((f) => f.replace(/\.js$/, ""));
|
|
8838
8908
|
} catch {
|
|
@@ -8977,7 +9047,7 @@ function registerSSRRoutes(app, options) {
|
|
|
8977
9047
|
let contentRoutes = [];
|
|
8978
9048
|
let dynamicRoutes = [];
|
|
8979
9049
|
try {
|
|
8980
|
-
const manifestPath =
|
|
9050
|
+
const manifestPath = join7(cwd, ".reroute", "manifest.json");
|
|
8981
9051
|
const { readFileSync } = __require("node:fs");
|
|
8982
9052
|
const manifestText = readFileSync(manifestPath, "utf-8");
|
|
8983
9053
|
const manifest = JSON.parse(manifestText);
|
|
@@ -9100,7 +9170,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9100
9170
|
head,
|
|
9101
9171
|
lang: i18n2.effectiveLang,
|
|
9102
9172
|
appId,
|
|
9103
|
-
maxAge: serverMaxAge,
|
|
9173
|
+
maxAge: isWatchMode ? 0 : serverMaxAge,
|
|
9104
9174
|
searchParams,
|
|
9105
9175
|
ogConfig: options.ogConfig,
|
|
9106
9176
|
ogMetaConfig: options.ogMetaConfig,
|
|
@@ -9283,7 +9353,7 @@ function registerSSRRoutes(app, options) {
|
|
|
9283
9353
|
head,
|
|
9284
9354
|
lang: i18n2.effectiveLang,
|
|
9285
9355
|
appId,
|
|
9286
|
-
maxAge: serverMaxAge,
|
|
9356
|
+
maxAge: isWatchMode ? 0 : serverMaxAge,
|
|
9287
9357
|
searchParams,
|
|
9288
9358
|
ogConfig: options.ogConfig,
|
|
9289
9359
|
ogMetaConfig: options.ogMetaConfig,
|
|
@@ -9621,7 +9691,7 @@ var reroute = () => async (app) => {
|
|
|
9621
9691
|
};
|
|
9622
9692
|
const clientDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute` : `${cwd}/src/client`;
|
|
9623
9693
|
const shouldIgnore = !ignorePatterns.length ? () => false : (file) => ignorePatterns.find((pattern) => typeof pattern === "string" ? file.includes(pattern) : pattern.test(file));
|
|
9624
|
-
const isWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
|
|
9694
|
+
const isWatchMode = process.env.REROUTE_DEV === "1" || Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
|
|
9625
9695
|
const dataCacheControl = browserCacheEnabled ? `${browserDirective}, max-age=${browserMaxAge}` : undefined;
|
|
9626
9696
|
if (isWatchMode) {
|
|
9627
9697
|
console.log(`[reroute] Live reload enabled`);
|
|
@@ -9640,6 +9710,15 @@ var reroute = () => async (app) => {
|
|
|
9640
9710
|
if (body?.mode === "css")
|
|
9641
9711
|
mode = "css";
|
|
9642
9712
|
} catch {}
|
|
9713
|
+
if (mode === "full") {
|
|
9714
|
+
ssrCache.clear();
|
|
9715
|
+
statusCache.clear();
|
|
9716
|
+
collectionCache.clear();
|
|
9717
|
+
dataCache.clear();
|
|
9718
|
+
fileCache.clear();
|
|
9719
|
+
clearWatchImportCache();
|
|
9720
|
+
clearSSRModuleStores();
|
|
9721
|
+
}
|
|
9643
9722
|
console.log(`[reroute] Reload notification received (${mode}), notifying ${liveReloadState.clients.size} browser(s)...`);
|
|
9644
9723
|
notifyReload(mode);
|
|
9645
9724
|
return new Response(JSON.stringify({
|
|
@@ -9884,4 +9963,4 @@ export {
|
|
|
9884
9963
|
reroute
|
|
9885
9964
|
};
|
|
9886
9965
|
|
|
9887
|
-
//# debugId=
|
|
9966
|
+
//# debugId=0148350251EC358E64756E2164756E21
|