I've started experimenting with embedding my ogv.js media player into TimedMediaHandler to provide Ogg playback in Safari and Internet Explorer: https://gerrit.wikimedia.org/r/#/c/145756/
This involves on-demand loading of a fairly large chunk of mostly machine-generated, dense, pre-minified JavaScript that weighs in around a megabyte (gzips to 250k or so).
Initially I tried tossing it in with the ResourceLoader modules and loading it with mw.loader.using(), but in some configurations the automatic JS minification in ResourceLoader was taking too long to process the file. (On MediaWiki-Vagrant with Zend PHP and Xdebug enabled, it actually hit the 30-second execution limit. Ouch!)
I couldn't find a way to disable minification for a particular module; it looks like it's applied as a filter step after modules are bundled together, so I'm not sure it's really possible.
Currently I'm loading the ogv.js payload as a separate file with $.ajax({dataType:'script'}); this totally bypasses ResourceLoader and thus the minifier, but gzipping is dependent on the web server configuration. (MediaWiki-Vagrant's Apache configuration auto-gzips .js files, so yay!)
I also lose other ResourceLoader features like automatic cache invalidation; for now I'm appending a version parameter on the URL to ensure that the file is re-cached when updated, but it has to be manually updated along with the JS payload file.
Any recommendations for making ResourceLoader and large, pre-minified JS sources fit together better? Or is what I'm doing pretty much the best practice for now? :)
I'm considering a 'stub' ResourceLoaderModule subclass that generates the $.ajax() loader call including an automatic version timestamp URL parameter from the file's last-modification time...
-- brion
You can bypass minification with &raw=true, but it would kill most of RL niceties too.
On Sun, Jul 13, 2014 at 6:10 AM, Brion Vibber bvibber@wikimedia.org wrote:
I've started experimenting with embedding my ogv.js media player into TimedMediaHandler to provide Ogg playback in Safari and Internet Explorer: https://gerrit.wikimedia.org/r/#/c/145756/
This involves on-demand loading of a fairly large chunk of mostly machine-generated, dense, pre-minified JavaScript that weighs in around a megabyte (gzips to 250k or so).
Initially I tried tossing it in with the ResourceLoader modules and loading it with mw.loader.using(), but in some configurations the automatic JS minification in ResourceLoader was taking too long to process the file. (On MediaWiki-Vagrant with Zend PHP and Xdebug enabled, it actually hit the 30-second execution limit. Ouch!)
I couldn't find a way to disable minification for a particular module; it looks like it's applied as a filter step after modules are bundled together, so I'm not sure it's really possible.
Currently I'm loading the ogv.js payload as a separate file with $.ajax({dataType:'script'}); this totally bypasses ResourceLoader and thus the minifier, but gzipping is dependent on the web server configuration. (MediaWiki-Vagrant's Apache configuration auto-gzips .js files, so yay!)
I also lose other ResourceLoader features like automatic cache invalidation; for now I'm appending a version parameter on the URL to ensure that the file is re-cached when updated, but it has to be manually updated along with the JS payload file.
Any recommendations for making ResourceLoader and large, pre-minified JS sources fit together better? Or is what I'm doing pretty much the best practice for now? :)
I'm considering a 'stub' ResourceLoaderModule subclass that generates the $.ajax() loader call including an automatic version timestamp URL parameter from the file's last-modification time...
-- brion _______________________________________________ Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On 13 Jul 2014, at 19:40, Max Semenik maxsem.wiki@gmail.com wrote:
You can bypass minification with &raw=true, but it would kill most of RL niceties too.
This is incorrect. ResourceLoader "raw" does not, nor ever has, bypassed minification.
"raw" is what bypasses the client loader framework. So instead of returning a combined script/styles/messages response to the mw.loader.implement callback, it returns a raw response for only scripts, styles or messages – whichever is specified in the "&only=" parameter – without a mw.loader.implement or mw.loader.state call.
This is mostly undocumented and discouraged hack that can be used to fetch ResourceLoader modules into a non-ResourceLoader context (e.g. Toolserver, old versions of MobileFrontend).
It does not bypass minification. That's what debug=true is for.
To fetch the scripts with only concatenation and not minification, you can use &modules=my.module.name&only=scripts&debug=true. Like all unversioned requests, this is only cached for 5 to 30 minutes (depending on mediawiki configuration).
-- Krinkle
Seems reasonable for us to consider adding a way to specify "packed" in RL to skip additional processing of that module.
- Trevor
On Sun, Jul 13, 2014 at 6:35 PM, Krinkle krinklemail@gmail.com wrote:
On 13 Jul 2014, at 19:40, Max Semenik maxsem.wiki@gmail.com wrote:
You can bypass minification with &raw=true, but it would kill most of RL niceties too.
This is incorrect. ResourceLoader "raw" does not, nor ever has, bypassed minification.
"raw" is what bypasses the client loader framework. So instead of returning a combined script/styles/messages response to the mw.loader.implement callback, it returns a raw response for only scripts, styles or messages – whichever is specified in the "&only=" parameter – without a mw.loader.implement or mw.loader.state call.
This is mostly undocumented and discouraged hack that can be used to fetch ResourceLoader modules into a non-ResourceLoader context (e.g. Toolserver, old versions of MobileFrontend).
It does not bypass minification. That's what debug=true is for.
To fetch the scripts with only concatenation and not minification, you can use &modules=my.module.name&only=scripts&debug=true. Like all unversioned requests, this is only cached for 5 to 30 minutes (depending on mediawiki configuration).
-- Krinkle
Wikitech-l mailing list Wikitech-l@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/wikitech-l
On Sun, Jul 13, 2014 at 6:35 PM, Krinkle krinklemail@gmail.com wrote:
"raw" is what bypasses the client loader framework. So instead of returning a combined script/styles/messages response to the mw.loader.implement callback, it returns a raw response for only scripts, styles or messages – whichever is specified in the "&only=" parameter – without a mw.loader.implement or mw.loader.state call.
Blargh, I'm quite good at forgetting stuff I myself have written :P
wikitech-l@lists.wikimedia.org