Call register_assignment_scope() in visit_export_default_expr() and visit_export_default_decl()#94581
Open
sampoder wants to merge 1 commit into
Open
Call register_assignment_scope() in visit_export_default_expr() and visit_export_default_decl()#94581sampoder wants to merge 1 commit into
register_assignment_scope() in visit_export_default_expr() and visit_export_default_decl()#94581sampoder wants to merge 1 commit into
Conversation
Contributor
Failing test suitesCommit: ab16b36 | About building and testing Next.js
Expand output● app dir - metadata static routes cache › should generate different content after replace the static metadata file Other failing CI jobs |
Contributor
Stats from current PR🟢 1 improvement
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📝 Changed Files (8 files)Files with changes:
View diffsapp-page-exp..ntime.dev.jsfailed to diffapp-page-exp..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page-tur..ntime.dev.jsfailed to diffapp-page-tur..time.prod.jsfailed to diffapp-page.runtime.dev.jsfailed to diffapp-page.runtime.prod.jsfailed to diff📎 Tarball URLCommit: ab16b36 |
Member
Can we add a test case for that? Or does this just unblock some future change? |
…nd `visit_export_default_decl()`
Registering an assignment scope for the synthetic default-export binding marks
it as constant-after-eval, so codegen can emit `export default <expr>` as a
plain value ("default", 0, ...) instead of a live getter arrow (() => ...) for
non-circuit-breaker modules. This avoids an arrow closure per default export.
Adds a snapshot test covering the value-form codegen.
5cd2411 to
ab16b36
Compare
Member
Author
Added a snapshot test that demonstrates it! |
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.
Talked IRL, we found that calling this in
visit_export_default_expr()cut down themodule-costbenchmark on ESM execution by about 10ms (approx. 35%).Doing this unlocks a codegen optimization to avoid arrow functions, this special case was needed to support
export default ...which is a kind of declaration all on its own.