mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
add some packages
This commit is contained in:
47
node_modules/babel-plugin-minify-infinity/README.md
generated
vendored
Normal file
47
node_modules/babel-plugin-minify-infinity/README.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# babel-plugin-minify-infinity
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
Infinity;
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
1 / 0;
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install babel-plugin-minify-infinity
|
||||
```
|
||||
|
||||
## 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"]
|
||||
});
|
||||
```
|
40
node_modules/babel-plugin-minify-infinity/lib/index.js
generated
vendored
Normal file
40
node_modules/babel-plugin-minify-infinity/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
"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;
|
||||
}
|
||||
|
||||
if (path.isLVal() && !path.parentPath.isExpressionStatement()) {
|
||||
return;
|
||||
}
|
||||
|
||||
path.replaceWith(INFINITY);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
};
|
46
node_modules/babel-plugin-minify-infinity/package.json
generated
vendored
Normal file
46
node_modules/babel-plugin-minify-infinity/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"_from": "babel-plugin-minify-infinity@^0.4.1",
|
||||
"_id": "babel-plugin-minify-infinity@0.4.1",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-zJw33MFmbcB/HrR4wrchoRz7lJE=",
|
||||
"_location": "/babel-plugin-minify-infinity",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "babel-plugin-minify-infinity@^0.4.1",
|
||||
"name": "babel-plugin-minify-infinity",
|
||||
"escapedName": "babel-plugin-minify-infinity",
|
||||
"rawSpec": "^0.4.1",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^0.4.1"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-preset-minify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babel-plugin-minify-infinity/-/babel-plugin-minify-infinity-0.4.1.tgz",
|
||||
"_shasum": "cc9c37dcc1666dc07f1eb478c2b721a11cfb9491",
|
||||
"_spec": "babel-plugin-minify-infinity@^0.4.1",
|
||||
"_where": "/home/s2/Documents/Code/minifyfromhtml/node_modules/babel-preset-minify",
|
||||
"author": {
|
||||
"name": "amasad"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/minify/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"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.1"
|
||||
}
|
Reference in New Issue
Block a user