[dev][Legacy][JS] Split Legacy mode JavaScript into new ResourceLoader module

The collapsible sidebar adds a new JavaScript dependency and behavior to
Latest mode only. There are a number of ways of to make the deviation
but we think now is the time to start splitting by module.

This patch adds a new ResourceLoader module, skins.vector.legacy.js, and
moves the existing JavaScript into it. The old module, skins.vector.js,
has been given a currently matching index.js entry point that references
the collapsible tabs' files by reaching across directories. It's not
quite ideal as usually ResourceLoader modules and directory structures
strive for 1:1 correspondence but this patch makes the bold assertions
that it's better than a file copy, better than a new
"skins.vector.common.js" ResourceLoader module, more compatible than a
symlink, and the existing jQuery tabs implementation will eventually be
replaced in Latest mode.

A "Legacy" module was added instead of a "Latest" with the assumption
that active development should generally be considered "latest" and
Legacy an intentional distinction.

Bug: T246419
Change-Id: I9980403f1ee5897c27ac0331f0b51a5bcbdff778
This commit is contained in:
Stephen Niedzielski 2020-05-11 15:29:56 -06:00
parent 185d9b28df
commit 108393daf1
6 changed files with 25 additions and 5 deletions

View file

@ -84,7 +84,7 @@ class SkinVector extends SkinTemplate {
$module = $this->isLegacy()
? 'skins.vector.styles.legacy' : 'skins.vector.styles';
$modules['styles']['skin'][] = $module;
$modules['core'][] = 'skins.vector.js';
$modules['core'][] = $this->isLegacy() ? 'skins.vector.legacy.js' : 'skins.vector.js';
return $modules;
}

View file

@ -1,6 +1,6 @@
var
collapsibleTabs = require( './collapsibleTabs.js' ),
vector = require( './vector.js' );
collapsibleTabs = require( '../skins.vector.legacy.js/collapsibleTabs.js' ),
vector = require( '../skins.vector.legacy.js/vector.js' );
function main() {
collapsibleTabs.init();

View file

@ -0,0 +1,10 @@
var
collapsibleTabs = require( './collapsibleTabs.js' ),
vector = require( './vector.js' );
function main() {
collapsibleTabs.init();
$( vector.init );
}
main();

View file

@ -67,8 +67,18 @@
"skins.vector.js": {
"packageFiles": [
"resources/skins.vector.js/index.js",
"resources/skins.vector.js/collapsibleTabs.js",
"resources/skins.vector.js/vector.js"
"resources/skins.vector.legacy.js/collapsibleTabs.js",
"resources/skins.vector.legacy.js/vector.js"
],
"dependencies": [
"mediawiki.util"
]
},
"skins.vector.legacy.js": {
"packageFiles": [
"resources/skins.vector.legacy.js/index.js",
"resources/skins.vector.legacy.js/collapsibleTabs.js",
"resources/skins.vector.legacy.js/vector.js"
],
"dependencies": [
"mediawiki.util"