jesus2099 / konami-command

power‐ups for various web sites
119 stars 25 forks source link

OpenUserJS metadata block needed to prevent minifying #158

Closed Martii closed 8 years ago

Martii commented 8 years ago

Since you have multi-line Function Expression strings in this script... you may want to put this around here.

Your metadata block parser probably isn't aware of this metadata block... so outside the UserScript Metadata Block parser might be preferable at this time.

The syntax is as follows:

// ==OpenUserJS==
// @unstableMinify Multi-line string comments using Function Expressions
// ==/OpenUserJS==

... please note you must give a reason after this key otherwise it won't notify your users. Feel free to change the reason why you suggest minification may be unusable in your scripts.

Currently any script that utilizes multi-line Function Expression strings needs this metadata block with that key.

TIA OUJS Admin

jesus2099 commented 8 years ago

I guess I should do this to all my scripts that have a metadata block parser. :)

jesus2099 commented 8 years ago

Thanks @Martii for the tip.

Martii commented 8 years ago

No problem. Thank you. Hopefully there will be some time to get this fixed at a later date with the dependency we use... it's an old bug on their project. Still want to give them every opportunity though. :)

Martii commented 8 years ago

One other quickie too... I've been contemplating doing an example of template literals string with parsers. There is a basic Unit Test but haven't made one for parsing yet _(here now)_... it is limited to ES6+ capable browsers and ES6+ .user.js engines though.

jesus2099 commented 8 years ago

Is the bug only mishoo/UglifyJS2#88 or are there others ?

Martii commented 8 years ago

There are some issues currently with ES6 arrow functions since we are using their experimental harmony support branch. I am planning on reporting them at UglifyJS2 approximately once a month (need to figure out reduced test cases too). Most ES5 seems pretty solid. I update our fork of that project about once a week if needed... so things could change. This is why it's a "suggestion" that minification may not be usable. Cc: @fabiosantoscode

fabiosantoscode commented 8 years ago

I would defenitely like to see those issues. I've been on a little bit of a hiatus when it comes to working on UglifyJS, but I've been doing some stuff lately (namely a local branch with ES6 imports)

Martii commented 7 years ago

@jesus2099

Thought of something just now (better late than never) that would let you and your users test/use .min.user.js versions but should have minimal code impact... try it first though as it's untested with the metadata block parser. Currently seems to work in UglifyJS2:

var meta = {rawmdb: function() {
// ==UserScript==
// @name         mb. FUNKEY ILLUSTRATED RECORDS
// @version      2016.6.15
// @changelog    https://github.com/jesus2099/konami-command/commits/master/mb_FUNKEY-ILLUSTRATED-RECORDS.user.js
// @description  musicbrainz.org: CAA front cover art archive pictures/images (release groups and releases) Big illustrated discography and/or inline everywhere possible without cluttering the pages
// @homepage     http://userscripts-mirror.org/scripts/show/154481
// @supportURL   https://github.com/jesus2099/konami-command/labels/mb_FUNKEY-ILLUSTRATED-RECORDS
// @compatible   opera(12.18.1872)+violentmonkey  my setup
// @compatible   firefox(39)+greasemonkey    quickly tested
// @compatible   chromium(46)+tampermonkey   quickly tested
// @compatible   chrome+tampermonkey         should be same as chromium
// @namespace    https://github.com/jesus2099/konami-command
// @downloadURL  https://github.com/jesus2099/konami-command/raw/master/mb_FUNKEY-ILLUSTRATED-RECORDS.user.js
// @updateURL    https://github.com/jesus2099/konami-command/raw/master/mb_FUNKEY-ILLUSTRATED-RECORDS.user.js
// @author       PATATE12
// @licence      CC BY-NC-SA 3.0 (https://creativecommons.org/licenses/by-nc-sa/3.0/)
// @since        2012-12-19
// @icon         data:image/gif;base64,R0lGODlhEAAQAKEDAP+/3/9/vwAAAP///yH/C05FVFNDQVBFMi4wAwEAAAAh/glqZXN1czIwOTkAIfkEAQACAwAsAAAAABAAEAAAAkCcL5nHlgFiWE3AiMFkNnvBed42CCJgmlsnplhyonIEZ8ElQY8U66X+oZF2ogkIYcFpKI6b4uls3pyKqfGJzRYAACH5BAEIAAMALAgABQAFAAMAAAIFhI8ioAUAIfkEAQgAAwAsCAAGAAUAAgAAAgSEDHgFADs=
// @require      https://greasyfork.org/scripts/10888-super/code/SUPER.js?version=70394&v=2015.8.27
// @grant        none
// @match        *://*.mbsandbox.org/
// @match        *://*.mbsandbox.org/artist/*
// @match        *://*.mbsandbox.org/cdtoc/*
// @match        *://*.mbsandbox.org/collection/*
// @match        *://*.mbsandbox.org/label/*
// @match        *://*.mbsandbox.org/recording/*
// @match        *://*.mbsandbox.org/release/*
// @match        *://*.mbsandbox.org/release-group/*
// @match        *://*.mbsandbox.org/search?*type=annotation*
// @match        *://*.mbsandbox.org/search?*type=release*
// @match        *://*.mbsandbox.org/series/*
// @match        *://*.mbsandbox.org/tag/*
// @match        *://*.mbsandbox.org/user/*/ratings*
// @match        *://*.mbsandbox.org/user/*/tag/*
// @match        *://*.musicbrainz.org/
// @match        *://*.musicbrainz.org/artist/*
// @match        *://*.musicbrainz.org/cdtoc/*
// @match        *://*.musicbrainz.org/collection/*
// @match        *://*.musicbrainz.org/label/*
// @match        *://*.musicbrainz.org/recording/*
// @match        *://*.musicbrainz.org/release/*
// @match        *://*.musicbrainz.org/release-group/*
// @match        *://*.musicbrainz.org/search?*type=annotation*
// @match        *://*.musicbrainz.org/search?*type=release*
// @match        *://*.musicbrainz.org/series/*
// @match        *://*.musicbrainz.org/tag/*
// @match        *://*.musicbrainz.org/user/*/ratings*
// @match        *://*.musicbrainz.org/user/*/tag/*
// @exclude      *.org/cdtoc/remove*
// @exclude      *.org/release/*/*edit*
// @exclude      *.org/series/*/*edit*
// @run-at       document-end
// ==/UserScript==
// ==OpenUserJS==
// @unstableMinify it might break metadata block parser
// ==/OpenUserJS==
'';
}};

... similar to "use strict";. :smile_cat: ... I'd still recommend keeping the OpenUserJS metadata block and key in case UglifyJS2 ever removes that... but might be an option if you are willing to try it.

jesus2099 commented 7 years ago

Thanks @Martii, I’ll look into this. :)