Skip to content

feat(ecmascript_utils): add AstFactory make_* methods for module_finalizers patterns#9697

Closed
hyf0 wants to merge 1 commit into
astfactory-migrate-hmrfrom
astfactory-mf-make-methods
Closed

feat(ecmascript_utils): add AstFactory make_* methods for module_finalizers patterns#9697
hyf0 wants to merge 1 commit into
astfactory-migrate-hmrfrom
astfactory-mf-make-methods

Conversation

@hyf0

@hyf0 hyf0 commented Jun 9, 2026

Copy link
Copy Markdown
Member

Adds the genuine-pattern make_* methods on AstFactory that the module_finalizers migration needs (the design doc's envisioned make_to_esm_wrapper / make_commonjs_wrapper family). No call-site changes — these are pub, so the crate compiles; they're consumed by the stacked module_finalizers PRs (C②/C③). Each is a faithful, behavior-identical port of the corresponding AstSnippet method (originals stay until AstSnippet is 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 helpers arrow_function_extract_property, then_with_arrow_callback).

AstFactory migration progress (meta/design/ast-construction.md)

🤖 Generated with Claude Code

hyf0 commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

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.
Learn more


How to use the Graphite Merge Queue

Add 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.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 AstFactory public make_* helpers for wrapper generation (__commonJS, __esm, __toESM) and keep_names patterns.
  • 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.

@hyf0

hyf0 commented Jun 10, 2026

Copy link
Copy Markdown
Member Author

Folded into the stack per review feedback: API-only PRs with no call sites don't stand on their own. The 12 make_* methods (+2 private helpers) consumed by module_finalizers/mod.rs moved into #9700; make_commonjs_wrapper_stmt / make_esm_wrapper_stmt moved into #9701 alongside their first callers. The stack-top tree is byte-identical to before the reshuffle.

@hyf0 hyf0 closed this Jun 10, 2026
@hyf0 hyf0 deleted the astfactory-mf-make-methods branch June 10, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants