As I recall, the only minifier that went this far was Closure Compiler [0] - the caveats documented there still apply!
(Fun fact: I believe that Closure Library, and by extension the Closure Compiler, are still used for the Gmail rich text editor! [1])
[0] https://developers.google.com/closure/compiler/docs/api-tuto...
[1] https://google.github.io/closure-library/source/closure/goog...