https://bugzilla.wikimedia.org/show_bug.cgi?id=28626

--- Comment #21 from Brion Vibber <br...@wikimedia.org> 2011-07-06 17:45:30 UTC 
---
I've done a little prelim poking at a custom parser for my own edification
(mostly to make sure I better understood the ECMAScript specs) but it's a
relatively low priority for me.

It looks like jsmin+'s parser is indeed legit per description at
http://crisp.tweakblogs.net/blog/1665/a-new-javascript-minifier-jsmin+.html --
that's a good catch, paul!

On quick peek, looks like it's got a standalone JSParser class that produces a
parse tree (and throws exceptions on parse error) which could be called
explicitly, or simply used via the JSMinPlus class which calls through to the
parser, then flattens the parse tree into minified source.

License is... MPL 1.1/GPL 2.0/LGPL 2.1 so it should be fine to integrate into
MediaWiki (yay!)

It's probably worth comparing jsmin+'s minification qualities to our current
home-grown minifier; it sounds like just swapping to jsmin+ as a minifier might
be more robust (since it should be able to detect a JavaScript parse failure
and throw an error that lets us skip the bad file) but we could also use just
the parser as a verifier.

If nothing else, I'd strongly recommend grabbing it and using it for the
minification unit tests (to verify that minified source parses correctly).

The library doesn't appear to have been updated since May 2009 and its parser
is based on the JS-based implementation in
https://github.com/mozilla/narcissus/wiki -- so it might need/want some slight
tweaks for newer ECMAScript standard updates (though it's unlikely we'll be
using any such new features in our code!)

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
Wikibugs-l@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to