Commit Graph

1635 Commits

Author SHA1 Message Date
Jerry Zhao 843aa88b64 docs(app-router): document findFile's forward-slash contract (#2299) 2026-06-24 09:50:36 +01:00
Jerry Zhao ca599ed0dd docs(app-router): document directoryToAppRoute's forward-slash contract (#2301) 2026-06-24 09:50:31 +01:00
Jerry Zhao 9d601aef75 refactor(app-router): build fileToAppRoute paths with path.posix (#2302) 2026-06-24 09:50:18 +01:00
Jerry Zhao afa9f56223 refactor(app-router): compute discoverParallelSlots owner segments and key with path.posix.relative (#2303) 2026-06-24 09:50:11 +01:00
Jerry Zhao 49d0454b55 docs(app-router): document discoverInterceptingRoutes' forward-slash contract (#2304) 2026-06-24 09:50:00 +01:00
Jerry Zhao 04e4311ae0 refactor(app-router): descend scanForInterceptingPages with path.posix.join (#2305) 2026-06-24 09:49:32 +01:00
James Anderson ee551d1e28 fix(config): match deprecation warning parity (#2252)
* fix(config): match deprecation warning output

* fix(config): dedupe deprecation warnings

* fix(test): preserve lifecycle install diagnostics

* fix(check): report unsupported proxy config options
2026-06-23 20:39:39 +01:00
James Anderson b4843d75c1 feat(images): configure image optimization via vinext({ images }) adapter (#1873)
* feat(images): configure image optimization via vinext({ images }) adapter

Move server-side image optimization from a hand-wired custom worker entry to a
declarative `vinext({ images: { optimizer } })` option, mirroring the cache
adapter pattern. The default entries now handle `/_next/image` through a
registered optimizer, so no custom worker is required, and the same config
works across all targets — optimizing on Cloudflare, gracefully serving images
unoptimized on Node/dev where the binding is unavailable (like KV cache
degrading to in-memory).

- add an ImageOptimizer registry (set/getImageOptimizer +
  handleConfiguredImageOptimization) in server/image-optimization.ts
- generate `virtual:vinext-image-adapters` (registerConfiguredImageOptimizer)
  from the new `images` plugin option
- add @vinext/cloudflare/image/image-adapter: imageAdapter() builder + runtime
  factory reading the env.IMAGES binding
- handle /_next/image in the default app-router entry and the generated Pages
  worker via the registry; inline next.config `images` (allowed widths +
  security headers) into the RSC entry
- vinext deploy points App Router `main` at vinext/server/app-router-entry
  (no generated worker) and prints a hint to enable the optimizer

next.config `images` (remotePatterns, deviceSizes, dangerouslyAllowSVG, etc.)
continues to drive the standard Next.js options; the vite-config
`images.optimizer` only selects the runtime transform backend.

* fix(images): cover deploy image-hint helpers and preserve optimizer this-binding

The Check CI job failed because knip flagged viteConfigHasImageAdapter and
formatImageOptimizationHint as unused exports — they were only called inside
deploy.ts. Cover both with unit tests in tests/deploy.test.ts (mirroring the
existing viteConfigHasCacheAdapter / formatMissingCacheAdapterError suites),
which also closes the coverage gap for the new deploy hint path.

Also wrap the registered optimizer's transformImage in
handleConfiguredImageOptimization instead of detaching the method, so an
optimizer implemented as a class instance keeps its this binding.

* fix(images): honor configured deviceSizes/imageSizes on the App Router Node prod server

Review follow-up (ask-bonk):

- The App Router prod server (vinext start) validated /_next/image widths
  against the hardcoded Next.js defaults, rejecting valid optimizer URLs with
  400 when the app configures custom images.deviceSizes/imageSizes — while the
  Cloudflare worker entry and the Pages prod path already honored them. Read
  the __imageAllowedWidths constant inlined into the RSC entry (falling back to
  the defaults for older builds), matching how __assetPrefix/__basePath are read.
- Lock in the this-binding behavior of handleConfiguredImageOptimization with a
  class-instance optimizer test.

* fix(images): pass an explicit empty allowed-widths config through on vinext start

Review follow-up (ask-bonk, awareness note): the old-build fallback guard
conflated a missing __imageAllowedWidths export with an explicit empty
deviceSizes/imageSizes config, mapping the latter to the Next.js defaults on
the Node App Router path while the Cloudflare worker passes the empty array
straight through. Only fall back to the defaults when the export is absent.

* refactor(images): read App Router image config from the RSC entry, retire the JSON sidecar

Review follow-up (ask-bonk): the App Router had two parallel build-time sources
for next.config images security/header settings — the __imageConfig constant
inlined into the RSC entry (read by the Cloudflare worker entry) and the
image-config.json sidecar written by the vinext:image-config plugin (read by
vinext start). Unify on the RSC entry export: prod-server now reads
rscModule.__imageConfig, keeping image-config.json only as a read-side fallback
for dist outputs built by older vinext versions, and the sidecar writer plugin
is removed.

* fix(deploy): keep wrangler main on a user-authored worker entry for App Router

Review follow-up (ask-bonk): an App Router app with a custom worker/index.ts
but no wrangler.jsonc would have had its custom worker silently dropped —
generateWranglerConfig unconditionally pointed main at the default
vinext/server/app-router-entry. Respect hasWorkerEntry so a user-authored
worker keeps winning for both routers, with a regression test.

* fix(images): expose Cloudflare optimizer under images path

* fix(deploy): install Cloudflare image adapter package

* fix(examples): declare Cloudflare image adapter package

* test(images): update App Router image config codegen assertions

* fix(examples): configure image optimizer adapters
2026-06-23 20:20:36 +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 caec466fe2 fix(actions): match root params execution phases (#2248)
* fix(actions): match root params execution phases

* fix(actions): preserve root params execution phases

* fix(actions): skip non-revalidating error rerenders

* test(actions): cover failed revalidation rerenders

* fix(actions): dedupe fallback robots metadata

* fix(actions): align thrown action render phases

* fix(actions): close remaining root params parity gaps

* refactor(actions): remove unused root params phase
2026-06-23 19:30:21 +01:00
Jerry Zhao 8eef972c95 refactor(cli): pass a forward-slash root to printBuildReport (#2294) 2026-06-23 18:40:59 +01:00
Jerry Zhao 04245d44d3 refactor(cli): pass a forward-slash root to runPrerender (#2295) 2026-06-23 18:40:50 +01:00
James Anderson f44a97a793 fix(build): align SSR CSS asset paths (#2291)
* fix(build): align SSR CSS asset paths

* test(build): cover SSR asset naming edge cases

* fix(build): preserve array output configuration
2026-06-23 16:39:15 +01:00
Jerry Zhao 4d90f8bac4 refactor(cli): pass a forward-slash root to hasAppDir (#2282) 2026-06-23 14:34:09 +01:00
github-actions[bot] 373cc8b946 chore: version packages (#2259)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
vinext@0.1.8
2026-06-23 12:53:49 +00: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
ponharu 66a7b4e6e8 fix(app-router): exclude dev overlay from production client bundle (#2284)
* fix(app-router): exclude dev overlay from production client bundle

* fix(app-router): reuse loaded dev overlay during HMR

---------

Co-authored-by: James <james@eli.cx>
2026-06-23 11:09:56 +01:00
James Anderson 92884eef42 feat(web): add Vite configuration examples (#2289) 2026-06-23 09:01:24 +00:00
James Anderson 0d5a9e5e1b fix(ssr): ignore runtime renderer import in Vite (#2288) 2026-06-23 10:01:01 +01:00
Jerry Zhao 516107cf7c refactor(deploy): build detectProject paths on a forward-slash root (#2283) 2026-06-23 09:41:40 +01:00
Jerry Zhao c9a16852e8 refactor(typegen): pass the findDir candidate as a forward-slash literal (#2281) 2026-06-23 09:41:26 +01:00
Jerry Zhao 6f7b37d77f refactor(check): build check scanner paths with path.posix (#2280) 2026-06-23 09:41:16 +01:00
Jerry Zhao 767c79afbc refactor(cli): normalize the check/init root to forward slashes at the CLI entry (#2278) 2026-06-23 00:04:22 +01:00
Jerry Zhao 9857bcf53c refactor(check): compute scanImports relative paths with path.posix.relative (#2277) 2026-06-23 00:04:10 +01:00
Jerry Zhao 06fc2b7dd0 refactor(check): join findSourceFiles paths with path.posix.join (#2276) 2026-06-23 00:04:00 +01:00
Jerry Zhao d7ce03dfbe refactor(check): match findDir's forward-slash contract in checkConventions (#2275) 2026-06-23 00:03:28 +01:00
Jerry Zhao cde1c45d77 docs(app-router): document the forward-slash appDir contract on appRouter/appRouteGraph (#2274) 2026-06-23 00:03:02 +01:00
Jerry Zhao 59f892c6b6 refactor(app-router): build typegen route paths on forward slashes (#2273) 2026-06-23 00:02:52 +01:00
ponharu 68547961ee test(deploy): stabilize Wrangler fallback resolution test (#2272) 2026-06-23 00:02:32 +01: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
ponharu 7c932f39cd fix(headers): strip internal dev request ID headers (#2260) 2026-06-22 23:25:08 +01:00
dependabot[bot] 0fa7c8046f chore(deps): bump zizmorcore/zizmor-action from 0.5.6 to 0.5.7 (#2263)
Bumps [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) from 0.5.6 to 0.5.7.
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](https://github.com/zizmorcore/zizmor-action/compare/5f14fd08f7cf1cb1609c1e344975f152c7ee938d...192e21d79ab29983730a13d1382995c2307fbcaa)

---
updated-dependencies:
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.5.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Anderson <james@eli.cx>
2026-06-22 22:22:03 +00:00
Jerry Zhao ad7fe15d9d refactor(app-router): consume directoryToAppRoute paths with path.posix (#2270) 2026-06-22 23:21:10 +01:00
Jerry Zhao 465c00f336 refactor(app-router): yield forward-slash ids from scanWithExtensions (#2271) 2026-06-22 23:20:56 +01:00
Jerry Zhao a532a03a26 refactor(config): normalize the resolveId id once and drop the Windows backslash branches (#2264) 2026-06-22 23:20:17 +01:00
Jerry Zhao 14549e323f test(shims): expect forward-slash shim ids in the next/error and subpath resolution fixtures (#2265) 2026-06-22 23:19:51 +01:00
Jerry Zhao ecfc68874f test(pages-router): wrap the client-navigation page module URL as a Vite /@fs/ id on Windows (#2266) 2026-06-22 23:19:37 +01:00
Jerry Zhao d89fcb5070 test(og-inline): use a forward-slash scoped package name in the linked-workspace fixture (#2267) 2026-06-22 23:19:17 +01:00
Jerry Zhao bc19327853 refactor(app-router): descend findSlotRootPage with path.posix.join to preserve forward-slash ids (#2268) 2026-06-22 23:18:59 +01:00
Jerry Zhao 13f30dd18b refactor(app-router): build parallel-slot dirs with path.posix.join (#2269) 2026-06-22 23:18:51 +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
Steve Faulkner 826ae4cc7c perf(app-router): skip speculative page probes for HTML renders (#2226) 2026-06-22 08:53:17 -05:00
James Anderson 65f9531d00 fix(app-router): canonicalize initial history URL (#2250) 2026-06-22 14:50:06 +01:00
James Anderson 1908494d4d fix(pages-router): allow server-only in API routes (#2234) 2026-06-22 14:46:49 +01:00
Stephen Zhou 6b55874ee0 fix(config): make vite-tsconfig-paths an optional peer (#2258) 2026-06-22 14:39:36 +01:00
Alexander Lichter d6afa2e874 perf(link): omit Pages runtime in app-only builds (#2225)
* perf(link): omit Pages runtime in app-only builds

* fix(link): use document fallback in app-only builds
2026-06-22 14:28:10 +01:00