bundler: fix mangled comments and double suffixes#3032
Merged
dead-claudia merged 3 commits intoMithrilJS:mainfrom Jul 5, 2025
Merged
bundler: fix mangled comments and double suffixes#3032dead-claudia merged 3 commits intoMithrilJS:mainfrom
dead-claudia merged 3 commits intoMithrilJS:mainfrom
Conversation
…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`.
dead-claudia
approved these changes
Jul 5, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
mountRedraw00in 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 testincluding new testsI also confirmed that the minified bundle file (mithril.min.js) remained unchanged.
Types of changes
Checklist