Remove modules from source

This commit is contained in:
Federico Grandi
2019-12-14 21:58:11 +01:00
parent f118062594
commit e5272e4c09
4269 changed files with 0 additions and 1074858 deletions

View File

@@ -1,7 +0,0 @@
# babel-helper-flip-expressions
## Installation
```sh
npm install babel-helper-flip-expressions --save-dev
```

View File

@@ -1,109 +0,0 @@
"use strict";
const flipSeen = Symbol("flipSeen");
module.exports = function (t) {
return {
hasSeen(node) {
return !!node[flipSeen];
},
// Takes an expressions and determines if it has
// more nodes that could benifit from flipping than not.
shouldFlip(topNode, savings = 0) {
visit(topNode);
return savings > 0;
function visit(node) {
if (t.isUnaryExpression(node, {
operator: "!"
})) {
savings++;
return;
}
if (t.isLogicalExpression(node)) {
visit(node.left);
visit(node.right);
return;
}
if (!(t.isBinaryExpression(node) && t.EQUALITY_BINARY_OPERATORS.indexOf(node.operator) > -1)) {
// Binary expressions wouldn't hurut because we know how to flip them
savings--;
}
}
},
flip(node, resultNotUsed) {
let lastNodeDesc;
const ret = visit(node);
ret[flipSeen] = true;
if (resultNotUsed && lastNodeDesc) {
const _lastNodeDesc = lastNodeDesc,
parent = _lastNodeDesc.parent,
key = _lastNodeDesc.key;
if (parent && key && t.isUnaryExpression(parent[key], {
operator: "!"
})) {
parent[key] = parent[key].argument;
}
}
return ret;
function visit(node, parent, key) {
lastNodeDesc = {
parent,
key
};
if (t.isUnaryExpression(node, {
operator: "!"
})) {
return node.argument;
}
if (t.isLogicalExpression(node)) {
node.operator = node.operator === "&&" ? "||" : "&&";
node.left = visit(node.left, node, "left");
node.right = visit(node.right, node, "right");
return node;
}
if (t.isBinaryExpression(node)) {
let operator;
switch (node.operator) {
case "!==":
operator = "===";
break;
case "===":
operator = "!==";
break;
case "!=":
operator = "==";
break;
case "==":
operator = "!=";
break;
}
if (operator) {
node.operator = operator;
return node;
} // Falls through to unary expression
}
return t.unaryExpression("!", node, true);
}
}
};
};

View File

@@ -1,51 +0,0 @@
{
"_args": [
[
"babel-helper-flip-expressions@0.4.3",
"/home/runner/work/add-and-commit/add-and-commit"
]
],
"_development": true,
"_from": "babel-helper-flip-expressions@0.4.3",
"_id": "babel-helper-flip-expressions@0.4.3",
"_inBundle": false,
"_integrity": "sha1-NpZzahKKwYvCUlS19AoizrPB0/0=",
"_location": "/babel-helper-flip-expressions",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-helper-flip-expressions@0.4.3",
"name": "babel-helper-flip-expressions",
"escapedName": "babel-helper-flip-expressions",
"rawSpec": "0.4.3",
"saveSpec": null,
"fetchSpec": "0.4.3"
},
"_requiredBy": [
"/babel-plugin-minify-guarded-expressions",
"/babel-plugin-minify-simplify"
],
"_resolved": "https://registry.npmjs.org/babel-helper-flip-expressions/-/babel-helper-flip-expressions-0.4.3.tgz",
"_spec": "0.4.3",
"_where": "/home/runner/work/add-and-commit/add-and-commit",
"author": {
"name": "amasad"
},
"bugs": {
"url": "https://github.com/babel/minify/issues"
},
"description": "## Installation",
"homepage": "https://github.com/babel/minify#readme",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-helper-flip-expressions",
"repository": {
"type": "git",
"url": "https://github.com/babel/minify/tree/master/packages/babel-helper-flip-expressions"
},
"version": "0.4.3"
}