Skip to content

refactor(swc): make the primary compilation path linear - #12023

Open
magic-akari wants to merge 1 commit into
mainfrom
refactor/linear-pipeline
Open

refactor(swc): make the primary compilation path linear#12023
magic-akari wants to merge 1 commit into
mainfrom
refactor/linear-pipeline

Conversation

@magic-akari

@magic-akari magic-akari commented Jul 14, 2026

Copy link
Copy Markdown
Member

Description:

Make the primary SWC compilation pipeline explicit:

resolve config → parse → transform → minify → finalize

Add a lazy Compiler::compile API with AST/codegen terminals and paired inspect/mutate hooks; migrate the default Node/wasm paths and isolate delayed build_as_input under config/legacy.

Codegen remains outside the pipeline, with emit preparation before transforms; Flow behavior is preserved, wasm custom passes remain on legacy for ABI/timing compatibility, and wasm span snapshots shift only because skipped inactive React setup no longer advances the shared SourceMap (generated output is unchanged).

BREAKING CHANGE:

Related issue (if exists):

@codspeed-hq

codspeed-hq Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 189 untouched benchmarks
⏩ 61 skipped benchmarks1


Comparing refactor/linear-pipeline (34d363e) with main (78b41b5)

Open in CodSpeed

Footnotes

  1. 61 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@magic-akari
magic-akari marked this pull request as ready for review July 14, 2026 17:55
@magic-akari
magic-akari requested review from a team as code owners July 14, 2026 17:55

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d63922c96e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread crates/swc/src/flow.rs Outdated
@magic-akari
magic-akari force-pushed the refactor/linear-pipeline branch from d63922c to b886bdc Compare July 15, 2026 04:33
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 34d363e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@magic-akari
magic-akari marked this pull request as draft July 15, 2026 14:31
Move the primary compiler path to an explicit resolve-config, parse, transform, minify, and finalize pipeline, while freezing build_as_input under config::legacy for bundler and custom-pass compatibility.

Expose Compiler::compile as a lazy request with codegen and AST terminals. Keep emit-only preparation on codegen, retain comments and helper requirements for AST consumers, and provide paired inspect/mutate hooks after parsing, resolution, and the post-syntax checkpoint.

Route process_js_file, process_js, and the default Node and wasm transforms through the direct pipeline. Keep Flow source classification on source input without reclassifying caller-supplied Program variants.
@magic-akari
magic-akari force-pushed the refactor/linear-pipeline branch from b886bdc to 34d363e Compare July 16, 2026 01:54
@magic-akari

Copy link
Copy Markdown
Member Author

Codex (@codex) review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34d363eb67

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "Codex (@codex) review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "Codex (@codex) address that feedback".

Comment thread crates/swc/src/pipeline/options.rs
Comment thread crates/swc/src/pipeline/transform.rs
@magic-akari
magic-akari marked this pull request as ready for review July 16, 2026 06:25
@kdy1

Copy link
Copy Markdown
Member

As magic-akari requested, I'll wait for a review from CPunisher 😄

@kdy1 Donny/강동윤 (kdy1) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you!
CPunisher I think this PR is good to go. Can you take a look?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants