reroute-js 1.0.0-alpha.16 → 1.0.0-alpha.19
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 +125 -79
- package/cli/bin.js.map +20 -19
- package/cli/index.d.ts +1 -1
- package/cli/index.js +578 -19
- package/cli/index.js.map +52 -4
- package/cli/src/cli.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts +1 -1
- package/cli/src/commands/analyze.d.ts.map +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 +2 -2
- package/cli/src/commands/lib/streaming/suspense.d.ts.map +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 +60 -24
- package/core/index.js.map +11 -10
- 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/extractor.d.ts.map +1 -1
- package/core/src/llms/formatter.d.ts +1 -1
- package/core/src/llms/formatter.d.ts.map +1 -1
- package/core/src/llms/full-generator.d.ts +1 -1
- package/core/src/llms/index-generator.d.ts +2 -2
- package/core/src/llms/index-generator.d.ts.map +1 -1
- package/core/src/llms/index.d.ts +1 -1
- package/core/src/og/discovery.d.ts +1 -1
- package/core/src/og/index.d.ts +1 -1
- package/core/src/og/meta.d.ts +1 -1
- package/core/src/og/render.d.ts +1 -1
- package/core/src/og/types.d.ts +1 -1
- package/core/src/robots/discovery.d.ts +1 -1
- package/core/src/robots/generator.d.ts +1 -1
- package/core/src/robots/index.d.ts +1 -1
- package/core/src/robots/policies.d.ts +1 -1
- package/core/src/rss/discovery.d.ts +2 -2
- package/core/src/rss/discovery.d.ts.map +1 -1
- package/core/src/rss/generator.d.ts +1 -1
- package/core/src/rss/index.d.ts +1 -1
- package/core/src/sitemap/discovery.d.ts +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 +91 -40
- package/elysia/index.js.map +13 -11
- 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 +66 -11
- package/react/index.js.map +6 -5
- 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/bundle.d.ts +27 -0
- package/react/src/lib/bundle.d.ts.map +1 -0
- 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 +2 -1
- package/react/src/lib/index.d.ts.map +1 -1
- package/react/src/lib/lazy-route.d.ts +1 -1
- 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 +2 -2
- package/react/src/providers/RerouteProvider.d.ts.map +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 +12 -3
- package/telemetry/server.js.map +9 -8
- 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.19
|
|
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.19";
|
|
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 "2cc62d6";
|
|
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 {
|
|
@@ -4274,9 +4299,18 @@ var init_render = __esm(() => {
|
|
|
4274
4299
|
});
|
|
4275
4300
|
|
|
4276
4301
|
// packages/core/src/llms/formatter.ts
|
|
4302
|
+
function leadingTitleLine(text) {
|
|
4303
|
+
const first = text.trimStart().split(/\r?\n/, 1)[0]?.trim();
|
|
4304
|
+
if (!first)
|
|
4305
|
+
return;
|
|
4306
|
+
return first.replace(/^#\s+/, "").trim();
|
|
4307
|
+
}
|
|
4308
|
+
function hasLeadingTitle(text, title) {
|
|
4309
|
+
return leadingTitleLine(text) === title.trim();
|
|
4310
|
+
}
|
|
4277
4311
|
function formatAsText(content) {
|
|
4278
4312
|
const parts = [];
|
|
4279
|
-
if (content.title) {
|
|
4313
|
+
if (content.title && !hasLeadingTitle(content.body, content.title)) {
|
|
4280
4314
|
parts.push(content.title);
|
|
4281
4315
|
parts.push("");
|
|
4282
4316
|
}
|
|
@@ -4286,7 +4320,7 @@ function formatAsText(content) {
|
|
|
4286
4320
|
}
|
|
4287
4321
|
function formatAsMarkdown(content) {
|
|
4288
4322
|
const parts = [];
|
|
4289
|
-
if (content.title) {
|
|
4323
|
+
if (content.title && !hasLeadingTitle(content.markdown, content.title)) {
|
|
4290
4324
|
parts.push(`# ${content.title}`);
|
|
4291
4325
|
parts.push("");
|
|
4292
4326
|
}
|
|
@@ -4573,23 +4607,15 @@ async function extractContentForLLMs(options) {
|
|
|
4573
4607
|
throw new Error("Content not found");
|
|
4574
4608
|
}
|
|
4575
4609
|
if (format === "md") {
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
}
|
|
4581
|
-
parts2.push(content.markdown);
|
|
4582
|
-
return parts2.join(`
|
|
4583
|
-
`);
|
|
4584
|
-
}
|
|
4585
|
-
const parts = [];
|
|
4586
|
-
if (content.title) {
|
|
4587
|
-
parts.push(content.title);
|
|
4588
|
-
parts.push("");
|
|
4610
|
+
return formatAsMarkdown({
|
|
4611
|
+
title: content.title,
|
|
4612
|
+
markdown: content.markdown
|
|
4613
|
+
});
|
|
4589
4614
|
}
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4615
|
+
return formatAsText({
|
|
4616
|
+
title: content.title,
|
|
4617
|
+
body: content.body
|
|
4618
|
+
});
|
|
4593
4619
|
}
|
|
4594
4620
|
var init_extractor = __esm(() => {
|
|
4595
4621
|
init_render();
|
|
@@ -4819,7 +4845,7 @@ async function discoverCollectionRoutes(cwd, collections2, isWatchMode, llmsConf
|
|
|
4819
4845
|
}
|
|
4820
4846
|
async function loadRouteModule(cwd, routePath, isWatchMode) {
|
|
4821
4847
|
try {
|
|
4822
|
-
const abs = join2(cwd,
|
|
4848
|
+
const abs = join2(cwd, resolveAppPaths(await loadConfig(cwd)).routesDir, routePath);
|
|
4823
4849
|
const modUrl = `${pathToFileURL6(abs).href}${isWatchMode ? `?t=${Date.now()}` : ""}`;
|
|
4824
4850
|
return await import(modUrl);
|
|
4825
4851
|
} catch {
|
|
@@ -5056,6 +5082,8 @@ async function generateLLMsIndex(options) {
|
|
|
5056
5082
|
`);
|
|
5057
5083
|
}
|
|
5058
5084
|
var init_index_generator = __esm(() => {
|
|
5085
|
+
init_app_paths();
|
|
5086
|
+
init_config();
|
|
5059
5087
|
init_extractor();
|
|
5060
5088
|
});
|
|
5061
5089
|
|
|
@@ -6063,7 +6091,7 @@ async function discoverCollectionFeedItems(cwd, collection, isWatchMode, baseUrl
|
|
|
6063
6091
|
async function discoverSSRDataFeedItems(cwd, routePattern, routePath, isWatchMode, baseUrl, rssConfig) {
|
|
6064
6092
|
const items = [];
|
|
6065
6093
|
try {
|
|
6066
|
-
const abs = join2(cwd,
|
|
6094
|
+
const abs = join2(cwd, resolveAppPaths(await loadConfig(cwd)).routesDir, routePath);
|
|
6067
6095
|
const mod = await import(pathToFileURL7(abs).href + (isWatchMode ? `?t=${Date.now()}` : ""));
|
|
6068
6096
|
const ssr = mod?.ssr;
|
|
6069
6097
|
const dataFn = ssr?.data;
|
|
@@ -6272,7 +6300,10 @@ async function discoverRSSData(cwd, collections2, baseUrl, isWatchMode, rssConfi
|
|
|
6272
6300
|
ssrDataFeeds
|
|
6273
6301
|
};
|
|
6274
6302
|
}
|
|
6275
|
-
var init_discovery6 = () => {
|
|
6303
|
+
var init_discovery6 = __esm(() => {
|
|
6304
|
+
init_app_paths();
|
|
6305
|
+
init_config();
|
|
6306
|
+
});
|
|
6276
6307
|
|
|
6277
6308
|
// packages/core/src/rss/generator.ts
|
|
6278
6309
|
function generateRSSXML(feed, options = {}) {
|
|
@@ -6895,6 +6926,7 @@ var init_ssr = __esm(() => {
|
|
|
6895
6926
|
|
|
6896
6927
|
// packages/core/src/index.ts
|
|
6897
6928
|
var init_src = __esm(() => {
|
|
6929
|
+
init_app_paths();
|
|
6898
6930
|
init_bundler();
|
|
6899
6931
|
init_config();
|
|
6900
6932
|
init_content();
|
|
@@ -6911,6 +6943,8 @@ var init_src = __esm(() => {
|
|
|
6911
6943
|
var exports_core = {};
|
|
6912
6944
|
__export(exports_core, {
|
|
6913
6945
|
AI_CRAWLERS: () => AI_CRAWLERS,
|
|
6946
|
+
DEFAULT_APP_SERVER: () => DEFAULT_APP_SERVER,
|
|
6947
|
+
DEFAULT_APP_SRC: () => DEFAULT_APP_SRC,
|
|
6914
6948
|
DEFAULT_COOKIE: () => DEFAULT_COOKIE,
|
|
6915
6949
|
DEFAULT_LOCALE: () => DEFAULT_LOCALE,
|
|
6916
6950
|
DEFAULT_LOCALES_DIR: () => DEFAULT_LOCALES_DIR,
|
|
@@ -7006,6 +7040,7 @@ __export(exports_core, {
|
|
|
7006
7040
|
hreflangTags: () => hreflangTags,
|
|
7007
7041
|
htmlToMarkdown: () => htmlToMarkdown,
|
|
7008
7042
|
importContentModuleForPath: () => importContentModuleForPath,
|
|
7043
|
+
importFromReroute: () => importFromReroute,
|
|
7009
7044
|
inlineThemeCSS: () => inlineThemeCSS,
|
|
7010
7045
|
isCompressible: () => isCompressible,
|
|
7011
7046
|
isThenable: () => isThenable,
|
|
@@ -7039,6 +7074,7 @@ __export(exports_core, {
|
|
|
7039
7074
|
renderSSRDocumentStream: () => renderSSRDocumentStream,
|
|
7040
7075
|
resetSSRAccessTracking: () => resetSSRAccessTracking,
|
|
7041
7076
|
resetSSRContentResults: () => resetSSRContentResults,
|
|
7077
|
+
resolveAppPaths: () => resolveAppPaths,
|
|
7042
7078
|
resolveLocale: () => resolveLocale,
|
|
7043
7079
|
seedSSRModuleForPath: () => seedSSRModuleForPath,
|
|
7044
7080
|
setGlobalCollections: () => setGlobalCollections,
|
|
@@ -7703,7 +7739,7 @@ async function generateStreamingWrapper(options) {
|
|
|
7703
7739
|
const { cwd, relativeFilePath, analysis, config: config2 } = options;
|
|
7704
7740
|
const streamingModulePath = join9(cwd, ".reroute", "streaming", relativeFilePath).replace(/\.(tsx|ts)$/, ".tsx");
|
|
7705
7741
|
const wrapperDir = dirname5(streamingModulePath);
|
|
7706
|
-
const originalModuleWithoutExt = removeExtension(join9(cwd,
|
|
7742
|
+
const originalModuleWithoutExt = removeExtension(join9(cwd, resolveAppPaths(config2).routesDir, relativeFilePath));
|
|
7707
7743
|
const originalImportPath = toImportPath(wrapperDir, originalModuleWithoutExt);
|
|
7708
7744
|
const skeletonImportBlock = await resolveSkeletonBlock({
|
|
7709
7745
|
analysis,
|
|
@@ -7777,15 +7813,18 @@ var AUTO_HEADER = `// \uD83D\uDEA8 Auto-generated streaming wrapper by Reroute -
|
|
|
7777
7813
|
/* eslint-disable */
|
|
7778
7814
|
// @ts-nocheck
|
|
7779
7815
|
`, warnedSkeletonType = false;
|
|
7780
|
-
var init_suspense = () => {
|
|
7816
|
+
var init_suspense = __esm(() => {
|
|
7817
|
+
init_core();
|
|
7818
|
+
});
|
|
7781
7819
|
|
|
7782
7820
|
// packages/cli/src/commands/lib/theme.ts
|
|
7783
7821
|
import { createHash as createHash2 } from "node:crypto";
|
|
7784
7822
|
import { existsSync as existsSync5, readFileSync as readFileSync4 } from "node:fs";
|
|
7785
7823
|
import { mkdir as mkdir2, readdir as readdir7, unlink as unlink2, writeFile } from "node:fs/promises";
|
|
7786
7824
|
import { dirname as dirname6, isAbsolute, join as join10, resolve as resolve2 } from "node:path";
|
|
7787
|
-
function getCssPaths(cwd) {
|
|
7788
|
-
const
|
|
7825
|
+
async function getCssPaths(cwd) {
|
|
7826
|
+
const paths = resolveAppPaths(await loadConfig(cwd));
|
|
7827
|
+
const input = join10(cwd, paths.cssEntry);
|
|
7789
7828
|
const bundlesDir = join10(cwd, ".reroute/bundles");
|
|
7790
7829
|
return { input, bundlesDir };
|
|
7791
7830
|
}
|
|
@@ -7843,7 +7882,7 @@ async function pruneStaleThemeCss(bundlesDir, keep) {
|
|
|
7843
7882
|
}
|
|
7844
7883
|
}
|
|
7845
7884
|
async function syncThemeCss(cwd) {
|
|
7846
|
-
const { input, bundlesDir } = getCssPaths(cwd);
|
|
7885
|
+
const { input, bundlesDir } = await getCssPaths(cwd);
|
|
7847
7886
|
if (!existsSync5(input)) {
|
|
7848
7887
|
return false;
|
|
7849
7888
|
}
|
|
@@ -7867,6 +7906,7 @@ ${message}`);
|
|
|
7867
7906
|
}
|
|
7868
7907
|
var HASHED_THEME_RE2, IMPORT_RE;
|
|
7869
7908
|
var init_theme = __esm(() => {
|
|
7909
|
+
init_core();
|
|
7870
7910
|
HASHED_THEME_RE2 = /^index\.[a-z0-9]{8,}\.css$/i;
|
|
7871
7911
|
IMPORT_RE = /@import\s+(?:url\(\s*)?(?:'([^']+)'|"([^"]+)"|([^'")\s]+))\s*\)?\s*([^;]*);/g;
|
|
7872
7912
|
});
|
|
@@ -7972,7 +8012,7 @@ async function ensureOutputDir(cwd, options = {}) {
|
|
|
7972
8012
|
await mkdir3(join12(cwd, ".reroute/streaming"), { recursive: true });
|
|
7973
8013
|
} catch {}
|
|
7974
8014
|
}
|
|
7975
|
-
async function writeStubFiles(cwd) {
|
|
8015
|
+
async function writeStubFiles(cwd, serverImport) {
|
|
7976
8016
|
const STUB_ROUTES = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
7977
8017
|
// This will be replaced by actual routes
|
|
7978
8018
|
/* eslint-disable */
|
|
@@ -8038,14 +8078,14 @@ export const bundle = {
|
|
|
8038
8078
|
|
|
8039
8079
|
export * from './artifacts';
|
|
8040
8080
|
`;
|
|
8041
|
-
const
|
|
8081
|
+
const stubEntry = `// \uD83D\uDEA8 Auto-generated stub by Reroute - DO NOT EDIT \uD83D\uDEA8
|
|
8042
8082
|
// Server entry wrapper for compiled binary builds
|
|
8043
8083
|
/* eslint-disable */
|
|
8044
8084
|
// @ts-nocheck
|
|
8045
8085
|
|
|
8046
8086
|
import './artifacts';
|
|
8047
8087
|
import './routes'; // Import routes (bundles all route components)
|
|
8048
|
-
import '
|
|
8088
|
+
import '${serverImport}';
|
|
8049
8089
|
`;
|
|
8050
8090
|
await Bun.write(join12(cwd, OUTPUT_ROUTES), STUB_ROUTES);
|
|
8051
8091
|
await Bun.write(join12(cwd, OUTPUT_ROUTES_CLIENT), STUB_ROUTES);
|
|
@@ -8054,7 +8094,7 @@ import '../src/index';
|
|
|
8054
8094
|
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_CLIENT), STUB_ARTIFACTS_CLIENT);
|
|
8055
8095
|
await Bun.write(join12(cwd, OUTPUT_ARTIFACTS_SERVER), STUB_ARTIFACTS_SERVER);
|
|
8056
8096
|
await Bun.write(join12(cwd, OUTPUT_INDEX), STUB_INDEX);
|
|
8057
|
-
await Bun.write(join12(cwd, ".reroute/entry.ts"),
|
|
8097
|
+
await Bun.write(join12(cwd, ".reroute/entry.ts"), stubEntry);
|
|
8058
8098
|
console.log("[reroute/gen] Initialized stub files");
|
|
8059
8099
|
}
|
|
8060
8100
|
function shouldSkipFile(relativePath, entryName) {
|
|
@@ -8188,7 +8228,7 @@ function generateRouteTree(files) {
|
|
|
8188
8228
|
notFoundRoutes
|
|
8189
8229
|
};
|
|
8190
8230
|
}
|
|
8191
|
-
function getImportPath(filePath, streamingMap) {
|
|
8231
|
+
function getImportPath(filePath, streamingMap, routesImportBase) {
|
|
8192
8232
|
const isMarkdown = /\.(md|mdx)$/.test(filePath);
|
|
8193
8233
|
if (isMarkdown) {
|
|
8194
8234
|
const pathWithoutExt2 = filePath.replace(/\.(md|mdx)$/, "");
|
|
@@ -8200,17 +8240,17 @@ function getImportPath(filePath, streamingMap) {
|
|
|
8200
8240
|
return `./streaming/${pathWithoutExt2}`;
|
|
8201
8241
|
}
|
|
8202
8242
|
const pathWithoutExt = filePath.replace(/\.(tsx|ts)$/, "");
|
|
8203
|
-
return
|
|
8243
|
+
return `${routesImportBase}/${pathWithoutExt}`;
|
|
8204
8244
|
}
|
|
8205
|
-
function generateTypeScript(tree, streamingMap, client
|
|
8245
|
+
function generateTypeScript(tree, streamingMap, client, routesImportBase) {
|
|
8206
8246
|
const helperImport = "import { createLazyRoute } from 'reroute-js/react';";
|
|
8207
8247
|
const ssrHelper = "const _ssr = (m: any) => m.ssr;";
|
|
8208
8248
|
const metaHelper = "const _meta = (m: any) => m.meta;";
|
|
8209
8249
|
const metaImports = [
|
|
8210
|
-
...tree.routes.map((r, i) => `import * as Route${i}Module from '${getImportPath(r.filePath, streamingMap)}';
|
|
8250
|
+
...tree.routes.map((r, i) => `import * as Route${i}Module from '${getImportPath(r.filePath, streamingMap, routesImportBase)}';
|
|
8211
8251
|
const Route${i}SSR = _ssr(Route${i}Module);
|
|
8212
8252
|
const Route${i}Meta = _meta(Route${i}Module);`),
|
|
8213
|
-
...tree.layouts.map((l, i) => `import * as Layout${i}Module from '${getImportPath(l.filePath, streamingMap)}';
|
|
8253
|
+
...tree.layouts.map((l, i) => `import * as Layout${i}Module from '${getImportPath(l.filePath, streamingMap, routesImportBase)}';
|
|
8214
8254
|
const Layout${i}SSR = _ssr(Layout${i}Module);
|
|
8215
8255
|
const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
8216
8256
|
].join(`
|
|
@@ -8218,28 +8258,28 @@ const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
|
8218
8258
|
const serverEagerImports = client ? "" : [
|
|
8219
8259
|
...tree.routes.map((_route, i) => `const Route${i}Eager = Route${i}Module.default;`),
|
|
8220
8260
|
...tree.layouts.map((_layout, i) => `const Layout${i}Eager = Layout${i}Module.default;`),
|
|
8221
|
-
...tree.notFoundRoutes.map((nf, i) => `import NotFound${i}Eager from '${getImportPath(nf.filePath, streamingMap)}';`)
|
|
8261
|
+
...tree.notFoundRoutes.map((nf, i) => `import NotFound${i}Eager from '${getImportPath(nf.filePath, streamingMap, routesImportBase)}';`)
|
|
8222
8262
|
].join(`
|
|
8223
8263
|
`);
|
|
8224
8264
|
const eagerImports = client ? metaImports : [metaImports, serverEagerImports].filter(Boolean).join(`
|
|
8225
8265
|
`);
|
|
8226
8266
|
const lazyWrappers = [
|
|
8227
8267
|
...tree.routes.map((r, i) => {
|
|
8228
|
-
const importPath = getImportPath(r.filePath, streamingMap);
|
|
8268
|
+
const importPath = getImportPath(r.filePath, streamingMap, routesImportBase);
|
|
8229
8269
|
if (client) {
|
|
8230
8270
|
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}");`;
|
|
8231
8271
|
}
|
|
8232
8272
|
return `const Route${i} = createLazyRoute(() => import('${importPath}'), "${r.pattern}", Route${i}Eager);`;
|
|
8233
8273
|
}),
|
|
8234
8274
|
...tree.layouts.map((l, i) => {
|
|
8235
|
-
const importPath = getImportPath(l.filePath, streamingMap);
|
|
8275
|
+
const importPath = getImportPath(l.filePath, streamingMap, routesImportBase);
|
|
8236
8276
|
if (client) {
|
|
8237
8277
|
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}");`;
|
|
8238
8278
|
}
|
|
8239
8279
|
return `const Layout${i} = createLazyRoute(() => import('${importPath}'), "${l.pattern}", Layout${i}Eager);`;
|
|
8240
8280
|
}),
|
|
8241
8281
|
...tree.notFoundRoutes.map((nf, i) => {
|
|
8242
|
-
const importPath = getImportPath(nf.filePath, streamingMap);
|
|
8282
|
+
const importPath = getImportPath(nf.filePath, streamingMap, routesImportBase);
|
|
8243
8283
|
if (client) {
|
|
8244
8284
|
return `const NotFound${i} = createLazyRoute(() => import('${importPath}'), "${nf.notFoundBasePattern || "/"}");`;
|
|
8245
8285
|
}
|
|
@@ -8619,8 +8659,8 @@ async function buildSingleContentChunk(cwd, collection, fileRef, contentDir, arg
|
|
|
8619
8659
|
locale
|
|
8620
8660
|
};
|
|
8621
8661
|
}
|
|
8622
|
-
async function buildContentChunks(cwd, args = [], defaultLocale = "en-US") {
|
|
8623
|
-
const routesRoot = join12(cwd,
|
|
8662
|
+
async function buildContentChunks(cwd, args = [], defaultLocale = "en-US", routesDir) {
|
|
8663
|
+
const routesRoot = join12(cwd, routesDir);
|
|
8624
8664
|
console.log(`[reroute/content] scan ${routesRoot}`);
|
|
8625
8665
|
const collections2 = await readdir8(routesRoot, { withFileTypes: true });
|
|
8626
8666
|
const results = [];
|
|
@@ -8738,7 +8778,7 @@ async function buildSearchIndex(cwd, config2, args = []) {
|
|
|
8738
8778
|
minHeadingLevel = 1,
|
|
8739
8779
|
maxHeadingLevel = 6
|
|
8740
8780
|
} = searchConfig;
|
|
8741
|
-
const routesRoot = join12(cwd,
|
|
8781
|
+
const routesRoot = join12(cwd, resolveAppPaths(config2).routesDir);
|
|
8742
8782
|
const collections2 = await readdir8(routesRoot, { withFileTypes: true });
|
|
8743
8783
|
const i18n2 = await discoverI18n(cwd, config2.i18n);
|
|
8744
8784
|
const defaultLocale = i18n2.defaultLocale;
|
|
@@ -8813,7 +8853,7 @@ async function buildSearchIndex(cwd, config2, args = []) {
|
|
|
8813
8853
|
}
|
|
8814
8854
|
async function preprocessMarkdownFiles(cwd, config2) {
|
|
8815
8855
|
console.log("[reroute/markdown] Starting markdown preprocessing...");
|
|
8816
|
-
const routesPath = join12(cwd,
|
|
8856
|
+
const routesPath = join12(cwd, resolveAppPaths(config2).routesDir);
|
|
8817
8857
|
const markdownDir = join12(cwd, ".reroute", "markdown");
|
|
8818
8858
|
try {
|
|
8819
8859
|
await rm(markdownDir, { force: true, recursive: true });
|
|
@@ -8874,7 +8914,7 @@ async function preprocessMarkdownFiles(cwd, config2) {
|
|
|
8874
8914
|
}
|
|
8875
8915
|
async function buildEntrypointBundle(cwd, args = []) {
|
|
8876
8916
|
const buildStartTime = performance.now();
|
|
8877
|
-
const clientDir = join12(cwd,
|
|
8917
|
+
const clientDir = join12(cwd, resolveAppPaths(await loadConfig(cwd)).clientDir);
|
|
8878
8918
|
const entrypoint = join12(clientDir, "index.tsx");
|
|
8879
8919
|
const exists = await Bun.file(entrypoint).exists();
|
|
8880
8920
|
if (!exists) {
|
|
@@ -9054,6 +9094,8 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9054
9094
|
console.log("[reroute/gen] Starting generation...");
|
|
9055
9095
|
}
|
|
9056
9096
|
const config2 = await loadConfig(cwd);
|
|
9097
|
+
const paths = resolveAppPaths(config2);
|
|
9098
|
+
const routesImportBase = importFromReroute(paths.routesDir);
|
|
9057
9099
|
const streamingEnabled = config2.streaming?.enabled ?? false;
|
|
9058
9100
|
const perfTrack = async (name, fn) => {
|
|
9059
9101
|
const stepStart = performance.now();
|
|
@@ -9067,10 +9109,10 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9067
9109
|
};
|
|
9068
9110
|
await ensureOutputDir(cwd, { clean });
|
|
9069
9111
|
if (writeStubs) {
|
|
9070
|
-
await writeStubFiles(cwd);
|
|
9112
|
+
await writeStubFiles(cwd, importFromReroute(paths.server));
|
|
9071
9113
|
}
|
|
9072
9114
|
await perfTrack("Markdown preprocessing", () => preprocessMarkdownFiles(cwd, config2));
|
|
9073
|
-
const routesPath = join12(cwd,
|
|
9115
|
+
const routesPath = join12(cwd, paths.routesDir);
|
|
9074
9116
|
try {
|
|
9075
9117
|
await perfTrack("Routes generation", async () => {
|
|
9076
9118
|
const files = await scanDirectory(routesPath);
|
|
@@ -9078,8 +9120,8 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9078
9120
|
const all = Array.from(new Set([...files, ...nfFiles]));
|
|
9079
9121
|
const tree = generateRouteTree(all.map((f) => f.replace(/\\/g, "/")));
|
|
9080
9122
|
const streamingAnalyses = streamingEnabled ? await buildStreamingWrappersForTree(cwd, routesPath, tree, config2) : new Map;
|
|
9081
|
-
const serverRoutes = generateTypeScript(tree, streamingAnalyses, false);
|
|
9082
|
-
const clientRoutes = generateTypeScript(tree, streamingAnalyses, true);
|
|
9123
|
+
const serverRoutes = generateTypeScript(tree, streamingAnalyses, false, routesImportBase);
|
|
9124
|
+
const clientRoutes = generateTypeScript(tree, streamingAnalyses, true, routesImportBase);
|
|
9083
9125
|
await Bun.write(join12(cwd, OUTPUT_ROUTES), serverRoutes);
|
|
9084
9126
|
await Bun.write(join12(cwd, OUTPUT_ROUTES_CLIENT), clientRoutes);
|
|
9085
9127
|
});
|
|
@@ -9108,7 +9150,7 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9108
9150
|
console.warn("[reroute/gen] Failed to write i18n.json:", error);
|
|
9109
9151
|
}
|
|
9110
9152
|
try {
|
|
9111
|
-
await perfTrack("Content building", () => buildContentChunks(cwd, args, defaultLocale));
|
|
9153
|
+
await perfTrack("Content building", () => buildContentChunks(cwd, args, defaultLocale, paths.routesDir));
|
|
9112
9154
|
if (!showPerformance) {
|
|
9113
9155
|
console.log(`[reroute/gen] Generated content: ${join12(cwd, OUTPUT_CONTENT_TS)} + collections/*.js`);
|
|
9114
9156
|
}
|
|
@@ -9200,12 +9242,12 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9200
9242
|
const ogTemplatePath = config2.ogImage.defaultTemplate.startsWith(".") ? `../${config2.ogImage.defaultTemplate}` : config2.ogImage.defaultTemplate;
|
|
9201
9243
|
indexLines.push(`import OGTemplate from '${ogTemplatePath}';`);
|
|
9202
9244
|
}
|
|
9203
|
-
const ogFiles = await scanOgFiles(join12(cwd,
|
|
9245
|
+
const ogFiles = await scanOgFiles(join12(cwd, paths.routesDir));
|
|
9204
9246
|
const ogImports = [];
|
|
9205
9247
|
for (let i = 0;i < ogFiles.length; i++) {
|
|
9206
9248
|
const ogFile = ogFiles[i];
|
|
9207
9249
|
const importName = `OGRoute${i}`;
|
|
9208
|
-
const importPath =
|
|
9250
|
+
const importPath = `${routesImportBase}/${ogFile.replace(/\.(tsx|ts)$/, "")}`;
|
|
9209
9251
|
indexLines.push(`import ${importName} from '${importPath}';`);
|
|
9210
9252
|
ogImports.push({ path: ogFile, name: importName });
|
|
9211
9253
|
}
|
|
@@ -9246,7 +9288,7 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9246
9288
|
}
|
|
9247
9289
|
indexLines.push("};");
|
|
9248
9290
|
}
|
|
9249
|
-
const templatePath = join12(cwd,
|
|
9291
|
+
const templatePath = join12(cwd, paths.clientDir, "index.html");
|
|
9250
9292
|
try {
|
|
9251
9293
|
const templateContent = await Bun.file(templatePath).text();
|
|
9252
9294
|
indexLines.push("");
|
|
@@ -9313,7 +9355,7 @@ async function generate(cwd, args = [], options = {}) {
|
|
|
9313
9355
|
"",
|
|
9314
9356
|
"import './artifacts.server'; // SSR bundle (eager routes)",
|
|
9315
9357
|
"import './routes'; // Route metadata for compiled binary discovery",
|
|
9316
|
-
|
|
9358
|
+
`import '${importFromReroute(paths.server)}'; // Import user's server entry`
|
|
9317
9359
|
];
|
|
9318
9360
|
await Bun.write(join12(cwd, ".reroute/entry.ts"), entryLines.join(`
|
|
9319
9361
|
`));
|
|
@@ -9526,7 +9568,8 @@ async function startGenWatch(cwd, args) {
|
|
|
9526
9568
|
});
|
|
9527
9569
|
});
|
|
9528
9570
|
}
|
|
9529
|
-
const
|
|
9571
|
+
const watchPaths = resolveAppPaths(loadedConfig);
|
|
9572
|
+
const routesPath = join12(cwd, watchPaths.routesDir);
|
|
9530
9573
|
console.log(`[reroute/watch] \uD83D\uDCC1 Watching ${routesPath}...`);
|
|
9531
9574
|
const routesWatcher = watch(routesPath, { recursive: true }, (_ev, filename) => {
|
|
9532
9575
|
if (!filename)
|
|
@@ -9562,7 +9605,7 @@ async function startGenWatch(cwd, args) {
|
|
|
9562
9605
|
redirectContentOnNegotiate: watchI18n.redirectContentOnNegotiate,
|
|
9563
9606
|
catalogs: watchI18n.catalogs
|
|
9564
9607
|
}, null, 2));
|
|
9565
|
-
await buildContentChunks(cwd, args, watchI18n.defaultLocale);
|
|
9608
|
+
await buildContentChunks(cwd, args, watchI18n.defaultLocale, watchPaths.routesDir);
|
|
9566
9609
|
const contentTime = ((performance.now() - contentStart) / 1000).toFixed(2);
|
|
9567
9610
|
console.log(`[reroute/watch] └─ Content: ${contentTime}s`);
|
|
9568
9611
|
if (loadedConfig.search?.enabled) {
|
|
@@ -9592,7 +9635,7 @@ async function startGenWatch(cwd, args) {
|
|
|
9592
9635
|
});
|
|
9593
9636
|
});
|
|
9594
9637
|
});
|
|
9595
|
-
const clientPath = join12(cwd,
|
|
9638
|
+
const clientPath = join12(cwd, watchPaths.clientDir);
|
|
9596
9639
|
console.log(`[reroute/watch] \uD83D\uDCE6 Watching ${clientPath}...`);
|
|
9597
9640
|
async function rebuildWatchedClient(changed) {
|
|
9598
9641
|
const label = changed.length === 1 ? changed[0] : `${changed.length} files`;
|
|
@@ -9685,7 +9728,7 @@ async function gen(args) {
|
|
|
9685
9728
|
});
|
|
9686
9729
|
process.exit(0);
|
|
9687
9730
|
}
|
|
9688
|
-
var
|
|
9731
|
+
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";
|
|
9689
9732
|
var init_gen = __esm(() => {
|
|
9690
9733
|
init_core();
|
|
9691
9734
|
init_env();
|
|
@@ -104358,9 +104401,9 @@ function setupProcessOutput(box, process2, screen, colorizeLogPrefix2) {
|
|
|
104358
104401
|
screen.render();
|
|
104359
104402
|
});
|
|
104360
104403
|
}
|
|
104361
|
-
function setupTerminalUIHandlers(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix2) {
|
|
104404
|
+
function setupTerminalUIHandlers(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix2, serverEntry = "src/index.ts") {
|
|
104362
104405
|
const genBox = createLogBox(grid, blessed, 0, 0, " reroute gen --watch ", "cyan");
|
|
104363
|
-
const serverBox = createLogBox(grid, blessed, 0, 1,
|
|
104406
|
+
const serverBox = createLogBox(grid, blessed, 0, 1, ` bun --watch ${serverEntry} `, "green");
|
|
104364
104407
|
setupScrollingKeys(genBox, screen);
|
|
104365
104408
|
setupScrollingKeys(serverBox, screen);
|
|
104366
104409
|
setupMouseSupport(genBox, screen);
|
|
@@ -104457,7 +104500,8 @@ async function startTui(port) {
|
|
|
104457
104500
|
genProcess.kill();
|
|
104458
104501
|
process.exit(1);
|
|
104459
104502
|
});
|
|
104460
|
-
const
|
|
104503
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104504
|
+
const serverProcess = spawn("bun", ["--watch", server2], {
|
|
104461
104505
|
stdio: ["ignore", "pipe", "pipe"],
|
|
104462
104506
|
env: {
|
|
104463
104507
|
...process.env,
|
|
@@ -104488,13 +104532,14 @@ async function startTui(port) {
|
|
|
104488
104532
|
screen
|
|
104489
104533
|
});
|
|
104490
104534
|
const { setupTerminalUIHandlers: setupTerminalUIHandlers2 } = await Promise.resolve().then(() => exports_terminal_ui);
|
|
104491
|
-
setupTerminalUIHandlers2(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix);
|
|
104535
|
+
setupTerminalUIHandlers2(screen, grid, genProcess, serverProcess, outputBuffer, blessed, colorizeLogPrefix, server2);
|
|
104492
104536
|
}
|
|
104493
104537
|
async function startDefault(port) {
|
|
104494
104538
|
process.env.PORT = String(port);
|
|
104495
104539
|
process.env.REROUTE_DEV = "1";
|
|
104496
104540
|
const session = await startGenWatch(process.cwd(), ["--watch"]);
|
|
104497
|
-
const
|
|
104541
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104542
|
+
const entry = join14(process.cwd(), server2);
|
|
104498
104543
|
if (!existsSync7(entry)) {
|
|
104499
104544
|
session.close();
|
|
104500
104545
|
throw new Error(`[reroute/dev] Missing ${entry}`);
|
|
@@ -104548,6 +104593,7 @@ async function dev(args) {
|
|
|
104548
104593
|
}
|
|
104549
104594
|
}
|
|
104550
104595
|
var init_dev = __esm(() => {
|
|
104596
|
+
init_core();
|
|
104551
104597
|
init_gen();
|
|
104552
104598
|
init_command();
|
|
104553
104599
|
init_log();
|
|
@@ -104634,7 +104680,8 @@ async function start(args) {
|
|
|
104634
104680
|
`));
|
|
104635
104681
|
process.stdout.write(`${colorizeLogPrefixAnsi("[reroute/start] Starting server...")}
|
|
104636
104682
|
`);
|
|
104637
|
-
const
|
|
104683
|
+
const { server: server2 } = resolveAppPaths(await loadConfig(process.cwd()));
|
|
104684
|
+
const serverProcess = spawn2("bun", [server2], {
|
|
104638
104685
|
stdio: ["ignore", "pipe", "pipe"],
|
|
104639
104686
|
env: {
|
|
104640
104687
|
...process.env,
|
|
@@ -104690,6 +104737,7 @@ async function start(args) {
|
|
|
104690
104737
|
}
|
|
104691
104738
|
}
|
|
104692
104739
|
var init_start = __esm(() => {
|
|
104740
|
+
init_core();
|
|
104693
104741
|
init_log();
|
|
104694
104742
|
});
|
|
104695
104743
|
|
|
@@ -104850,10 +104898,8 @@ async function runGenCommand(rerouteCmd, useShell, noCompression) {
|
|
|
104850
104898
|
}
|
|
104851
104899
|
async function copyAssets(cwd) {
|
|
104852
104900
|
const config2 = await loadConfig(cwd);
|
|
104853
|
-
const
|
|
104854
|
-
const
|
|
104855
|
-
const assetsPath = dirname8(appSrc);
|
|
104856
|
-
const sourceAssetsDir = join17(cwd, assetsPath, "assets");
|
|
104901
|
+
const { assetsDir } = resolveAppPaths(config2);
|
|
104902
|
+
const sourceAssetsDir = join17(cwd, assetsDir);
|
|
104857
104903
|
const rerouteAssetsDir = join17(cwd, ".reroute", "assets");
|
|
104858
104904
|
process.stdout.write(colorizeLogPrefixAnsi(`[reroute/build] Copying assets...
|
|
104859
104905
|
`));
|
|
@@ -105049,7 +105095,7 @@ async function findBundles(cwd) {
|
|
|
105049
105095
|
}
|
|
105050
105096
|
async function findBrowserEntry(cwd) {
|
|
105051
105097
|
try {
|
|
105052
|
-
const clientDir = join18(cwd,
|
|
105098
|
+
const clientDir = join18(cwd, resolveAppPaths(await loadConfig(cwd)).clientDir);
|
|
105053
105099
|
const tsxEntry = join18(clientDir, "index.tsx");
|
|
105054
105100
|
const tsEntry = join18(clientDir, "index.ts");
|
|
105055
105101
|
let sourceEntry = null;
|
|
@@ -107065,7 +107111,7 @@ async function analyze(args) {
|
|
|
107065
107111
|
let entry = null;
|
|
107066
107112
|
let depTree = null;
|
|
107067
107113
|
let mainInfo = null;
|
|
107068
|
-
const srcEntry = join18(cwd,
|
|
107114
|
+
const srcEntry = join18(cwd, resolveAppPaths(await loadConfig(cwd)).server);
|
|
107069
107115
|
if (existsSync11(srcEntry)) {
|
|
107070
107116
|
console.log(colorizeLogPrefixAnsi(`[reroute/analyze] Building server binary for analysis...
|
|
107071
107117
|
`));
|
|
@@ -107184,6 +107230,7 @@ async function analyze(args) {
|
|
|
107184
107230
|
}
|
|
107185
107231
|
var ASCII_TABLE_CHARS;
|
|
107186
107232
|
var init_analyze = __esm(() => {
|
|
107233
|
+
init_core();
|
|
107187
107234
|
init_log();
|
|
107188
107235
|
ASCII_TABLE_CHARS = {
|
|
107189
107236
|
top: "-",
|
|
@@ -107340,7 +107387,7 @@ async function findRoutesWithOG(cwd) {
|
|
|
107340
107387
|
}
|
|
107341
107388
|
} catch {
|
|
107342
107389
|
console.warn("⚠️ .reroute/manifest.json not found, scanning routes directory...");
|
|
107343
|
-
const routesPath = join19(cwd,
|
|
107390
|
+
const routesPath = join19(cwd, resolveAppPaths(await loadConfig(cwd)).routesDir);
|
|
107344
107391
|
await scanForOgTemplates(routesPath, "", routes);
|
|
107345
107392
|
await addContentRoutes(routesPath, routes);
|
|
107346
107393
|
}
|
|
@@ -107378,7 +107425,7 @@ ogImage: {
|
|
|
107378
107425
|
console.error("❌ No routes found for OG image generation");
|
|
107379
107426
|
console.log(`
|
|
107380
107427
|
Make sure you have:`);
|
|
107381
|
-
console.log(
|
|
107428
|
+
console.log(` 1. Routes defined in ${resolveAppPaths(config2).routesDir}/`);
|
|
107382
107429
|
console.log(" 2. Run `reroute dev` or `reroute build` first to generate .reroute/manifest.json");
|
|
107383
107430
|
console.log(`
|
|
107384
107431
|
Or create [og].tsx files in your routes for custom OG templates.`);
|
|
@@ -107483,7 +107530,6 @@ Or create [og].tsx files in your routes for custom OG templates.`);
|
|
|
107483
107530
|
list.focus();
|
|
107484
107531
|
screen.render();
|
|
107485
107532
|
}
|
|
107486
|
-
var ROUTES_DIR2 = "src/client/routes";
|
|
107487
107533
|
var init_og2 = __esm(() => {
|
|
107488
107534
|
init_core();
|
|
107489
107535
|
});
|
|
@@ -107592,7 +107638,7 @@ async function getVersionString2() {
|
|
|
107592
107638
|
}
|
|
107593
107639
|
async function getVersion2() {
|
|
107594
107640
|
if (true) {
|
|
107595
|
-
return "1.0.0-alpha.
|
|
107641
|
+
return "1.0.0-alpha.19";
|
|
107596
107642
|
}
|
|
107597
107643
|
const possiblePaths = [
|
|
107598
107644
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -107609,10 +107655,10 @@ async function getVersion2() {
|
|
|
107609
107655
|
}
|
|
107610
107656
|
async function getCommit2() {
|
|
107611
107657
|
if (true) {
|
|
107612
|
-
return "
|
|
107658
|
+
return "2cc62d6";
|
|
107613
107659
|
}
|
|
107614
107660
|
return "dev";
|
|
107615
107661
|
}
|
|
107616
107662
|
main();
|
|
107617
107663
|
|
|
107618
|
-
//# debugId=
|
|
107664
|
+
//# debugId=DAE9B5FCCE76ACB064756E2164756E21
|