mirror of
https://github.com/cloudflare/vinext.git
synced 2026-09-14 19:04:59 +08:00
b4c829d6a2
* test(interception): add failing sibling-interception graph tests * feat(routing): discover sibling-style interception markers * feat(routing): emit sibling interception manifest facts * feat(app-router): serialize sibling intercepts in route manifest * feat(app-router): match sibling intercepts in route matcher * feat(app-router): render sibling intercept as full page response * test: add siblingIntercepts field to AppRoute test fixtures * test(interception): add sibling interception fixtures * fix(app-router): emit null proof for sibling intercepts to bypass slot-validation * test(interception): add sibling interception e2e specs * fix(interception): correct (...)→(..)(..) marker in interception-from-root fixture * fix(interception): resolve sourceRouteIndex to slot-owner route in intercept lookup When a route inherits a @slot from an ancestor via discoverInheritedParallelSlots, the inherited slot's interceptingRoutes are copied from the ancestor. Previously, createInterceptLookup used routeIndex (the inheriting descendant's index) as sourceRouteIndex, causing resolveAppPageInterceptState to see sourceRoute === currentRoute → kind='current-route' instead of kind='source-route'. Fix: build a patternToIndex map and resolve sourceRouteIndex via the intercept's sourceMatchPattern (which names the actual slot-owner route), falling back to routeIndex only when no match is found. * fix(interception): use locale-prefixed href so middleware interception fires correctly * fix(interception): address codex review issues in sibling intercept implementation - Pass effectiveParams to resolveAppPageHead so generateMetadata/generateViewport sees the intercepted route's params instead of the source route's params - Rename SIBLING_INTERCEPT_SLOT_NAME from __page to __vinext_sibling_intercept to prevent collision with a user @__page parallel route directory - Restore middleware-rewrite fixture link without locale prefix so the interception-dynamic-segment-middleware spec exercises the intended middleware rewrite path * fix(test): update slotId assertions and restore locale-prefixed fixture link - Update test assertions from slot:__page to slot:__vinext_sibling_intercept following the rename in commit2248b8fe- Restore locale-prefixed href in interception-mw fixture so the interception-dynamic-segment-middleware E2E tests pass (reverts the accidental revert from2248b8feback to the working state from02e80c26) * fix(interception): address review findings on sibling interception PR - Restore locale-less href in interception-mw fixture and fix the underlying middleware-rewrite interception gap: add a Referer-based fallback in app-rsc-handler so interception fires when middleware rewrites the URL before the server matches it (the client-side manifest check sees the pre-rewrite target and skips setting the interception context header; the Referer carries the source page the server needs) - Apply interceptLayouts for sibling intercepts in buildPageElements so a layout.tsx under the interception marker dir wraps the intercepting page, matching Next.js segment-layout wrapping behaviour; add fixture layout and E2E assertion - Add unit test proving findOwnerRouteForDir ancestor walk attaches a sibling intercept to the nearest ancestor route when the marker's parent dir has no page.tsx (not dropped silently) * fix(interception): send current pathname as fallback interception context The client-side manifest check compares the pre-middleware target URL against declared interception patterns. When middleware rewrites the URL (e.g. /foo/p/1 → /en/foo/p/1), the pre-rewrite URL has fewer segments and doesn't match the pattern, so no X-Vinext-Interception-Context header is sent and the server cannot fire interception. Fix: when the manifest check yields no match and there is no prior intercepted navigation in browser state, fall back to sending the current page pathname as the interception context. This mirrors Next.js sending Next-URL on every RSC navigation. The server's findIntercept is double-gated on both source and target matching, so false positives cannot occur. The previousNextUrl is also populated so back/forward traversal can restore intercepted state. Revert the Referer-based server-side fallback (unreliable across environments) in favour of this explicit browser-side fix. * fix(interception): gate middleware-rewrite fallback on declared source pattern The previous fix sent window.location.pathname as fallback interception context on every unmatched navigation, which broke prefetch cache reuse: a prefetch stored with null context wouldn't be found when the navigation used a non-null context key. Refine the fallback to only fire when the current page URL matches at least one sourcePatternParts declared in the route manifest — i.e., the current page is a known interception source. This preserves prefetch cache reuse for ordinary navigations while still enabling middleware- rewrite interception for pages that declare an interception relationship. * fix(interception): support middleware-rewrite targets in fallback context and planner The previous fallback-context gate only checked whether the current page is a declared interception source; it did not verify the target URL could plausibly be a middleware-rewritten version of the declared target pattern. This meant the client sent interception context when it shouldn't (pre-middleware target had no static anchors in common with the pattern) and the planner hard-navigated when the proof target matched only after the rewrite. Three coordinated fixes: 1. Client fallback gate (app-browser-entry / app-browser-interception-context): replace the broad source-only check with matchRoutePatternWithOptionalDynamicSegments on the target side — the pre-middleware URL must still share every static anchor of the declared target pattern, in order, while allowing dynamic segments to be absent. 2. Planner interception proof (navigation-planner): findRouteManifestInterceptionForProof now accepts a proof whose target matched URL equals the pre-rewrite canonical pathname (shorter than the full pattern) when matchRoutePatternWithOptionalDynamicSegments passes. Exact pattern match still skips the targetRouteId guard; the relaxed path skips it too so the middleware-added locale segment does not invalidate an otherwise valid proof. 3. displayPathname threading (app-rsc-handler / app-rsc-entry / app-page-element-builder): the handler now passes canonicalPathname as displayPathname separately from cleanPathname. buildPageElements uses cleanPathname for all internal routing work (slot param extraction, slot overrides) and displayPathname only for render identity — keeping the browser-visible URL in RSC metadata without affecting internal matching. * fix(interception): guard siblingInterceptElement construction and document reserved slot name * fix(interception): surface missing default export on sibling intercept pages A sibling-style interception whose intercepting page module is missing its `default` export previously fell back to the source route's page component (`effectivePageModule?.default ?? PageComponent`), silently rendering a *different* page than the one requested. Resolve the effective component from the intercepting page only and extend the existing no-default-export guard to cover sibling intercepts, so a missing export surfaces the same explicit "Page has no default export" error the source/slot paths already produce. For a normal request this is identical to the previous behavior since `effectivePageModule === pageModule`. Addresses bonk review feedback on #1804. * test(app-router): guard canonical pathname commit on soft-nav config rewrites The `displayPathname = canonicalPathname` change feeds the RSC payload identity the client planner uses to commit a navigation, so it affects every rewritten route, not just interceptions. Existing coverage (nextjs-compat/hooks.test.ts) only exercises the hard-nav (SSR) path. Add an e2e that soft-navigates (client-side) to an afterFiles-rewritten route and asserts the committed URL and `usePathname()` stay canonical (pre-rewrite), with a marker check proving no full page reload occurred. Addresses bonk review feedback on #1804. * fix(interception): restore __pageLoader on slot intercept lookup entries The main merge auto-resolved incorrectly: it moved the `__pageLoader` field that #1738 added to the *slot* intercept push block onto the new *sibling* push block instead (the two `interceptLookup.push({...})` calls are textually similar). As a result slot intercept lookup entries lost `__pageLoader`, so resolveAppPageInterceptState never loaded the lazy intercepting page (`page` stayed null) and the modal slot fell back to default.tsx — breaking every slot interception. Restore `__pageLoader: intercept.__pageLoader` on the slot push block. The sibling block already carries it (see merge commit), and both intercept types declare the optional field. Fixes the app-router-dev-server intercept tests and the interception e2e suites that regressed after merging main. --------- Co-authored-by: James Anderson <james@eli.cx>
418 lines
15 KiB
TypeScript
418 lines
15 KiB
TypeScript
import { describe, expect, it } from "vite-plus/test";
|
|
import {
|
|
createAppRscRouteMatcher,
|
|
matchAppRscRoutePattern,
|
|
SIBLING_PAGE_INTERCEPT_SLOT_KEY,
|
|
} from "../packages/vinext/src/server/app-rsc-route-matching.js";
|
|
|
|
describe("App RSC route matching", () => {
|
|
it("matches app routes through the shared route trie", () => {
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/", []),
|
|
route("/blog/:slug", ["blog", ":slug"]),
|
|
route("/docs/:path+", ["docs", ":path+"]),
|
|
route("/shop/:path*", ["shop", ":path*"]),
|
|
]);
|
|
|
|
expect(matcher.matchRoute("/blog/hello-world/")).toMatchObject({
|
|
route: { pattern: "/blog/:slug" },
|
|
params: { slug: "hello-world" },
|
|
});
|
|
expect(matcher.matchRoute("/docs")).toBeNull();
|
|
expect(matcher.matchRoute("/docs/guides/rsc")).toMatchObject({
|
|
route: { pattern: "/docs/:path+" },
|
|
params: { path: ["guides", "rsc"] },
|
|
});
|
|
const result = matcher.matchRoute("/shop");
|
|
expect(result).not.toBeNull();
|
|
expect(result!.route.pattern).toBe("/shop/:path*");
|
|
expect(result!.params).toEqual({});
|
|
});
|
|
|
|
it("omits optional catch-all params when zero segments are matched", () => {
|
|
// Next.js represents a missing optional catch-all param as absent at the
|
|
// route-match boundary; app rendering later treats that as the `null`
|
|
// tree segment for optional catch-all.
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/route-matcher.ts
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/get-dynamic-param.test.ts
|
|
const matcher = createAppRscRouteMatcher([route("/shop/:path*", ["shop", ":path*"])]);
|
|
|
|
const result = matcher.matchRoute("/shop");
|
|
expect(result).not.toBeNull();
|
|
expect(result!.route.pattern).toBe("/shop/:path*");
|
|
expect(result!.params).toEqual({});
|
|
});
|
|
|
|
it("omits optional catch-all params from standalone route pattern matches", () => {
|
|
expect(matchAppRscRoutePattern(["shop"], ["shop", ":path*"])).toEqual({});
|
|
expect(matchAppRscRoutePattern(["shop", "a", "b"], ["shop", ":path*"])).toEqual({
|
|
path: ["a", "b"],
|
|
});
|
|
});
|
|
|
|
// Ported from Next.js: route-matcher.ts decodeURIComponent behaviour
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/shared/lib/router/utils/route-matcher.ts#L25-L27
|
|
it("decodes matched params via decodeURIComponent (mirrors Next.js)", () => {
|
|
const matcher = createAppRscRouteMatcher([route("/files/:name", ["files", ":name"])]);
|
|
|
|
expect(matcher.matchRoute("/files/a%2Fb")).toMatchObject({
|
|
params: { name: "a/b" },
|
|
});
|
|
});
|
|
|
|
it("canonicalizes encoded URL parts before matching app routes", () => {
|
|
// Next.js canonicalizes URL pathname parts before deriving dynamic segment
|
|
// cache keys; vinext should apply the same decode-first discipline at the
|
|
// App RSC route-match boundary so encoded static segments and params use
|
|
// one normalized representation.
|
|
// https://github.com/vercel/next.js/blob/47bcfa0956679c2a5fea0b941b76bb2d69878d9c/packages/next/src/client/route-params.ts
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/_sites/:subdomain", ["_sites", ":subdomain"]),
|
|
route("/files/:name", ["files", ":name"]),
|
|
]);
|
|
|
|
expect(matcher.matchRoute("/%5Fsites/demo")).toMatchObject({
|
|
route: { pattern: "/_sites/:subdomain" },
|
|
params: { subdomain: "demo" },
|
|
});
|
|
expect(matcher.matchRoute("/files/a%252Fb")).toMatchObject({
|
|
params: { name: "a%2Fb" },
|
|
});
|
|
});
|
|
|
|
it("matches standalone route patterns for dynamic metadata routes", () => {
|
|
expect(
|
|
matchAppRscRoutePattern(["blog", "hello", "sitemap.xml"], ["blog", ":slug", "sitemap.xml"]),
|
|
).toMatchObject({
|
|
slug: "hello",
|
|
});
|
|
});
|
|
|
|
it("treats static segments ending in plus or star as literals", () => {
|
|
expect(matchAppRscRoutePattern(["c++", "intro"], ["c++", ":slug"])).toMatchObject({
|
|
slug: "intro",
|
|
});
|
|
|
|
const starResult = matchAppRscRoutePattern(["file*"], ["file*"]);
|
|
expect(starResult).not.toBeNull();
|
|
expect(Object.keys(starResult ?? {})).toEqual([]);
|
|
});
|
|
|
|
it("finds intercepting routes and merges source and target params", () => {
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/feed/:id", ["feed", ":id"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
targetPattern: "/photos/:id",
|
|
interceptLayouts: ["modal-layout"],
|
|
page: "photo-page",
|
|
params: ["id"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/photos/target-id", "/feed/source-id")).toMatchObject({
|
|
sourceRouteIndex: 0,
|
|
slotKey: "modal",
|
|
targetPattern: "/photos/:id",
|
|
page: "photo-page",
|
|
matchedParams: { id: "target-id" },
|
|
});
|
|
});
|
|
|
|
it("does not treat a target match as an intercept without a matching source route", () => {
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/feed", ["feed"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
targetPattern: "/photos/:id",
|
|
interceptLayouts: ["modal-layout"],
|
|
page: "photo-page",
|
|
params: ["id"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/photos/42", null)).toBeNull();
|
|
expect(matcher.findIntercept("/photos/42", "/gallery")).toBeNull();
|
|
});
|
|
|
|
it("canonicalizes encoded source path parts for interception params", () => {
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/_sites/:tenant", ["_sites", ":tenant"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
targetPattern: "/photos/:id",
|
|
interceptLayouts: ["modal-layout"],
|
|
page: "photo-page",
|
|
params: ["id"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/photos/a%2Fb", "/%5Fsites/acme")).toMatchObject({
|
|
targetPattern: "/photos/:id",
|
|
matchedParams: { tenant: "acme", id: "a/b" },
|
|
});
|
|
});
|
|
|
|
it("preserves bracket-shaped literal segments in intercept target patterns", () => {
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/feed", ["feed"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
targetPattern: "/photos/[literal]",
|
|
interceptLayouts: ["modal-layout"],
|
|
page: "literal-photo-page",
|
|
params: [],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/photos/[literal]", "/feed")).toMatchObject({
|
|
targetPattern: "/photos/[literal]",
|
|
page: "literal-photo-page",
|
|
matchedParams: {},
|
|
});
|
|
expect(matcher.findIntercept("/photos/anything", "/feed")).toBeNull();
|
|
});
|
|
|
|
// Ported from Next.js: lib/generate-interception-routes-rewrites.test.ts
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/generate-interception-routes-rewrites.test.ts
|
|
//
|
|
// Interception is implemented in Next.js as a rewrite that only fires when
|
|
// the Next-URL header matches the *intercepting route* regex (the path that
|
|
// owns the slot, with route groups and @slot segments stripped).
|
|
//
|
|
// vinext must enforce the same constraint at the matcher boundary: an
|
|
// intercept entry whose targetPattern matches the request URL is only valid
|
|
// when the provided source pathname matches its declared sourceMatchPattern.
|
|
// Otherwise the matcher must fall through to null so the direct route is
|
|
// rendered.
|
|
describe("source-pathname filtering (mirrors Next.js Next-URL header rewrite)", () => {
|
|
it("returns null when the source pathname does not match the intercepting route", () => {
|
|
// Slot lives at root (`/@modal`) and intercepts `/groups/[id]/new`.
|
|
// Intercepting route = `/` so any source under `/` is allowed.
|
|
// But for a slot at `/templates`, only `/templates(?:/.*)?` sources qualify.
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/templates/:catchAll+", ["templates", ":catchAll+"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
// (..)showcase/[...catchAll] from `app/templates`
|
|
sourceMatchPattern: "/templates",
|
|
targetPattern: "/showcase/:catchAll+",
|
|
interceptLayouts: ["layout"],
|
|
page: "intercept-page",
|
|
params: ["catchAll"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
// Source under /templates — should intercept.
|
|
expect(matcher.findIntercept("/showcase/multi/slug", "/templates/multi/slug")).toMatchObject({
|
|
targetPattern: "/showcase/:catchAll+",
|
|
});
|
|
|
|
// Source NOT under /templates — must not intercept.
|
|
expect(matcher.findIntercept("/showcase/single", "/")).toBeNull();
|
|
expect(matcher.findIntercept("/showcase/single", "/other")).toBeNull();
|
|
});
|
|
|
|
it("returns null when no source pathname is provided (no Next-URL header)", () => {
|
|
// Without a Next-URL header the rewrite cannot fire in Next.js, so the
|
|
// direct page must render. vinext should mirror that.
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/templates/:catchAll+", ["templates", ":catchAll+"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
sourceMatchPattern: "/templates",
|
|
targetPattern: "/showcase/:catchAll+",
|
|
interceptLayouts: ["layout"],
|
|
page: "intercept-page",
|
|
params: ["catchAll"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/showcase/multi/slug", null)).toBeNull();
|
|
expect(matcher.findIntercept("/showcase/multi/slug")).toBeNull();
|
|
});
|
|
|
|
it("accepts descendants of the intercepting route as valid sources", () => {
|
|
// Header regex appends `(?:/.*)?` to allow any descendant of the
|
|
// intercepting route to trigger the rewrite.
|
|
// https://github.com/vercel/next.js/blob/canary/packages/next/src/lib/generate-interception-routes-rewrites.ts
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/feed/:id", ["feed", ":id"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
// (.)photos/[id] from `app/feed/[id]`
|
|
sourceMatchPattern: "/feed/:id",
|
|
targetPattern: "/feed/:id/photos/:photoId",
|
|
interceptLayouts: ["layout"],
|
|
page: "modal-photo",
|
|
params: ["id", "photoId"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
// Exact match on intercepting route.
|
|
expect(matcher.findIntercept("/feed/abc/photos/1", "/feed/abc")).not.toBeNull();
|
|
// Descendant of intercepting route.
|
|
expect(matcher.findIntercept("/feed/abc/photos/1", "/feed/abc/nested/deep")).not.toBeNull();
|
|
// Parent of intercepting route — should NOT intercept.
|
|
expect(matcher.findIntercept("/feed/abc/photos/1", "/")).toBeNull();
|
|
// Sibling — should NOT intercept.
|
|
expect(matcher.findIntercept("/feed/abc/photos/1", "/other")).toBeNull();
|
|
});
|
|
|
|
it("treats a sourceMatchPattern of `/` as matching any source", () => {
|
|
// Slot at root (`/@modal/(.)groups/[id]/new`) yields intercepting route `/`,
|
|
// which Next.js implements as `^/.*$` — i.e. any source.
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/", [], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
sourceMatchPattern: "/",
|
|
targetPattern: "/groups/:id/new",
|
|
interceptLayouts: ["layout"],
|
|
page: "modal-new",
|
|
params: ["id"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/groups/123/new", "/")).not.toBeNull();
|
|
expect(matcher.findIntercept("/groups/123/new", "/groups/123")).not.toBeNull();
|
|
expect(matcher.findIntercept("/groups/123/new", "/anything/else/deep")).not.toBeNull();
|
|
// But still must require a source pathname (Next-URL header) to fire.
|
|
expect(matcher.findIntercept("/groups/123/new", null)).toBeNull();
|
|
});
|
|
|
|
it("findIntercept matches sibling intercept on soft-nav and misses on hard-nav", () => {
|
|
const routes: TestRoute[] = [
|
|
{
|
|
pattern: "/foo/bar",
|
|
patternParts: ["foo", "bar"],
|
|
siblingIntercepts: [
|
|
{
|
|
targetPattern: "/hoge",
|
|
sourceMatchPattern: "/foo/bar",
|
|
slotId: "slot:__vinext_sibling_intercept:/foo/bar",
|
|
interceptLayouts: [],
|
|
page: { default: () => null },
|
|
params: [],
|
|
},
|
|
],
|
|
},
|
|
{ pattern: "/hoge", patternParts: ["hoge"] },
|
|
];
|
|
const matcher = createAppRscRouteMatcher(routes as any);
|
|
|
|
// Soft-nav from /foo/bar: should match
|
|
const hit = matcher.findIntercept("/hoge", "/foo/bar");
|
|
expect(hit).not.toBeNull();
|
|
expect(hit?.slotKey).toBe(SIBLING_PAGE_INTERCEPT_SLOT_KEY);
|
|
|
|
// Hard-nav (no source): must return null
|
|
expect(matcher.findIntercept("/hoge", null)).toBeNull();
|
|
|
|
// Wrong source: must return null
|
|
expect(matcher.findIntercept("/hoge", "/other")).toBeNull();
|
|
});
|
|
|
|
it("matches dynamic segments in the intercepting route pattern", () => {
|
|
// /[lang]/foo/(..)photos has interceptingRoute `/[lang]/foo`,
|
|
// header regex `^/(?<lang>[^/]+)/foo(?:/.*)?$`.
|
|
const matcher = createAppRscRouteMatcher([
|
|
route("/:lang/foo", [":lang", "foo"], {
|
|
modal: {
|
|
intercepts: [
|
|
{
|
|
sourceMatchPattern: "/:lang/foo",
|
|
targetPattern: "/:lang/photos",
|
|
interceptLayouts: ["layout"],
|
|
page: "modal-photos",
|
|
params: ["lang"],
|
|
},
|
|
],
|
|
},
|
|
}),
|
|
]);
|
|
|
|
expect(matcher.findIntercept("/en/photos", "/en/foo")).not.toBeNull();
|
|
expect(matcher.findIntercept("/en/photos", "/en/foo/bar")).not.toBeNull();
|
|
// Wrong dynamic value — still a descendant in URL terms but the
|
|
// intercepting route requires `/<lang>/foo`, so `/en/bar` should fail.
|
|
expect(matcher.findIntercept("/en/photos", "/en/bar")).toBeNull();
|
|
expect(matcher.findIntercept("/en/photos", "/en")).toBeNull();
|
|
});
|
|
});
|
|
});
|
|
|
|
function route(
|
|
pattern: string,
|
|
patternParts: string[],
|
|
slots?: Record<string, { intercepts?: TestIntercept[] }>,
|
|
): TestRoute {
|
|
return {
|
|
pattern,
|
|
patternParts,
|
|
slots,
|
|
};
|
|
}
|
|
|
|
type TestSiblingIntercept = {
|
|
targetPattern: string;
|
|
sourceMatchPattern: string | null;
|
|
slotId: string | null;
|
|
interceptLayouts: readonly unknown[];
|
|
page: unknown;
|
|
params: string[];
|
|
};
|
|
|
|
type TestRoute = {
|
|
pattern: string;
|
|
patternParts: string[];
|
|
slots?: Record<string, { intercepts?: TestIntercept[] }>;
|
|
siblingIntercepts?: TestSiblingIntercept[];
|
|
};
|
|
|
|
type TestIntercept = {
|
|
targetPattern: string;
|
|
/**
|
|
* URL pattern of the intercepting route (the path that owns the slot,
|
|
* with route groups and `@slot` segments stripped). Mirrors Next.js'
|
|
* `interceptingRoute` from `extractInterceptionRouteInformation` and is
|
|
* used to gate `findIntercept` against the Next-URL header.
|
|
*/
|
|
sourceMatchPattern?: string;
|
|
interceptLayouts: readonly unknown[];
|
|
page: unknown;
|
|
params: string[];
|
|
};
|