reroute-js 1.0.0-alpha.15 → 1.0.0-alpha.18
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 +189 -73
- package/cli/bin.js.map +14 -13
- package/cli/index.d.ts +1 -1
- package/cli/index.js +573 -19
- package/cli/index.js.map +51 -4
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/build.d.ts +2 -2
- package/cli/src/commands/build.d.ts.map +1 -1
- package/cli/src/commands/dev.d.ts +4 -3
- package/cli/src/commands/dev.d.ts.map +1 -1
- package/cli/src/commands/gen.d.ts +1 -1
- package/cli/src/commands/gen.d.ts.map +1 -1
- package/cli/src/commands/index.d.ts +1 -1
- package/cli/src/commands/init.d.ts +1 -1
- package/cli/src/commands/lib/assets.d.ts +1 -1
- package/cli/src/commands/lib/bundler.d.ts +1 -1
- package/cli/src/commands/lib/command.d.ts +1 -1
- package/cli/src/commands/lib/env.d.ts +1 -1
- package/cli/src/commands/lib/index.d.ts +1 -1
- package/cli/src/commands/lib/log.d.ts +1 -1
- package/cli/src/commands/lib/markdown/availability.d.ts +1 -1
- package/cli/src/commands/lib/markdown/index.d.ts +1 -1
- package/cli/src/commands/lib/markdown/processor.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/streaming/analyzer.d.ts +1 -1
- package/cli/src/commands/lib/streaming/suspense.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +2 -2
- package/cli/src/commands/lib/terminal-ui.d.ts.map +1 -1
- package/cli/src/commands/lib/theme.d.ts +4 -2
- package/cli/src/commands/lib/theme.d.ts.map +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/lib/watch.d.ts +1 -1
- package/cli/src/commands/og.d.ts +1 -1
- package/cli/src/commands/og.d.ts.map +1 -1
- package/cli/src/commands/start.d.ts +2 -2
- package/cli/src/commands/start.d.ts.map +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +33 -3
- package/core/index.js.map +7 -6
- package/core/src/app-paths.d.ts +32 -0
- package/core/src/app-paths.d.ts.map +1 -0
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +15 -2
- 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 +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/index.d.ts +2 -1
- package/core/src/index.d.ts.map +1 -1
- package/core/src/llms/discovery.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/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 +70 -18
- package/elysia/index.js.map +9 -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 +1 -1
- package/elysia/src/libs/image.d.ts +1 -1
- package/elysia/src/libs/index.d.ts +1 -1
- package/elysia/src/libs/llms.d.ts +1 -1
- package/elysia/src/libs/response.d.ts +1 -1
- package/elysia/src/libs/serving.d.ts +1 -1
- package/elysia/src/plugin.d.ts +1 -1
- package/elysia/src/plugin.d.ts.map +1 -1
- package/elysia/src/routes/artifacts.d.ts +1 -1
- package/elysia/src/routes/content.d.ts +1 -1
- package/elysia/src/routes/image.d.ts +1 -1
- package/elysia/src/routes/index.d.ts +1 -1
- package/elysia/src/routes/internal.d.ts +1 -1
- package/elysia/src/routes/liveReloadClient.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 +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 +68 -5
- 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/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 +7 -21
- package/react/src/lib/lazy-route.d.ts.map +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 +6 -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/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.18
|
|
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.18";
|
|
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 "ee1178f";
|
|
90
90
|
}
|
|
91
91
|
return "dev";
|
|
92
92
|
}
|
|
@@ -363,6 +363,31 @@ var init_init = __esm(() => {
|
|
|
363
363
|
];
|
|
364
364
|
});
|
|
365
365
|
|
|
366
|
+
// packages/core/src/app-paths.ts
|
|
367
|
+
import { posix } from "node:path";
|
|
368
|
+
function toPosix(p) {
|
|
369
|
+
return p.replace(/\\/g, "/");
|
|
370
|
+
}
|
|
371
|
+
function resolveAppPaths(config = {}) {
|
|
372
|
+
const src = config.app?.src ?? DEFAULT_APP_SRC;
|
|
373
|
+
const server = config.app?.server ?? DEFAULT_APP_SERVER;
|
|
374
|
+
const clientDir = toPosix(posix.dirname(src));
|
|
375
|
+
return {
|
|
376
|
+
src,
|
|
377
|
+
clientDir,
|
|
378
|
+
routesDir: toPosix(posix.join(clientDir, "routes")),
|
|
379
|
+
cssEntry: toPosix(posix.join(clientDir, "index.css")),
|
|
380
|
+
assetsDir: toPosix(posix.join(clientDir, "assets")),
|
|
381
|
+
server
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function importFromReroute(relPath) {
|
|
385
|
+
const cleaned = toPosix(relPath).replace(/^\.\//, "").replace(/\.(tsx|ts|jsx|js)$/, "");
|
|
386
|
+
return `../${cleaned}`;
|
|
387
|
+
}
|
|
388
|
+
var DEFAULT_APP_SRC = "./src/client/App", DEFAULT_APP_SERVER = "./src/index.ts";
|
|
389
|
+
var init_app_paths = () => {};
|
|
390
|
+
|
|
366
391
|
// packages/core/src/bundler/hash.ts
|
|
367
392
|
async function generateContentHash(content) {
|
|
368
393
|
const data = new TextEncoder().encode(content);
|
|
@@ -3697,7 +3722,7 @@ function createI18nScript(i18n) {
|
|
|
3697
3722
|
}
|
|
3698
3723
|
}
|
|
3699
3724
|
function createContentCaptureScript() {
|
|
3700
|
-
return `<script>(function(){try{var w=window;w.__REROUTE_INITIAL_HYDRATION__=true;var h={};document.querySelectorAll('[data-reroute-key]').forEach(function(el){var k=el.getAttribute('data-reroute-key');if(k)h[k]=el.innerHTML;});w.__REROUTE_CONTENT_HTML__=h;var r=document.querySelector('[data-reroute-route="ssr"]');if(r)w.__REROUTE_ROUTE_HTML__=r.innerHTML;}catch(e){}})();</script>`;
|
|
3725
|
+
return `<script>(function(){try{var w=window;w.__REROUTE_INITIAL_HYDRATION__=true;var h={};document.querySelectorAll('[data-reroute-key]').forEach(function(el){var k=el.getAttribute('data-reroute-key');if(k)h[k]=el.innerHTML;});w.__REROUTE_CONTENT_HTML__=h;var r=document.querySelector('[data-reroute-route="ssr"]');if(r){w.__REROUTE_ROUTE_HTML__=r.innerHTML;}else{var root=document.getElementById('root');if(root)w.__REROUTE_ROUTE_HTML__=root.innerHTML;}}catch(e){}})();</script>`;
|
|
3701
3726
|
}
|
|
3702
3727
|
function createSSRExportsScript(pathname) {
|
|
3703
3728
|
try {
|
|
@@ -6895,6 +6920,7 @@ var init_ssr = __esm(() => {
|
|
|
6895
6920
|
|
|
6896
6921
|
// packages/core/src/index.ts
|
|
6897
6922
|
var init_src = __esm(() => {
|
|
6923
|
+
init_app_paths();
|
|
6898
6924
|
init_bundler();
|
|
6899
6925
|
init_config();
|
|
6900
6926
|
init_content();
|
|
@@ -6911,6 +6937,8 @@ var init_src = __esm(() => {
|
|
|
6911
6937
|
var exports_core = {};
|
|
6912
6938
|
__export(exports_core, {
|
|
6913
6939
|
AI_CRAWLERS: () => AI_CRAWLERS,
|
|
6940
|
+
DEFAULT_APP_SERVER: () => DEFAULT_APP_SERVER,
|
|
6941
|
+
DEFAULT_APP_SRC: () => DEFAULT_APP_SRC,
|
|
6914
6942
|
DEFAULT_COOKIE: () => DEFAULT_COOKIE,
|
|
6915
6943
|
DEFAULT_LOCALE: () => DEFAULT_LOCALE,
|
|
6916
6944
|
DEFAULT_LOCALES_DIR: () => DEFAULT_LOCALES_DIR,
|
|
@@ -7006,6 +7034,7 @@ __export(exports_core, {
|
|
|
7006
7034
|
hreflangTags: () => hreflangTags,
|
|
7007
7035
|
htmlToMarkdown: () => htmlToMarkdown,
|
|
7008
7036
|
importContentModuleForPath: () => importContentModuleForPath,
|
|
7037
|
+
importFromReroute: () => importFromReroute,
|
|
7009
7038
|
inlineThemeCSS: () => inlineThemeCSS,
|
|
7010
7039
|
isCompressible: () => isCompressible,
|
|
7011
7040
|
isThenable: () => isThenable,
|
|
@@ -7039,6 +7068,7 @@ __export(exports_core, {
|
|
|
7039
7068
|
renderSSRDocumentStream: () => renderSSRDocumentStream,
|
|
7040
7069
|
resetSSRAccessTracking: () => resetSSRAccessTracking,
|
|
7041
7070
|
resetSSRContentResults: () => resetSSRContentResults,
|
|
7071
|
+
resolveAppPaths: () => resolveAppPaths,
|
|
7042
7072
|
resolveLocale: () => resolveLocale,
|
|
7043
7073
|
seedSSRModuleForPath: () => seedSSRModuleForPath,
|
|
7044
7074
|
setGlobalCollections: () => setGlobalCollections,
|
|
@@ -7784,8 +7814,9 @@ import { createHash as createHash2 } from "node:crypto";
|
|
|
7784
7814
|
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
7785
7815
|
import { mkdir as mkdir2, readdir as readdir7, unlink as unlink2, writeFile } from "node:fs/promises";
|
|
7786
7816
|
import { dirname as dirname6, isAbsolute, join as join10, resolve as resolve2 } from "node:path";
|
|
7787
|
-
function getCssPaths(cwd) {
|
|
7788
|
-
const
|
|
7817
|
+
async function getCssPaths(cwd) {
|
|
7818
|
+
const paths = resolveAppPaths(await loadConfig(cwd));
|
|
7819
|
+
const input = join10(cwd, paths.cssEntry);
|
|
7789
7820
|
const bundlesDir = join10(cwd, ".reroute/bundles");
|
|
7790
7821
|
return { input, bundlesDir };
|
|
7791
7822
|
}
|
|
@@ -7843,7 +7874,7 @@ async function pruneStaleThemeCss(bundlesDir, keep) {
|
|
|
7843
7874
|
}
|
|
7844
7875
|
}
|
|
7845
7876
|
async function syncThemeCss(cwd) {
|
|
7846
|
-
const { input, bundlesDir } = getCssPaths(cwd);
|
|
7877
|
+
const { input, bundlesDir } = await getCssPaths(cwd);
|
|
7847
7878
|
if (!existsSync5(input)) {
|
|
7848
7879
|
return false;
|
|
7849
7880
|
}
|
|
@@ -7867,6 +7898,7 @@ ${message}`);
|
|
|
7867
7898
|
}
|
|
7868
7899
|
var HASHED_THEME_RE2, IMPORT_RE;
|
|
7869
7900
|
var init_theme = __esm(() => {
|
|
7901
|
+
init_core();
|
|
7870
7902
|
HASHED_THEME_RE2 = /^index\.[a-z0-9]{8,}\.css$/i;
|
|
7871
7903
|
IMPORT_RE = /@import\s+(?:url\(\s*)?(?:'([^']+)'|"([^"]+)"|([^'")\s]+))\s*\)?\s*([^;]*);/g;
|
|
7872
7904
|
});
|
|
@@ -7972,7 +8004,7 @@ async function ensureOutputDir(cwd, options = {}) {
|
|
|
7972
8004
|
await mkdir3(join12(cwd, ".reroute/streaming"), { recursive: true });
|
|
7973
8005
|
} catch {}
|
|
7974
8006
|
}
|
|
7975
|
-
async function writeStubFiles(cwd) {
|
|
8007
|
+
async function writeStubFiles(cwd, serverImport) {
|
|
7976
8008
|
const STUB_ROUTES = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
7977
8009
|
// This will be replaced by actual routes
|
|
7978
8010
|
/* eslint-disable */
|
|
@@ -7995,11 +8027,17 @@ export type RouteParams = Record<string, never>;
|
|
|
7995
8027
|
export const contentRegistry: Record<string, any> = {};
|
|
7996
8028
|
`;
|
|
7997
8029
|
const STUB_ARTIFACTS = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
7998
|
-
//
|
|
8030
|
+
// Client bundle entry — lazy routes only
|
|
7999
8031
|
/* eslint-disable */
|
|
8000
8032
|
// @ts-nocheck
|
|
8001
8033
|
|
|
8002
|
-
|
|
8034
|
+
export * from './artifacts.client';
|
|
8035
|
+
`;
|
|
8036
|
+
const STUB_ARTIFACTS_CLIENT = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
8037
|
+
/* eslint-disable */
|
|
8038
|
+
// @ts-nocheck
|
|
8039
|
+
|
|
8040
|
+
import { layouts, matchRoute, notFoundRoutes } from './routes.client';
|
|
8003
8041
|
|
|
8004
8042
|
export const bundle = {
|
|
8005
8043
|
layouts,
|
|
@@ -8010,6 +8048,20 @@ export const bundle = {
|
|
|
8010
8048
|
} as const;
|
|
8011
8049
|
|
|
8012
8050
|
export type RerouteBundle = typeof bundle;
|
|
8051
|
+
`;
|
|
8052
|
+
const STUB_ARTIFACTS_SERVER = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
8053
|
+
/* eslint-disable */
|
|
8054
|
+
// @ts-nocheck
|
|
8055
|
+
|
|
8056
|
+
import { layouts, matchRoute, notFoundRoutes } from './routes';
|
|
8057
|
+
|
|
8058
|
+
export const bundle = {
|
|
8059
|
+
layouts,
|
|
8060
|
+
matchRoute,
|
|
8061
|
+
notFoundRoutes,
|
|
8062
|
+
contentBaseUrl: '/.reroute/collections',
|
|
8063
|
+
AppComponent: undefined
|
|
8064
|
+
} as const;
|
|
8013
8065
|
`;
|
|
8014
8066
|
const STUB_INDEX = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
8015
8067
|
// Barrel export for client imports
|
|
@@ -8018,20 +8070,23 @@ export type RerouteBundle = typeof bundle;
|
|
|
8018
8070
|
|
|
8019
8071
|
export * from './artifacts';
|
|
8020
8072
|
`;
|
|
8021
|
-
const
|
|
8073
|
+
const stubEntry = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
8022
8074
|
// Server entry wrapper for compiled binary builds
|
|
8023
8075
|
/* eslint-disable */
|
|
8024
8076
|
// @ts-nocheck
|
|
8025
8077
|
|
|
8026
8078
|
import './artifacts';
|
|
8027
8079
|
import './routes'; // Import routes (bundles all route components)
|
|
8028
|
-
import '
|
|
8080
|
+
import '${serverImport}';
|
|
8029
8081
|
`;
|
|
8030
8082
|
await Bun.write(join12(cwd, OUTPUT_ROUTES), STUB_ROUTES);
|
|
8083
|
+
await Bun.write(join12(cwd, OUTPUT_ROUTES_CLIENT), STUB_ROUTES);
|
|
8031
8084
|
await Bun.write(join12(cwd, OUTPUT_CONTENT_TS), STUB_CONTENT);
|
|
8032
8085
|
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS), STUB_ARTIFACTS);
|
|
8086
|
+
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_CLIENT), STUB_ARTIFACTS_CLIENT);
|
|
8087
|
+
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_SERVER), STUB_ARTIFACTS_SERVER);
|
|
8033
8088
|
await Bun.write(join12(cwd, OUTPUT_INDEX), STUB_INDEX);
|
|
8034
|
-
await Bun.write(join12(cwd, ".reroute/entry.ts"),
|
|
8089
|
+
await Bun.write(join12(cwd, ".reroute/entry.ts"), stubEntry);
|
|
8035
8090
|
console.log("[reroute/gen] Initialized stub files");
|
|
8036
8091
|
}
|
|
8037
8092
|
function shouldSkipFile(relativePath, entryName) {
|
|
@@ -8165,7 +8220,7 @@ function generateRouteTree(files) {
|
|
|
8165
8220
|
notFoundRoutes
|
|
8166
8221
|
};
|
|
8167
8222
|
}
|
|
8168
|
-
function getImportPath(filePath, streamingMap) {
|
|
8223
|
+
function getImportPath(filePath, streamingMap, routesImportBase) {
|
|
8169
8224
|
const isMarkdown = /\.(md|mdx)$/.test(filePath);
|
|
8170
8225
|
if (isMarkdown) {
|
|
8171
8226
|
const pathWithoutExt2 = filePath.replace(/\.(md|mdx)$/, "");
|
|
@@ -8177,36 +8232,50 @@ function getImportPath(filePath, streamingMap) {
|
|
|
8177
8232
|
return `./streaming/${pathWithoutExt2}`;
|
|
8178
8233
|
}
|
|
8179
8234
|
const pathWithoutExt = filePath.replace(/\.(tsx|ts)$/, "");
|
|
8180
|
-
return
|
|
8235
|
+
return `${routesImportBase}/${pathWithoutExt}`;
|
|
8181
8236
|
}
|
|
8182
|
-
function generateTypeScript(tree, streamingMap) {
|
|
8237
|
+
function generateTypeScript(tree, streamingMap, client, routesImportBase) {
|
|
8183
8238
|
const helperImport = "import { createLazyRoute } from 'reroute-js/react';";
|
|
8184
8239
|
const ssrHelper = "const _ssr = (m: any) => m.ssr;";
|
|
8185
8240
|
const metaHelper = "const _meta = (m: any) => m.meta;";
|
|
8186
|
-
const
|
|
8187
|
-
...tree.routes.map((r, i) => `import * as Route${i}Module from '${getImportPath(r.filePath, streamingMap)}';
|
|
8188
|
-
const Route${i}Eager = Route${i}Module.default;
|
|
8241
|
+
const metaImports = [
|
|
8242
|
+
...tree.routes.map((r, i) => `import * as Route${i}Module from '${getImportPath(r.filePath, streamingMap, routesImportBase)}';
|
|
8189
8243
|
const Route${i}SSR = _ssr(Route${i}Module);
|
|
8190
8244
|
const Route${i}Meta = _meta(Route${i}Module);`),
|
|
8191
|
-
...tree.layouts.map((l, i) => `import * as Layout${i}Module from '${getImportPath(l.filePath, streamingMap)}';
|
|
8192
|
-
const Layout${i}Eager = Layout${i}Module.default;
|
|
8245
|
+
...tree.layouts.map((l, i) => `import * as Layout${i}Module from '${getImportPath(l.filePath, streamingMap, routesImportBase)}';
|
|
8193
8246
|
const Layout${i}SSR = _ssr(Layout${i}Module);
|
|
8194
|
-
const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
8195
|
-
...tree.notFoundRoutes.map((nf, i) => `import NotFound${i}Eager from '${getImportPath(nf.filePath, streamingMap)}';`)
|
|
8247
|
+
const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
8196
8248
|
].join(`
|
|
8249
|
+
`);
|
|
8250
|
+
const serverEagerImports = client ? "" : [
|
|
8251
|
+
...tree.routes.map((_route, i) => `const Route${i}Eager = Route${i}Module.default;`),
|
|
8252
|
+
...tree.layouts.map((_layout, i) => `const Layout${i}Eager = Layout${i}Module.default;`),
|
|
8253
|
+
...tree.notFoundRoutes.map((nf, i) => `import NotFound${i}Eager from '${getImportPath(nf.filePath, streamingMap, routesImportBase)}';`)
|
|
8254
|
+
].join(`
|
|
8255
|
+
`);
|
|
8256
|
+
const eagerImports = client ? metaImports : [metaImports, serverEagerImports].filter(Boolean).join(`
|
|
8197
8257
|
`);
|
|
8198
8258
|
const lazyWrappers = [
|
|
8199
8259
|
...tree.routes.map((r, i) => {
|
|
8200
|
-
const importPath = getImportPath(r.filePath, streamingMap);
|
|
8201
|
-
|
|
8260
|
+
const importPath = getImportPath(r.filePath, streamingMap, routesImportBase);
|
|
8261
|
+
if (client) {
|
|
8262
|
+
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}");`;
|
|
8263
|
+
}
|
|
8264
|
+
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}", Route${i}Eager);`;
|
|
8202
8265
|
}),
|
|
8203
8266
|
...tree.layouts.map((l, i) => {
|
|
8204
|
-
const importPath = getImportPath(l.filePath, streamingMap);
|
|
8205
|
-
|
|
8267
|
+
const importPath = getImportPath(l.filePath, streamingMap, routesImportBase);
|
|
8268
|
+
if (client) {
|
|
8269
|
+
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}");`;
|
|
8270
|
+
}
|
|
8271
|
+
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}", Layout${i}Eager);`;
|
|
8206
8272
|
}),
|
|
8207
8273
|
...tree.notFoundRoutes.map((nf, i) => {
|
|
8208
|
-
const importPath = getImportPath(nf.filePath, streamingMap);
|
|
8209
|
-
|
|
8274
|
+
const importPath = getImportPath(nf.filePath, streamingMap, routesImportBase);
|
|
8275
|
+
if (client) {
|
|
8276
|
+
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}");`;
|
|
8277
|
+
}
|
|
8278
|
+
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}", NotFound${i}Eager);`;
|
|
8210
8279
|
})
|
|
8211
8280
|
].join(`
|
|
8212
8281
|
`);
|
|
@@ -8336,10 +8405,10 @@ function matchPattern(route: Route, pathname: string): Record<string, string> |
|
|
|
8336
8405
|
return pathnameIndex === pathnameParts.length ? params : null;
|
|
8337
8406
|
}
|
|
8338
8407
|
|
|
8339
|
-
|
|
8408
|
+
${client ? "" : `// Set globals for compiled binary support (sitemap/RSS/robots discovery)
|
|
8340
8409
|
(globalThis as any).__REROUTE_ROUTES__ = routes;
|
|
8341
8410
|
(globalThis as any).__REROUTE_LAYOUTS__ = layouts;
|
|
8342
|
-
(globalThis as any).__REROUTE_NOT_FOUND_ROUTES__ = notFoundRoutes
|
|
8411
|
+
(globalThis as any).__REROUTE_NOT_FOUND_ROUTES__ = notFoundRoutes;`}
|
|
8343
8412
|
`;
|
|
8344
8413
|
}
|
|
8345
8414
|
async function buildStreamingWrappersForTree(cwd, routesPath, tree, config2) {
|
|
@@ -8582,8 +8651,8 @@ async function buildSingleContentChunk(cwd, collection, fileRef, contentDir, arg
|
|
|
8582
8651
|
locale
|
|
8583
8652
|
};
|
|
8584
8653
|
}
|
|
8585
|
-
async function buildContentChunks(cwd, args = [], defaultLocale = "en-US") {
|
|
8586
|
-
const routesRoot = join12(cwd,
|
|
8654
|
+
async function buildContentChunks(cwd, args = [], defaultLocale = "en-US", routesDir) {
|
|
8655
|
+
const routesRoot = join12(cwd, routesDir);
|
|
8587
8656
|
console.log(`[reroute/content] scan ${routesRoot}`);
|
|
8588
8657
|
const collections2 = await readdir8(routesRoot, { withFileTypes: true });
|
|
8589
8658
|
const results = [];
|
|
@@ -8701,7 +8770,7 @@ async function buildSearchIndex(cwd, config2, args = []) {
|
|
|
8701
8770
|
minHeadingLevel = 1,
|
|
8702
8771
|
maxHeadingLevel = 6
|
|
8703
8772
|
} = searchConfig;
|
|
8704
|
-
const routesRoot = join12(cwd,
|
|
8773
|
+
const routesRoot = join12(cwd, resolveAppPaths(config2).routesDir);
|
|
8705
8774
|
const collections2 = await readdir8(routesRoot, { withFileTypes: true });
|
|
8706
8775
|
const i18n2 = await discoverI18n(cwd, config2.i18n);
|
|
8707
8776
|
const defaultLocale = i18n2.defaultLocale;
|
|
@@ -8776,7 +8845,7 @@ async function buildSearchIndex(cwd, config2, args = []) {
|
|
|
8776
8845
|
}
|
|
8777
8846
|
async function preprocessMarkdownFiles(cwd, config2) {
|
|
8778
8847
|
console.log("[reroute/markdown] Starting markdown preprocessing...");
|
|
8779
|
-
const routesPath = join12(cwd,
|
|
8848
|
+
const routesPath = join12(cwd, resolveAppPaths(config2).routesDir);
|
|
8780
8849
|
const markdownDir = join12(cwd, ".reroute", "markdown");
|
|
8781
8850
|
try {
|
|
8782
8851
|
await rm(markdownDir, { force: true, recursive: true });
|
|
@@ -9017,6 +9086,8 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9017
9086
|
console.log("[reroute/gen] Starting generation...");
|
|
9018
9087
|
}
|
|
9019
9088
|
const config2 = await loadConfig(cwd);
|
|
9089
|
+
const paths = resolveAppPaths(config2);
|
|
9090
|
+
const routesImportBase = importFromReroute(paths.routesDir);
|
|
9020
9091
|
const streamingEnabled = config2.streaming?.enabled ?? false;
|
|
9021
9092
|
const perfTrack = async (name, fn) => {
|
|
9022
9093
|
const stepStart = performance.now();
|
|
@@ -9030,10 +9101,10 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9030
9101
|
};
|
|
9031
9102
|
await ensureOutputDir(cwd, { clean });
|
|
9032
9103
|
if (writeStubs) {
|
|
9033
|
-
await writeStubFiles(cwd);
|
|
9104
|
+
await writeStubFiles(cwd, importFromReroute(paths.server));
|
|
9034
9105
|
}
|
|
9035
9106
|
await perfTrack("Markdown preprocessing", () => preprocessMarkdownFiles(cwd, config2));
|
|
9036
|
-
const routesPath = join12(cwd,
|
|
9107
|
+
const routesPath = join12(cwd, paths.routesDir);
|
|
9037
9108
|
try {
|
|
9038
9109
|
await perfTrack("Routes generation", async () => {
|
|
9039
9110
|
const files = await scanDirectory(routesPath);
|
|
@@ -9041,11 +9112,13 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9041
9112
|
const all = Array.from(new Set([...files, ...nfFiles]));
|
|
9042
9113
|
const tree = generateRouteTree(all.map((f) => f.replace(/\\/g, "/")));
|
|
9043
9114
|
const streamingAnalyses = streamingEnabled ? await buildStreamingWrappersForTree(cwd, routesPath, tree, config2) : new Map;
|
|
9044
|
-
const
|
|
9045
|
-
|
|
9115
|
+
const serverRoutes = generateTypeScript(tree, streamingAnalyses, false, routesImportBase);
|
|
9116
|
+
const clientRoutes = generateTypeScript(tree, streamingAnalyses, true, routesImportBase);
|
|
9117
|
+
await Bun.write(join12(cwd, OUTPUT_ROUTES), serverRoutes);
|
|
9118
|
+
await Bun.write(join12(cwd, OUTPUT_ROUTES_CLIENT), clientRoutes);
|
|
9046
9119
|
});
|
|
9047
9120
|
if (!showPerformance) {
|
|
9048
|
-
console.log(`[reroute/gen] Generated routes: ${join12(cwd, OUTPUT_ROUTES)}`);
|
|
9121
|
+
console.log(`[reroute/gen] Generated routes: ${join12(cwd, OUTPUT_ROUTES)} + ${OUTPUT_ROUTES_CLIENT}`);
|
|
9049
9122
|
}
|
|
9050
9123
|
} catch (error) {
|
|
9051
9124
|
console.error("[reroute/gen] Failed to generate routes:", error);
|
|
@@ -9069,7 +9142,7 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9069
9142
|
console.warn("[reroute/gen] Failed to write i18n.json:", error);
|
|
9070
9143
|
}
|
|
9071
9144
|
try {
|
|
9072
|
-
await perfTrack("Content building", () => buildContentChunks(cwd, args, defaultLocale));
|
|
9145
|
+
await perfTrack("Content building", () => buildContentChunks(cwd, args, defaultLocale, paths.routesDir));
|
|
9073
9146
|
if (!showPerformance) {
|
|
9074
9147
|
console.log(`[reroute/gen] Generated content: ${join12(cwd, OUTPUT_CONTENT_TS)} + collections/*.js`);
|
|
9075
9148
|
}
|
|
@@ -9138,12 +9211,18 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9138
9211
|
await Bun.write(join12(cwd, ".reroute/markdown-components.ts"), mdComponentsLines.join(`
|
|
9139
9212
|
`));
|
|
9140
9213
|
}
|
|
9141
|
-
const
|
|
9142
|
-
|
|
9143
|
-
|
|
9144
|
-
|
|
9145
|
-
|
|
9146
|
-
|
|
9214
|
+
const buildArtifactsLines = (routesModule) => {
|
|
9215
|
+
const indexLines2 = [];
|
|
9216
|
+
indexLines2.push("// \uD83D\uDEA8 Auto-generated by Reroute - DO NOT EDIT \uD83D\uDEA8");
|
|
9217
|
+
indexLines2.push("/* eslint-disable */");
|
|
9218
|
+
indexLines2.push("// @ts-nocheck");
|
|
9219
|
+
indexLines2.push("");
|
|
9220
|
+
indexLines2.push(`import { layouts, matchRoute, notFoundRoutes } from './${routesModule}';`);
|
|
9221
|
+
return indexLines2;
|
|
9222
|
+
};
|
|
9223
|
+
const serverLines = buildArtifactsLines("routes");
|
|
9224
|
+
const clientLines = buildArtifactsLines("routes.client");
|
|
9225
|
+
const indexLines = serverLines;
|
|
9147
9226
|
if (config2.markdown?.components) {
|
|
9148
9227
|
indexLines.push("import { markdownComponents } from './markdown-components';");
|
|
9149
9228
|
}
|
|
@@ -9155,12 +9234,12 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9155
9234
|
const ogTemplatePath = config2.ogImage.defaultTemplate.startsWith(".") ? `../${config2.ogImage.defaultTemplate}` : config2.ogImage.defaultTemplate;
|
|
9156
9235
|
indexLines.push(`import OGTemplate from '${ogTemplatePath}';`);
|
|
9157
9236
|
}
|
|
9158
|
-
const ogFiles = await scanOgFiles(join12(cwd,
|
|
9237
|
+
const ogFiles = await scanOgFiles(join12(cwd, paths.routesDir));
|
|
9159
9238
|
const ogImports = [];
|
|
9160
9239
|
for (let i = 0;i < ogFiles.length; i++) {
|
|
9161
9240
|
const ogFile = ogFiles[i];
|
|
9162
9241
|
const importName = `OGRoute${i}`;
|
|
9163
|
-
const importPath =
|
|
9242
|
+
const importPath = `${routesImportBase}/${ogFile.replace(/\.(tsx|ts)$/, "")}`;
|
|
9164
9243
|
indexLines.push(`import ${importName} from '${importPath}';`);
|
|
9165
9244
|
ogImports.push({ path: ogFile, name: importName });
|
|
9166
9245
|
}
|
|
@@ -9213,8 +9292,39 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9213
9292
|
indexLines.push(`(globalThis as any).__REROUTE_CONFIG__ = ${serializeConfig(config2)};`);
|
|
9214
9293
|
indexLines.push("");
|
|
9215
9294
|
indexLines.push("export type RerouteBundle = typeof bundle;");
|
|
9216
|
-
|
|
9295
|
+
indexLines.push("");
|
|
9296
|
+
indexLines.push("(globalThis as any).__REROUTE_SERVER_BUNDLE__ = bundle;");
|
|
9297
|
+
if (config2.markdown?.components) {
|
|
9298
|
+
clientLines.push("import { markdownComponents } from './markdown-components';");
|
|
9299
|
+
}
|
|
9300
|
+
clientLines.push("");
|
|
9301
|
+
clientLines.push("export const bundle = {");
|
|
9302
|
+
clientLines.push(" layouts,");
|
|
9303
|
+
clientLines.push(" matchRoute,");
|
|
9304
|
+
clientLines.push(" notFoundRoutes,");
|
|
9305
|
+
clientLines.push(" contentBaseUrl: '/.reroute/collections',");
|
|
9306
|
+
if (config2.markdown?.components) {
|
|
9307
|
+
clientLines.push(" markdownComponents,");
|
|
9308
|
+
}
|
|
9309
|
+
clientLines.push("} as const;");
|
|
9310
|
+
clientLines.push("");
|
|
9311
|
+
clientLines.push("export type RerouteBundle = typeof bundle;");
|
|
9312
|
+
clientLines.push("");
|
|
9313
|
+
clientLines.push("(globalThis as any).__REROUTE_CLIENT_BUNDLE__ = bundle;");
|
|
9314
|
+
const barrelArtifacts = [
|
|
9315
|
+
"// \uD83D\uDEA8 Auto-generated by Reroute - DO NOT EDIT \uD83D\uDEA8",
|
|
9316
|
+
"// Client bundle entry — lazy routes only",
|
|
9317
|
+
"/* eslint-disable */",
|
|
9318
|
+
"// @ts-nocheck",
|
|
9319
|
+
"",
|
|
9320
|
+
"export * from './artifacts.client';"
|
|
9321
|
+
].join(`
|
|
9322
|
+
`);
|
|
9323
|
+
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_SERVER), indexLines.join(`
|
|
9324
|
+
`));
|
|
9325
|
+
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_CLIENT), clientLines.join(`
|
|
9217
9326
|
`));
|
|
9327
|
+
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS), barrelArtifacts);
|
|
9218
9328
|
const barrelLines = [
|
|
9219
9329
|
"// \uD83D\uDEA8 Auto-generated by Reroute - DO NOT EDIT \uD83D\uDEA8",
|
|
9220
9330
|
"// Barrel export for client imports",
|
|
@@ -9235,9 +9345,9 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9235
9345
|
"import 'react/jsx-runtime';",
|
|
9236
9346
|
"import 'react/jsx-dev-runtime';",
|
|
9237
9347
|
"",
|
|
9238
|
-
"import './artifacts'; //
|
|
9239
|
-
"import './routes'; //
|
|
9240
|
-
|
|
9348
|
+
"import './artifacts.server'; // SSR bundle (eager routes)",
|
|
9349
|
+
"import './routes'; // Route metadata for compiled binary discovery",
|
|
9350
|
+
`import '${importFromReroute(paths.server)}'; // Import user's server entry`
|
|
9241
9351
|
];
|
|
9242
9352
|
await Bun.write(join12(cwd, ".reroute/entry.ts"), entryLines.join(`
|
|
9243
9353
|
`));
|
|
@@ -9450,7 +9560,8 @@ async function startGenWatch(cwd, args) {
|
|
|
9450
9560
|
});
|
|
9451
9561
|
});
|
|
9452
9562
|
}
|
|
9453
|
-
const
|
|
9563
|
+
const watchPaths = resolveAppPaths(loadedConfig);
|
|
9564
|
+
const routesPath = join12(cwd, watchPaths.routesDir);
|
|
9454
9565
|
console.log(`[reroute/watch] \uD83D\uDCC1 Watching ${routesPath}...`);
|
|
9455
9566
|
const routesWatcher = watch(routesPath, { recursive: true }, (_ev, filename) => {
|
|
9456
9567
|
if (!filename)
|
|
@@ -9486,7 +9597,7 @@ async function startGenWatch(cwd, args) {
|
|
|
9486
9597
|
redirectContentOnNegotiate: watchI18n.redirectContentOnNegotiate,
|
|
9487
9598
|
catalogs: watchI18n.catalogs
|
|
9488
9599
|
}, null, 2));
|
|
9489
|
-
await buildContentChunks(cwd, args, watchI18n.defaultLocale);
|
|
9600
|
+
await buildContentChunks(cwd, args, watchI18n.defaultLocale, watchPaths.routesDir);
|
|
9490
9601
|
const contentTime = ((performance.now() - contentStart) / 1000).toFixed(2);
|
|
9491
9602
|
console.log(`[reroute/watch] └─ Content: ${contentTime}s`);
|
|
9492
9603
|
if (loadedConfig.search?.enabled) {
|
|
@@ -9516,7 +9627,7 @@ async function startGenWatch(cwd, args) {
|
|
|
9516
9627
|
});
|
|
9517
9628
|
});
|
|
9518
9629
|
});
|
|
9519
|
-
const clientPath = join12(cwd,
|
|
9630
|
+
const clientPath = join12(cwd, watchPaths.clientDir);
|
|
9520
9631
|
console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${clientPath}...`);
|
|
9521
9632
|
async function rebuildWatchedClient(changed) {
|
|
9522
9633
|
const label = changed.length === 1 ? changed[0] : `${changed.length} files`;
|
|
@@ -9609,7 +9720,7 @@ async function gen(args) {
|
|
|
9609
9720
|
});
|
|
9610
9721
|
process.exit(0);
|
|
9611
9722
|
}
|
|
9612
|
-
var
|
|
9723
|
+
var OUTPUT_DIR = ".reroute", OUTPUT_ROUTES = ".reroute/routes.ts", OUTPUT_ROUTES_CLIENT = ".reroute/routes.client.ts", OUTPUT_CONTENT_TS = ".reroute/content.ts", OUTPUT_COLLECTIONS_DIR = ".reroute/collections", OUTPUT_SEARCH_INDEX = ".reroute/search.json", OUTPUT_ARTIFACTS = ".reroute/artifacts.ts", OUTPUT_ARTIFACTS_SERVER = ".reroute/artifacts.server.ts", OUTPUT_ARTIFACTS_CLIENT = ".reroute/artifacts.client.ts", OUTPUT_INDEX = ".reroute/index.ts";
|
|
9613
9724
|
var init_gen = __esm(() => {
|
|
9614
9725
|
init_core();
|
|
9615
9726
|
init_env();
|
|
@@ -104282,9 +104393,9 @@ function setupProcessOutput(box, process2, screen, colorizeLogPrefix2) {
|
|
|
104282
104393
|
screen.render();
|
|
104283
104394
|
});
|
|
104284
104395
|
}
|
|
104285
|
-
function setupTerminalUIHandlers(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix2) {
|
|
104396
|
+
function setupTerminalUIHandlers(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix2, serverEntry = "src/index.ts") {
|
|
104286
104397
|
const genBox = createLogBox(grid, blessed, 0, 0, " reroute gen --watch ", "cyan");
|
|
104287
|
-
const serverBox = createLogBox(grid, blessed, 0, 1,
|
|
104398
|
+
const serverBox = createLogBox(grid, blessed, 0, 1, ` bun --watch ${serverEntry} `, "green");
|
|
104288
104399
|
setupScrollingKeys(genBox, screen);
|
|
104289
104400
|
setupScrollingKeys(serverBox, screen);
|
|
104290
104401
|
setupMouseSupport(genBox, screen);
|
|
@@ -104381,7 +104492,8 @@ async function startTui(port) {
|
|
|
104381
104492
|
genProcess.kill();
|
|
104382
104493
|
process.exit(1);
|
|
104383
104494
|
});
|
|
104384
|
-
const
|
|
104495
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104496
|
+
const serverProcess = spawn("bun", ["--watch", server2], {
|
|
104385
104497
|
stdio: ["ignore", "pipe", "pipe"],
|
|
104386
104498
|
env: {
|
|
104387
104499
|
...process.env,
|
|
@@ -104412,13 +104524,14 @@ async function startTui(port) {
|
|
|
104412
104524
|
screen
|
|
104413
104525
|
});
|
|
104414
104526
|
const { setupTerminalUIHandlers: setupTerminalUIHandlers2 } = await Promise.resolve().then(() => exports_terminal_ui);
|
|
104415
|
-
setupTerminalUIHandlers2(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix);
|
|
104527
|
+
setupTerminalUIHandlers2(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix, server2);
|
|
104416
104528
|
}
|
|
104417
104529
|
async function startDefault(port) {
|
|
104418
104530
|
process.env.PORT = String(port);
|
|
104419
104531
|
process.env.REROUTE_DEV = "1";
|
|
104420
104532
|
const session = await startGenWatch(process.cwd(), ["--watch"]);
|
|
104421
|
-
const
|
|
104533
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104534
|
+
const entry = join14(process.cwd(), server2);
|
|
104422
104535
|
if (!existsSync7(entry)) {
|
|
104423
104536
|
session.close();
|
|
104424
104537
|
throw new Error(`[reroute/dev] Missing ${entry}`);
|
|
@@ -104472,6 +104585,7 @@ async function dev(args) {
|
|
|
104472
104585
|
}
|
|
104473
104586
|
}
|
|
104474
104587
|
var init_dev = __esm(() => {
|
|
104588
|
+
init_core();
|
|
104475
104589
|
init_gen();
|
|
104476
104590
|
init_command();
|
|
104477
104591
|
init_log();
|
|
@@ -104558,7 +104672,8 @@ async function start(args) {
|
|
|
104558
104672
|
`));
|
|
104559
104673
|
process.stdout.write(`${colorizeLogPrefixAnsi("[reroute/start] Starting server...")}
|
|
104560
104674
|
`);
|
|
104561
|
-
const
|
|
104675
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104676
|
+
const serverProcess = spawn2("bun", [server2], {
|
|
104562
104677
|
stdio: ["ignore", "pipe", "pipe"],
|
|
104563
104678
|
env: {
|
|
104564
104679
|
...process.env,
|
|
@@ -104614,6 +104729,7 @@ async function start(args) {
|
|
|
104614
104729
|
}
|
|
104615
104730
|
}
|
|
104616
104731
|
var init_start = __esm(() => {
|
|
104732
|
+
init_core();
|
|
104617
104733
|
init_log();
|
|
104618
104734
|
});
|
|
104619
104735
|
|
|
@@ -104774,10 +104890,8 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
104774
104890
|
}
|
|
104775
104891
|
async function copyAssets(cwd) {
|
|
104776
104892
|
const config2 = await loadConfig(cwd);
|
|
104777
|
-
const
|
|
104778
|
-
const
|
|
104779
|
-
const assetsPath = dirname8(appSrc);
|
|
104780
|
-
const sourceAssetsDir = join17(cwd, assetsPath, "assets");
|
|
104893
|
+
const { assetsDir } = resolveAppPaths(config2);
|
|
104894
|
+
const sourceAssetsDir = join17(cwd, assetsDir);
|
|
104781
104895
|
const rerouteAssetsDir = join17(cwd, ".reroute", "assets");
|
|
104782
104896
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copying assets...
|
|
104783
104897
|
`));
|
|
@@ -104832,9 +104946,12 @@ function cleanupBundledFiles(rerouteDir) {
|
|
|
104832
104946
|
let cleanupCount = 0;
|
|
104833
104947
|
const tsFilesToRemove = [
|
|
104834
104948
|
"artifacts.ts",
|
|
104949
|
+
"artifacts.server.ts",
|
|
104950
|
+
"artifacts.client.ts",
|
|
104835
104951
|
"entry.ts",
|
|
104836
104952
|
"index.ts",
|
|
104837
104953
|
"routes.ts",
|
|
104954
|
+
"routes.client.ts",
|
|
104838
104955
|
"markdown-components.ts"
|
|
104839
104956
|
];
|
|
104840
104957
|
for (const file of tsFilesToRemove) {
|
|
@@ -107261,7 +107378,7 @@ async function findRoutesWithOG(cwd) {
|
|
|
107261
107378
|
}
|
|
107262
107379
|
} catch {
|
|
107263
107380
|
console.warn("⚠️ .reroute/manifest.json not found, scanning routes directory...");
|
|
107264
|
-
const routesPath = join19(cwd,
|
|
107381
|
+
const routesPath = join19(cwd, resolveAppPaths(await loadConfig(cwd)).routesDir);
|
|
107265
107382
|
await scanForOgTemplates(routesPath, "", routes);
|
|
107266
107383
|
await addContentRoutes(routesPath, routes);
|
|
107267
107384
|
}
|
|
@@ -107299,7 +107416,7 @@ ogImage: {
|
|
|
107299
107416
|
console.error("❌ No routes found for OG image generation");
|
|
107300
107417
|
console.log(`
|
|
107301
107418
|
Make sure you have:`);
|
|
107302
|
-
console.log(
|
|
107419
|
+
console.log(` 1. Routes defined in ${resolveAppPaths(config2).routesDir}/`);
|
|
107303
107420
|
console.log(" 2. Run `reroute dev` or `reroute build` first to generate .reroute/manifest.json");
|
|
107304
107421
|
console.log(`
|
|
107305
107422
|
Or create [og].tsx files in your routes for custom OG templates.`);
|
|
@@ -107404,7 +107521,6 @@ Or create [og].tsx files in your routes for custom OG templates.`);
|
|
|
107404
107521
|
list.focus();
|
|
107405
107522
|
screen.render();
|
|
107406
107523
|
}
|
|
107407
|
-
var ROUTES_DIR2 = "src/client/routes";
|
|
107408
107524
|
var init_og2 = __esm(() => {
|
|
107409
107525
|
init_core();
|
|
107410
107526
|
});
|
|
@@ -107513,7 +107629,7 @@ async function getVersionString2() {
|
|
|
107513
107629
|
}
|
|
107514
107630
|
async function getVersion2() {
|
|
107515
107631
|
if (true) {
|
|
107516
|
-
return "1.0.0-alpha.
|
|
107632
|
+
return "1.0.0-alpha.18";
|
|
107517
107633
|
}
|
|
107518
107634
|
const possiblePaths = [
|
|
107519
107635
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -107530,10 +107646,10 @@ async function getVersion2() {
|
|
|
107530
107646
|
}
|
|
107531
107647
|
async function getCommit2() {
|
|
107532
107648
|
if (true) {
|
|
107533
|
-
return "
|
|
107649
|
+
return "ee1178f";
|
|
107534
107650
|
}
|
|
107535
107651
|
return "dev";
|
|
107536
107652
|
}
|
|
107537
107653
|
main();
|
|
107538
107654
|
|
|
107539
|
-
//# debugId=
|
|
107655
|
+
//# debugId=8378878696E4AA1264756E2164756E21
|