mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-02 20:00:05 +02:00
add some packages
This commit is contained in:
51
node_modules/babel-plugin-transform-minify-booleans/README.md
generated
vendored
Normal file
51
node_modules/babel-plugin-transform-minify-booleans/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# babel-plugin-transform-minify-booleans
|
||||
|
||||
This plugin allows Babel to transform boolean literals into `!0` for `true` and `!1` for `false`.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
true;
|
||||
false;
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
!0;
|
||||
!1;
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
npm install babel-plugin-transform-minify-booleans
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-minify-booleans"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
babel --plugins transform-minify-booleans script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("@babel/core").transform("code", {
|
||||
plugins: ["transform-minify-booleans"]
|
||||
});
|
||||
```
|
20
node_modules/babel-plugin-transform-minify-booleans/lib/index.js
generated
vendored
Normal file
20
node_modules/babel-plugin-transform-minify-booleans/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
"use strict";
|
||||
|
||||
module.exports = function ({
|
||||
types: t
|
||||
}) {
|
||||
const TRUE = t.unaryExpression("!", t.numericLiteral(0), true);
|
||||
const FALSE = t.unaryExpression("!", t.numericLiteral(1), true);
|
||||
return {
|
||||
name: "transform-minify-booleans",
|
||||
visitor: {
|
||||
// shorten booleans to a negation
|
||||
// true -> !0
|
||||
// false -> !1
|
||||
BooleanLiteral(path) {
|
||||
path.replaceWith(path.node.value ? TRUE : FALSE);
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
};
|
46
node_modules/babel-plugin-transform-minify-booleans/package.json
generated
vendored
Normal file
46
node_modules/babel-plugin-transform-minify-booleans/package.json
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
{
|
||||
"_from": "babel-plugin-transform-minify-booleans@^6.9.2",
|
||||
"_id": "babel-plugin-transform-minify-booleans@6.9.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-z5lb4GegMDy1JlSfA9zZaCQZQw0=",
|
||||
"_location": "/babel-plugin-transform-minify-booleans",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "babel-plugin-transform-minify-booleans@^6.9.2",
|
||||
"name": "babel-plugin-transform-minify-booleans",
|
||||
"escapedName": "babel-plugin-transform-minify-booleans",
|
||||
"rawSpec": "^6.9.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^6.9.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/babel-preset-minify"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/babel-plugin-transform-minify-booleans/-/babel-plugin-transform-minify-booleans-6.9.2.tgz",
|
||||
"_shasum": "cf995be067a0303cb526549f03dcd9682419430d",
|
||||
"_spec": "babel-plugin-transform-minify-booleans@^6.9.2",
|
||||
"_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": "Turn boolean literals into !0 for true and !1 for false.",
|
||||
"homepage": "https://github.com/babel/minify#readme",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "babel-plugin-transform-minify-booleans",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-minify-booleans"
|
||||
},
|
||||
"version": "6.9.2"
|
||||
}
|
Reference in New Issue
Block a user