reroute-js 0.34.1 → 0.34.2
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 +3 -3
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +11 -11
- 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/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 +2 -2
- package/core/index.js.map +3 -3
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +53 -17
- 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/index.d.ts +1 -1
- package/core/src/llms/extractor.d.ts +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +1 -1
- package/core/src/sitemap/generator.d.ts +1 -1
- package/core/src/sitemap/index.d.ts +1 -1
- package/core/src/ssr/index.d.ts +1 -1
- package/core/src/ssr/lib/cache.d.ts +1 -1
- package/core/src/ssr/lib/collections.d.ts +1 -1
- package/core/src/ssr/lib/compression.d.ts +1 -1
- package/core/src/ssr/lib/compute/content.d.ts +1 -1
- package/core/src/ssr/lib/compute/index.d.ts +1 -1
- package/core/src/ssr/lib/compute/layouts.d.ts +1 -1
- package/core/src/ssr/lib/compute/routes.d.ts +1 -1
- package/core/src/ssr/lib/data.d.ts +1 -1
- package/core/src/ssr/lib/html.d.ts +1 -1
- package/core/src/ssr/lib/imports.d.ts +1 -1
- package/core/src/ssr/lib/index.d.ts +1 -1
- package/core/src/ssr/lib/layouts.d.ts +1 -1
- package/core/src/ssr/lib/metadata.d.ts +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 +60 -97
- package/elysia/index.js.map +6 -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/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 +2 -3
- package/elysia/src/plugin.d.ts.map +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/llms.d.ts +1 -1
- package/elysia/src/routes/og.d.ts +1 -1
- package/elysia/src/routes/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 +2 -4
- package/elysia/src/routes/static.d.ts.map +1 -1
- package/elysia/src/types.d.ts +2 -54
- package/elysia/src/types.d.ts.map +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/elysia/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* reroute-js v0.34.
|
|
2
|
+
* reroute-js v0.34.2
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @copyright 2025 stewones <hi@stewan.io>
|
|
@@ -4930,25 +4930,12 @@ var init_core = __esm(() => {
|
|
|
4930
4930
|
|
|
4931
4931
|
// packages/elysia/src/plugin.ts
|
|
4932
4932
|
init_core();
|
|
4933
|
+
import { existsSync as existsSync3 } from "node:fs";
|
|
4933
4934
|
import { pathToFileURL as pathToFileURL8 } from "node:url";
|
|
4934
4935
|
import { createElement as createElement2 } from "react";
|
|
4935
4936
|
|
|
4936
|
-
// packages/elysia/src/libs/assets.ts
|
|
4937
|
-
import { existsSync } from "node:fs";
|
|
4938
|
-
function resolveClientDir(cwd, assets) {
|
|
4939
|
-
if (assets.startsWith("/")) {
|
|
4940
|
-
return assets;
|
|
4941
|
-
}
|
|
4942
|
-
const rerouteAssetsPath = `${cwd}/.reroute/assets`;
|
|
4943
|
-
if (existsSync(rerouteAssetsPath)) {
|
|
4944
|
-
return `${cwd}/.reroute`;
|
|
4945
|
-
}
|
|
4946
|
-
const devPath = `${cwd.replace(/\/$/, "")}/${assets.replace(/^\.\//, "")}`;
|
|
4947
|
-
return devPath;
|
|
4948
|
-
}
|
|
4949
|
-
|
|
4950
4937
|
// packages/elysia/src/libs/image.ts
|
|
4951
|
-
import { existsSync
|
|
4938
|
+
import { existsSync } from "node:fs";
|
|
4952
4939
|
import { join as join2 } from "node:path";
|
|
4953
4940
|
import sharp from "sharp";
|
|
4954
4941
|
var imageCache = new Map;
|
|
@@ -4994,7 +4981,7 @@ async function loadFromDiskCache(cacheKey) {
|
|
|
4994
4981
|
try {
|
|
4995
4982
|
const cachePath = join2(diskCacheDir, `${cacheKey}.json`);
|
|
4996
4983
|
const imagePath = join2(diskCacheDir, `${cacheKey}.img`);
|
|
4997
|
-
if (!(
|
|
4984
|
+
if (!(existsSync(cachePath) && existsSync(imagePath))) {
|
|
4998
4985
|
return null;
|
|
4999
4986
|
}
|
|
5000
4987
|
const metadata3 = JSON.parse(await Bun.file(cachePath).text());
|
|
@@ -5420,7 +5407,7 @@ function registerContentRoutes(app, cwd, collectionCache, directive, maxAge, isW
|
|
|
5420
5407
|
|
|
5421
5408
|
// packages/elysia/src/routes/image.ts
|
|
5422
5409
|
init_core();
|
|
5423
|
-
import { existsSync as
|
|
5410
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
5424
5411
|
import { join as join3 } from "node:path";
|
|
5425
5412
|
function parseNumericParam(value) {
|
|
5426
5413
|
if (!value)
|
|
@@ -5473,7 +5460,7 @@ function registerImageRoutes(app, options) {
|
|
|
5473
5460
|
if (!normalizedPath.startsWith(clientDir2)) {
|
|
5474
5461
|
return { error: "Access denied" };
|
|
5475
5462
|
}
|
|
5476
|
-
if (!
|
|
5463
|
+
if (!existsSync2(imagePath)) {
|
|
5477
5464
|
return { error: "Image not found" };
|
|
5478
5465
|
}
|
|
5479
5466
|
if (!isImageFile(imagePath)) {
|
|
@@ -6289,8 +6276,8 @@ import { NotFoundError as NotFoundError6 } from "elysia";
|
|
|
6289
6276
|
async function tryLoadPrebuiltCollection(cwd, collection, slug, meta) {
|
|
6290
6277
|
try {
|
|
6291
6278
|
const jsPath = `${cwd}/.reroute/collections/${collection}.js`;
|
|
6292
|
-
const { existsSync:
|
|
6293
|
-
if (
|
|
6279
|
+
const { existsSync: existsSync3 } = await import("node:fs");
|
|
6280
|
+
if (existsSync3(jsPath)) {
|
|
6294
6281
|
try {
|
|
6295
6282
|
const mod = await import(jsPath);
|
|
6296
6283
|
const items = mod.items || [];
|
|
@@ -6423,7 +6410,7 @@ async function loadOgImageFromRoute(_cwd, clientDir, pathname, isWatchMode) {
|
|
|
6423
6410
|
}
|
|
6424
6411
|
}
|
|
6425
6412
|
const { pathToFileURL: pathToFileURL8 } = await import("node:url");
|
|
6426
|
-
const { existsSync:
|
|
6413
|
+
const { existsSync: existsSync3 } = await import("node:fs");
|
|
6427
6414
|
const pathnameOnly = pathname.split("?")[0];
|
|
6428
6415
|
const cleanPath = pathnameOnly === "/" ? "index" : pathnameOnly.replace(/^\//, "").replace(/\/$/, "");
|
|
6429
6416
|
const possiblePaths = [
|
|
@@ -6433,7 +6420,7 @@ async function loadOgImageFromRoute(_cwd, clientDir, pathname, isWatchMode) {
|
|
|
6433
6420
|
`${clientDir}/routes/${cleanPath}/index.ts`
|
|
6434
6421
|
];
|
|
6435
6422
|
for (const routePath of possiblePaths) {
|
|
6436
|
-
if (
|
|
6423
|
+
if (existsSync3(routePath)) {
|
|
6437
6424
|
const routeMod = await import(pathToFileURL8(routePath).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
6438
6425
|
return {
|
|
6439
6426
|
meta: routeMod.meta,
|
|
@@ -6514,7 +6501,7 @@ function registerOGRoutes(app, options) {
|
|
|
6514
6501
|
let fonts;
|
|
6515
6502
|
if (ogConfig2.fonts && ogConfig2.fonts.length > 0) {
|
|
6516
6503
|
const { join: join4, dirname } = await import("node:path");
|
|
6517
|
-
const { existsSync:
|
|
6504
|
+
const { existsSync: existsSync3 } = await import("node:fs");
|
|
6518
6505
|
const loadedFonts = [];
|
|
6519
6506
|
const isCompiledBinary = typeof Bun !== "undefined" && process.argv[0]?.endsWith(process.argv[1]);
|
|
6520
6507
|
const baseDir = isCompiledBinary ? dirname(process.argv[1]) : cwd2;
|
|
@@ -6530,7 +6517,7 @@ function registerOGRoutes(app, options) {
|
|
|
6530
6517
|
];
|
|
6531
6518
|
let loaded = false;
|
|
6532
6519
|
for (const fontPath of possiblePaths) {
|
|
6533
|
-
if (
|
|
6520
|
+
if (existsSync3(fontPath)) {
|
|
6534
6521
|
const fontFile = Bun.file(fontPath);
|
|
6535
6522
|
const data = await fontFile.arrayBuffer();
|
|
6536
6523
|
loadedFonts.push({
|
|
@@ -7609,11 +7596,9 @@ function isOtelAvailable4() {
|
|
|
7609
7596
|
}
|
|
7610
7597
|
function registerStaticRoutes(app, options) {
|
|
7611
7598
|
const {
|
|
7612
|
-
|
|
7613
|
-
prefix,
|
|
7599
|
+
staticAssetsDir,
|
|
7614
7600
|
maxAge,
|
|
7615
7601
|
directive,
|
|
7616
|
-
indexHTML,
|
|
7617
7602
|
staticHeaders = {},
|
|
7618
7603
|
shouldIgnore,
|
|
7619
7604
|
fileCache,
|
|
@@ -7636,18 +7621,9 @@ function registerStaticRoutes(app, options) {
|
|
|
7636
7621
|
}
|
|
7637
7622
|
currentSpan?.setAttributes(attrs);
|
|
7638
7623
|
}
|
|
7639
|
-
async function
|
|
7640
|
-
let actualFilePath = filePath;
|
|
7641
|
-
let exists = await Bun.file(actualFilePath).exists();
|
|
7642
|
-
if (!exists && indexHTML2) {
|
|
7643
|
-
actualFilePath = join(filePath, "index.html");
|
|
7644
|
-
exists = await Bun.file(actualFilePath).exists();
|
|
7645
|
-
}
|
|
7646
|
-
return { path: actualFilePath, exists };
|
|
7647
|
-
}
|
|
7648
|
-
app.get(`${prefix}/*`, async function serveStaticFile({ params, headers }) {
|
|
7624
|
+
app.get("/assets/*", async function serveStaticFile({ params, headers }) {
|
|
7649
7625
|
const requestPath = params["*"];
|
|
7650
|
-
const filePath = join(
|
|
7626
|
+
const filePath = join(staticAssetsDir, requestPath);
|
|
7651
7627
|
try {
|
|
7652
7628
|
const acceptEncoding = headers["accept-encoding"] ?? "";
|
|
7653
7629
|
const encoding = getEncoding(acceptEncoding);
|
|
@@ -7659,20 +7635,20 @@ function registerStaticRoutes(app, options) {
|
|
|
7659
7635
|
response2.headers.set("Reroute-Cache", "HIT");
|
|
7660
7636
|
return response2;
|
|
7661
7637
|
}
|
|
7662
|
-
const
|
|
7638
|
+
const exists = await Bun.file(filePath).exists();
|
|
7663
7639
|
if (!exists) {
|
|
7664
7640
|
setOtelAttributes(404, false, requestPath, undefined, "file_not_exists");
|
|
7665
7641
|
throw new NotFoundError12;
|
|
7666
7642
|
}
|
|
7667
|
-
if (shouldIgnore(
|
|
7643
|
+
if (shouldIgnore(filePath)) {
|
|
7668
7644
|
setOtelAttributes(404, false, requestPath, undefined, "file_ignored");
|
|
7669
7645
|
throw new NotFoundError12;
|
|
7670
7646
|
}
|
|
7671
|
-
const contentBuf = await Bun.file(
|
|
7647
|
+
const contentBuf = await Bun.file(filePath).arrayBuffer();
|
|
7672
7648
|
const content2 = new Uint8Array(contentBuf);
|
|
7673
|
-
const contentType = getMimeType(
|
|
7649
|
+
const contentType = getMimeType(filePath);
|
|
7674
7650
|
const { body, extraHeaders } = compression2 ? gzipIfAccepted(content2, contentType, acceptEncoding) : { body: content2, extraHeaders: {} };
|
|
7675
|
-
const cacheControl = getAssetCacheControl(
|
|
7651
|
+
const cacheControl = getAssetCacheControl(filePath, contentType, maxAge, directive, isWatchMode);
|
|
7676
7652
|
const response = new Response(body, {
|
|
7677
7653
|
headers: {
|
|
7678
7654
|
"Content-Type": contentType,
|
|
@@ -7709,7 +7685,7 @@ function registerStaticRoutes(app, options) {
|
|
|
7709
7685
|
}
|
|
7710
7686
|
|
|
7711
7687
|
// packages/elysia/src/plugin.ts
|
|
7712
|
-
var reroute = (
|
|
7688
|
+
var reroute = () => async (app) => {
|
|
7713
7689
|
const cwd = typeof process !== "undefined" && typeof process.cwd === "function" ? process.cwd() : "/";
|
|
7714
7690
|
app.onRequest(({ request }) => {
|
|
7715
7691
|
if (request.method === "HEAD") {
|
|
@@ -7722,54 +7698,45 @@ var reroute = (options = {}) => async (app) => {
|
|
|
7722
7698
|
const globalConfig = await loadConfig(cwd);
|
|
7723
7699
|
let rootComponent;
|
|
7724
7700
|
const globalApp = globalThis.__REROUTE_APP_COMPONENT__;
|
|
7725
|
-
if (
|
|
7726
|
-
if (typeof options.app === "string") {
|
|
7727
|
-
const appPath = options.app.startsWith("/") ? options.app : `${cwd}/${options.app.replace(/^\.\//, "")}`;
|
|
7728
|
-
const AppModule = await import(`${pathToFileURL8(appPath).href}?t=${Date.now()}`);
|
|
7729
|
-
rootComponent = createElement2(AppModule.default);
|
|
7730
|
-
} else {
|
|
7731
|
-
rootComponent = options.app;
|
|
7732
|
-
}
|
|
7733
|
-
} else if (globalApp) {
|
|
7701
|
+
if (globalApp) {
|
|
7734
7702
|
rootComponent = createElement2(globalApp);
|
|
7735
|
-
} else if (globalConfig.
|
|
7736
|
-
const appPath = globalConfig.
|
|
7703
|
+
} else if (globalConfig.app?.src) {
|
|
7704
|
+
const appPath = globalConfig.app.src.startsWith("/") ? globalConfig.app.src : `${cwd}/${globalConfig.app.src.replace(/^\.\//, "")}`;
|
|
7737
7705
|
const AppModule = await import(`${pathToFileURL8(appPath).href}?t=${Date.now()}`);
|
|
7738
7706
|
rootComponent = createElement2(AppModule.default);
|
|
7739
7707
|
}
|
|
7740
7708
|
if (!rootComponent) {
|
|
7741
7709
|
console.warn("[reroute] No app component provided. SSR routes will not be registered.");
|
|
7742
7710
|
}
|
|
7743
|
-
const ssrHead =
|
|
7744
|
-
const ssrLang =
|
|
7745
|
-
const ssrAppId =
|
|
7746
|
-
const
|
|
7747
|
-
|
|
7748
|
-
const ignorePatterns =
|
|
7711
|
+
const ssrHead = globalConfig.app?.head ?? "";
|
|
7712
|
+
const ssrLang = globalConfig.app?.lang ?? "en";
|
|
7713
|
+
const ssrAppId = globalConfig.app?.appId ?? "root";
|
|
7714
|
+
const staticAssetsDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute/assets` : `${cwd}/src/client/assets`;
|
|
7715
|
+
const staticConfig = globalConfig.static ?? {};
|
|
7716
|
+
const ignorePatterns = staticConfig.ignorePatterns ?? [
|
|
7749
7717
|
".DS_Store",
|
|
7750
7718
|
".git",
|
|
7751
|
-
".env"
|
|
7752
|
-
"index.html",
|
|
7753
|
-
/favicon\.ico/,
|
|
7754
|
-
/\.well-known/
|
|
7719
|
+
".env"
|
|
7755
7720
|
];
|
|
7756
|
-
const staticHeaders =
|
|
7757
|
-
const maxAge =
|
|
7758
|
-
const directive =
|
|
7759
|
-
const
|
|
7760
|
-
const
|
|
7761
|
-
const
|
|
7762
|
-
const
|
|
7763
|
-
const
|
|
7764
|
-
const
|
|
7765
|
-
const
|
|
7766
|
-
const
|
|
7767
|
-
const
|
|
7768
|
-
const
|
|
7769
|
-
const
|
|
7721
|
+
const staticHeaders = staticConfig.headers;
|
|
7722
|
+
const maxAge = globalConfig.app?.maxAge ?? 3600;
|
|
7723
|
+
const directive = globalConfig.app?.directive ?? "public";
|
|
7724
|
+
const staticMaxAge = staticConfig.maxAge ?? maxAge;
|
|
7725
|
+
const staticDirective = staticConfig.directive ?? directive;
|
|
7726
|
+
const compression2 = globalConfig.app?.compression ?? true;
|
|
7727
|
+
const debug = globalConfig.app?.debug ?? false;
|
|
7728
|
+
const imageConfig = globalConfig.image ?? {};
|
|
7729
|
+
const imageMaxAge = imageConfig.maxAge ?? 31536000;
|
|
7730
|
+
const imageAllowedDomains = imageConfig.allowedDomains ?? [];
|
|
7731
|
+
const imageMaxWidth = imageConfig.maxWidth ?? 3840;
|
|
7732
|
+
const imageMaxHeight = imageConfig.maxHeight ?? 2160;
|
|
7733
|
+
const bundleMaxAge = globalConfig.app?.bundleMaxAge ?? 3600;
|
|
7734
|
+
const streamingEnabled = globalConfig.streaming?.enabled ?? false;
|
|
7735
|
+
const baseUrl = globalConfig.app?.baseUrl;
|
|
7736
|
+
const autoCanonical = globalConfig.app?.autoCanonical;
|
|
7770
7737
|
const sitemapConfig = globalConfig.sitemap;
|
|
7771
7738
|
const sitemapEnabled = sitemapConfig?.enabled === true;
|
|
7772
|
-
const sitemapBaseUrl =
|
|
7739
|
+
const sitemapBaseUrl = sitemapConfig?.baseUrl;
|
|
7773
7740
|
const rssConfig = globalConfig.rss;
|
|
7774
7741
|
const rssEnabled = rssConfig?.enabled === true;
|
|
7775
7742
|
const rssBaseUrl = rssConfig?.baseUrl;
|
|
@@ -7779,8 +7746,6 @@ var reroute = (options = {}) => async (app) => {
|
|
|
7779
7746
|
const llmsEnabled = llmsConfig?.enabled === true;
|
|
7780
7747
|
const robotsConfig = globalConfig.robots;
|
|
7781
7748
|
const robotsEnabled = robotsConfig?.enabled === true;
|
|
7782
|
-
if (prefix === "/")
|
|
7783
|
-
prefix = "";
|
|
7784
7749
|
const fileCache = new LRUCache(100);
|
|
7785
7750
|
const dataCache = new LRUCache(100);
|
|
7786
7751
|
const collectionCache = new LRUCache(50);
|
|
@@ -7822,7 +7787,7 @@ var reroute = (options = {}) => async (app) => {
|
|
|
7822
7787
|
}
|
|
7823
7788
|
}
|
|
7824
7789
|
};
|
|
7825
|
-
const clientDir =
|
|
7790
|
+
const clientDir = existsSync3(`${cwd}/.reroute/assets`) ? `${cwd}/.reroute` : `${cwd}/src/client`;
|
|
7826
7791
|
const shouldIgnore = !ignorePatterns.length ? () => false : (file) => ignorePatterns.find((pattern) => typeof pattern === "string" ? file.includes(pattern) : pattern.test(file));
|
|
7827
7792
|
const isWatchMode = Array.isArray(process.execArgv) && process.execArgv.includes("--watch") || Array.isArray(process.argv) && process.argv.includes("--watch");
|
|
7828
7793
|
const dataCacheControl = `${directive}, max-age=${maxAge}`;
|
|
@@ -7908,6 +7873,16 @@ var reroute = (options = {}) => async (app) => {
|
|
|
7908
7873
|
maxHeight: imageMaxHeight,
|
|
7909
7874
|
compression: compression2
|
|
7910
7875
|
});
|
|
7876
|
+
registerStaticRoutes(app, {
|
|
7877
|
+
staticAssetsDir,
|
|
7878
|
+
maxAge: staticMaxAge,
|
|
7879
|
+
directive: staticDirective,
|
|
7880
|
+
staticHeaders,
|
|
7881
|
+
shouldIgnore,
|
|
7882
|
+
fileCache,
|
|
7883
|
+
isWatchMode,
|
|
7884
|
+
compression: compression2
|
|
7885
|
+
});
|
|
7911
7886
|
if (rootComponent) {
|
|
7912
7887
|
try {
|
|
7913
7888
|
const collections2 = await discoverCollections(clientDir);
|
|
@@ -8035,18 +8010,6 @@ var reroute = (options = {}) => async (app) => {
|
|
|
8035
8010
|
throw error;
|
|
8036
8011
|
}
|
|
8037
8012
|
}
|
|
8038
|
-
registerStaticRoutes(app, {
|
|
8039
|
-
clientDir,
|
|
8040
|
-
prefix,
|
|
8041
|
-
maxAge,
|
|
8042
|
-
directive,
|
|
8043
|
-
indexHTML,
|
|
8044
|
-
staticHeaders,
|
|
8045
|
-
shouldIgnore,
|
|
8046
|
-
fileCache,
|
|
8047
|
-
isWatchMode,
|
|
8048
|
-
compression: compression2
|
|
8049
|
-
});
|
|
8050
8013
|
app.onError(({ set, error }) => {
|
|
8051
8014
|
if ("status" in error && error.status === 404) {
|
|
8052
8015
|
set.status = 404;
|
|
@@ -8062,4 +8025,4 @@ export {
|
|
|
8062
8025
|
reroute
|
|
8063
8026
|
};
|
|
8064
8027
|
|
|
8065
|
-
//# debugId=
|
|
8028
|
+
//# debugId=203F5F1F5634A54D64756E2164756E21
|