Skip to content

Commit

Permalink
Upgrade deps (#522)
Browse files Browse the repository at this point in the history
* Upgrade deps

* Apply prettier
  • Loading branch information
boopathi committed May 5, 2017
1 parent 7f03281 commit 23b07ac
Show file tree
Hide file tree
Showing 12 changed files with 125 additions and 130 deletions.
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"lerna": "2.0.0-rc.2",
"lerna": "2.0.0-rc.4",
"version": "independent",
"commands": {
"publish": {
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-helper-flip-expressions/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
39 changes: 20 additions & 19 deletions packages/babel-plugin-minify-builtins/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 4 additions & 2 deletions packages/babel-plugin-minify-mangle-names/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
52 changes: 25 additions & 27 deletions packages/babel-plugin-minify-replace/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
}
Expand Down
13 changes: 9 additions & 4 deletions packages/babel-plugin-minify-simplify/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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" ||
Expand All @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 3 additions & 1 deletion packages/babel-plugin-minify-type-constructors/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-babili/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion scripts/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ function run() {
program
.usage("[options] <file ...>")
.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(
Expand Down
2 changes: 1 addition & 1 deletion smoke/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Loading

0 comments on commit 23b07ac

Please sign in to comment.