New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uglified code breaks Greasemonkey scripts #583
Comments
I guess this issue can be generalized "line starting with comments" - and only that - (so drop the see also thingy, userscripts - except that comments have to start on its own line and related github issues). If the generator can detect that a comment started from pos 0, I think it should be possible to put that comment on a separate line. Though then there are the comments starting with whitespace characters. I currently don't know how to deal with that (even though this may be not impossible?). |
@rvanvelzen and Cc: @avdg !function(){// ==UserScript==
// @name RFC 2606§3 - Hello, World!
// @namespace http://localhost.localdomain
// @description JavaScript alert box saying Hello, World!
// @copyright 2007+, Marti Martz (http://userscripts.org/users/37004)
// @license GPL version 3 or any later version; http://www.gnu.org/copyleft/gpl.html
// @license (CC); http://creativecommons.org/licenses/by-nc-sa/3.0/
// @version 0.0.0
// @icon https://s3.amazonaws.com/uso_ss/icon/13701/large.png
// @homepageURL https://github.com/Martii/UserScripts/tree/master/src/RFC%202606%C2%A73/Hello%2C%20World
// @homepageURL https://openuserjs.org/scripts/Marti/RFC_2606%C2%A73_-_Hello,_World!
// @homepageURL http://userscripts.org/scripts/show/13701
// @supportURL http://userscripts.org/topics/23566
// @include http://www.example.com/*
// @include http://www.example.net/*
// @include http://www.example.org/*
// ==/UserScript==
alert("Hello, World!")}(); ... Thanks for trying though... @rvanvelzen can this be reopened or do you want me to create a new issue with the exact same criteria referencing this one? EDIT: Oh wait ... did you publish this to npmjs.com? |
Sorry, this hasn't been in a release yet. HEAD gives the correct result. |
Aww kewl... just got done retesting it with a manual patch into express-minify deps and it works (even with tab characters)... learned something about our project too that slightly deviates from the GM standard but minimal... retested on the known 99% observations that I've seen people trying to hack GM_info and appears to keep all comments starting at the beginning of the line in the UserScript metadata block. Thank you both and sorry for the extra noise. |
When using express-minify 0.1.1 which currently uses a dependency of uglify-js 2.4.15 we are currently experiencing a breakage during minification.
Current passed through uglify-js options used are:
Reduced testcase at https://gist.github.com/Martii/2f032c172d438435aef7 with minified output results attached.
Currently GM, and variants, requires that the first UserScript metadata block comment starts on its own line with no whitespace save for the prior newline in the text stream... uglify-js appears to be stripping the newline out with the above options and thus breaks the UserScript metadata block and script injection occurs everywhere instead of what the author intends.
Any assistance would be greatly appreciated.
See also:
The text was updated successfully, but these errors were encountered: