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,47 +0,0 @@
# babel-plugin-minify-infinity
## Example
**In**
```javascript
Infinity;
```
**Out**
```javascript
1 / 0;
```
## Installation
```sh
npm install babel-plugin-minify-infinity --save-dev
```
## Usage
### Via `.babelrc` (Recommended)
**.babelrc**
```json
{
"plugins": ["minify-infinity"]
}
```
### Via CLI
```sh
babel --plugins minify-infinity script.js
```
### Via Node API
```javascript
require("@babel/core").transform("code", {
plugins: ["minify-infinity"]
});
```

View File

@@ -1,44 +0,0 @@
"use strict";
module.exports = function ({
types: t
}) {
const INFINITY = t.binaryExpression("/", t.numericLiteral(1), t.numericLiteral(0));
return {
name: "minify-infinity",
visitor: {
// Infinity -> 1 / 0
Identifier(path) {
if (path.node.name !== "Infinity") {
return;
} // It's a referenced identifier
if (path.scope.getBinding("Infinity")) {
return;
}
if (path.parentPath.isObjectProperty({
key: path.node
})) {
return;
}
if (path.parentPath.isMemberExpression()) {
return;
}
const bindingIds = path.parentPath.getBindingIdentifierPaths();
if (bindingIds["Infinity"] === path && // ObjectProperty is common for ObjectExpression and ObjectPattern and only
// one of them is a Binding, the other is simply a reference
!path.parentPath.parentPath.isObjectExpression()) {
return;
}
path.replaceWith(INFINITY);
}
}
};
};

View File

@@ -1,50 +0,0 @@
{
"_args": [
[
"babel-plugin-minify-infinity@0.4.3",
"/home/runner/work/add-and-commit/add-and-commit"
]
],
"_development": true,
"_from": "babel-plugin-minify-infinity@0.4.3",
"_id": "babel-plugin-minify-infinity@0.4.3",
"_inBundle": false,
"_integrity": "sha1-37h2obCKBldjhO8/kuZTumB7Oco=",
"_location": "/babel-plugin-minify-infinity",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "babel-plugin-minify-infinity@0.4.3",
"name": "babel-plugin-minify-infinity",
"escapedName": "babel-plugin-minify-infinity",
"rawSpec": "0.4.3",
"saveSpec": null,
"fetchSpec": "0.4.3"
},
"_requiredBy": [
"/babel-preset-minify"
],
"_resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-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": "## Example",
"homepage": "https://github.com/babel/minify#readme",
"keywords": [
"babel-plugin"
],
"license": "MIT",
"main": "lib/index.js",
"name": "babel-plugin-minify-infinity",
"repository": {
"type": "git",
"url": "https://github.com/babel/minify/tree/master/packages/babel-plugin-minify-infinity"
},
"version": "0.4.3"
}