From 8567a7fd6c81ece8fcb2fbc4be29db18f454cee8 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Mon, 9 Jul 2018 23:50:04 -0700 Subject: [PATCH 1/8] [wip] initial async generator support --- .babelrc | 5 ++- lib/internal/asyncEachOfLimit.js | 59 ++++++++++++++++++++++++++++++ lib/internal/eachOfLimit.js | 5 +++ lib/internal/wrapAsync.js | 6 +++- package-lock.json | 20 ++++++++--- package.json | 1 + test/asyncFunctions.js | 17 +++++++++ test/es2017/asyncGenerators.js | 61 ++++++++++++++++++++++++++++++++ 8 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 lib/internal/asyncEachOfLimit.js create mode 100644 test/es2017/asyncGenerators.js diff --git a/.babelrc b/.babelrc index 913eb6aef..911ec28ad 100644 --- a/.babelrc +++ b/.babelrc @@ -1,5 +1,8 @@ { - "plugins": ["transform-es2015-modules-commonjs"], + "plugins": [ + "transform-es2015-modules-commonjs", + "syntax-async-generators" + ], "env": { "test": { "plugins": ["istanbul"] diff --git a/lib/internal/asyncEachOfLimit.js b/lib/internal/asyncEachOfLimit.js new file mode 100644 index 000000000..a34bf0a8e --- /dev/null +++ b/lib/internal/asyncEachOfLimit.js @@ -0,0 +1,59 @@ +const breakLoop = require('./breakLoop') + +// for async generators +export default function asyncEachOfLimit(generator, limit, iteratee, callback) { + let done = false + let canceled = false + let awaiting = false + let running = 0 + let idx = 0 + + function replenish() { + //console.log('replenish') + if (running >= limit || awaiting) return + //console.log('replenish awaiting') + awaiting = true + generator.next().then(({value, done: iterDone}) => { + //console.log('got value', value) + awaiting = false + if (iterDone) { + done = true; + if (running <= 0) { + callback(null) + } + return; + } + running++ + iteratee(value, idx, iterateeCallback) + idx++ + replenish() + }).catch(handleError) + } + + function iterateeCallback(err, result) { + //console.log('iterateeCallback') + if (canceled) return + running -= 1; + if (err) return handleError(err) + + if (err === false) { + done = true; + canceled = true; + } + + if (result === breakLoop || (done && running <= 0)) { + done = true; + //console.log('done') + return callback(null); + } + replenish() + } + + function handleError(err) { + awaiting = false + done = true + callback(err) + } + + replenish() +} diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index 1d710dc34..9f3f65de1 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -3,6 +3,8 @@ import once from './once'; import iterator from './iterator'; import onlyOnce from './onlyOnce'; +import {isAsyncGenerator} from './wrapAsync' +import asyncEachOfLimit from './asyncEachOfLimit' import breakLoop from './breakLoop'; @@ -15,6 +17,9 @@ export default (limit) => { if (!obj) { return callback(null); } + if (isAsyncGenerator(obj)) { + return asyncEachOfLimit(obj, limit, iteratee, callback) + } var nextElem = iterator(obj); var done = false; var canceled = false; diff --git a/lib/internal/wrapAsync.js b/lib/internal/wrapAsync.js index 2b1490c57..b1be4201f 100644 --- a/lib/internal/wrapAsync.js +++ b/lib/internal/wrapAsync.js @@ -4,10 +4,14 @@ function isAsync(fn) { return fn[Symbol.toStringTag] === 'AsyncFunction'; } +function isAsyncGenerator(fn) { + return fn[Symbol.toStringTag] === 'AsyncGenerator'; +} + function wrapAsync(asyncFn) { return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; } export default wrapAsync; -export { isAsync }; +export { isAsync, isAsyncGenerator }; diff --git a/package-lock.json b/package-lock.json index 28904fafc..49c303b79 100644 --- a/package-lock.json +++ b/package-lock.json @@ -190,6 +190,7 @@ }, "ansi-styles": { "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", "dev": true }, @@ -1227,6 +1228,12 @@ "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", + "dev": true + }, "babel-plugin-syntax-trailing-function-commas": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", @@ -3875,7 +3882,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -4290,7 +4298,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -4346,6 +4355,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4389,12 +4399,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, diff --git a/package.json b/package.json index 8f7569343..213a108c4 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "babel-core": "^6.26.3", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-istanbul": "^2.0.1", + "babel-plugin-syntax-async-generators": "^6.13.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2", "babel-preset-es2015": "^6.3.13", "babel-preset-es2017": "^6.22.0", diff --git a/test/asyncFunctions.js b/test/asyncFunctions.js index 894b32be0..d2a1355c6 100644 --- a/test/asyncFunctions.js +++ b/test/asyncFunctions.js @@ -11,6 +11,17 @@ function supportsAsync() { return supported; } +function supportsAsyncGenerators() { + var supported; + try { + /* eslint no-eval: 0 */ + supported = eval('(async function * () { yield await 1 })'); + } catch (e) { + supported = false; + } + return supported; +} + describe('async function support', function () { this.timeout(100); @@ -19,4 +30,10 @@ describe('async function support', function () { } else { it('should not test async functions in this environment'); } + + if (supportsAsyncGenerators()) { + require('./es2017/asyncGenerators.js')(); + } else { + it('should not test async generators in this environment'); + } }); diff --git a/test/es2017/asyncGenerators.js b/test/es2017/asyncGenerators.js new file mode 100644 index 000000000..4fab12611 --- /dev/null +++ b/test/es2017/asyncGenerators.js @@ -0,0 +1,61 @@ +var async = require('../../lib'); +const {expect} = require('chai'); +const assert = require('assert'); + +const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) + +module.exports = function () { + async function asyncIdentity(val) { + var res = await Promise.resolve(val); + return res; + } + + async function * range (num) { + for(let i = 0; i < num; i++) { + await delay(1) + yield i + } + } + + it('should handle async generators in each', (done) => { + const calls = [] + async.each(range(5), + async (val) => { + calls.push(val) + await delay(5) + }, (err) => { + if (err) throw err + expect(calls).to.eql([0, 1, 2, 3, 4]) + done() + } + ) + }); + + it('should handle async generators in eachLimit', (done) => { + const calls = [] + async.eachLimit(range(5), 2, + async (val) => { + calls.push(val) + await delay(5) + }, (err) => { + if (err) throw err + expect(calls).to.eql([0, 1, 2, 3, 4]) + done() + } + ) + }); + + it('should handle async generators in eachSeries', (done) => { + const calls = [] + async.eachSeries(range(5), + async (val) => { + calls.push(val) + await delay(5) + }, (err) => { + if (err) throw err + expect(calls).to.eql([0, 1, 2, 3, 4]) + done() + } + ) + }); +} From aa1ec94791542df69c3b22c071bd1e9e77bcb42f Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Tue, 10 Jul 2018 21:16:45 -0700 Subject: [PATCH 2/8] tighten up implementation --- lib/internal/asyncEachOfLimit.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/internal/asyncEachOfLimit.js b/lib/internal/asyncEachOfLimit.js index a34bf0a8e..403915b1a 100644 --- a/lib/internal/asyncEachOfLimit.js +++ b/lib/internal/asyncEachOfLimit.js @@ -10,15 +10,17 @@ export default function asyncEachOfLimit(generator, limit, iteratee, callback) { function replenish() { //console.log('replenish') - if (running >= limit || awaiting) return + if (running >= limit || awaiting || done) return //console.log('replenish awaiting') awaiting = true generator.next().then(({value, done: iterDone}) => { //console.log('got value', value) + if (canceled || done) return awaiting = false if (iterDone) { done = true; if (running <= 0) { + //console.log('done nextCb') callback(null) } return; @@ -32,24 +34,26 @@ export default function asyncEachOfLimit(generator, limit, iteratee, callback) { function iterateeCallback(err, result) { //console.log('iterateeCallback') - if (canceled) return running -= 1; + if (canceled) return if (err) return handleError(err) if (err === false) { done = true; canceled = true; + return } if (result === breakLoop || (done && running <= 0)) { done = true; - //console.log('done') + //console.log('done iterCb') return callback(null); } replenish() } function handleError(err) { + if (canceled) return awaiting = false done = true callback(err) From 82cef4f31e4a5476751dbbd229b55d3a189a9d00 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 16:41:50 -0700 Subject: [PATCH 3/8] fix linter --- .eslintrc | 1 + package-lock.json | 272 +++++++++++++++++++++++++++++---- package.json | 1 + test/es2017/asyncGenerators.js | 6 - 4 files changed, 244 insertions(+), 36 deletions(-) diff --git a/.eslintrc b/.eslintrc index 3380c044d..18d322a9c 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,6 +5,7 @@ "mocha": true, "es6": true }, + "parser": "babel-eslint", "parserOptions": { "ecmaVersion": 8, "sourceType": "module" diff --git a/package-lock.json b/package-lock.json index 49c303b79..3c8fdf3e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,185 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.44.tgz", + "integrity": "sha512-cuAuTTIQ9RqcFRJ/Y8PvTh+paepNcaGxwQwjIDRWPXmzzyAeCO4KqS9ikMvq0MCbRk6GlYKwfzStrcP3/jSL8g==", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.44" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.44.tgz", + "integrity": "sha512-5xVb7hlhjGcdkKpMXgicAVgx8syK5VJz193k0i/0sLP6DzE6lRrU1K3B/rFefgdo9LPGMAOOOAWW4jycj07ShQ==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44", + "jsesc": "^2.5.1", + "lodash": "^4.2.0", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + }, + "dependencies": { + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + } + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.44.tgz", + "integrity": "sha512-MHRG2qZMKMFaBavX0LWpfZ2e+hLloT++N7rfM3DYOMUOGCD8cVjqZpwiL8a0bOX3IYcQev1ruciT0gdFFRTxzg==", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.44", + "@babel/template": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.44.tgz", + "integrity": "sha512-w0YjWVwrM2HwP6/H3sEgrSQdkCaxppqFeJtAnB23pRiJB5E/O9Yp7JAAeWBl+gGEgmBFinnTyOv2RN7rcSmMiw==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.44.tgz", + "integrity": "sha512-aQ7QowtkgKKzPGf0j6u77kBMdUFVBKNHw2p/3HX/POt5/oz8ec5cs0GwlgM8Hz7ui5EwJnzyfRmkNF1Nx1N7aA==", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.44" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", + "integrity": "sha512-Il19yJvy7vMFm8AVAh6OZzaFoAd0hbkeMZiX3P5HGD+z7dyI7RzndHB0dg6Urh/VAFfHtpOIzDUSxmY6coyZWQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/template": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.44.tgz", + "integrity": "sha512-w750Sloq0UNifLx1rUqwfbnC6uSUk0mfwwgGRfdLiaUzfAOiH0tHJE6ILQIUi3KYkjiCDTskoIsnfqZvWLBDng==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "lodash": "^4.2.0" + }, + "dependencies": { + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + } + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.44.tgz", + "integrity": "sha512-UHuDz8ukQkJCDASKHf+oDt3FVUzFd+QYfuBIsiNu/4+/ix6pP/C+uQZJ6K1oEfbCMv/IKWbgDEh7fcsnIE5AtA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.44", + "@babel/generator": "7.0.0-beta.44", + "@babel/helper-function-name": "7.0.0-beta.44", + "@babel/helper-split-export-declaration": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "debug": "^3.1.0", + "globals": "^11.1.0", + "invariant": "^2.2.0", + "lodash": "^4.2.0" + }, + "dependencies": { + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + } + } + }, + "@babel/types": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.44.tgz", + "integrity": "sha512-5eTV4WRmqbaFM3v9gHAIljEQJU4Ssc6fxL61JN+Oe2ga/BwyjzjamwkCVVAQjHGuAX8i0BWo42dshL8eO5KfLQ==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.2.0", + "to-fast-properties": "^2.0.0" + } + }, "JSONStream": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", @@ -494,6 +673,28 @@ } } }, + "babel-eslint": { + "version": "8.2.6", + "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.2.6.tgz", + "integrity": "sha512-aCdHjhzcILdP8c9lej7hvXKvQieyRt20SF102SIGyY4cUIiw6UaAtK4j2o3dXX74jEmy0TJ0CEhv4fTIM3SzcA==", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.44", + "@babel/traverse": "7.0.0-beta.44", + "@babel/types": "7.0.0-beta.44", + "babylon": "7.0.0-beta.44", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "^1.0.0" + }, + "dependencies": { + "babylon": { + "version": "7.0.0-beta.44", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.44.tgz", + "integrity": "sha512-5Hlm13BJVAioCHpImtFqNOF2H3ieTOHd0fmFGMxOJ9jgeFqeAwsv3u5P5cR7CSeFrkgHsT19DgFJkHV0/Mcd8g==", + "dev": true + } + } + }, "babel-generator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", @@ -3882,8 +4083,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -3904,14 +4104,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -3926,20 +4124,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -4056,8 +4251,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -4069,7 +4263,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -4084,7 +4277,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -4092,14 +4284,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -4118,7 +4308,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -4199,8 +4388,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -4212,7 +4400,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -4298,8 +4485,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -4335,7 +4521,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -4355,7 +4540,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -4399,14 +4583,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -5114,6 +5296,15 @@ "xtend": "^4.0.0" } }, + "invariant": { + "version": "2.2.4", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.4.tgz", + "integrity": "sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==", + "dev": true, + "requires": { + "loose-envify": "^1.0.0" + } + }, "invert-kv": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", @@ -5328,6 +5519,12 @@ "integrity": "sha1-4mJbrbwNZ8dTPp7cEGjFh65BN+8=", "dev": true }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, "js-yaml": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.6.1.tgz", @@ -6026,6 +6223,15 @@ "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", "dev": true }, + "loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "dev": true, + "requires": { + "js-tokens": "^3.0.0 || ^4.0.0" + } + }, "lru-cache": { "version": "2.2.4", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.2.4.tgz", @@ -10865,6 +11071,12 @@ "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", "dev": true }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha1-3F5pjL0HkmW8c+A3doGk5Og/YW4=", + "dev": true + }, "tough-cookie": { "version": "2.3.4", "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.4.tgz", diff --git a/package.json b/package.json index 213a108c4..b05e7110b 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ "dependencies": {}, "devDependencies": { "babel-core": "^6.26.3", + "babel-eslint": "^8.2.6", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-istanbul": "^2.0.1", "babel-plugin-syntax-async-generators": "^6.13.0", diff --git a/test/es2017/asyncGenerators.js b/test/es2017/asyncGenerators.js index 4fab12611..d0a5172e4 100644 --- a/test/es2017/asyncGenerators.js +++ b/test/es2017/asyncGenerators.js @@ -1,15 +1,9 @@ var async = require('../../lib'); const {expect} = require('chai'); -const assert = require('assert'); const delay = ms => new Promise(resolve => setTimeout(resolve, ms)) module.exports = function () { - async function asyncIdentity(val) { - var res = await Promise.resolve(val); - return res; - } - async function * range (num) { for(let i = 0; i < num; i++) { await delay(1) From 59fea53dfd6f7515093f6bac100d8a3c96cf6388 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 17:33:15 -0700 Subject: [PATCH 4/8] add suport for async iterables --- lib/internal/eachOfLimit.js | 5 ++++- lib/internal/wrapAsync.js | 6 +++++- test/asyncFunctions.js | 4 ++-- test/es2017/asyncGenerators.js | 30 ++++++++++++++++++++++++++++++ 4 files changed, 41 insertions(+), 4 deletions(-) diff --git a/lib/internal/eachOfLimit.js b/lib/internal/eachOfLimit.js index 9f3f65de1..999cbfa5d 100644 --- a/lib/internal/eachOfLimit.js +++ b/lib/internal/eachOfLimit.js @@ -3,7 +3,7 @@ import once from './once'; import iterator from './iterator'; import onlyOnce from './onlyOnce'; -import {isAsyncGenerator} from './wrapAsync' +import {isAsyncGenerator, isAsyncIterable} from './wrapAsync' import asyncEachOfLimit from './asyncEachOfLimit' import breakLoop from './breakLoop'; @@ -20,6 +20,9 @@ export default (limit) => { if (isAsyncGenerator(obj)) { return asyncEachOfLimit(obj, limit, iteratee, callback) } + if (isAsyncIterable(obj)) { + return asyncEachOfLimit(obj[Symbol.asyncIterator](), limit, iteratee, callback) + } var nextElem = iterator(obj); var done = false; var canceled = false; diff --git a/lib/internal/wrapAsync.js b/lib/internal/wrapAsync.js index b1be4201f..5c3edd97b 100644 --- a/lib/internal/wrapAsync.js +++ b/lib/internal/wrapAsync.js @@ -8,10 +8,14 @@ function isAsyncGenerator(fn) { return fn[Symbol.toStringTag] === 'AsyncGenerator'; } +function isAsyncIterable(obj) { + return typeof obj[Symbol.asyncIterator] === 'function'; +} + function wrapAsync(asyncFn) { return isAsync(asyncFn) ? asyncify(asyncFn) : asyncFn; } export default wrapAsync; -export { isAsync, isAsyncGenerator }; +export { isAsync, isAsyncGenerator, isAsyncIterable }; diff --git a/test/asyncFunctions.js b/test/asyncFunctions.js index d2a1355c6..700579dc2 100644 --- a/test/asyncFunctions.js +++ b/test/asyncFunctions.js @@ -26,13 +26,13 @@ describe('async function support', function () { this.timeout(100); if (supportsAsync()) { - require('./es2017/asyncFunctions.js')(); + require('./es2017/asyncFunctions.js').call(this); } else { it('should not test async functions in this environment'); } if (supportsAsyncGenerators()) { - require('./es2017/asyncGenerators.js')(); + require('./es2017/asyncGenerators.js').call(this); } else { it('should not test async generators in this environment'); } diff --git a/test/es2017/asyncGenerators.js b/test/es2017/asyncGenerators.js index d0a5172e4..c9be07ec5 100644 --- a/test/es2017/asyncGenerators.js +++ b/test/es2017/asyncGenerators.js @@ -11,6 +11,21 @@ module.exports = function () { } } + function AsyncIterable (size) { + // cant use method shorthand because babel doesnt parse it right + async function * iterator () { + let idx = 0 + while (idx < size) { + yield idx + await delay(1) + idx++ + } + } + return { + [Symbol.asyncIterator]: iterator + } + } + it('should handle async generators in each', (done) => { const calls = [] async.each(range(5), @@ -52,4 +67,19 @@ module.exports = function () { } ) }); + + + it('should handle async iterables in each', (done) => { + const calls = [] + async.each(new AsyncIterable(5), + async (val) => { + calls.push(val) + await delay(5) + }, (err) => { + if (err) throw err + expect(calls).to.eql([0, 1, 2, 3, 4]) + done() + } + ) + }); } From 2cdaa454ce26365eca6fdedb8671f40b0821c803 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 17:34:51 -0700 Subject: [PATCH 5/8] docs --- lib/applyEach.js | 2 +- lib/applyEachSeries.js | 2 +- lib/concat.js | 2 +- lib/concatLimit.js | 2 +- lib/concatSeries.js | 2 +- lib/detect.js | 2 +- lib/detectLimit.js | 2 +- lib/detectSeries.js | 2 +- lib/each.js | 2 +- lib/eachLimit.js | 2 +- lib/eachOf.js | 2 +- lib/eachOfLimit.js | 2 +- lib/eachOfSeries.js | 2 +- lib/eachSeries.js | 2 +- lib/every.js | 2 +- lib/everyLimit.js | 2 +- lib/everySeries.js | 2 +- lib/filter.js | 2 +- lib/filterLimit.js | 2 +- lib/filterSeries.js | 2 +- lib/groupBy.js | 2 +- lib/groupByLimit.js | 2 +- lib/groupBySeries.js | 2 +- lib/map.js | 2 +- lib/mapLimit.js | 2 +- lib/mapSeries.js | 2 +- lib/parallel.js | 2 +- lib/parallelLimit.js | 2 +- lib/reduce.js | 2 +- lib/reject.js | 2 +- lib/rejectLimit.js | 2 +- lib/rejectSeries.js | 2 +- lib/series.js | 2 +- lib/some.js | 2 +- lib/someLimit.js | 2 +- lib/someSeries.js | 2 +- lib/sortBy.js | 2 +- lib/transform.js | 2 +- lib/tryEach.js | 2 +- 39 files changed, 39 insertions(+), 39 deletions(-) diff --git a/lib/applyEach.js b/lib/applyEach.js index 9228d4401..45462619f 100644 --- a/lib/applyEach.js +++ b/lib/applyEach.js @@ -15,7 +15,7 @@ import map from './map'; * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s + * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s * to all call with the same arguments * @param {...*} [args] - any number of separate arguments to pass to the * function. diff --git a/lib/applyEachSeries.js b/lib/applyEachSeries.js index 392b1396e..6a4d62b6c 100644 --- a/lib/applyEachSeries.js +++ b/lib/applyEachSeries.js @@ -10,7 +10,7 @@ import mapSeries from './mapSeries'; * @method * @see [async.applyEach]{@link module:ControlFlow.applyEach} * @category Control Flow - * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all + * @param {Array|Iterable|AsyncIterable|Object} fns - A collection of {@link AsyncFunction}s to all * call with the same arguments * @param {...*} [args] - any number of separate arguments to pass to the * function. diff --git a/lib/concat.js b/lib/concat.js index b4857c9d2..62f5517fa 100644 --- a/lib/concat.js +++ b/lib/concat.js @@ -13,7 +13,7 @@ import concatLimit from './concatLimit'; * @memberOf module:Collections * @method * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, * which should use an array as its result. Invoked with (item, callback). * @param {Function} [callback(err)] - A callback which is called after all the diff --git a/lib/concatLimit.js b/lib/concatLimit.js index 39d0dd782..5dbbe8dd1 100644 --- a/lib/concatLimit.js +++ b/lib/concatLimit.js @@ -11,7 +11,7 @@ import mapLimit from './mapLimit'; * @method * @see [async.concat]{@link module:Collections.concat} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, * which should use an array as its result. Invoked with (item, callback). diff --git a/lib/concatSeries.js b/lib/concatSeries.js index 26f5268e5..ae1bd67b6 100644 --- a/lib/concatSeries.js +++ b/lib/concatSeries.js @@ -10,7 +10,7 @@ import concatLimit from './concatLimit'; * @method * @see [async.concat]{@link module:Collections.concat} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. * The iteratee should complete with an array an array of results. * Invoked with (item, callback). diff --git a/lib/detect.js b/lib/detect.js index 1ea4eb498..3e28f0ee2 100644 --- a/lib/detect.js +++ b/lib/detect.js @@ -17,7 +17,7 @@ import doParallel from './internal/doParallel'; * @method * @alias find * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. * The iteratee must complete with a boolean value as its result. * Invoked with (item, callback). diff --git a/lib/detectLimit.js b/lib/detectLimit.js index e9ff15880..a0f9d8936 100644 --- a/lib/detectLimit.js +++ b/lib/detectLimit.js @@ -12,7 +12,7 @@ import doParallelLimit from './internal/doParallelLimit'; * @see [async.detect]{@link module:Collections.detect} * @alias findLimit * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. * The iteratee must complete with a boolean value as its result. diff --git a/lib/detectSeries.js b/lib/detectSeries.js index 684bdaaab..f563eae40 100644 --- a/lib/detectSeries.js +++ b/lib/detectSeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.detect]{@link module:Collections.detect} * @alias findSeries * @category Collections - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. * The iteratee must complete with a boolean value as its result. * Invoked with (item, callback). diff --git a/lib/each.js b/lib/each.js index 29f2bafc8..dc856ac54 100644 --- a/lib/each.js +++ b/lib/each.js @@ -18,7 +18,7 @@ import wrapAsync from './internal/wrapAsync' * @method * @alias forEach * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to * each item in `coll`. Invoked with (item, callback). * The array index is not passed to the iteratee. diff --git a/lib/eachLimit.js b/lib/eachLimit.js index 462e329ee..e4d67cbf2 100644 --- a/lib/eachLimit.js +++ b/lib/eachLimit.js @@ -12,7 +12,7 @@ import wrapAsync from './internal/wrapAsync'; * @see [async.each]{@link module:Collections.each} * @alias forEachLimit * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. diff --git a/lib/eachOf.js b/lib/eachOf.js index 7d9ebd0a0..070204bf0 100644 --- a/lib/eachOf.js +++ b/lib/eachOf.js @@ -49,7 +49,7 @@ var eachOfGeneric = doLimit(eachOfLimit, Infinity); * @alias forEachOf * @category Collection * @see [async.each]{@link module:Collections.each} - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - A function to apply to each * item in `coll`. * The `key` is the item's key, or index in the case of an array. diff --git a/lib/eachOfLimit.js b/lib/eachOfLimit.js index 1de28efc6..f439be675 100644 --- a/lib/eachOfLimit.js +++ b/lib/eachOfLimit.js @@ -12,7 +12,7 @@ import wrapAsync from './internal/wrapAsync'; * @see [async.eachOf]{@link module:Collections.eachOf} * @alias forEachOfLimit * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async function to apply to each * item in `coll`. The `key` is the item's key, or index in the case of an diff --git a/lib/eachOfSeries.js b/lib/eachOfSeries.js index fc1a09724..d64e7ec24 100644 --- a/lib/eachOfSeries.js +++ b/lib/eachOfSeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.eachOf]{@link module:Collections.eachOf} * @alias forEachOfSeries * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. * Invoked with (item, key, callback). diff --git a/lib/eachSeries.js b/lib/eachSeries.js index 9f8d7defd..ae6f6c70e 100644 --- a/lib/eachSeries.js +++ b/lib/eachSeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.each]{@link module:Collections.each} * @alias forEachSeries * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each * item in `coll`. * The array index is not passed to the iteratee. diff --git a/lib/every.js b/lib/every.js index ed00f7219..be2bc4aa2 100644 --- a/lib/every.js +++ b/lib/every.js @@ -11,7 +11,7 @@ import doParallel from './internal/doParallel'; * @method * @alias all * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collection in parallel. * The iteratee must complete with a boolean result value. diff --git a/lib/everyLimit.js b/lib/everyLimit.js index 536229a9a..78ffa36ea 100644 --- a/lib/everyLimit.js +++ b/lib/everyLimit.js @@ -11,7 +11,7 @@ import doParallelLimit from './internal/doParallelLimit'; * @see [async.every]{@link module:Collections.every} * @alias allLimit * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collection in parallel. diff --git a/lib/everySeries.js b/lib/everySeries.js index b67368c95..c450bff40 100644 --- a/lib/everySeries.js +++ b/lib/everySeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.every]{@link module:Collections.every} * @alias allSeries * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collection in series. * The iteratee must complete with a boolean result value. diff --git a/lib/filter.js b/lib/filter.js index 4f0cbf183..692802b61 100644 --- a/lib/filter.js +++ b/lib/filter.js @@ -12,7 +12,7 @@ import doParallel from './internal/doParallel'; * @method * @alias select * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {Function} iteratee - A truth test to apply to each item in `coll`. * The `iteratee` is passed a `callback(err, truthValue)`, which must be called * with a boolean argument once it has completed. Invoked with (item, callback). diff --git a/lib/filterLimit.js b/lib/filterLimit.js index 2c053640d..946002de4 100644 --- a/lib/filterLimit.js +++ b/lib/filterLimit.js @@ -12,7 +12,7 @@ import doParallelLimit from './internal/doParallelLimit'; * @see [async.filter]{@link module:Collections.filter} * @alias selectLimit * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {Function} iteratee - A truth test to apply to each item in `coll`. * The `iteratee` is passed a `callback(err, truthValue)`, which must be called diff --git a/lib/filterSeries.js b/lib/filterSeries.js index c973c148e..908afbcee 100644 --- a/lib/filterSeries.js +++ b/lib/filterSeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.filter]{@link module:Collections.filter} * @alias selectSeries * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {Function} iteratee - A truth test to apply to each item in `coll`. * The `iteratee` is passed a `callback(err, truthValue)`, which must be called * with a boolean argument once it has completed. Invoked with (item, callback). diff --git a/lib/groupBy.js b/lib/groupBy.js index a2f923ff5..860a01f80 100644 --- a/lib/groupBy.js +++ b/lib/groupBy.js @@ -17,7 +17,7 @@ import groupByLimit from './groupByLimit'; * @memberOf module:Collections * @method * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. * The iteratee should complete with a `key` to group the value under. diff --git a/lib/groupByLimit.js b/lib/groupByLimit.js index 816bcc6d9..f0402aa47 100644 --- a/lib/groupByLimit.js +++ b/lib/groupByLimit.js @@ -10,7 +10,7 @@ import wrapAsync from './internal/wrapAsync'; * @method * @see [async.groupBy]{@link module:Collections.groupBy} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. diff --git a/lib/groupBySeries.js b/lib/groupBySeries.js index 91935c378..a093d7fa7 100644 --- a/lib/groupBySeries.js +++ b/lib/groupBySeries.js @@ -10,7 +10,7 @@ import groupByLimit from './groupByLimit'; * @method * @see [async.groupBy]{@link module:Collections.groupBy} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. diff --git a/lib/map.js b/lib/map.js index 100ab7a1a..2512c327a 100644 --- a/lib/map.js +++ b/lib/map.js @@ -23,7 +23,7 @@ import map from './internal/map'; * @memberOf module:Collections * @method * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. * The iteratee should complete with the transformed item. diff --git a/lib/mapLimit.js b/lib/mapLimit.js index 0a2fc02c4..905edc64c 100644 --- a/lib/mapLimit.js +++ b/lib/mapLimit.js @@ -10,7 +10,7 @@ import map from './internal/map'; * @method * @see [async.map]{@link module:Collections.map} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. diff --git a/lib/mapSeries.js b/lib/mapSeries.js index 596c75ec7..96b5f0ad7 100644 --- a/lib/mapSeries.js +++ b/lib/mapSeries.js @@ -10,7 +10,7 @@ import doLimit from './internal/doLimit'; * @method * @see [async.map]{@link module:Collections.map} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. * The iteratee should complete with the transformed item. diff --git a/lib/parallel.js b/lib/parallel.js index 8b6c2ce89..edf8be48b 100644 --- a/lib/parallel.js +++ b/lib/parallel.js @@ -27,7 +27,7 @@ import parallel from './internal/parallel'; * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection of + * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of * [async functions]{@link AsyncFunction} to run. * Each async function can complete with any number of optional `result` values. * @param {Function} [callback] - An optional callback to run once all the diff --git a/lib/parallelLimit.js b/lib/parallelLimit.js index 14e9e5230..9a857b844 100644 --- a/lib/parallelLimit.js +++ b/lib/parallelLimit.js @@ -11,7 +11,7 @@ import parallel from './internal/parallel'; * @method * @see [async.parallel]{@link module:ControlFlow.parallel} * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection of + * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of * [async functions]{@link AsyncFunction} to run. * Each async function can complete with any number of optional `result` values. * @param {number} limit - The maximum number of async operations at a time. diff --git a/lib/reduce.js b/lib/reduce.js index 7966e49e5..1a6c036b7 100644 --- a/lib/reduce.js +++ b/lib/reduce.js @@ -21,7 +21,7 @@ import wrapAsync from './internal/wrapAsync'; * @alias inject * @alias foldl * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {*} memo - The initial state of the reduction. * @param {AsyncFunction} iteratee - A function applied to each item in the * array to produce the next step in the reduction. diff --git a/lib/reject.js b/lib/reject.js index 95a627036..cfac12d84 100644 --- a/lib/reject.js +++ b/lib/reject.js @@ -10,7 +10,7 @@ import doParallel from './internal/doParallel'; * @method * @see [async.filter]{@link module:Collections.filter} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {Function} iteratee - An async truth test to apply to each item in * `coll`. * The should complete with a boolean value as its `result`. diff --git a/lib/rejectLimit.js b/lib/rejectLimit.js index 814781138..76e6ffc27 100644 --- a/lib/rejectLimit.js +++ b/lib/rejectLimit.js @@ -11,7 +11,7 @@ import doParallelLimit from './internal/doParallelLimit'; * @method * @see [async.reject]{@link module:Collections.reject} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {Function} iteratee - An async truth test to apply to each item in * `coll`. diff --git a/lib/rejectSeries.js b/lib/rejectSeries.js index 7eba2f736..3f2d62f17 100644 --- a/lib/rejectSeries.js +++ b/lib/rejectSeries.js @@ -10,7 +10,7 @@ import doLimit from './internal/doLimit'; * @method * @see [async.reject]{@link module:Collections.reject} * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {Function} iteratee - An async truth test to apply to each item in * `coll`. * The should complete with a boolean value as its `result`. diff --git a/lib/series.js b/lib/series.js index eef153411..539a1e7cb 100644 --- a/lib/series.js +++ b/lib/series.js @@ -27,7 +27,7 @@ import eachOfSeries from './eachOfSeries'; * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection containing + * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing * [async functions]{@link AsyncFunction} to run in series. * Each function can complete with any number of optional `result` values. * @param {Function} [callback] - An optional callback to run once all the diff --git a/lib/some.js b/lib/some.js index d0d9d9e93..65543bb48 100644 --- a/lib/some.js +++ b/lib/some.js @@ -12,7 +12,7 @@ import doParallel from './internal/doParallel'; * @method * @alias any * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collections in parallel. * The iteratee should complete with a boolean `result` value. diff --git a/lib/someLimit.js b/lib/someLimit.js index a5906aae2..fb6841c50 100644 --- a/lib/someLimit.js +++ b/lib/someLimit.js @@ -11,7 +11,7 @@ import doParallelLimit from './internal/doParallelLimit'; * @see [async.some]{@link module:Collections.some} * @alias anyLimit * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {number} limit - The maximum number of async operations at a time. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collections in parallel. diff --git a/lib/someSeries.js b/lib/someSeries.js index 8e278deb7..c05ca1f22 100644 --- a/lib/someSeries.js +++ b/lib/someSeries.js @@ -11,7 +11,7 @@ import doLimit from './internal/doLimit'; * @see [async.some]{@link module:Collections.some} * @alias anySeries * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async truth test to apply to each item * in the collections in series. * The iteratee should complete with a boolean `result` value. diff --git a/lib/sortBy.js b/lib/sortBy.js index 4316665ba..ba2a80407 100644 --- a/lib/sortBy.js +++ b/lib/sortBy.js @@ -10,7 +10,7 @@ import wrapAsync from './internal/wrapAsync'; * @memberOf module:Collections * @method * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {AsyncFunction} iteratee - An async function to apply to each item in * `coll`. * The iteratee should complete with a value to use as the sort criteria as diff --git a/lib/transform.js b/lib/transform.js index 014a494ba..821a0fa47 100644 --- a/lib/transform.js +++ b/lib/transform.js @@ -13,7 +13,7 @@ import wrapAsync from './internal/wrapAsync'; * @memberOf module:Collections * @method * @category Collection - * @param {Array|Iterable|Object} coll - A collection to iterate over. + * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over. * @param {*} [accumulator] - The initial state of the transform. If omitted, * it will default to an empty Object or Array, depending on the type of `coll` * @param {AsyncFunction} iteratee - A function applied to each item in the diff --git a/lib/tryEach.js b/lib/tryEach.js index 1b405316f..af885dc05 100644 --- a/lib/tryEach.js +++ b/lib/tryEach.js @@ -13,7 +13,7 @@ import wrapAsync from './internal/wrapAsync'; * @memberOf module:ControlFlow * @method * @category Control Flow - * @param {Array|Iterable|Object} tasks - A collection containing functions to + * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to * run, each function is passed a `callback(err, result)` it must call on * completion with an error `err` (which can be `null`) and an optional `result` * value. From e491bd1e0ca6a234f2d15879a4b40f17590397a4 Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 18:08:50 -0700 Subject: [PATCH 6/8] bump timeout --- test/asyncFunctions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/asyncFunctions.js b/test/asyncFunctions.js index 700579dc2..6bd7a8d11 100644 --- a/test/asyncFunctions.js +++ b/test/asyncFunctions.js @@ -23,7 +23,7 @@ function supportsAsyncGenerators() { } describe('async function support', function () { - this.timeout(100); + this.timeout(200); if (supportsAsync()) { require('./es2017/asyncFunctions.js').call(this); From 0b5c27ec5373b8e9bc4d7c84538da08450e0098c Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 18:36:40 -0700 Subject: [PATCH 7/8] switch to babel-minify --- Makefile | 14 +- package-lock.json | 852 +++++++++++++++++++++++++++++++++++++++------- package.json | 2 +- 3 files changed, 744 insertions(+), 124 deletions(-) diff --git a/Makefile b/Makefile index 86af46c0e..6cff2c3d6 100644 --- a/Makefile +++ b/Makefile @@ -7,7 +7,6 @@ export PATH := ./node_modules/.bin/:$(PATH):./bin/ PACKAGE = asyncjs REQUIRE_NAME = async -UGLIFY = uglifyjs XYZ = support/xyz.sh --repo git@github.com:caolan/async.git BUILDDIR = build @@ -21,7 +20,7 @@ LINT_FILES := lib/ test/ $(shell find perf/ -maxdepth 2 -type f) $(shell find su UMD_BUNDLE := $(BUILDDIR)/dist/async.js UMD_BUNDLE_MIN := $(BUILDDIR)/dist/async.min.js -UMD_BUNDLE_MAP := $(BUILDDIR)/dist/async.min.map +# UMD_BUNDLE_MAP := $(BUILDDIR)/dist/async.min.map ALIAS_ES := $(addprefix build-es/, $(addsuffix .js, $(shell cat $(SCRIPTS)/aliases.txt | cut -d ' ' -f1))) ALIAS_CJS := $(patsubst build-es/%, build/%, $(ALIAS_ES)) ES_MODULES := $(patsubst lib/%.js, build-es/%.js, $(JS_SRC)) $(ALIAS_ES) @@ -81,17 +80,14 @@ $(UMD_BUNDLE): $(ES_MODULES) package.json node $(SCRIPTS)/build/aggregate-bundle.js # Create the minified UMD versions and copy them to dist/ for bower -build-dist: $(DIST) $(DIST)/async.js $(DIST)/async.min.js $(DIST)/async.min.map +build-dist: $(DIST) $(DIST)/async.js $(DIST)/async.min.js # $(DIST)/async.min.map $(DIST): mkdir -p $@ $(UMD_BUNDLE_MIN): $(UMD_BUNDLE) mkdir -p "$(@D)" - $(UGLIFY) $< --mangle --compress \ - --source-map $(UMD_BUNDLE_MAP) \ - --source-map-url async.min.map \ - -o $@ + babel-minify $< --mangle -o $@ $(DIST)/async.js: $(UMD_BUNDLE) cp $< $@ @@ -99,8 +95,8 @@ $(DIST)/async.js: $(UMD_BUNDLE) $(DIST)/async.min.js: $(UMD_BUNDLE_MIN) cp $< $@ -$(DIST)/async.min.map: $(UMD_BUNDLE_MIN) - cp $(UMD_BUNDLE_MAP) $@ +# $(DIST)/async.min.map: $(UMD_BUNDLE_MIN) +# cp $(UMD_BUNDLE_MAP) $@ build-es: $(ES_MODULES) diff --git a/package-lock.json b/package-lock.json index 3c8fdf3e2..95724ca71 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,6 +13,188 @@ "@babel/highlight": "7.0.0-beta.44" } }, + "@babel/core": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.0.0-beta.55.tgz", + "integrity": "sha1-nhfDS1rIVeQnyY9XCRWhf8xrq0o=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.55", + "@babel/generator": "7.0.0-beta.55", + "@babel/helpers": "7.0.0-beta.55", + "@babel/parser": "7.0.0-beta.55", + "@babel/template": "7.0.0-beta.55", + "@babel/traverse": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55", + "convert-source-map": "^1.1.0", + "debug": "^3.1.0", + "json5": "^0.5.0", + "lodash": "^4.17.10", + "resolve": "^1.3.2", + "semver": "^5.4.1", + "source-map": "^0.5.0" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.55.tgz", + "integrity": "sha1-cfUw57AQr163p993UveJId1X6e4=", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.55" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.55.tgz", + "integrity": "sha1-jsERUtzDmLrjXdGBEicEQVw4OgE=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55", + "jsesc": "^2.5.1", + "lodash": "^4.17.10", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.55.tgz", + "integrity": "sha1-FqqyE4Ci6rzuMyjSG5WGujQn2+8=", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.55", + "@babel/template": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.55.tgz", + "integrity": "sha1-hVne2W7NO2JvnB9XSU7cT6PMapQ=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.55.tgz", + "integrity": "sha1-7LgHS/LSLGUYolIoJTXe8TeocE8=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.55.tgz", + "integrity": "sha1-mIZTZH1inCYdrhVudNXwJSulIMA=", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "@babel/template": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.55.tgz", + "integrity": "sha1-xsqw4nIrpeM/4DQHO20xZzq6Mm4=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.55", + "@babel/parser": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55", + "lodash": "^4.17.10" + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.55.tgz", + "integrity": "sha1-UL5dD8xcxKwCCnsMUZvo2uNF1L4=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.55", + "@babel/generator": "7.0.0-beta.55", + "@babel/helper-function-name": "7.0.0-beta.55", + "@babel/helper-split-export-declaration": "7.0.0-beta.55", + "@babel/parser": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55", + "debug": "^3.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.10" + } + }, + "@babel/types": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.55.tgz", + "integrity": "sha1-d1XJ0uWDFaZPBdjPMyI3m+FtkZk=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "@babel/generator": { "version": "7.0.0-beta.44", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.44.tgz", @@ -63,6 +245,177 @@ "@babel/types": "7.0.0-beta.44" } }, + "@babel/helpers": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.0.0-beta.55.tgz", + "integrity": "sha1-0LS5oyfbpC1YiQAR3rkFyCBzlhc=", + "dev": true, + "requires": { + "@babel/template": "7.0.0-beta.55", + "@babel/traverse": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55" + }, + "dependencies": { + "@babel/code-frame": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.55.tgz", + "integrity": "sha1-cfUw57AQr163p993UveJId1X6e4=", + "dev": true, + "requires": { + "@babel/highlight": "7.0.0-beta.55" + } + }, + "@babel/generator": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.0.0-beta.55.tgz", + "integrity": "sha1-jsERUtzDmLrjXdGBEicEQVw4OgE=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55", + "jsesc": "^2.5.1", + "lodash": "^4.17.10", + "source-map": "^0.5.0", + "trim-right": "^1.0.1" + } + }, + "@babel/helper-function-name": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.55.tgz", + "integrity": "sha1-FqqyE4Ci6rzuMyjSG5WGujQn2+8=", + "dev": true, + "requires": { + "@babel/helper-get-function-arity": "7.0.0-beta.55", + "@babel/template": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/helper-get-function-arity": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.55.tgz", + "integrity": "sha1-hVne2W7NO2JvnB9XSU7cT6PMapQ=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.0.0-beta.55.tgz", + "integrity": "sha1-7LgHS/LSLGUYolIoJTXe8TeocE8=", + "dev": true, + "requires": { + "@babel/types": "7.0.0-beta.55" + } + }, + "@babel/highlight": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.55.tgz", + "integrity": "sha1-mIZTZH1inCYdrhVudNXwJSulIMA=", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^3.0.0" + } + }, + "@babel/template": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.55.tgz", + "integrity": "sha1-xsqw4nIrpeM/4DQHO20xZzq6Mm4=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.55", + "@babel/parser": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55", + "lodash": "^4.17.10" + } + }, + "@babel/traverse": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.55.tgz", + "integrity": "sha1-UL5dD8xcxKwCCnsMUZvo2uNF1L4=", + "dev": true, + "requires": { + "@babel/code-frame": "7.0.0-beta.55", + "@babel/generator": "7.0.0-beta.55", + "@babel/helper-function-name": "7.0.0-beta.55", + "@babel/helper-split-export-declaration": "7.0.0-beta.55", + "@babel/parser": "7.0.0-beta.55", + "@babel/types": "7.0.0-beta.55", + "debug": "^3.1.0", + "globals": "^11.1.0", + "lodash": "^4.17.10" + } + }, + "@babel/types": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.55.tgz", + "integrity": "sha1-d1XJ0uWDFaZPBdjPMyI3m+FtkZk=", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.10", + "to-fast-properties": "^2.0.0" + } + }, + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "jsesc": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.1.tgz", + "integrity": "sha1-5CGiqOINawgZ3yiQj3glJrlt0f4=", + "dev": true + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, "@babel/highlight": { "version": "7.0.0-beta.44", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0-beta.44.tgz", @@ -111,6 +464,12 @@ } } }, + "@babel/parser": { + "version": "7.0.0-beta.55", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.0.0-beta.55.tgz", + "integrity": "sha1-ClJ+/BSMbIzYXV/92srYF6La7rI=", + "dev": true + }, "@babel/template": { "version": "7.0.0-beta.44", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.44.tgz", @@ -301,17 +660,6 @@ "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", "dev": true }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true, - "requires": { - "kind-of": "^3.0.2", - "longest": "^1.0.1", - "repeat-string": "^1.5.2" - } - }, "amqplib": { "version": "0.5.2", "resolved": "https://registry.npmjs.org/amqplib/-/amqplib-0.5.2.tgz", @@ -529,12 +877,6 @@ "acorn": "^4.0.3" } }, - "async": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz", - "integrity": "sha1-trvgsGdLnXGXCMo43owjfLUmw9E=", - "dev": true - }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -743,6 +1085,18 @@ "lodash": "^4.17.4" } }, + "babel-helper-evaluate-path": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-evaluate-path/-/babel-helper-evaluate-path-0.4.3.tgz", + "integrity": "sha1-ComvcCwGshcCf6NxkI3UmJ0+Yz8=", + "dev": true + }, + "babel-helper-flip-expressions": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz", + "integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0=", + "dev": true + }, "babel-helper-function-name": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", @@ -776,6 +1130,24 @@ "babel-types": "^6.24.1" } }, + "babel-helper-is-nodes-equiv": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/babel-helper-is-nodes-equiv/-/babel-helper-is-nodes-equiv-0.0.1.tgz", + "integrity": "sha1-NOmzALFHnd2Y7HfqC76TQt/jloQ=", + "dev": true + }, + "babel-helper-is-void-0": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-is-void-0/-/babel-helper-is-void-0-0.4.3.tgz", + "integrity": "sha1-fZwBtFYee5Xb2g9u7kj1tg5nMT4=", + "dev": true + }, + "babel-helper-mark-eval-scopes": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-mark-eval-scopes/-/babel-helper-mark-eval-scopes-0.4.3.tgz", + "integrity": "sha1-0kSjvvmESHJgP/tG4izorN9VFWI=", + "dev": true + }, "babel-helper-optimise-call-expression": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", @@ -810,6 +1182,12 @@ "babel-types": "^6.24.1" } }, + "babel-helper-remove-or-void": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-remove-or-void/-/babel-helper-remove-or-void-0.4.3.tgz", + "integrity": "sha1-pPA7QAd6D/6I5F0HAQ3uJB/1rmA=", + "dev": true + }, "babel-helper-replace-supers": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", @@ -824,6 +1202,12 @@ "babel-types": "^6.24.1" } }, + "babel-helper-to-multiple-sequence-expressions": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-helper-to-multiple-sequence-expressions/-/babel-helper-to-multiple-sequence-expressions-0.4.3.tgz", + "integrity": "sha1-W1GLESf0ezA4dzOGoVYaK0jmMrY=", + "dev": true + }, "babel-helpers": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", @@ -843,6 +1227,31 @@ "babel-runtime": "^6.22.0" } }, + "babel-minify": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-minify/-/babel-minify-0.4.3.tgz", + "integrity": "sha1-2Ufk7WtibcjCVofyQsJcvPbygaY=", + "dev": true, + "requires": { + "@babel/core": "^7.0.0-beta.46", + "babel-preset-minify": "^0.4.3", + "fs-readdir-recursive": "^1.1.0", + "mkdirp": "^0.5.1", + "util.promisify": "^1.0.0", + "yargs-parser": "^10.0.0" + }, + "dependencies": { + "yargs-parser": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-10.1.0.tgz", + "integrity": "sha512-VCIyR1wJoEBZUqk5PA+oOBF6ypbwh5aNB3I50guxAL/quggdfs4TtNHQrSazFA3fYZ+tEqfs0zIGlv0c/rgjbQ==", + "dev": true, + "requires": { + "camelcase": "^4.1.0" + } + } + } + }, "babel-plugin-add-module-exports": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/babel-plugin-add-module-exports/-/babel-plugin-add-module-exports-0.2.1.tgz", @@ -1423,6 +1832,101 @@ } } }, + "babel-plugin-minify-builtins": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-builtins/-/babel-plugin-minify-builtins-0.4.3.tgz", + "integrity": "sha1-nqPVn0rEp7uVjXEtKVVqH4b3+B4=", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.4.3" + } + }, + "babel-plugin-minify-constant-folding": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-constant-folding/-/babel-plugin-minify-constant-folding-0.4.3.tgz", + "integrity": "sha1-MA+d6N2ghEoXaxk2U5YOJK0z4ZE=", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.4.3" + } + }, + "babel-plugin-minify-dead-code-elimination": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-dead-code-elimination/-/babel-plugin-minify-dead-code-elimination-0.4.3.tgz", + "integrity": "sha1-c2KCZYZPkAjQAnUG9Yq+s8HQLZg=", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.4.3", + "babel-helper-mark-eval-scopes": "^0.4.3", + "babel-helper-remove-or-void": "^0.4.3", + "lodash.some": "^4.6.0" + } + }, + "babel-plugin-minify-flip-comparisons": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-flip-comparisons/-/babel-plugin-minify-flip-comparisons-0.4.3.tgz", + "integrity": "sha1-AMqHDLjxO0XAOLPB68DyJyk8llo=", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.4.3" + } + }, + "babel-plugin-minify-guarded-expressions": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-guarded-expressions/-/babel-plugin-minify-guarded-expressions-0.4.3.tgz", + "integrity": "sha1-zHCbRFP9IbHzAod0RMifiEJ845c=", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.4.3" + } + }, + "babel-plugin-minify-infinity": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.3.tgz", + "integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco=", + "dev": true + }, + "babel-plugin-minify-mangle-names": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-mangle-names/-/babel-plugin-minify-mangle-names-0.4.3.tgz", + "integrity": "sha1-FvG/90t6fJPfwkHngx3V+0sCPvc=", + "dev": true, + "requires": { + "babel-helper-mark-eval-scopes": "^0.4.3" + } + }, + "babel-plugin-minify-numeric-literals": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-numeric-literals/-/babel-plugin-minify-numeric-literals-0.4.3.tgz", + "integrity": "sha1-jk/VYcefeAEob/YOjF/Z3u6TwLw=", + "dev": true + }, + "babel-plugin-minify-replace": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-replace/-/babel-plugin-minify-replace-0.4.3.tgz", + "integrity": "sha1-nSifS6FdTmAR6HmfpfG6d+yBIZ0=", + "dev": true + }, + "babel-plugin-minify-simplify": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-simplify/-/babel-plugin-minify-simplify-0.4.3.tgz", + "integrity": "sha1-N3VthcYURktLCSfytOQXGR1Vc4o=", + "dev": true, + "requires": { + "babel-helper-flip-expressions": "^0.4.3", + "babel-helper-is-nodes-equiv": "^0.0.1", + "babel-helper-to-multiple-sequence-expressions": "^0.4.3" + } + }, + "babel-plugin-minify-type-constructors": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-minify-type-constructors/-/babel-plugin-minify-type-constructors-0.4.3.tgz", + "integrity": "sha1-G8bxW4f3qxCF1CszC3F2V6IVZQA=", + "dev": true, + "requires": { + "babel-helper-is-void-0": "^0.4.3" + } + }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", @@ -1686,6 +2190,39 @@ "regexpu-core": "^2.0.0" } }, + "babel-plugin-transform-inline-consecutive-adds": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-inline-consecutive-adds/-/babel-plugin-transform-inline-consecutive-adds-0.4.3.tgz", + "integrity": "sha1-Mj1Ho+pjqDp6w8gRro5pQfrysNE=", + "dev": true + }, + "babel-plugin-transform-member-expression-literals": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-member-expression-literals/-/babel-plugin-transform-member-expression-literals-6.9.4.tgz", + "integrity": "sha1-NwOcmgwzE6OUlfqsL/OmtbnQOL8=", + "dev": true + }, + "babel-plugin-transform-merge-sibling-variables": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-merge-sibling-variables/-/babel-plugin-transform-merge-sibling-variables-6.9.4.tgz", + "integrity": "sha1-hbQi/DN3tEnJ0c3kQIcgNTJAHa4=", + "dev": true + }, + "babel-plugin-transform-minify-booleans": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.4.tgz", + "integrity": "sha1-rLs+VqNVXdI5KOS1gtKFFi3SsZg=", + "dev": true + }, + "babel-plugin-transform-property-literals": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-property-literals/-/babel-plugin-transform-property-literals-6.9.4.tgz", + "integrity": "sha1-mMHSHiVXNlc/k+zlRFn2ziSYXTk=", + "dev": true, + "requires": { + "esutils": "^2.0.2" + } + }, "babel-plugin-transform-regenerator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", @@ -1695,6 +2232,39 @@ "regenerator-transform": "^0.10.0" } }, + "babel-plugin-transform-regexp-constructors": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regexp-constructors/-/babel-plugin-transform-regexp-constructors-0.4.3.tgz", + "integrity": "sha1-WLd3W2OvzzMyj66aX4j71PsLSWU=", + "dev": true + }, + "babel-plugin-transform-remove-console": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-console/-/babel-plugin-transform-remove-console-6.9.4.tgz", + "integrity": "sha1-uYA2DAZzhOJLNXpYjYB9PINSd4A=", + "dev": true + }, + "babel-plugin-transform-remove-debugger": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-debugger/-/babel-plugin-transform-remove-debugger-6.9.4.tgz", + "integrity": "sha1-QrcnYxyXl44estGZp67IShgznvI=", + "dev": true + }, + "babel-plugin-transform-remove-undefined": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-remove-undefined/-/babel-plugin-transform-remove-undefined-0.4.3.tgz", + "integrity": "sha1-1AsNp/kcCMBsxyt2dHTAHEiU3gI=", + "dev": true, + "requires": { + "babel-helper-evaluate-path": "^0.4.3" + } + }, + "babel-plugin-transform-simplify-comparison-operators": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-simplify-comparison-operators/-/babel-plugin-transform-simplify-comparison-operators-6.9.4.tgz", + "integrity": "sha1-9ir+CWyrDh9ootdT/fKDiIRxzrk=", + "dev": true + }, "babel-plugin-transform-strict-mode": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", @@ -1705,6 +2275,12 @@ "babel-types": "^6.24.1" } }, + "babel-plugin-transform-undefined-to-void": { + "version": "6.9.4", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-undefined-to-void/-/babel-plugin-transform-undefined-to-void-6.9.4.tgz", + "integrity": "sha1-viQcqBQEAwZ4t0hxcyK4nQyP4oA=", + "dev": true + }, "babel-preset-es2015": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", @@ -1747,6 +2323,37 @@ "babel-plugin-transform-async-to-generator": "^6.24.1" } }, + "babel-preset-minify": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/babel-preset-minify/-/babel-preset-minify-0.4.3.tgz", + "integrity": "sha1-spw91pGJBThFmPCSuVUVLiah/g8=", + "dev": true, + "requires": { + "babel-plugin-minify-builtins": "^0.4.3", + "babel-plugin-minify-constant-folding": "^0.4.3", + "babel-plugin-minify-dead-code-elimination": "^0.4.3", + "babel-plugin-minify-flip-comparisons": "^0.4.3", + "babel-plugin-minify-guarded-expressions": "^0.4.3", + "babel-plugin-minify-infinity": "^0.4.3", + "babel-plugin-minify-mangle-names": "^0.4.3", + "babel-plugin-minify-numeric-literals": "^0.4.3", + "babel-plugin-minify-replace": "^0.4.3", + "babel-plugin-minify-simplify": "^0.4.3", + "babel-plugin-minify-type-constructors": "^0.4.3", + "babel-plugin-transform-inline-consecutive-adds": "^0.4.3", + "babel-plugin-transform-member-expression-literals": "^6.9.4", + "babel-plugin-transform-merge-sibling-variables": "^6.9.4", + "babel-plugin-transform-minify-booleans": "^6.9.4", + "babel-plugin-transform-property-literals": "^6.9.4", + "babel-plugin-transform-regexp-constructors": "^0.4.3", + "babel-plugin-transform-remove-console": "^6.9.4", + "babel-plugin-transform-remove-debugger": "^6.9.4", + "babel-plugin-transform-remove-undefined": "^0.4.3", + "babel-plugin-transform-simplify-comparison-operators": "^6.9.4", + "babel-plugin-transform-undefined-to-void": "^6.9.4", + "lodash.isplainobject": "^4.0.6" + } + }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -2335,9 +2942,9 @@ "dev": true }, "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, "caseless": { @@ -2355,16 +2962,6 @@ "underscore-contrib": "~0.3.0" } }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", - "dev": true, - "requires": { - "align-text": "^0.1.3", - "lazy-cache": "^1.0.3" - } - }, "chai": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", @@ -2714,25 +3311,6 @@ "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", "dev": true }, - "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true, - "requires": { - "center-align": "^0.1.1", - "right-align": "^0.1.1", - "wordwrap": "0.0.2" - }, - "dependencies": { - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true - } - } - }, "co": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", @@ -3114,6 +3692,16 @@ "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", "dev": true }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "dev": true, + "requires": { + "foreach": "^2.0.5", + "object-keys": "^1.0.8" + } + }, "defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", @@ -3420,6 +4008,30 @@ "integrity": "sha1-6WQhkyWiHQX0RGai9obtbOX13R0=", "dev": true }, + "es-abstract": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.12.0.tgz", + "integrity": "sha512-C8Fx/0jFmV5IPoMOFPA9P9G5NtqW+4cOPit3MIuvR2t7Ag2K15EJTpxnHAYTzL+aYQJIESYeXZmDBfOBE1HcpA==", + "dev": true, + "requires": { + "es-to-primitive": "^1.1.1", + "function-bind": "^1.1.1", + "has": "^1.0.1", + "is-callable": "^1.1.3", + "is-regex": "^1.0.4" + } + }, + "es-to-primitive": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", + "dev": true, + "requires": { + "is-callable": "^1.1.1", + "is-date-object": "^1.0.1", + "is-symbol": "^1.0.1" + } + }, "es6-promise": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.3.0.tgz", @@ -3995,6 +4607,12 @@ "for-in": "^0.1.5" } }, + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", + "dev": true + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -4057,6 +4675,12 @@ } } }, + "fs-readdir-recursive": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz", + "integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==", + "dev": true + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -5332,6 +5956,18 @@ "integrity": "sha1-24l/w/esotUN6UtsjCiWpHcWJ68=", "dev": true }, + "is-callable": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.4.tgz", + "integrity": "sha512-r5p9sxJjYnArLjObpjA4xu5EKI3CuKHkJXMhT7kwbpUyIFD1n5PMAsoPvWnvtZiNz7LjkYDRZhd7FlI0eMijEA==", + "dev": true + }, + "is-date-object": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", + "dev": true + }, "is-dotfile": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.2.tgz", @@ -5462,6 +6098,15 @@ "dev": true, "optional": true }, + "is-regex": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", + "dev": true, + "requires": { + "has": "^1.0.1" + } + }, "is-resolvable": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", @@ -5474,6 +6119,12 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, + "is-symbol": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", + "dev": true + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -5867,12 +6518,6 @@ } } }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -5962,12 +6607,24 @@ "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", "dev": true }, + "lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha1-fFJqUtibRcRcxpC4gWO+BJf1UMs=", + "dev": true + }, "lodash.memoize": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-3.0.4.tgz", "integrity": "sha1-LcvSwofLwKVcxCMovQxzYVDVPj8=", "dev": true }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=", + "dev": true + }, "log-driver": { "version": "1.2.7", "resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz", @@ -6217,12 +6874,6 @@ } } }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -9365,6 +10016,22 @@ "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", "dev": true }, + "object-keys": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.12.tgz", + "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", + "dev": true + }, + "object.getownpropertydescriptors": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz", + "integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.5.1" + } + }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -10356,15 +11023,6 @@ "integrity": "sha1-/s5hv6DBtSoga9axgZgYS91SOjs=", "dev": true }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", - "dev": true, - "requires": { - "align-text": "^0.1.1" - } - }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -11169,44 +11827,6 @@ "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", "dev": true }, - "uglify-js": { - "version": "2.7.5", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.7.5.tgz", - "integrity": "sha1-RhLAx7qu4rp8SH3kkErhIgefLKg=", - "dev": true, - "requires": { - "async": "~0.2.6", - "source-map": "~0.5.1", - "uglify-to-browserify": "~1.0.0", - "yargs": "~3.10.0" - }, - "dependencies": { - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "yargs": { - "version": "3.10.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.10.0.tgz", - "integrity": "sha1-9+572FfdfB0tOMDnTvvWgdFDH9E=", - "dev": true, - "requires": { - "camelcase": "^1.0.2", - "cliui": "^2.1.0", - "decamelize": "^1.0.0", - "window-size": "0.1.0" - } - } - } - }, - "uglify-to-browserify": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/uglify-to-browserify/-/uglify-to-browserify-1.0.2.tgz", - "integrity": "sha1-bgkk1r2mta/jSeOabWMoUKD4grc=", - "dev": true - }, "ultron": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/ultron/-/ultron-1.1.1.tgz", @@ -11305,6 +11925,16 @@ "integrity": "sha1-p8IW0mdUUWljeztu3GypEZ4v+T8=", "dev": true }, + "util.promisify": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/util.promisify/-/util.promisify-1.0.0.tgz", + "integrity": "sha512-i+6qA2MPhvoKLuxnJNpXAGhg7HphQOSUq2LKMZD0m15EiskXUkMvKdF4Uui0WYeCUGea+o2cw/ZuwehtfsrNkA==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "object.getownpropertydescriptors": "^2.0.3" + } + }, "utile": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/utile/-/utile-0.3.0.tgz", @@ -11391,12 +12021,6 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "window-size": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.0.tgz", - "integrity": "sha1-VDjNLqk7IC76Ohn+iIeu58lPnJ0=", - "dev": true - }, "winston": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/winston/-/winston-2.1.1.tgz", diff --git a/package.json b/package.json index b05e7110b..84206ead1 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,7 @@ "devDependencies": { "babel-core": "^6.26.3", "babel-eslint": "^8.2.6", + "babel-minify": "^0.4.3", "babel-plugin-add-module-exports": "^0.2.1", "babel-plugin-istanbul": "^2.0.1", "babel-plugin-syntax-async-generators": "^6.13.0", @@ -56,7 +57,6 @@ "rollup-plugin-npm": "^2.0.0", "rsvp": "^3.0.18", "semver": "^5.5.0", - "uglify-js": "~2.7.3", "yargs": "^11.0.0" }, "scripts": { From c99905a71309cbc2e91ec3f26693903480fc40aa Mon Sep 17 00:00:00 2001 From: Alexander Early Date: Sun, 29 Jul 2018 18:48:05 -0700 Subject: [PATCH 8/8] fix rollup build --- lib/internal/asyncEachOfLimit.js | 2 +- lib/internal/breakLoop.js | 3 ++- package-lock.json | 21 +++++++++++++++++---- package.json | 2 +- support/build.test.js | 4 ++-- support/build/aggregate-bundle.js | 6 +++--- 6 files changed, 26 insertions(+), 12 deletions(-) diff --git a/lib/internal/asyncEachOfLimit.js b/lib/internal/asyncEachOfLimit.js index 403915b1a..69d5e7453 100644 --- a/lib/internal/asyncEachOfLimit.js +++ b/lib/internal/asyncEachOfLimit.js @@ -1,4 +1,4 @@ -const breakLoop = require('./breakLoop') +import breakLoop from './breakLoop'; // for async generators export default function asyncEachOfLimit(generator, limit, iteratee, callback) { diff --git a/lib/internal/breakLoop.js b/lib/internal/breakLoop.js index 6bb216e8c..542b1bcf4 100644 --- a/lib/internal/breakLoop.js +++ b/lib/internal/breakLoop.js @@ -1,3 +1,4 @@ // A temporary value used to identify if the loop should be broken. // See #1064, #1293 -export default {}; \ No newline at end of file +const breakLoop = {}; +export default breakLoop; diff --git a/package-lock.json b/package-lock.json index 95724ca71..f42b9b49e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -542,6 +542,18 @@ "to-fast-properties": "^2.0.0" } }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, + "@types/node": { + "version": "10.5.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-10.5.4.tgz", + "integrity": "sha512-8TqvB0ReZWwtcd3LXq3YSrBoLyXFgBX/sBZfGye9+YS8zH7/g+i6QRIuiDmwBoTzcQ/pk89nZYTYU4c5akKkzw==", + "dev": true + }, "JSONStream": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-1.3.2.tgz", @@ -11043,12 +11055,13 @@ } }, "rollup": { - "version": "0.36.4", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.36.4.tgz", - "integrity": "sha1-oiRJTFOGwdc9OPe7hvafXrARo9I=", + "version": "0.63.4", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.63.4.tgz", + "integrity": "sha512-IGTH7u0P6bmu7cXL0g11UDYTR9WKku70cYlqVyOYdqLoQopBGmCbGC3SMeheqHymnehHe/5yf6BJ6BEoxQBVTQ==", "dev": true, "requires": { - "source-map-support": "^0.4.0" + "@types/estree": "0.0.39", + "@types/node": "*" } }, "rollup-plugin-node-resolve": { diff --git a/package.json b/package.json index 84206ead1..2e82c557f 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "native-promise-only": "^0.8.0-a", "nyc": "^11.8.0", "rimraf": "^2.5.0", - "rollup": "^0.36.3", + "rollup": "^0.63.4", "rollup-plugin-node-resolve": "^2.0.0", "rollup-plugin-npm": "^2.0.0", "rsvp": "^3.0.18", diff --git a/support/build.test.js b/support/build.test.js index 02f11cea9..095127011 100644 --- a/support/build.test.js +++ b/support/build.test.js @@ -74,14 +74,14 @@ describe("ES Modules", () => { before(() => { return rollup({ - entry: __dirname + "/es.test.js", + input: __dirname + "/es.test.js", plugins: [ rollupPluginNodeResolve() ] }).then((bundle) => { return bundle.write({ format: "umd", - dest: buildFile + file: buildFile }); }); }); diff --git a/support/build/aggregate-bundle.js b/support/build/aggregate-bundle.js index 9430822d7..452a1f1fa 100644 --- a/support/build/aggregate-bundle.js +++ b/support/build/aggregate-bundle.js @@ -2,14 +2,14 @@ const {rollup} = require('rollup'); const nodeResolve = require('rollup-plugin-node-resolve'); rollup({ - entry: 'build-es/index.js', + input: 'build-es/index.js', plugins: [ nodeResolve() ] }) .then(( bundle ) => { return bundle.write({ format: 'umd', - moduleName: 'async', - dest: 'build/dist/async.js' + name: 'async', + file: 'build/dist/async.js' }); }) .catch((err) => { throw err; });