Page MenuHomePhabricator

Add ability to mark ResourceLoader modules as deprecated
Closed, ResolvedPublic


We have various modules (infamously jquery.ui but also jquery.tipsy) that we want to discourage use of for reasons such as performance, mobile compatibility and replicating functionality of a preferred library. However because these modules are in core they are commonly used in new extensions unless someone who knows what their future fate is.
I would like to find a way to speed up deprecation of these modules so that we can deprecate the targets attribute.

As a straw man proposal I would suggest a 'deprecated' => true ResourceLoader entry that when present (possibly in debug mode) outputs a message in the console such as

This page uses the deprecated modules jquery.ui, jquery.tipsy. Offending modules should be written without these dependencies: '', ''


Related Gerrit Patches:

Event Timeline

Restricted Application added subscribers: Zppix, Aklapper. · View Herald TranscriptJun 14 2016, 6:50 AM
TheDJ added a subscriber: TheDJ.Jun 14 2016, 11:16 AM

Sounds like a good plan to me. ideally, i want to actually make deprecations of modules even more visible while running code, but it's a bit difficult to identify people who might actually be able to do something with such a warning, vs people who would be heavily annoyed by it....

Krinkle triaged this task as Medium priority.Jul 13 2016, 6:29 PM

The front-end standards group discussed it today, here is a summary:

  • We think the proposal makes sense, it can help developers identify deprecated modules and encourage updating existing code.
  • We should inject a script statement when the module is loaded, to log a message to the developer console. We should not do it into the startup manifest.
  • We should make clear what "deprecate" means on
    • We can have a first and a second warning, with two different messages logged to the browser console. This can define an expiration date and insist on updating existing code.
Jdlrobson updated the task description. (Show Details)Jul 14 2016, 9:56 PM

Change 299090 had a related patch set uploaded (by Jdlrobson):
POC: ResourceLoader should support deprecation of modules

Apologies for not making this discussion - I completely lost track of time for the frontend standards meeting. Let me throw up a proof of concept for discussion.

I've tried to make this as flexible as possible.
A ResourceLoader module can set a deprecated field which can be a boolean or an array.
If an array it can provide a message key which will be outputted to the console which could potentially define an expiration date/migrate path.
I hope this is a good first step.

Krinkle renamed this task from Make more obvious to engineers which ResourceLoader modules are deprecated to Add ability to mark ResourceLoader modules as deprecated.Jul 18 2016, 7:41 PM
Krinkle moved this task from Inbox to Accepted Enhancement on the MediaWiki-ResourceLoader board.
Krinkle assigned this task to Jdlrobson.Jul 18 2016, 7:44 PM
Krinkle moved this task from Accepted Enhancement to Assigned on the MediaWiki-ResourceLoader board.

Change 299090 merged by jenkins-bot:
resourceloader: Implement 'deprecated' option for FileModule

Krinkle closed this task as Resolved.Aug 8 2016, 6:44 PM
Restricted Application added a project: Performance-Team. · View Herald TranscriptWed, Dec 11, 12:45 AM