feat(ecmascript_utils): add AstFactory make_* methods for module_finalizers patterns#9697
feat(ecmascript_utils): add AstFactory make_* methods for module_finalizers patterns#9697hyf0 wants to merge 1 commit into
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd the label graphite: merge-when-ready to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
There was a problem hiding this comment.
Pull request overview
This PR extends rolldown_ecmascript_utils::AstFactory with a set of make_* constructors needed for the upcoming module_finalizers migration, mirroring the established AST-construction conventions from the design doc and providing behavior-identical ports of the existing AstSnippet helpers (without changing any call sites yet).
Changes:
- Added
AstFactorypublicmake_*helpers for wrapper generation (__commonJS,__esm,__toESM) andkeep_namespatterns. - Added member-expression and re-export construction helpers (
make_member_expr_or_ident_ref,make_member_expr_with_void_zero_object,make_re_export_call). - Added Promise/
.then(...)chaining helpers for dynamic-import style patterns (make_then_extract_property,make_then_call_*,make_callee_then_call) plus small private helper constructors.
|
Folded into the stack per review feedback: API-only PRs with no call sites don't stand on their own. The 12 |

Adds the genuine-pattern
make_*methods onAstFactorythat themodule_finalizersmigration needs (the design doc's envisionedmake_to_esm_wrapper/make_commonjs_wrapperfamily). No call-site changes — these arepub, so the crate compiles; they're consumed by the stackedmodule_finalizersPRs (C②/C③). Each is a faithful, behavior-identical port of the correspondingAstSnippetmethod (originals stay untilAstSnippetis deleted).Added:
make_to_esm_wrapper,make_commonjs_wrapper_stmt,make_esm_wrapper_stmt,make_keep_name_call,make_static_block_keep_name,make_re_export_call,make_member_expr_or_ident_ref,make_member_expr_with_void_zero_object,make_then_extract_property,make_then_call_esm_wrapper_with_namespace,make_then_call_cjs_wrapper_with_to_esm,make_callee_then_call(+ two private helpersarrow_function_extract_property,then_with_arrow_callback).AstFactory migration progress (
meta/design/ast-construction.md)AstFactory+vite_web_worker_post+generate_lazy_export— feat(ecmascript_utils): introduce AstFactory for AST construction #9682 (merged)tweak_ast_for_scanning— refactor(scanner): migrate tweak_ast_for_scanning to AstFactory #9683vite_build_import_analysis— refactor(plugin): migrate vite_build_import_analysis to AstFactory #9693hmr_stage(+ 6 sharedmake_*,builder()by-value) — refactor(hmr): migrate hmr finalizer to AstFactory #9695make_*methods formodule_finalizerspatterns (API only, no call sites) — feat(ecmascript_utils): add AstFactory make_* methods for module_finalizers patterns #9697 ← this PRmodule_finalizers/mod.rs(179 sites, transitional dual field) — refactor(finalizer): migrate module_finalizers/mod.rs to AstFactory #9700ScopeHoistingFinalizer(impl_visit_mut/rename/hmr;snippetfield removed) — refactor(finalizer): finish ScopeHoistingFinalizer migration to AstFactory #9701AstFactory; deleteAstSnippet— refactor(ecmascript_utils): fold construction ext traits onto AstFactory and delete AstSnippet #9702🤖 Generated with Claude Code