Commit Graph

320 Commits

Author SHA1 Message Date
Steve Faulkner b7455c3fa6 fix: fully elide inline type-only import specifiers (#2498)
Vite 8's OXC transform (and Vite 7's esbuild transform) honour
`"verbatimModuleSyntax": true` from the app's tsconfig, so
`import { type Metadata } from "next"` leaves a side-effect
`import "next"` behind when every specifier is type-only. Next.js
(SWC) — and esbuild/tsc without verbatimModuleSyntax — elide the whole
statement. create-t3-app and other scaffolds emit both the tsconfig
option and the inline-type import form stock, so on vinext the real
Next.js server runtime was pulled into the RSC graph (dev 500
"require is not defined", build failures via styled-jsx/client-only)
and server-only modules were pulled into the browser bundle when a
"use client" file imported only types from them (t3's tRPC router
shipped to clients and crashed hydration).

Force `typescript.onlyRemoveTypeImports: false` in the oxc transform
options (and `verbatimModuleSyntax: false` in the Vite 7 esbuild
tsconfigRaw) so type-import elision matches Next.js regardless of the
app's tsconfig.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:35:59 +01:00
James Anderson 6c7b71eb12 fix(app-router): isolate global not-found css (#2444)
* fix(app-router): isolate global not-found css

* fix(app-router): cover global not-found css review gaps
2026-07-02 21:35:52 +01:00
James Anderson 6bd1ee0153 fix(app-router): expose app rewrites to pages data clients (#2468) 2026-07-02 21:03:05 +01:00
James Anderson 5f8048f660 fix(app-router): align app static ISR lifecycle (#2472)
* fix(app-router): align app static ISR lifecycle

* fix(fetch-cache): honor shorter revalidate on hits

* fix(cache): honor read-time revalidate in KV cache
2026-07-02 20:19:02 +01:00
James Anderson 239595e69e fix(app-router): reuse metadata rewrite prefetches (#2455)
* fix(app-router): reuse metadata rewrite prefetches

* fix(app-router): normalize rsc reference validation ids

* Revert "fix(app-router): normalize rsc reference validation ids"

This reverts commit bbff1eb13a.

* chore: format link shim
2026-07-01 17:02:35 +00:00
James Anderson ebf8e59289 fix(app-router): avoid runtime route-tree prefetch sizing (#2467)
* fix(app-router): start optimistic prefetches immediately

* fix(app-router): support route tree prefetch inlining

* fix(app-router): dedupe max prefetch inlining requests

* fix(app-router): cap route-tree prefetch size reads

* fix(app-router): avoid runtime route-tree prefetch sizing

* Fixed CI type error, flagged parity gap

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* fix(app-router): preserve negative prefetch inlining thresholds

* fix(app-router): normalize rsc reference validation ids

* Revert "fix(app-router): normalize rsc reference validation ids"

This reverts commit 68b96b596c.

* fix(app-router): keep route-tree prefetch metadata scoped

---------

Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
2026-07-01 17:47:08 +01:00
James Anderson b0367f1448 fix(link): avoid reusing dynamic app route prefetches (#2450)
* fix(link): avoid reusing dynamic app route prefetches

* fix(link): preserve static dynamic app prefetches

* test(e2e): scope segment cache client params to prod
2026-07-01 11:14:11 +01:00
James Anderson de733ce4aa fix(app-router): revalidate dynamic intercepted actions (#2443) 2026-07-01 11:02:53 +01:00
James Anderson 8df2344e77 fix(css): preserve Sass partial asset URLs (#2338)
* fix(css): preserve Sass partial asset URLs

* fix(css): preserve Sass use namespaces

* fix(css): match Sass namespace derivation
2026-06-30 20:31:49 +01:00
James Anderson 49945a9e05 fix(link): reuse full prefetch loading shells (#2332)
* fix(link): reuse full prefetch loading shells

* fix(link): share loading shell prefetch ownership
2026-06-30 19:34:50 +01:00
James Anderson b0de1af028 fix(cloudflare): support Sentry request errors on Workers (#2425)
* fix(cloudflare): support sentry request errors on workers

* fix(cloudflare): avoid worker conditions in node pages builds

* test(cloudflare): run sentry worker e2es in ci

* test(cloudflare): cover sentry render errors

* test(cloudflare): mirror sentry next setup in fixtures

* update lockfile

* update lockfile

* test(cloudflare): cover sentry client instrumentation
2026-06-30 10:58:04 +01:00
James Anderson bf8ba93d4c fix(test): mark app trailing slash ISR fixture private (#2417) 2026-06-29 18:54:36 +00:00
James Anderson bcd4e44d96 feat(build): support prerender vite config (#2415)
* feat(build): support prerender vite config

* feat(init): offer prerender config opt-in

* fix(cloudflare): export prerender deploy helper

* fix(cloudflare): avoid redundant prerender config load

* fix(build): quiet adapter fallback warnings
2026-06-29 19:16:08 +01:00
James Anderson a3910e7aa9 feat(cloudflare): add unified worker entry (#2416)
* feat(cloudflare): add default pages router worker entry

* feat(cloudflare): add unified worker entry

* chore(web): use unified worker entry

* chore(examples): use built-in workers-cache entry

* chore(examples): keep hackernews on app router entry

* chore(cloudflare): rename unified entry to fetch handler

* chore(cloudflare): keep pages entry source helper test-local
2026-06-29 17:33:51 +00:00
Nathan Nguyen 23ed801656 fix(e2e): stabilize nav regression suspense window (#2408)
* fix(e2e): stabilize nav regression suspense window

* test(e2e): strengthen nav regression flake guard
2026-06-29 16:57:29 +01:00
James Anderson 69e0051cf7 fix(pages): expose parsed cookies on request objects (#2401) 2026-06-29 11:29:35 +01:00
James Anderson 011349b858 fix(app-router): match generated params case-insensitively (#2351)
* fix(app-router): match generated params case-insensitively

* test(app-router): preserve requested static param casing
2026-06-28 23:14:14 +00:00
James Anderson 0ea90fdbaa fix(app-router): preserve layouts across soft navigation (#2316)
* test(app-router): reproduce server layout identity reset

* fix(app-router): preserve soft navigation layout identity

* test(app-router): model bfcache identities in reducer fixtures

* fix(app-router): refresh layouts after revalidating actions

* fix(navigation): balance history restore snapshots

* fix(app-router): refresh layout elements during HMR commits
2026-06-28 23:07:55 +00:00
James Anderson 18e618c53e fix(app-router): preserve primary parallel route slot (#2347)
* fix(app-router): preserve primary parallel route slot

* test(app-router): match parallel default layout parity

* fix(app-router): prefer nearest parallel children owner

* fix(app-router): preserve mounted slot state after HMR

* test(app-router): wait for selected parallel slot before HMR
2026-06-28 22:59:48 +00:00
James Anderson f67f872b88 fix(app-router): preserve named parallel slot state (#2246)
* fix(app-router): preserve named layout segments

* fix(app-router): preserve named slots on replace

* fix(app-router): preserve named slots through hmr

* fix(app-router): settle named slot review races

* fix(app-router): reject superseded hmr payloads

* fix(app-router): preserve committed named segments

* fix(app-router): resolve intercepted named slot segments

* fix(app-router): preserve unmatched named segments

* fix(app-router): prioritize navigation over pending hmr

* fix(app-router): keep navigation authority over hmr

* fix(app-router): preserve hmr authority for stale lanes

* fix(app-router): preserve page segment marker
2026-06-28 22:35:23 +00:00
James Anderson f0ba7b4afe fix(app-router): reuse committed client cache payloads (#2251)
* fix(app-router): seed client navigation cache

* fix(cache): parse prerender cache metadata marker

* test(cache): cover prerender metadata done marker

* fix(cache): preserve static committed stale time

* fix(link): honor dynamic stale time for auto prefetches

* fix(router): retain committed client cache state

* fix(router): publish client cache after commit

* fix(router): gate hydration cache publication

* fix(router): guard late client cache publication

* fix(router): isolate client cache parity coverage

* fix(router): preserve authoritative navigation commits

* fix(router): preserve committed navigation streams
2026-06-28 22:01:58 +00:00
MaxtuneLee c602026b6d fix(app-router): normalize trailing slash in implicit cache tags (#2390)
* fix(app-router): normalize trailing slash in implicit cache tags for revalidatePath

* docs: remove unnecessary comments

* style: format files
2026-06-28 20:50:18 +01:00
James Anderson a21667fd09 fix(app-router): discover nested leaf slot routes (#2350)
* fix(app-router): discover nested leaf slot routes

* test(routing): align nested leaf slot expectation

* test(routing): assert nested leaf route match

* fix(app-router): scope nested leaf slot discovery
2026-06-26 21:42:15 +01:00
James Anderson cab6622ce8 fix(app-router): restore intercepted history slots (#2363)
* fix(app-router): restore intercepted history slots

* fix(app-router): scope interception restore proof
2026-06-26 21:41:12 +01:00
James Anderson 737532aaa8 fix(app-router): preserve interception across middleware rewrites (#2342) 2026-06-26 21:36:48 +01:00
James Anderson e4f5a0e56b fix(app-router): honor global not found opt-in (#2340)
* fix(app-router): honor global not found opt-in

* fix(app-router): render default global 404 standalone

* test(app-router): avoid fixture workspace lockfile entry

* test(app-router): keep fixture esm outside workspace

* fix(app-router): add default global 404 shell

* test(app-router): cover client not found boundary

* fix(app-router): gate global not found discovery
2026-06-26 21:34:25 +01:00
James Anderson 5c1e870ace fix(router): honor middleware app rewrites for page links (#2339)
* fix(router): honor middleware app rewrites for page links

* fix(router): preserve masked page data targets

* fix(router): keep non-middleware data fetch timing

* docs(router): explain middleware data handoff invariants
2026-06-26 21:33:23 +01:00
James Anderson 859a0aac15 fix(app-router): bind layout-only children defaults (#2335)
* fix(app-router): bind layout-only children defaults

* fix(app-router): preserve standalone slot owners

* fix(app-router): ghost fallback catch-all owners
2026-06-26 21:31:02 +01:00
James Anderson 50e2385986 fix(form): match Next.js navigation parity (#2245)
* fix(form): match Next.js navigation parity

* fix(form): block dangerous navigation schemes

* fix(form): address Pages navigation review

* fix(form): preserve native and hard navigation fallbacks
2026-06-26 19:56:06 +00:00
James Anderson 70c500bf65 fix(app-router): scope static params across parallel routes (#2317)
* fix(app-router): scope static params across parallel routes

* fix(app-router): collect static params from parallel layouts

* style(app-router): format parallel route fixtures

* fix(app-router): scope parallel segment params
2026-06-26 20:52:20 +01:00
James Anderson 77d67a98c4 fix(cache): bypass unstable cache in draft mode (#2319)
* fix(cache): bypass unstable cache in draft mode

* fix(cache): preserve draft state during action rerenders
2026-06-26 19:58:36 +01:00
James Anderson 42c3e24b40 fix(test): name trailing slash ISR fixture (#2376) 2026-06-26 13:58:53 +00:00
James Anderson da179857dc fix(app-router): render templates with children only (#2322)
* fix(app-router): render templates with children only

* test(app-router): correct server template navigation parity

* LGTM: template fix matches Next.js

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* chore(test): remove fixture symlink noise

* LGTM: template fix matches Next.js

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* fix(app-router): preserve template children-only fix

---------

Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
2026-06-26 14:51:46 +01:00
James Anderson 618cd66b30 fix(app-router): align static dynamic params parity (#2321)
* fix(app-router): align static dynamic params parity

* fix(app-router): preserve dynamic error fallback params

* chore(test): format force-static fixture
2026-06-26 14:45:37 +01:00
James Anderson f05eeb8dde fix(cache): throw updateTag context errors synchronously (#2311) 2026-06-26 14:42:40 +01:00
James Anderson 126856cdc4 fix(config): match trailing-slash route sources (#2255)
* fix(routing): match slashed rewrite sources

* fix(routing): align redirect slash matching
2026-06-26 14:42:04 +01:00
James Anderson 640e971ec5 fix(pages): match optional catch-all prerender paths (#2238)
* fix(pages): match empty optional catch-all static paths

* fix(pages): validate static path route params

* fix(pages): share static path matching in dev
2026-06-23 20:00:43 +01:00
James Anderson e00687a0f6 fix(middleware): match Pages data request metadata (#2239)
* fix(middleware): preserve Pages data routing metadata

* fix(middleware): preserve matched path on data misses

* test(pages): align middleware data miss assertions

* fix(pages): align dev middleware data misses

* fix(pages): gate data misses on real middleware

* fix(middleware): address data redirect review

* Reviewed PR #2239: fixes confirmed

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* chore(tests): remove stray node_modules symlinks

---------

Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
2026-06-23 19:39:59 +01:00
James Anderson 2cbd2a0356 fix(build): apply default server externals (#2257)
* fix(build): externalize Next.js default server packages

* test(node): cover externalized shiki in standalone output
2026-06-23 10:20:55 +00:00
James Anderson a34c083e88 fix(app-router): match interception route precedence (#2231)
* fix(app-router): prioritize specific interception routes

* fix(app-router): match interception route precedence

* Reviewed PR #2231: LGTM, minor notes

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* fix(app-router): align interception route tiebreaks

---------

Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
2026-06-22 23:37:34 +01:00
James Anderson d65dd4c601 fix(router): ignore stale initial popstate with i18n (#2230)
* fix(router): ignore stale initial popstate with i18n

* Review done: no issues found

Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>

* test(router): run i18n popstate coverage in existing project

---------

Co-authored-by: ask-bonk[bot] <ask-bonk[bot]@users.noreply.github.com>
Co-authored-by: james-elicx <james-elicx@users.noreply.github.com>
2026-06-22 22:36:52 +00:00
James Anderson 6e998ec114 fix(middleware): run on missing build assets (#2242)
* fix(middleware): run on missing build assets

* fix(middleware): preserve missing asset rewrites on workers
2026-06-22 23:36:49 +01:00
James Anderson 7b21c429c0 fix(app-router): preserve global error details (#2249)
* fix(app-router): preserve global error details

* fix(app-router): preserve default global error semantics
2026-06-22 23:29:40 +01:00
James Anderson fbf68d588e fix(app-router): restore cache and parallel route parity (#2261)
* fix(app-router): preserve searchParams cache variants

* test(app-router): cover RSC metadata cache variants

* fix(app-router): isolate metadata searchParams observation

* fix(app-router): preserve static ISR cache proofs

* fix(app-router): limit queryless cache probes

* fix(app-router): skip redundant cache proof probes

* fix(app-router): harden incomplete cache proofs

* fix(app-router): observe loading page execution

* fix(app-router): preserve exotic page exports

* fix(app-router): preserve client page ISR

* fix(app-router): avoid duplicate queryless page execution

* fix(app-router): observe viewport search params

* fix(app-router): clear force-static search params

* fix(app-router): isolate intercept static context

* fix(app-router): preserve intercept request context

* fix(app-router): isolate action static context

* fix(app-router): match static request API semantics

* fix(app-router): preserve dynamic segment constraints

* fix(app-router): apply slot-only segment config

* fix(app-router): preserve draft mode reads in static errors

* fix(app-router): include nested slot constraints

* fix(app-router): refresh slot layout constraints

* fix(app-router): render nested slot layouts

* fix(app-router): preserve nested slot params

* fix(app-router): preserve intercepted slot head

* fix(app-router): scope parallel layout params

* fix(app-router): preserve intercept layout parity

* fix(app-router): preserve intercept ancestor params

* fix(app-router): scope intercept source params

* fix(app-router): preserve intercept source route params

* test(app-router): stabilize parity validation
2026-06-22 23:17:41 +01:00
James Anderson 656a381de9 fix(og): constrain inlined assets to trusted roots (#2172)
* fix(og): constrain inlined assets to trusted roots

* fix(og): canonicalize asset package boundaries

* test(og): cover canonical boundary intersections

* fix(og): support file-symlinked dependency modules

* docs(og): clarify logical asset boundary resolution

* fix(og): pin symlinked modules to matching packages

* fix(og): keep linked package boundaries narrow

* fix(og): reject workspace-root asset boundaries

* fix(og): name-pin external package boundaries

* fix(og): validate linked package ownership

* fix(og): track linked package ownership

* fix(og): harden linked package provenance

* fix(og): confine captured alias packages

* fix(og): pin captured directory aliases

* fix(og): require alias package ownership

* fix(og): support single-segment aliases

* perf(og): preserve alias lookup precedence

* refactor(og): extract asset ownership policy

* test(og): cover linked package fonts in e2e

* fix(og): recognize resolved package aliases

* fix(og): support regex package aliases

* test(og): isolate linked font fixture

* docs(test): clarify linked font coverage
2026-06-19 16:08:46 +01:00
Nathan Nguyen 301418a3f1 perf(app-router): defer layout, template and boundary modules to first request (#2145)
* perf(app-router): defer layout, template and boundary modules to first request

The generated RSC entry statically imported every route's layout, template,
loading/error/not-found/forbidden/unauthorized boundary and parallel-slot
module at the top level. On a cold isolate — and on the dev server's first
request — that eagerly evaluated the whole app's segment tree, including
routes never visited in that lifetime. Page and route-handler modules were
already lazy; the surrounding segment modules were not.

Emit those modules as lazy `() => import()` loaders paired with `null`
placeholders in the manifest, and hydrate them onto the route's synchronous
fields in `ensureAppRouteModulesLoaded` before any read (extended from
page/handler to layouts, templates, boundaries and parallel-slot modules).
Intercept layouts hydrate via the dedicated `loadAppInterceptLayouts` because
they live on the match object, not the route. Every reader already runs behind
`ensureAppRouteModulesLoaded` (handler dispatch and `buildPageElements`) or the
intercept resolvers, so no synchronous module field is read before hydration.

The shared intercept `interceptLayouts` arrays keep their `readonly` public
types; the loader is their sole writer and fills slots through one
boundary-local cast, so route metadata stays immutable to callers.

Dev cold start is unchanged on page-heavy apps — pages were already lazy — but
on a boundary-heavy app (80 independent sections, each with
layout+template+error+loading+not-found) first-request module compile drops
704ms -> 534ms (~24%) and time-to-first-200 1917ms -> 1665ms. The saving scales
with the number of unrelated segments deferred.

* test(app-router): localize react max header font fixture

* fix(app-router): dedupe lazy intercept module loads

* fix(app-router): share intercept load state across matches

* docs(app-router): explain root layout loader reuse

---------

Co-authored-by: James <james@eli.cx>
2026-06-19 14:49:29 +01:00
MaxtuneLee 42f8700f15 fix(router): enhance navigation with as mask for URL handling (#2076)
* fix(router): enhance navigation with `as` mask for URL handling

* fix(router): implement bracket-pattern interpolation for dynamic routes in Pages Router

* fix(router): preserve masked state in beforePopState

* fix(router): cover basepath navigation in ci

* docs(router): clarify navigation state invariants

* refactor(router): require complete history state

* refactor(router): share dynamic href interpolation

* test(router): cover localized masked navigation

* fix(router): keep interpolation internals private

---------

Co-authored-by: James <james@eli.cx>
2026-06-19 00:07:03 +01:00
James Anderson b2ea860284 fix(proxy): match Next.js file conventions (#2155)
* fix(proxy): match Next.js file conventions

* test(proxy): keep convention fixture out of workspace

* test(proxy): provide middleware path in handler fixture
2026-06-18 23:54:39 +01:00
James Anderson 12f04d6d63 fix(app-router): block dangerous RSC redirect URLs (#2154)
* fix(app-router): block dangerous RSC redirect URLs

* refactor(app-router): reuse blocked navigation reporter

* style(app-router): format redirect guard import
2026-06-18 17:51:07 +00:00
James Anderson 2f8b0ef78b fix(build): preserve lazy RSC framework chunks (#2074)
* fix(build): preserve lazy RSC framework chunks

* test(image): wait for completed watch output

* test(build): isolate RSC startup regression

* fix(build): preserve lazy framework chunks on Vite 7

* test(build): cover transitive framework reachability

* test(build): harden framework chunk regressions
2026-06-16 14:28:15 +01:00