fix(nextcompile): parse real Next 14/15 server-action manifest shape - #40
Merged
Conversation
Verified the actual server-reference-manifest.json against real Next 14.2 and
15.1 builds (captured into testdata/fixtures): the `workers` map keys on the
MODULE PATH ("app/page") and its value is the webpack moduleId — a bare string
in Next 14 ("9459") and a {moduleId, async} object in Next 15. The previous
map[string]string modeling aborted json.Unmarshal on every Next 15 build.
Decode the value as json.RawMessage and extract the moduleId from both shapes,
keeping Module as the module path (what the action loader keys on).
Also documents a larger finding: the compiled module does NOT expose the action
as a named export (it exports Next's decodeReply/decodeAction/serverHooks
machinery), so actions.mjs's `mod[entry.export]` model cannot invoke a real
action. Correct execution needs Next's action runtime — tracked as a milestone.
Adds fixture-driven tests over both real manifests.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ru3K1fyNRnyTXQ95Gmv6Su
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Captured the real
server-reference-manifest.jsonfrom actual Next 14.2 and15.1 builds (into
shared/nextcompile/testdata/fixtures) and fixed the parser tomatch:
workersmap keys on the module path (app/page); its value is thewebpack moduleId — a bare string in Next 14 (
"9459") and a{moduleId, async}object in Next 15. The oldmap[string]stringmodelingfailed
json.Unmarshalon every Next 15 build.json.RawMessageand extracts the moduleId from bothshapes, keeping
Module= the module path (what the action loader keys on).Also documents (in
actions.go) a larger, evidence-backed finding: the compiledmodule does not expose the action as a named export —
.next/server/app/page.jsexports Next's own
decodeReply/decodeAction/serverHooksmachinery, so theruntime's
mod[entry.export]model cannot invoke a real server action. Correctexecution needs Next's action runtime and is tracked as a milestone.
Fixture-driven tests parse both real manifests.
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ru3K1fyNRnyTXQ95Gmv6Su