Skip to content

bundler: fix mangled comments and double suffixes#3032

Merged
dead-claudia merged 3 commits intoMithrilJS:mainfrom
kfule:fix-comment-lines
Jul 5, 2025
Merged

bundler: fix mangled comments and double suffixes#3032
dead-claudia merged 3 commits intoMithrilJS:mainfrom
kfule:fix-comment-lines

Conversation

@kfule
Copy link
Copy Markdown
Contributor

@kfule kfule commented Jul 5, 2025

Description

This PR removes unnecessary suffixes from comments in the bundle file. It also fixes the strange double suffix (mountRedraw00).

This PR only removes suffixes from comments and fixes the count-up of some suffixes in the bundle file, and does not break the code. Only the suffixes in the bundle (mithril.js) are fixed, and the minified bundle (mithril.min.js) remains completely unchanged.

Motivation and Context

The mithril bundle file is very clean and has not so many lines (around 1,700 LOC now). However, comments with mysterious suffixes are not easy to read for first-time readers and diminish its value.

In addition, the double suffix mountRedraw00 in the bundle file seemed strange, and it was related to the comment fix, so I decided to investigate and fix it.

How Has This Been Tested?

npm run test including new tests

I also confirmed that the minified bundle file (mithril.min.js) remained unchanged.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

kfule added 3 commits July 5, 2025 19:57
…mment lines

This removes the mysterious suffixes in the comments and improves the readability of the bundled mithril.js. There is no impact on the code other than comments, as the processing is limited to lines containing only comments.
Trailing comments are not subject to this processing, but there are few trailing comments, and mangling does not seem to occur so far.
For some modules that are imported multiple times, it seems that the suffix count may be reset to 0. As a result, the suffix count does not increase, and a suffix may be added to the suffix, such as `mountRedraw00`. These double suffixes are annoying to fix, and it seems that `mountRedraw00` in the comments is corrected to `mountRedraw0`.
This commit prevents double suffixes by preventing the suffix count reset. Some suffixes in the bundled mithril.js will change, but this is because the suffixes are correctly incremented, and the code will not be broken (i.e., mithril.min.js will remain unchanged).
The double suffix test reproduces the current file structure for `mountRedraw00`.
@kfule kfule requested a review from a team as a code owner July 5, 2025 12:40
@dead-claudia dead-claudia merged commit efa4c88 into MithrilJS:main Jul 5, 2025
7 checks passed
@JAForbes JAForbes mentioned this pull request Jul 5, 2025
@kfule kfule deleted the fix-comment-lines branch September 6, 2025 00:19
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