reroute-js 1.0.0-alpha.33 → 1.0.0-alpha.34
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 +1 -0
- package/cli/bin.d.ts +1 -1
- package/cli/bin.js +137 -78
- package/cli/bin.js.map +9 -8
- package/cli/index.d.ts +1 -1
- package/cli/index.js +15 -7
- package/cli/index.js.map +5 -5
- 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/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/images.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/prerender.d.ts +1 -1
- package/cli/src/commands/lib/production.d.ts +1 -1
- package/cli/src/commands/lib/routes.d.ts +40 -0
- package/cli/src/commands/lib/routes.d.ts.map +1 -0
- package/cli/src/commands/lib/server.d.ts +1 -1
- package/cli/src/commands/lib/static.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/supervise.d.ts +1 -1
- package/cli/src/commands/lib/terminal-ui.d.ts +1 -1
- package/cli/src/commands/lib/theme.d.ts +1 -1
- package/cli/src/commands/lib/version.d.ts +1 -1
- package/cli/src/commands/lib/watch.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/commands/static-render.d.ts +1 -1
- package/cli/src/index.d.ts +1 -1
- package/core/index.d.ts +1 -1
- package/core/index.js +26 -10
- package/core/index.js.map +6 -6
- package/core/src/app-paths.d.ts +1 -1
- package/core/src/bundler/hash.d.ts +1 -1
- package/core/src/bundler/index.d.ts +1 -1
- package/core/src/config.d.ts +1 -1
- package/core/src/content/discovery.d.ts +1 -1
- package/core/src/content/index.d.ts +1 -1
- package/core/src/content/metadata.d.ts +1 -1
- package/core/src/i18n/catalog.d.ts +1 -1
- package/core/src/i18n/discover.d.ts +1 -1
- package/core/src/i18n/index.d.ts +1 -1
- package/core/src/i18n/messages.d.ts +1 -1
- package/core/src/i18n/negotiate.d.ts +1 -1
- package/core/src/i18n/pathname.d.ts +1 -1
- package/core/src/i18n/resolve.d.ts +1 -1
- package/core/src/i18n/types.d.ts +1 -1
- package/core/src/image.d.ts +1 -1
- package/core/src/index.d.ts +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/layouts.d.ts.map +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 +10 -2
- package/core/src/ssr/lib/layouts.d.ts.map +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 +26 -10
- package/elysia/index.js.map +6 -6
- 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/devReload.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/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 +12 -4
- package/react/index.js.map +4 -4
- 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 +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 +2 -1
- package/react/src/lib/index.d.ts.map +1 -1
- package/react/src/lib/layouts.d.ts +11 -1
- package/react/src/lib/layouts.d.ts.map +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/lib/static-data.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 +13 -5
- package/telemetry/server.js.map +5 -5
- package/telemetry/src/react/api.d.ts +1 -1
- package/telemetry/src/react/context.d.ts +1 -1
- package/telemetry/src/react/index.d.ts +1 -1
- package/telemetry/src/react/telemetry.d.ts +1 -1
- package/telemetry/src/server/context.d.ts +1 -1
- package/telemetry/src/server/headers/extractor.d.ts +1 -1
- package/telemetry/src/server/headers/index.d.ts +1 -1
- package/telemetry/src/server/headers/presets.d.ts +1 -1
- package/telemetry/src/server/index.d.ts +1 -1
- package/telemetry/src/server/instrumentation.d.ts +1 -1
- package/telemetry/src/server/plugin.d.ts +1 -1
- package/telemetry/src/server/sourcemap.d.ts +1 -1
package/README.md
CHANGED
|
@@ -130,6 +130,7 @@ Reroute is a feature-rich file-based routing framework for building fullstack Re
|
|
|
130
130
|
- `<Link>` - Client-side navigation with automatic prefetching (localizes content hrefs)
|
|
131
131
|
- `<Image>` - Optimized images with automatic format negotiation and lazy loading
|
|
132
132
|
- `<Outlet>` - Render nested route components
|
|
133
|
+
- Route groups - `routes/(app)/[layout].tsx` wraps the routes in `(app)/` with one layout, no URL segment
|
|
133
134
|
- `<ContentRoute>` - Dynamic content rendering with metadata injection
|
|
134
135
|
- `<ClientOnly>` - Client-side only rendering with optional layout preservation (className/style props)
|
|
135
136
|
- 🎭 **Providers**:
|
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.34
|
|
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.34";
|
|
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 "6ce1c35";
|
|
90
90
|
}
|
|
91
91
|
return "dev";
|
|
92
92
|
}
|
|
@@ -1908,10 +1908,17 @@ function layoutCovers(pattern, pathname) {
|
|
|
1908
1908
|
return true;
|
|
1909
1909
|
return pathname === base || pathname.startsWith(`${base}/`);
|
|
1910
1910
|
}
|
|
1911
|
-
function
|
|
1911
|
+
function layoutWraps(layout, pathname, routePattern) {
|
|
1912
|
+
if (Array.isArray(layout?.routes)) {
|
|
1913
|
+
return routePattern !== undefined && layout.routes.includes(routePattern);
|
|
1914
|
+
}
|
|
1915
|
+
return layoutCovers(String(layout?.pattern || "/"), pathname);
|
|
1916
|
+
}
|
|
1917
|
+
function getMatchingLayouts(pathname, layouts, routes) {
|
|
1912
1918
|
if (!Array.isArray(layouts))
|
|
1913
1919
|
return [];
|
|
1914
|
-
|
|
1920
|
+
const routePattern = Array.isArray(routes) ? matchRoutes(routes, pathname)?.route.pattern : undefined;
|
|
1921
|
+
return layouts.filter((layout) => layoutWraps(layout, pathname, routePattern)).sort((a, b) => {
|
|
1915
1922
|
const aDepth = getPatternDepth(a?.pattern);
|
|
1916
1923
|
const bDepth = getPatternDepth(b?.pattern);
|
|
1917
1924
|
return aDepth - bDepth;
|
|
@@ -1926,6 +1933,7 @@ function createLayoutCacheKey(pattern, pathname) {
|
|
|
1926
1933
|
function createLayoutDataKey(pattern) {
|
|
1927
1934
|
return `__layout:${pattern}`;
|
|
1928
1935
|
}
|
|
1936
|
+
var init_layouts = () => {};
|
|
1929
1937
|
|
|
1930
1938
|
// packages/core/src/ssr/lib/compute/layouts.ts
|
|
1931
1939
|
async function loadLayoutSSRExport(layout, clientDir, isWatchMode) {
|
|
@@ -2025,7 +2033,8 @@ async function computeLayoutData(pathname, clientDir, _cwd, isWatchMode, options
|
|
|
2025
2033
|
const maxAgeMs = maxAge * 1000;
|
|
2026
2034
|
try {
|
|
2027
2035
|
const layouts = routesModule?.layouts;
|
|
2028
|
-
const
|
|
2036
|
+
const routes = routesModule?.routes;
|
|
2037
|
+
const matchingLayouts = getMatchingLayouts(pathname, layouts, routes);
|
|
2029
2038
|
for (const layout of matchingLayouts) {
|
|
2030
2039
|
try {
|
|
2031
2040
|
const layoutStatus = await processLayout(layout, pathname, clientDir, isWatchMode, streaming, maxAgeMs, searchParams, ssrData, pendingTasks, options.headers);
|
|
@@ -2052,9 +2061,10 @@ function mergeLayoutData(ssrData, pathname) {
|
|
|
2052
2061
|
ssrData[pathname] = layoutData;
|
|
2053
2062
|
}
|
|
2054
2063
|
}
|
|
2055
|
-
var
|
|
2064
|
+
var init_layouts2 = __esm(() => {
|
|
2056
2065
|
init_cache();
|
|
2057
2066
|
init_imports();
|
|
2067
|
+
init_layouts();
|
|
2058
2068
|
});
|
|
2059
2069
|
|
|
2060
2070
|
// packages/core/src/ssr/lib/compute/routes.ts
|
|
@@ -2346,10 +2356,10 @@ function setGlobalSSRData(data) {
|
|
|
2346
2356
|
var init_compute = __esm(() => {
|
|
2347
2357
|
init_imports();
|
|
2348
2358
|
init_content2();
|
|
2349
|
-
|
|
2359
|
+
init_layouts2();
|
|
2350
2360
|
init_routes();
|
|
2351
2361
|
init_content2();
|
|
2352
|
-
|
|
2362
|
+
init_layouts2();
|
|
2353
2363
|
init_routes();
|
|
2354
2364
|
});
|
|
2355
2365
|
|
|
@@ -2661,12 +2671,14 @@ async function loadLayoutData(pathname, clientDir, cwd, isWatchMode, searchParam
|
|
|
2661
2671
|
const allData = {};
|
|
2662
2672
|
try {
|
|
2663
2673
|
let layouts = globalThis.__REROUTE_LAYOUTS__;
|
|
2674
|
+
let routes = globalThis.__REROUTE_ROUTES__;
|
|
2664
2675
|
if (!layouts) {
|
|
2665
2676
|
const routesPath = join2(cwd, ".reroute", "routes.ts");
|
|
2666
2677
|
const m = await dynamicImport(routesPath, isWatchMode);
|
|
2667
2678
|
layouts = m?.layouts;
|
|
2679
|
+
routes = m?.routes;
|
|
2668
2680
|
}
|
|
2669
|
-
const matchingLayouts = getMatchingLayouts(pathname, layouts);
|
|
2681
|
+
const matchingLayouts = getMatchingLayouts(pathname, layouts, routes);
|
|
2670
2682
|
for (const layout of matchingLayouts) {
|
|
2671
2683
|
const result = await processLayout2(layout, pathname, clientDir, isWatchMode, searchParams);
|
|
2672
2684
|
if (result) {
|
|
@@ -2688,6 +2700,7 @@ function createLazyMarker(pathname, key) {
|
|
|
2688
2700
|
var init_data = __esm(() => {
|
|
2689
2701
|
init_content_path();
|
|
2690
2702
|
init_imports();
|
|
2703
|
+
init_layouts();
|
|
2691
2704
|
init_seed();
|
|
2692
2705
|
});
|
|
2693
2706
|
|
|
@@ -3153,7 +3166,7 @@ ${ssrHead}`);
|
|
|
3153
3166
|
async function extractLayoutMetadata(pathname, clientDir, cwd, isWatchMode, addHead, setLang, ogConfig, titleSuffix) {
|
|
3154
3167
|
try {
|
|
3155
3168
|
const m = await loadRoutesModule(cwd, isWatchMode);
|
|
3156
|
-
const matchingLayouts = getMatchingLayouts(pathname, m?.layouts);
|
|
3169
|
+
const matchingLayouts = getMatchingLayouts(pathname, m?.layouts, m?.routes);
|
|
3157
3170
|
for (const layout of matchingLayouts) {
|
|
3158
3171
|
await processLayoutForMetadata(layout, clientDir, isWatchMode, addHead, setLang, ogConfig, titleSuffix);
|
|
3159
3172
|
}
|
|
@@ -3472,6 +3485,7 @@ var init_metadata2 = __esm(() => {
|
|
|
3472
3485
|
init_compute();
|
|
3473
3486
|
init_content_path();
|
|
3474
3487
|
init_imports();
|
|
3488
|
+
init_layouts();
|
|
3475
3489
|
});
|
|
3476
3490
|
|
|
3477
3491
|
// packages/core/src/ssr/lib/preload.ts
|
|
@@ -4196,6 +4210,7 @@ var init_lib = __esm(() => {
|
|
|
4196
4210
|
init_compute();
|
|
4197
4211
|
init_html();
|
|
4198
4212
|
init_imports();
|
|
4213
|
+
init_layouts();
|
|
4199
4214
|
init_metadata2();
|
|
4200
4215
|
init_modules();
|
|
4201
4216
|
init_preload();
|
|
@@ -7113,6 +7128,7 @@ __export(exports_core, {
|
|
|
7113
7128
|
isThenable: () => isThenable,
|
|
7114
7129
|
join: () => join2,
|
|
7115
7130
|
layoutCovers: () => layoutCovers,
|
|
7131
|
+
layoutWraps: () => layoutWraps,
|
|
7116
7132
|
listContentFiles: () => listContentFiles,
|
|
7117
7133
|
llmsAlternateLinkTag: () => llmsAlternateLinkTag,
|
|
7118
7134
|
loadCollections: () => loadCollections,
|
|
@@ -8070,6 +8086,109 @@ function isProductionMode(args = []) {
|
|
|
8070
8086
|
return hasProdFlag(args);
|
|
8071
8087
|
}
|
|
8072
8088
|
|
|
8089
|
+
// packages/cli/src/commands/lib/routes.ts
|
|
8090
|
+
function isRouteGroup(segment) {
|
|
8091
|
+
return groupSegment.test(segment);
|
|
8092
|
+
}
|
|
8093
|
+
function withoutGroups(routePath) {
|
|
8094
|
+
return routePath.split("/").filter((segment) => segment !== "" && !isRouteGroup(segment)).join("/");
|
|
8095
|
+
}
|
|
8096
|
+
function dirOf(filePath) {
|
|
8097
|
+
return filePath.split("/").slice(0, -1).join("/");
|
|
8098
|
+
}
|
|
8099
|
+
function inGroup(dir) {
|
|
8100
|
+
return dir.split("/").some(isRouteGroup);
|
|
8101
|
+
}
|
|
8102
|
+
function fileToRoute(filePath) {
|
|
8103
|
+
const isLayout = filePath.endsWith("[layout].tsx") || filePath.endsWith("[layout].ts") || filePath.endsWith("[layout].md") || filePath.endsWith("[layout].mdx");
|
|
8104
|
+
const dir = dirOf(filePath);
|
|
8105
|
+
let routePath = filePath.replace(/\.(tsx|ts|md|mdx)$/, "");
|
|
8106
|
+
if (isLayout) {
|
|
8107
|
+
const pattern2 = routePath.replace(/\[layout\]$/, "").replace(/\/$/, "");
|
|
8108
|
+
const normalizedPattern2 = pattern2 === "" ? "/" : `/${pattern2}`;
|
|
8109
|
+
return {
|
|
8110
|
+
path: routePath,
|
|
8111
|
+
pattern: normalizedPattern2,
|
|
8112
|
+
filePath,
|
|
8113
|
+
isLayout,
|
|
8114
|
+
isDynamic: false,
|
|
8115
|
+
params: [],
|
|
8116
|
+
isNotFound: false,
|
|
8117
|
+
dir
|
|
8118
|
+
};
|
|
8119
|
+
}
|
|
8120
|
+
routePath = routePath.replace(/\/index$/, "").replace(/^index$/, "");
|
|
8121
|
+
const params = [];
|
|
8122
|
+
const pattern = withoutGroups(routePath).replace(/\[([^\]]+)\]/g, (_, param) => {
|
|
8123
|
+
params.push(param);
|
|
8124
|
+
return `:${param}`;
|
|
8125
|
+
});
|
|
8126
|
+
const normalizedPattern = pattern === "" ? "/" : `/${pattern}`;
|
|
8127
|
+
const isNotFound = /(^|\/)\[404\]$/.test(routePath);
|
|
8128
|
+
let notFoundBasePattern;
|
|
8129
|
+
if (isNotFound) {
|
|
8130
|
+
const base = withoutGroups(routePath.replace(/(^|\/)\[404\]$/, ""));
|
|
8131
|
+
notFoundBasePattern = base ? `/${base}` : "/";
|
|
8132
|
+
}
|
|
8133
|
+
return {
|
|
8134
|
+
path: routePath,
|
|
8135
|
+
pattern: normalizedPattern,
|
|
8136
|
+
filePath,
|
|
8137
|
+
isLayout: false,
|
|
8138
|
+
isDynamic: params.length > 0,
|
|
8139
|
+
params,
|
|
8140
|
+
isNotFound,
|
|
8141
|
+
notFoundBasePattern,
|
|
8142
|
+
dir
|
|
8143
|
+
};
|
|
8144
|
+
}
|
|
8145
|
+
function sortRoutes(routes) {
|
|
8146
|
+
return routes.sort((a, b) => compareRouteSpecificity(a, b));
|
|
8147
|
+
}
|
|
8148
|
+
function assertUniquePatterns(routes) {
|
|
8149
|
+
const seen = new Map;
|
|
8150
|
+
for (const route of routes) {
|
|
8151
|
+
const other = seen.get(route.pattern);
|
|
8152
|
+
if (other) {
|
|
8153
|
+
throw new Error(`Routes ${other} and ${route.filePath} both serve ${route.pattern}`);
|
|
8154
|
+
}
|
|
8155
|
+
seen.set(route.pattern, route.filePath);
|
|
8156
|
+
}
|
|
8157
|
+
}
|
|
8158
|
+
function routesUnder(dir, routes) {
|
|
8159
|
+
return routes.filter((route) => route.dir === dir || route.dir.startsWith(`${dir}/`)).map((route) => route.pattern);
|
|
8160
|
+
}
|
|
8161
|
+
function generateRouteTree(files) {
|
|
8162
|
+
const routes = [];
|
|
8163
|
+
const layouts2 = [];
|
|
8164
|
+
const notFoundRoutes = [];
|
|
8165
|
+
for (const file of files) {
|
|
8166
|
+
const route = fileToRoute(file);
|
|
8167
|
+
if (route.isLayout) {
|
|
8168
|
+
layouts2.push(route);
|
|
8169
|
+
} else if (route.isNotFound) {
|
|
8170
|
+
notFoundRoutes.push(route);
|
|
8171
|
+
} else {
|
|
8172
|
+
routes.push(route);
|
|
8173
|
+
}
|
|
8174
|
+
}
|
|
8175
|
+
assertUniquePatterns(routes);
|
|
8176
|
+
for (const layout of layouts2) {
|
|
8177
|
+
if (inGroup(layout.dir))
|
|
8178
|
+
layout.routes = routesUnder(layout.dir, routes);
|
|
8179
|
+
}
|
|
8180
|
+
return {
|
|
8181
|
+
routes: sortRoutes(routes),
|
|
8182
|
+
layouts: layouts2,
|
|
8183
|
+
notFoundRoutes
|
|
8184
|
+
};
|
|
8185
|
+
}
|
|
8186
|
+
var groupSegment;
|
|
8187
|
+
var init_routes2 = __esm(() => {
|
|
8188
|
+
init_core();
|
|
8189
|
+
groupSegment = /^\(.+\)$/;
|
|
8190
|
+
});
|
|
8191
|
+
|
|
8073
8192
|
// packages/cli/src/commands/lib/streaming/analyzer.ts
|
|
8074
8193
|
import { dirname as dirname4, join as join10 } from "node:path";
|
|
8075
8194
|
function hasSSRDataExport(source) {
|
|
@@ -8606,69 +8725,6 @@ async function scanOgFiles(dir, base = "") {
|
|
|
8606
8725
|
}
|
|
8607
8726
|
return files;
|
|
8608
8727
|
}
|
|
8609
|
-
function fileToRoute(filePath) {
|
|
8610
|
-
const isLayout = filePath.endsWith("[layout].tsx") || filePath.endsWith("[layout].ts") || filePath.endsWith("[layout].md") || filePath.endsWith("[layout].mdx");
|
|
8611
|
-
let routePath = filePath.replace(/\.(tsx|ts|md|mdx)$/, "");
|
|
8612
|
-
if (isLayout) {
|
|
8613
|
-
const pattern2 = routePath.replace(/\[layout\]$/, "").replace(/\/$/, "");
|
|
8614
|
-
const normalizedPattern2 = pattern2 === "" ? "/" : `/${pattern2}`;
|
|
8615
|
-
return {
|
|
8616
|
-
path: routePath,
|
|
8617
|
-
pattern: normalizedPattern2,
|
|
8618
|
-
filePath,
|
|
8619
|
-
isLayout,
|
|
8620
|
-
isDynamic: false,
|
|
8621
|
-
params: [],
|
|
8622
|
-
isNotFound: false
|
|
8623
|
-
};
|
|
8624
|
-
}
|
|
8625
|
-
routePath = routePath.replace(/\/index$/, "").replace(/^index$/, "");
|
|
8626
|
-
const params = [];
|
|
8627
|
-
const pattern = routePath.replace(/\[([^\]]+)\]/g, (_, param) => {
|
|
8628
|
-
params.push(param);
|
|
8629
|
-
return `:${param}`;
|
|
8630
|
-
});
|
|
8631
|
-
const normalizedPattern = pattern === "" ? "/" : `/${pattern}`;
|
|
8632
|
-
const isNotFound = /(^|\/)\[404\]$/.test(routePath);
|
|
8633
|
-
let notFoundBasePattern;
|
|
8634
|
-
if (isNotFound) {
|
|
8635
|
-
const base = routePath.replace(/(^|\/)\[404\]$/, "").replace(/\/$/, "");
|
|
8636
|
-
notFoundBasePattern = base ? `/${base}` : "/";
|
|
8637
|
-
}
|
|
8638
|
-
return {
|
|
8639
|
-
path: routePath,
|
|
8640
|
-
pattern: normalizedPattern,
|
|
8641
|
-
filePath,
|
|
8642
|
-
isLayout: false,
|
|
8643
|
-
isDynamic: params.length > 0,
|
|
8644
|
-
params,
|
|
8645
|
-
isNotFound,
|
|
8646
|
-
notFoundBasePattern
|
|
8647
|
-
};
|
|
8648
|
-
}
|
|
8649
|
-
function sortRoutes(routes) {
|
|
8650
|
-
return routes.sort((a, b) => compareRouteSpecificity(a, b));
|
|
8651
|
-
}
|
|
8652
|
-
function generateRouteTree(files) {
|
|
8653
|
-
const routes = [];
|
|
8654
|
-
const layouts2 = [];
|
|
8655
|
-
const notFoundRoutes = [];
|
|
8656
|
-
for (const file of files) {
|
|
8657
|
-
const route = fileToRoute(file);
|
|
8658
|
-
if (route.isLayout) {
|
|
8659
|
-
layouts2.push(route);
|
|
8660
|
-
} else if (route.isNotFound) {
|
|
8661
|
-
notFoundRoutes.push(route);
|
|
8662
|
-
} else {
|
|
8663
|
-
routes.push(route);
|
|
8664
|
-
}
|
|
8665
|
-
}
|
|
8666
|
-
return {
|
|
8667
|
-
routes: sortRoutes(routes),
|
|
8668
|
-
layouts: layouts2,
|
|
8669
|
-
notFoundRoutes
|
|
8670
|
-
};
|
|
8671
|
-
}
|
|
8672
8728
|
function getImportPath(filePath, streamingMap, routesImportBase) {
|
|
8673
8729
|
const isMarkdown = /\.(md|mdx)$/.test(filePath);
|
|
8674
8730
|
if (isMarkdown) {
|
|
@@ -8746,9 +8802,11 @@ const Layout${i}Meta = _meta(Layout${i}Module);`)
|
|
|
8746
8802
|
}).join(`
|
|
8747
8803
|
`);
|
|
8748
8804
|
const layoutsArray = tree.layouts.map((l, i) => {
|
|
8805
|
+
const scope = l.routes ? `
|
|
8806
|
+
routes: ${JSON.stringify(l.routes)},` : "";
|
|
8749
8807
|
return ` {
|
|
8750
8808
|
pattern: "${l.pattern}",
|
|
8751
|
-
path: "${l.path}"
|
|
8809
|
+
path: "${l.path}",${scope}
|
|
8752
8810
|
component: Layout${i},
|
|
8753
8811
|
ssr: Layout${i}SSR,
|
|
8754
8812
|
meta: Layout${i}Meta,
|
|
@@ -10266,6 +10324,7 @@ var init_gen = __esm(() => {
|
|
|
10266
10324
|
init_env();
|
|
10267
10325
|
init_images();
|
|
10268
10326
|
init_markdown();
|
|
10327
|
+
init_routes2();
|
|
10269
10328
|
init_analyzer();
|
|
10270
10329
|
init_suspense();
|
|
10271
10330
|
init_theme();
|
|
@@ -108620,7 +108679,7 @@ async function getVersionString2() {
|
|
|
108620
108679
|
}
|
|
108621
108680
|
async function getVersion2() {
|
|
108622
108681
|
if (true) {
|
|
108623
|
-
return "1.0.0-alpha.
|
|
108682
|
+
return "1.0.0-alpha.34";
|
|
108624
108683
|
}
|
|
108625
108684
|
const possiblePaths = [
|
|
108626
108685
|
path3.join(import.meta.dir, "../../../package.json"),
|
|
@@ -108637,10 +108696,10 @@ async function getVersion2() {
|
|
|
108637
108696
|
}
|
|
108638
108697
|
async function getCommit2() {
|
|
108639
108698
|
if (true) {
|
|
108640
|
-
return "
|
|
108699
|
+
return "6ce1c35";
|
|
108641
108700
|
}
|
|
108642
108701
|
return "dev";
|
|
108643
108702
|
}
|
|
108644
108703
|
main();
|
|
108645
108704
|
|
|
108646
|
-
//# debugId=
|
|
108705
|
+
//# debugId=402DEFEEFB03DEC964756E2164756E21
|