This is just an idea, if Wikimedia-Minify already this does or it's not worth anyone's time because there's not enough to gain I apologize in advance.
I have no personal need for this, it's just an idea.
Feature summary (what you would like to be able to do and where):
Allow Wikimedia-Minify to skip minification of already-minified files.
I imagine this could be realized by either having Wikimedia-Minify autodetect this (perhaps by looking for unusually long lines?) or some indicator in the minified file or its filename.
Use case(s) (list the steps that you performed to discover that problem, and describe the actual underlying problem which you want to solve. Do not describe only a solution):
Some JS files are already minified. For example Vue and Pako. (T346075) This is also true for some gadgets, for example https://en.wikipedia.org/wiki/MediaWiki:Gadget-XFDcloser-core.js.
I assume Wikimedia-Minify will still spend some CPU-cycles trying to compress this further. I'd expect it to fail to compress these files any further. So some performance benefit may be possible by skipping Wikimedia-Minify here, or only removing comments at the top+bottom.
Benefits (why should this be implemented?):
Saving a few CPU cycles on the Wikimedia servers. I have no idea how "expensive" Wikimedia-Minify is, so it may or may not be worth the hassle. It's just an idea.
I actually skimmed over https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/libs/Minify/+/refs/heads/master/src/JavaScriptMinifier.php and nothing stood out that could skip already-minified files, but I only skimmed over it so I could have missed it.