diff --git a/lerna.json b/lerna.json index e3d2fbb41..a56523c23 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "lerna": "2.0.0-rc.2", + "lerna": "2.0.0-rc.4", "version": "independent", "commands": { "publish": { diff --git a/package.json b/package.json index 0d634deec..42c4d550c 100644 --- a/package.json +++ b/package.json @@ -37,7 +37,7 @@ }, "devDependencies": { "babel-core": "^6.24.1", - "babel-eslint": "^7.2.2", + "babel-eslint": "^7.2.3", "babel-jest": "^19.0.0", "babel-plugin-transform-es2015-block-scoping": "^6.24.1", "babel-preset-env": "^1.4.0", @@ -49,16 +49,16 @@ "codecov": "^2.1.0", "commander": "^2.9.0", "eslint": "^3.18.0", - "google-closure-compiler-js": "^20170409.0.0", + "google-closure-compiler-js": "^20170423.0.0", "gulp": "github:gulpjs/gulp#4.0", "gulp-babel": "^6.1.2", "gulp-newer": "^1.1.0", "gulp-util": "^3.0.8", "jest-cli": "^19.0.2", - "lerna": "^2.0.0-rc.2", + "lerna": "^2.0.0-rc.4", "lerna-changelog": "^0.4.0", "markdown-table": "^1.1.0", - "prettier": "^1.1.0", + "prettier": "^1.3.1", "request": "^2.81.0", "through2": "^2.0.1", "uglify-js": "^2.8.22" diff --git a/packages/babel-helper-flip-expressions/src/index.js b/packages/babel-helper-flip-expressions/src/index.js index a9f9264f7..bca396046 100644 --- a/packages/babel-helper-flip-expressions/src/index.js +++ b/packages/babel-helper-flip-expressions/src/index.js @@ -45,7 +45,9 @@ module.exports = function(t) { if (resultNotUsed && lastNodeDesc) { const { parent, key } = lastNodeDesc; if ( - parent && key && t.isUnaryExpression(parent[key], { operator: "!" }) + parent && + key && + t.isUnaryExpression(parent[key], { operator: "!" }) ) { parent[key] = parent[key].argument; } diff --git a/packages/babel-plugin-minify-builtins/src/index.js b/packages/babel-plugin-minify-builtins/src/index.js index bde0996a8..cb5e61a91 100644 --- a/packages/babel-plugin-minify-builtins/src/index.js +++ b/packages/babel-plugin-minify-builtins/src/index.js @@ -144,26 +144,27 @@ function getSegmentedSubPaths(paths) { let segments = new Map(); // Get earliest Path in tree where paths intersect - paths[ - 0 - ].getDeepestCommonAncestorFrom(paths, (lastCommon, index, ancestries) => { - // we found the LCA - if (!lastCommon.isProgram()) { - lastCommon = !lastCommon.isFunction() - ? lastCommon.getFunctionParent() - : lastCommon; - segments.set(lastCommon, paths); - return; - } - // Deopt and construct segments otherwise - for (const ancestor of ancestries) { - const parentPath = ancestor[index + 1]; - const validDescendants = paths.filter(p => { - return p.isDescendant(parentPath); - }); - segments.set(parentPath, validDescendants); + paths[0].getDeepestCommonAncestorFrom( + paths, + (lastCommon, index, ancestries) => { + // we found the LCA + if (!lastCommon.isProgram()) { + lastCommon = !lastCommon.isFunction() + ? lastCommon.getFunctionParent() + : lastCommon; + segments.set(lastCommon, paths); + return; + } + // Deopt and construct segments otherwise + for (const ancestor of ancestries) { + const parentPath = ancestor[index + 1]; + const validDescendants = paths.filter(p => { + return p.isDescendant(parentPath); + }); + segments.set(parentPath, validDescendants); + } } - }); + ); return segments; } diff --git a/packages/babel-plugin-minify-mangle-names/src/index.js b/packages/babel-plugin-minify-mangle-names/src/index.js index a68021f4a..77e108248 100644 --- a/packages/babel-plugin-minify-mangle-names/src/index.js +++ b/packages/babel-plugin-minify-mangle-names/src/index.js @@ -167,10 +167,12 @@ module.exports = ({ types: t, traverse }) => { let next; do { next = getNext(); - } while (!t.isValidIdentifier(next) || + } while ( + !t.isValidIdentifier(next) || hop.call(bindings, next) || scope.hasGlobal(next) || - scope.hasReference(next)); + scope.hasReference(next) + ); // TODO: // re-enable this - check above diff --git a/packages/babel-plugin-minify-replace/src/index.js b/packages/babel-plugin-minify-replace/src/index.js index 4012f7cd3..b6b614f2d 100644 --- a/packages/babel-plugin-minify-replace/src/index.js +++ b/packages/babel-plugin-minify-replace/src/index.js @@ -55,38 +55,36 @@ module.exports = ({ types: t }) => { } const map = Object.create(null); - this.opts.replacements.forEach(({ - identifierName, - replacement, - member - }) => { - if (path.scope.globals[identifierName]) { - // Convert to a node, we only allow identifiers and literals as replacements - if (!replacement.type.match(/literal|identifier/i)) { - throw new Error( - "Only literals and identifier are supported as replacements" - ); - } + this.opts.replacements.forEach( + ({ identifierName, replacement, member }) => { + if (path.scope.globals[identifierName]) { + // Convert to a node, we only allow identifiers and literals as replacements + if (!replacement.type.match(/literal|identifier/i)) { + throw new Error( + "Only literals and identifier are supported as replacements" + ); + } - const node = t[replacement.type](replacement.value); - const options = { - identifierName, - node, - member - }; + const node = t[replacement.type](replacement.value); + const options = { + identifierName, + node, + member + }; - if (!map[identifierName]) { - map[identifierName] = {}; - } + if (!map[identifierName]) { + map[identifierName] = {}; + } - if (member && map[identifierName][member]) { - throw new Error( - `Replacement collision ${identifierName}.${member}` - ); + if (member && map[identifierName][member]) { + throw new Error( + `Replacement collision ${identifierName}.${member}` + ); + } + map[identifierName][member || NO_MEMBER] = options; } - map[identifierName][member || NO_MEMBER] = options; } - }); + ); path.traverse(replaceVisitor, { replacements: map }); } diff --git a/packages/babel-plugin-minify-simplify/src/index.js b/packages/babel-plugin-minify-simplify/src/index.js index 439a186c3..412f9492e 100644 --- a/packages/babel-plugin-minify-simplify/src/index.js +++ b/packages/babel-plugin-minify-simplify/src/index.js @@ -203,7 +203,8 @@ module.exports = ({ types: t }) => { // !NaN and !undefined are truthy // separate check here as they are considered impure by babel if ( - input.isUnaryExpression() && input.get("argument").isIdentifier() + input.isUnaryExpression() && + input.get("argument").isIdentifier() ) { if ( input.node.argument.name === "NaN" || @@ -222,7 +223,8 @@ module.exports = ({ types: t }) => { // separate check here as they are considered impure by babel if (input.isIdentifier()) { if ( - input.node.name === "NaN" || input.node.name === "undefined" + input.node.name === "NaN" || + input.node.name === "undefined" ) { return true; } @@ -757,7 +759,9 @@ module.exports = ({ types: t }) => { } if ( - statements.length > 1 || needsBlock(node, parent) || node.directives + statements.length > 1 || + needsBlock(node, parent) || + node.directives ) { node.body = statements; return; @@ -1323,7 +1327,8 @@ module.exports = ({ types: t }) => { defaultRet = nextPath.node; nextPath.remove(); } else if ( - !nextPath.node && path.parentPath.parentPath.isFunction() + !nextPath.node && + path.parentPath.parentPath.isFunction() ) { // If this is the last statement in a function we just fake a void return. defaultRet = t.returnStatement(VOID_0); diff --git a/packages/babel-plugin-minify-type-constructors/src/index.js b/packages/babel-plugin-minify-type-constructors/src/index.js index d3108585f..148b31ac0 100644 --- a/packages/babel-plugin-minify-type-constructors/src/index.js +++ b/packages/babel-plugin-minify-type-constructors/src/index.js @@ -18,7 +18,9 @@ function replaceArray(t, path) { if (result.confident) { if (typeof result.value === "number") { if ( - result.value >= 0 && result.value <= 6 && result.value % 1 === 0 + result.value >= 0 && + result.value <= 6 && + result.value % 1 === 0 ) { // "Array(7)" is shorter than "[,,,,,,,]" path.replaceWith(t.arrayExpression(Array(result.value).fill(null))); diff --git a/packages/babel-preset-babili/src/index.js b/packages/babel-preset-babili/src/index.js index 062055676..3504e676b 100644 --- a/packages/babel-preset-babili/src/index.js +++ b/packages/babel-preset-babili/src/index.js @@ -91,7 +91,7 @@ function preset(context, _opts = {}) { .filter(plugin => plugin.enabled) .map( plugin => - (plugin.options ? [plugin.plugin, plugin.options] : plugin.plugin) + plugin.options ? [plugin.plugin, plugin.options] : plugin.plugin ); return { diff --git a/scripts/benchmark.js b/scripts/benchmark.js index f68af754a..55186819a 100755 --- a/scripts/benchmark.js +++ b/scripts/benchmark.js @@ -301,7 +301,7 @@ function run() { program .usage("[options] ") .arguments("[file...]") - .action(_files => files = _files) + .action(_files => (files = _files)) .option("-q, --quiet", "Quiet mode. Show only results. Don't show progress") .option("-t, --target [target]", "Output target (TERM|MD)") .option( diff --git a/smoke/run.js b/smoke/run.js index f30f6849e..5795b1c15 100644 --- a/smoke/run.js +++ b/smoke/run.js @@ -40,7 +40,7 @@ function run() { let inputTests = []; program .usage("[options] [inputTests...]") - .action(_inputTests => inputTests = _inputTests) + .action(_inputTests => (inputTests = _inputTests)) .option("-i --skip-install", "Skip Install Step") .option("-b --skip-build", "Skip Build step") .option("-c --skip-cleanup", "Skip cleanup step") diff --git a/yarn.lock b/yarn.lock index 8ae37eccb..efae2b344 100644 --- a/yarn.lock +++ b/yarn.lock @@ -298,29 +298,16 @@ babel-core@^6.0.0, babel-core@^6.0.2, babel-core@^6.24.1: slash "^1.0.0" source-map "^0.5.0" -babel-eslint@^7.2.2: - version "7.2.2" - resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.2.tgz#0da2cbe6554fd0fb069f19674f2db2f9c59270ff" +babel-eslint@^7.2.3: + version "7.2.3" + resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-7.2.3.tgz#b2fe2d80126470f5c19442dc757253a897710827" dependencies: babel-code-frame "^6.22.0" babel-traverse "^6.23.1" babel-types "^6.23.0" - babylon "^6.16.1" + babylon "^6.17.0" -babel-generator@^6.18.0: - version "6.24.0" - resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.0.tgz#eba270a8cc4ce6e09a61be43465d7c62c1f87c56" - dependencies: - babel-messages "^6.23.0" - babel-runtime "^6.22.0" - babel-types "^6.23.0" - detect-indent "^4.0.0" - jsesc "^1.3.0" - lodash "^4.2.0" - source-map "^0.5.0" - trim-right "^1.0.1" - -babel-generator@^6.24.1: +babel-generator@^6.18.0, babel-generator@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-generator/-/babel-generator-6.24.1.tgz#e715f486c58ded25649d888944d52aa07c5d9497" dependencies: @@ -734,17 +721,7 @@ babel-runtime@^6.18.0, babel-runtime@^6.22.0: core-js "^2.4.0" regenerator-runtime "^0.10.0" -babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.23.0.tgz#04d4f270adbb3aa704a8143ae26faa529238e638" - dependencies: - babel-runtime "^6.22.0" - babel-traverse "^6.23.0" - babel-types "^6.23.0" - babylon "^6.11.0" - lodash "^4.2.0" - -babel-template@^6.24.1: +babel-template@^6.16.0, babel-template@^6.22.0, babel-template@^6.23.0, babel-template@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-template/-/babel-template-6.24.1.tgz#04ae514f1f93b3a2537f2a0f60a5a45fb8308333" dependencies: @@ -768,16 +745,7 @@ babel-traverse@^6.18.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-tr invariant "^2.2.0" lodash "^4.2.0" -babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0: - version "6.23.0" - resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf" - dependencies: - babel-runtime "^6.22.0" - esutils "^2.0.2" - lodash "^4.2.0" - to-fast-properties "^1.0.1" - -babel-types@^6.24.1: +babel-types@^6.18.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0, babel-types@^6.24.1: version "6.24.1" resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.24.1.tgz#a136879dc15b3606bda0d90c1fc74304c2ff0975" dependencies: @@ -790,10 +758,14 @@ babylon@7.0.0-beta.8: version "7.0.0-beta.8" resolved "https://registry.yarnpkg.com/babylon/-/babylon-7.0.0-beta.8.tgz#2bdc5ae366041442c27e068cce6f0d7c06ea9949" -babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0, babylon@^6.16.1: +babylon@^6.11.0, babylon@^6.13.0, babylon@^6.15.0: version "6.16.1" resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3" +babylon@^6.17.0: + version "6.17.0" + resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.17.0.tgz#37da948878488b9c4e3c4038893fa3314b3fc932" + bach@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/bach/-/bach-1.1.0.tgz#cfe542db925cb37051fc490ad102c73bcb258a84" @@ -1301,13 +1273,6 @@ core-util-is@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/core-util-is/-/core-util-is-1.0.2.tgz#b5fd54220aa2bc5ab57aab7140c940754503c1a7" -cross-spawn@^4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-4.0.2.tgz#7b9247621c23adfdd3856004a823cbe397424d41" - dependencies: - lru-cache "^4.0.1" - which "^1.2.9" - cross-spawn@^5.0.1: version "5.1.0" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" @@ -1885,9 +1850,9 @@ flat-cache@^1.2.1: graceful-fs "^4.1.2" write "^0.2.1" -flow-parser@0.43.0: - version "0.43.0" - resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.43.0.tgz#e2b8eb1ac83dd53f7b6b04a7c35b6a52c33479b7" +flow-parser@0.45.0: + version "0.45.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.45.0.tgz#aa29d4ae27f06aa02817772bba0fcbefef7e62f0" for-in@^1.0.1: version "1.0.2" @@ -2004,6 +1969,10 @@ get-pkg-repo@^1.0.0: parse-github-repo-url "^1.3.0" through2 "^2.0.0" +get-port@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/get-port/-/get-port-3.1.0.tgz#ef01b18a84ca6486970ff99e54446141a73ffd3e" + get-stdin@5.0.1: version "5.0.1" resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-5.0.1.tgz#122e161591e21ff4c52530305693f20e6393a398" @@ -2156,15 +2125,25 @@ globby@^5.0.0: pify "^2.0.0" pinkie-promise "^2.0.0" +globby@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/globby/-/globby-6.1.0.tgz#f5a6d70e8395e21c858fb0489d64df02424d506c" + dependencies: + array-union "^1.0.1" + glob "^7.0.3" + object-assign "^4.0.1" + pify "^2.0.0" + pinkie-promise "^2.0.0" + glogg@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/glogg/-/glogg-1.0.0.tgz#7fe0f199f57ac906cf512feead8f90ee4a284fc5" dependencies: sparkles "^1.0.0" -google-closure-compiler-js@^20170409.0.0: - version "20170409.0.0" - resolved "https://registry.yarnpkg.com/google-closure-compiler-js/-/google-closure-compiler-js-20170409.0.0.tgz#e71063ab2bf26db794732222ec76ba07403df854" +google-closure-compiler-js@^20170423.0.0: + version "20170423.0.0" + resolved "https://registry.yarnpkg.com/google-closure-compiler-js/-/google-closure-compiler-js-20170423.0.0.tgz#e9e8b40dadfdf0e64044c9479b5d26d228778fbc" dependencies: minimist "^1.2.0" vinyl "^2.0.1" @@ -3107,9 +3086,9 @@ lerna-changelog@^0.4.0: string.prototype.padend "^3.0.0" yargs "^6.6.0" -lerna@^2.0.0-rc.2: - version "2.0.0-rc.2" - resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-rc.2.tgz#6c2191f6af2bf736bea4f49ba36e6576e204a13d" +lerna@^2.0.0-rc.4: + version "2.0.0-rc.4" + resolved "https://registry.yarnpkg.com/lerna/-/lerna-2.0.0-rc.4.tgz#567fc62c1d46190ce5f5ee0f654e0a9c9a63bdba" dependencies: async "^1.5.0" chalk "^1.1.1" @@ -3118,20 +3097,21 @@ lerna@^2.0.0-rc.2: command-join "^2.0.0" conventional-changelog-cli "^1.3.1" conventional-recommended-bump "^1.0.0" - cross-spawn "^4.0.0" dedent "^0.7.0" execa "^0.6.3" find-up "^2.1.0" fs-promise "^2.0.2" + get-port "^3.1.0" glob "^7.0.6" + globby "^6.1.0" graceful-fs "^4.1.11" inquirer "^3.0.6" load-json-file "^2.0.0" lodash "^4.17.4" minimatch "^3.0.0" + npmlog "^4.0.2" p-finally "^1.0.0" path-exists "^3.0.0" - progress "^2.0.0" read-cmd-shim "^1.0.1" read-pkg "^2.0.0" rimraf "^2.6.1" @@ -3140,9 +3120,10 @@ lerna@^2.0.0-rc.2: signal-exit "^3.0.2" strong-log-transformer "^1.0.6" temp-write "^3.2.0" + write-file-atomic "^1.3.3" write-json-file "^2.0.0" write-pkg "^2.1.0" - yargs "^7.0.2" + yargs "^7.1.0" leven@^2.0.0: version "2.1.0" @@ -3846,16 +3827,16 @@ preserve@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b" -prettier@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.1.0.tgz#9d6ad005703efefa66b6999b8916bfc6afeaf9f8" +prettier@^1.3.1: + version "1.3.1" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.3.1.tgz#fa0ea84b45ac0ba6de6a1e4cecdcff900d563151" dependencies: ast-types "0.9.8" babel-code-frame "6.22.0" babylon "7.0.0-beta.8" chalk "1.1.3" esutils "2.0.2" - flow-parser "0.43.0" + flow-parser "0.45.0" get-stdin "5.0.1" glob "7.1.1" jest-validate "19.0.0" @@ -3883,10 +3864,6 @@ progress@^1.1.8: version "1.1.8" resolved "https://registry.yarnpkg.com/progress/-/progress-1.1.8.tgz#e260c78f6161cdd9b0e56cc3e0a85de17c7a57be" -progress@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/progress/-/progress-2.0.0.tgz#8a1be366bf8fc23db2bd23f10c6fe920b4389d1f" - prr@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/prr/-/prr-0.0.0.tgz#1a84b85908325501411853d0081ee3fa86e2926a" @@ -4952,6 +4929,14 @@ write-file-atomic@^1.1.2: imurmurhash "^0.1.4" slide "^1.1.5" +write-file-atomic@^1.3.3: + version "1.3.4" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-1.3.4.tgz#f807a4f0b1d9e913ae7a48112e6cc3af1991b45f" + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + slide "^1.1.5" + write-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/write-json-file/-/write-json-file-2.0.0.tgz#0eaec981fcf9288dbc2806cbd26e06ab9bdca4ed" @@ -5033,7 +5018,7 @@ yargs@^6.3.0, yargs@^6.6.0: y18n "^3.2.1" yargs-parser "^4.2.0" -yargs@^7.0.2: +yargs@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8" dependencies: