From a81bfeed03c025ae2cb77d4a03a5bc1613c6bbdd Mon Sep 17 00:00:00 2001 From: Vivek Date: Mon, 10 Aug 2026 21:24:06 +0530 Subject: [PATCH 1/2] feat(server): auto-link app/icon and app/apple-icon metadata routes An icon metadata route served its bytes and nothing referenced them, so the file every other framework treats as "this is my favicon" produced a blank tab with no diagnostic. Next links its static icon files; WebJs shipped the Next-shaped file convention and the Next-shaped config object and left the two unconnected, which is a trap for anyone arriving with that muscle memory. It cost the gallery two PRs to notice. With no metadata.icons declared, app/icon.* and app/apple-icon.* now emit their link. The href carries basePath, because the listener strips the prefix before matching and that is where the route answers. No type or sizes is asserted: the route picks its content type at request time, which is the reason to use one, so declaring a type here could contradict the bytes. A declared metadata.icons SUPPRESSES the routes rather than merging with them, which is Next's precedence for its static icon files. An author who names their icons has said which ones they want, and the route is often a placeholder the app has outgrown. Bound from the route table at boot and on each rebuild, the setClientRouterEnabled shape, so no opt threads through every render path and adding or deleting the file takes effect live. --- .../webjs/references/routing-and-pages.md | 23 ++- AGENTS.md | 2 +- packages/server/src/dev.js | 10 +- packages/server/src/ssr.js | 67 +++++++- test/bun/metadata-icon-routes.mjs | 151 ++++++++++++++++++ test/ssr/ssr.test.js | 63 +++++++- website/app/docs/metadata-routes/page.ts | 28 ++++ 7 files changed, 336 insertions(+), 8 deletions(-) create mode 100644 test/bun/metadata-icon-routes.mjs diff --git a/.agents/skills/webjs/references/routing-and-pages.md b/.agents/skills/webjs/references/routing-and-pages.md index 0512c1300..baa4d1583 100644 --- a/.agents/skills/webjs/references/routing-and-pages.md +++ b/.agents/skills/webjs/references/routing-and-pages.md @@ -192,7 +192,28 @@ Refusals worth knowing: `formaction=${fn}` is supported on a `