mediawiki.util: Move mw.RegExp over as well to simplify migration
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 9 Sep 2019 17:23:34 +0000 (18:23 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Mon, 9 Sep 2019 17:25:09 +0000 (18:25 +0100)
Follows-up 8697ba835463c94. In order to allow for a simpler migration
and to keep compatibility over 1 stable release at least, deprecate
the module only, and keep the alias in the destination module.

This means 'mediawiki.RegExp' can be replaced with 'mediawiki.util',
without it causing code to break. It will still warn about
the method being deprecated, which can then be fixed separately,
depending on whether compat is needed.

This is mainly to reduce risk from mass migrations in user scripts
and gadgets (to do in two separate passes).

Bug: T218339
Change-Id: I07ba0a481b83fe704be3a17199070bafba4d5233

resources/Resources.php
resources/src/mediawiki.RegExp.js [deleted file]
resources/src/mediawiki.util/util.js

index b3aee84..8a6ec61 100644 (file)
@@ -1028,7 +1028,6 @@ return [
        ],
        'mediawiki.RegExp' => [
                'deprecated' => 'Please use mw.util.escapeRegExp() instead.',
-               'scripts' => 'resources/src/mediawiki.RegExp.js',
                'targets' => [ 'desktop', 'mobile' ],
                'dependencies' => [
                        'mediawiki.util',
diff --git a/resources/src/mediawiki.RegExp.js b/resources/src/mediawiki.RegExp.js
deleted file mode 100644 (file)
index 258bc2c..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-( function () {
-       mw.RegExp = {};
-       // Backwards-compatible alias; @deprecated since 1.34
-       mw.log.deprecate( mw.RegExp, 'escape', mw.util.escapeRegExp, 'Use mw.util.escapeRegExp() instead.', 'mw.RegExp.escape' );
-}() );
index 6342011..e8823e1 100644 (file)
@@ -533,6 +533,11 @@ util = {
        }
 };
 
+// Backwards-compatible alias for mediawiki.RegExp module.
+// @deprecated since 1.34
+mw.RegExp = {};
+mw.log.deprecate( mw.RegExp, 'escape', util.escapeRegExp, 'Use mw.util.escapeRegExp() instead.', 'mw.RegExp.escape' );
+
 // Not allowed outside unit tests
 if ( window.QUnit ) {
        util.setOptionsForTest = function ( opts ) {