Most JavaScript minifiers "want" to put all of the generated, minified code on a single line, except for the license comments. However, it has been discovered that some JavaScript interpreters become unstable when lines are too long. (Also, if a need arises to inspect a minified file in a text editor, you better make sure your editor is up to the challenge!)
As an adaptation to the problems sometimes caused by ultra-long lines, many minifiers automatically limit the maximum line length to some arbitrary value, such as 10000 characters.
But why do it this way? Even minified code must have spaces here and there. If these spaces were replaced* with newline characters (\n), the size of the file would not grow, and all of the problems often attributed to super-long lines would probably go away. Additionally, splitting long lines in this manner might make it more feasible to perform other tasks, such as "diffing" different builds of the same minified project.
So my question is this: Are there minifiers that provide a way to do this? Or, alternatively: Are there build tasks that can be used to automatically replace spaces with newlines, without disrupting the preserved (license) comments?
I'm using Grunt to build my project, so I would prefer answers targeting this environment, but I'm interested in all possible solutions.
Edit:
* wherever it is safe to do so without breaking semantics