Skip to content

refactor(packages/codegen): TSDown plugin strip all debugAssert* calls - #25987

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls
Aug 24, 2026
Merged

graphite-app[bot] merged 1 commit into
mainfrom
om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Aug 22, 2026

Copy link
Copy Markdown
Member

Refactor in preparation for #25989.

remove_asserts TSDown plugin removes debug assertions in release builds, but only when the assertion functions are imported from asserts.ts.

We have various other debugAssert* functions which are defined elsewhere. Make the plugin remove them too in release builds.

The reason this is needed is that many of these debugAssert functions receive node. #25989 removes node param from functions containing these assertions, which means node becomes a global. Minifier has to assume accessing a global may have side-effects and therefore does not remove these debug assertions. We need the plugin to do it.

@github-actions github-actions Bot added the A-codegen Area - Code Generation label Aug 22, 2026

overlookmotel commented Aug 22, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of 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.

@overlookmotel
overlookmotel force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from 9b6e495 to ba80f23 Compare August 22, 2026 01:43
@overlookmotel
overlookmotel force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from 3e7eaae to 0a703b3 Compare August 22, 2026 01:43
@overlookmotel
overlookmotel marked this pull request as ready for review August 22, 2026 02:04
Copilot AI lite review requested due to automatic review settings August 22, 2026 02:04

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@overlookmotel
overlookmotel requested a review from camc314 August 22, 2026 02:13
@graphite-app
graphite-app Bot force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from 0a703b3 to 1f92e23 Compare August 22, 2026 09:44
@graphite-app
graphite-app Bot force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from ba80f23 to f716744 Compare August 22, 2026 09:45
@graphite-app
graphite-app Bot force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from 1f92e23 to 6514151 Compare August 22, 2026 10:35
@graphite-app
graphite-app Bot force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from f716744 to 999ab14 Compare August 22, 2026 10:36
@graphite-app
graphite-app Bot force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from 6514151 to d4f4401 Compare August 22, 2026 13:38
@graphite-app
graphite-app Bot force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from 999ab14 to 7e4b3e4 Compare August 22, 2026 13:38
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Aug 24, 2026

camc314 commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Merge activity

@graphite-app
graphite-app Bot force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from d4f4401 to af2ee26 Compare August 24, 2026 09:08
@graphite-app
graphite-app Bot force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from 7e4b3e4 to 09bb6d8 Compare August 24, 2026 09:09
…lls (#25987)

Refactor in preparation for #25989.

`remove_asserts` TSDown plugin removes debug assertions in release builds, but only when the assertion functions are imported from `asserts.ts`.

We have various other `debugAssert*` functions which are defined elsewhere. Make the plugin remove them too in release builds.

The reason this is needed is that many of these `debugAssert` functions receive `node`. #25989 removes `node` param from functions containing these assertions, which means `node` becomes a global. Minifier has to assume accessing a global may have side-effects and therefore does not remove these debug assertions. We need the plugin to do it.
@graphite-app
graphite-app Bot force-pushed the om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions branch from af2ee26 to 29a7749 Compare August 24, 2026 09:23
@graphite-app
graphite-app Bot force-pushed the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch from 09bb6d8 to b6c6036 Compare August 24, 2026 09:23
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Aug 24, 2026
Base automatically changed from om/08-19-perf_packages_codegen_pass_start_and_end_to_write_and_mark_functions to main August 24, 2026 09:31
@graphite-app
graphite-app Bot merged commit b6c6036 into main Aug 24, 2026
31 checks passed
@graphite-app
graphite-app Bot deleted the om/08-19-refactor_packages_codegen_tsdown_plugin_strip_all_debugassert_calls branch August 24, 2026 09:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area - Code Generation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Sponsor
SponsoredKunjungi sekarang
Promo