Unverified Commit 6d0379d4 authored by Josh Story's avatar Josh Story Committed by GitHub

Extract metadata resolution primitives (#97388)

## Summary

The existing metadata resolver combines two responsibilities: walking
the loader tree to collect and schedule route exports, and interpreting
the metadata or viewport value produced by an individual route layer.

Move the route-layer operations into metadata-resolution-primitives.ts.
This includes wrapping generateMetadata and generateViewport, loading
file-based metadata, merging values with their resolved parents,
post-processing metadata, and producing SelectedMetadata for rendering.

Keep resolve-metadata.ts responsible for the existing traversal and
scheduling flow, importing the extracted operations back into the same
call sites and preserving its existing exports. This creates a reusable
boundary for other traversal strategies without introducing another
resolution path.

This is intended to be behavior preserving: traversal order, eager
generator invocation, parent promise behavior, warnings, and rendered
metadata and viewport tags are unchanged.

## Verification

- pnpm build-all

<!-- NEXT_JS_LLM -->
parent b5538511
......@@ -300,6 +300,7 @@ async function readNormalizedNFT(next, name) {
"/node_modules/next/dist/lib/metadata/get-metadata-route.js",
"/node_modules/next/dist/lib/metadata/is-metadata-route.js",
"/node_modules/next/dist/lib/metadata/metadata-context.js",
"/node_modules/next/dist/lib/metadata/metadata-resolution-primitives.js",
"/node_modules/next/dist/lib/metadata/metadata.js",
"/node_modules/next/dist/lib/metadata/resolve-metadata.js",
"/node_modules/next/dist/lib/metadata/resolvers/resolve-basics.js",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment