jenkins-bot has submitted this change and it was merged.

Change subject: Switch from es6-shim to core-js; update prfun and jshint.
......................................................................


Switch from es6-shim to core-js; update prfun and jshint.

We now use a subclass of the native Promise instead of polluting the
global Promise.

Change-Id: Ic19fb9efaa492650fc22864f5942c04b46696572
---
M .jshintrc
M bin/mw-ocg-bundler
M lib/api.js
M lib/attribution.js
M lib/authors.js
M lib/db.js
M lib/html.js
M lib/image.js
M lib/index.js
M lib/metabook.js
M lib/p.js
M lib/parsoid.js
M lib/retry-request.js
M lib/revisions.js
M lib/siteinfo.js
M package.json
M samples/featured.js
M test/samples.js
18 files changed, 36 insertions(+), 35 deletions(-)

Approvals:
  Arlolra: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/.jshintrc b/.jshintrc
index 529d30e..88e79fd 100644
--- a/.jshintrc
+++ b/.jshintrc
@@ -7,7 +7,6 @@
                "QUnit",
 
                "Map",
-               "Promise",
                "Set"
        ],
 
diff --git a/bin/mw-ocg-bundler b/bin/mw-ocg-bundler
index 9211ae7..493bf62 100755
--- a/bin/mw-ocg-bundler
+++ b/bin/mw-ocg-bundler
@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 "use strict";
-require('es6-shim'); // for Map, endsWith, etc.
-require('prfun');
+require('core-js/shim'); // for Map, endsWith, etc.
+var Promise = require('prfun');
 
 var program = require('commander');
 var bundler = require('../');
diff --git a/lib/api.js b/lib/api.js
index 36491bf..d0346ee 100644
--- a/lib/api.js
+++ b/lib/api.js
@@ -1,7 +1,7 @@
 // helpers for making mediawiki api requests
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var querystring = require('querystring');
 var request = Promise.promisify(require('./retry-request'), true);
diff --git a/lib/attribution.js b/lib/attribution.js
index 101f062..37daf21 100644
--- a/lib/attribution.js
+++ b/lib/attribution.js
@@ -1,6 +1,6 @@
 "use strict";
-require('es6-shim'); // Map/Set/Promise support
-require('prfun');
+require('core-js/shim'); // Map/Set/Promise support
+var Promise = require('prfun');
 
 var util = require('util');
 
diff --git a/lib/authors.js b/lib/authors.js
index 485a8c3..cdab536 100644
--- a/lib/authors.js
+++ b/lib/authors.js
@@ -1,7 +1,7 @@
 // Obtain authorship information for wiki articles.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var util = require('util');
 
diff --git a/lib/db.js b/lib/db.js
index 1d9b0c9..c208056 100644
--- a/lib/db.js
+++ b/lib/db.js
@@ -1,7 +1,7 @@
 // Helpers to create/read key/value mappings in sqlite db
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var sqlite3 = require('sqlite3');
 
diff --git a/lib/html.js b/lib/html.js
index 3b17edd..ddc708e 100644
--- a/lib/html.js
+++ b/lib/html.js
@@ -1,5 +1,7 @@
 // Generate contents of html.db
 "use strict";
+require('core-js/shim');
+var Promise = require('prfun');
 
 var util = require('util');
 
diff --git a/lib/image.js b/lib/image.js
index b1e47af..13e9a50 100644
--- a/lib/image.js
+++ b/lib/image.js
@@ -1,7 +1,7 @@
 // Fetch images and metadata about them.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var fs = require('fs');
 var path = require('path');
diff --git a/lib/index.js b/lib/index.js
index 9f60fc3..f47a620 100644
--- a/lib/index.js
+++ b/lib/index.js
@@ -1,6 +1,6 @@
 "use strict";
-require('es6-shim'); // Map/Set/Promise support
-require('prfun');
+require('core-js/shim'); // Map/Set/Promise support
+var Promise = require('prfun');
 
 var json = require('../package.json');
 
diff --git a/lib/metabook.js b/lib/metabook.js
index 976b878..5e7eab5 100644
--- a/lib/metabook.js
+++ b/lib/metabook.js
@@ -1,7 +1,7 @@
 /** Create a new metabook structure, or fixup a broken/incomplete one. */
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var url = require('url');
 
diff --git a/lib/p.js b/lib/p.js
index 1a997ea..93efc77 100644
--- a/lib/p.js
+++ b/lib/p.js
@@ -1,7 +1,7 @@
 // Helpers for promises.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var spawn = require('child_process').spawn;
 
@@ -39,7 +39,7 @@
 // If the optional `p` parameter is provided, wait for that to resolve
 // before starting to process the array contents.
 P.forEachPar = function(a, f, p) {
-       return (p || Promise.resolve()).then(function() {
+       return Promise.resolve(p).then(function() {
                return a;
        }).then(function(aResolved) {
                return Promise.all(aResolved.map(f));
@@ -52,7 +52,7 @@
 // before starting to process the array contents.
 P.forEachSeq = function(a, f, p) {
        // The initial value must not be undefined.  Arbitrarily choose `true`.
-       p = p ? p.return(true) : Promise.resolve(true);
+       p = p ? Promise.resolve(p).return(true) : Promise.resolve(true);
        return Promise.reduce(a, function(curResult, value, index, total) {
                /* jshint unused: vars */
                return f.call(null, value, index, null);
diff --git a/lib/parsoid.js b/lib/parsoid.js
index fff3e48..4549876 100644
--- a/lib/parsoid.js
+++ b/lib/parsoid.js
@@ -1,7 +1,7 @@
 // Make concurrency-limited parsoid API requests.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var domino = require('domino');
 var fs = require('fs');
diff --git a/lib/retry-request.js b/lib/retry-request.js
index 99c42b6..55eeb3f 100644
--- a/lib/retry-request.js
+++ b/lib/retry-request.js
@@ -1,8 +1,8 @@
 // Wrapper for the 'request' module, which makes it automatically retry
 // requests.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var request = require('request');
 
diff --git a/lib/revisions.js b/lib/revisions.js
index 9e250f0..8e24cad 100644
--- a/lib/revisions.js
+++ b/lib/revisions.js
@@ -2,8 +2,8 @@
 // this is a particularly grody file, so we also store this in a more
 // sane manner as revisions.db.  hopefully we can deprecate the ugliness.
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var fs = require('fs');
 var path = require('path');
diff --git a/lib/siteinfo.js b/lib/siteinfo.js
index bf19853..54e0382 100644
--- a/lib/siteinfo.js
+++ b/lib/siteinfo.js
@@ -1,7 +1,7 @@
 // Generate content of siteinfo.json
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var fs = require('fs');
 var path = require('path');
diff --git a/package.json b/package.json
index 77fa56b..ba09df4 100644
--- a/package.json
+++ b/package.json
@@ -13,9 +13,9 @@
   "license": "GPLv2",
   "dependencies": {
     "commander": "~2.5.0",
+    "core-js": "~0.9.1",
     "domino": "~1.0.17",
-    "es6-shim": "~0.20.2",
-    "prfun": "~1.0.1",
+    "prfun": "~2.1.1",
     "readable-stream": "~1.0.0",
     "request": "~2.47.0",
     "rimraf": "~2.2.2",
@@ -23,7 +23,7 @@
     "tmp": "~0.0.24"
   },
   "devDependencies": {
-    "jshint": "~2.5.0",
+    "jshint": "~2.6.3",
     "mocha": "~2.0.1",
     "npm-travis": "~1.0.0"
   },
diff --git a/samples/featured.js b/samples/featured.js
index 75c499d..306ff32 100755
--- a/samples/featured.js
+++ b/samples/featured.js
@@ -1,7 +1,7 @@
 #!/usr/bin/env node
 /** Generate bundles from the featured articles list. */
 "use strict";
-require('es6-shim');
+require('core-js/shim');
 
 
 var program = require('commander');
diff --git a/test/samples.js b/test/samples.js
index d8cb584..e2e3548 100644
--- a/test/samples.js
+++ b/test/samples.js
@@ -1,7 +1,7 @@
 /* global describe, it */
 "use strict";
-require('es6-shim');
-require('prfun');
+require('core-js/shim');
+var Promise = require('prfun');
 
 var assert = require("assert");
 var fs = require('fs');

-- 
To view, visit https://gerrit.wikimedia.org/r/209782
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic19fb9efaa492650fc22864f5942c04b46696572
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/bundler
Gerrit-Branch: master
Gerrit-Owner: Cscott <[email protected]>
Gerrit-Reviewer: Arlolra <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to