Page MenuHomePhabricator

Make ResourceLoader a standalone library
Open, LowPublic

Description

Frontend

mw.loader is naturally quite separate from other MediaWiki JS modules. Mainly, because it has to - it's the first thing that loads.

  • Implement an abstraction for mw.loader (e.g. factory function or class)? Or find another way to inject MW-specific config (e.g. where load.php is mounted).
  • ???

Progress:

Backend

When ResourceLoader was first written, and shortly before this task was filed, it was mostly MW-agnostic.

Having said that, a few things have crept in over the years.

Original task description

Just like the backend, the front-end should be less tied into MediaWiki base as well.

It sounds more complicated than it really is though. All we need to do is move mw.loader into a separate file and create an instance of it in mw.loader.

It's already an object constructor, except that right now it is instantly-instantiating an anonymous object constructor (this.loader = new (function(){ ... }));

Details

Reference
bz30956
ProjectBranchLines +/-Subject
mediawiki/coremaster+8 -2
mediawiki/coremaster+4 -6
mediawiki/coremaster+36 -23
mediawiki/coremaster+13 -14
mediawiki/coremaster+27 -38
mediawiki/coremaster+100 -108
mediawiki/coremaster+4 -7
mediawiki/coremaster+11 -2
mediawiki/coremaster+39 -34
mediawiki/corewmf/1.34.0-wmf.1+22 -22
mediawiki/coremaster+22 -22
mediawiki/coremaster+10 -8
mediawiki/coremaster+5 -10
mediawiki/coremaster+10 -14
mediawiki/coremaster+8 -10
mediawiki/coremaster+45 -18
Show related patches Customize query in gerrit

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

Change 491018 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Instantiate main class via ServiceWiring

https://gerrit.wikimedia.org/r/491018

Change 491018 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Instantiate main class via ServiceWiring

https://gerrit.wikimedia.org/r/491018

@Krinkle Just want to clarify, was this intentionally mark as resolved or was it an accident? There was a patch above, which only mentioned:
“Making ResourceLoader a standalone library (some day)” (as something that is now possible to do in the future). This part mentioned actually hasn’t been done yet, so I don’t think it’s valid to mark this task as resolved. Thank you (and thank you for the patch!)

Change 495306 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Replace ResourceLoaderDebug config use with context

https://gerrit.wikimedia.org/r/495306

@SamanthaNguyen Accidental indeed. This'll be an on-going process in various small steps.

Change 495306 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Replace ResourceLoaderDebug config use with context

https://gerrit.wikimedia.org/r/495306

Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

Change 499954 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Move registering of custom sources to ServiceWiring

https://gerrit.wikimedia.org/r/499954

Change 499954 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Move registering of custom sources to ServiceWiring

https://gerrit.wikimedia.org/r/499954

Change 501961 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Move registration of Resources.php to ServiceWiring

https://gerrit.wikimedia.org/r/501961

Change 501961 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Move registration of Resources.php to ServiceWiring

https://gerrit.wikimedia.org/r/501961

Change 503132 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Remove needless MW-specific fallback

https://gerrit.wikimedia.org/r/503132

Change 503133 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger

https://gerrit.wikimedia.org/r/503133

Change 503132 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Remove needless MW-specific fallback

https://gerrit.wikimedia.org/r/503132

Change 504561 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Move remaining module registrations to ServiceWiring

https://gerrit.wikimedia.org/r/504561

Change 504561 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Move remaining module registrations to ServiceWiring

https://gerrit.wikimedia.org/r/504561

Change 504660 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@wmf/1.34.0-wmf.1] resourceloader: Move remaining module registrations to ServiceWiring

https://gerrit.wikimedia.org/r/504660

Change 504660 merged by jenkins-bot:
[mediawiki/core@wmf/1.34.0-wmf.1] resourceloader: Move remaining module registrations to ServiceWiring

https://gerrit.wikimedia.org/r/504660

Change 516277 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Warn on ResourceLoader::construct without Config

https://gerrit.wikimedia.org/r/516277

Change 516277 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Warn on ResourceLoader::construct without Config

https://gerrit.wikimedia.org/r/516277

Krinkle updated the task description. (Show Details)
Krinkle updated the task description. (Show Details)

Change 503133 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Deprecate ResourceLoaderContext::getConfig and ::getLogger

https://gerrit.wikimedia.org/r/503133

Change 517873 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Switch Xml::encodeJsCall call in getDeprecationInformation

https://gerrit.wikimedia.org/r/517873

Change 517873 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Switch Xml::encodeJsCall call in getDeprecationInformation

https://gerrit.wikimedia.org/r/517873

Change 523371 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Replace some Xml::encodeJs calls with RL's own encodeJson

https://gerrit.wikimedia.org/r/523371

Change 523371 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Replace some Xml::encodeJs calls with RL's own encodeJson

https://gerrit.wikimedia.org/r/523371

Change 535354 had a related patch set uploaded (by Fomafix; owner: Fomafix):
[mediawiki/core@master] resourceloader: Replace Xml::encodeJsCall by encodeJsonForScript

https://gerrit.wikimedia.org/r/535354

Change 535354 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Replace Xml::encodeJsCall by encodeJsonForScript

https://gerrit.wikimedia.org/r/535354

Change 578382 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Export ResourceModuleSkinStyles as extension attribute

https://gerrit.wikimedia.org/r/578382

Change 578383 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Export ResourceModules as extension attribute

https://gerrit.wikimedia.org/r/578383

Change 578382 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Export ResourceModuleSkinStyles as extension attribute

https://gerrit.wikimedia.org/r/578382

Change 578383 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Export ResourceModules as extension attribute

https://gerrit.wikimedia.org/r/578383

Marking T190129 as subtask. While resourceloader will most likely not use language-data directly (it takes lang and dir parameters instead), I'd like to be able to document wikimedia/language-data as a suggested package for any consumer that uses it in multilingual context since we don't want to encourage consumers to maintain their own lang->direction map.

Change 673308 had a related patch set uploaded (by Krinkle; owner: Krinkle):
[mediawiki/core@master] resourceloader: Require a Config object in ResourceLoader::__construct()

https://gerrit.wikimedia.org/r/673308

Change 673308 merged by jenkins-bot:
[mediawiki/core@master] resourceloader: Require a Config object in ResourceLoader::__construct()

https://gerrit.wikimedia.org/r/673308

Change 523967 had a related patch set uploaded (by Fomafix; author: Fomafix):

[mediawiki/core@master] Keep the test language code 'en-rtl' out of resourceloader

https://gerrit.wikimedia.org/r/523967