remove minify plugins (will be in another repo) (#3621)
This commit is contained in:
parent
8354120664
commit
be02536f18
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,50 +0,0 @@
|
||||
# babel-plugin-transform-inline-environment-variables
|
||||
|
||||
Inline environment variables
|
||||
|
||||
## Example
|
||||
|
||||
### In
|
||||
|
||||
```js
|
||||
// assuming process.env.NODE_ENV is actually "development"
|
||||
process.env.NODE_ENV;
|
||||
```
|
||||
|
||||
### Out
|
||||
|
||||
```js
|
||||
"development";
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-inline-environment-variables
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-inline-environment-variables"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-inline-environment-variables script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-inline-environment-variables"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-inline-environment-variables",
|
||||
"version": "6.8.0",
|
||||
"description": "Inline environment variables",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-inline-environment-variables",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,14 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
MemberExpression(path) {
|
||||
if (path.get("object").matchesPattern("process.env")) {
|
||||
let key = path.toComputedKey();
|
||||
if (t.isStringLiteral(key)) {
|
||||
path.replaceWith(t.valueToNode(process.env[key.value]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,55 +0,0 @@
|
||||
# babel-plugin-transform-member-expression-literals
|
||||
|
||||
Turn valid member expression property literals into plain identifiers
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
obj["foo"] = "isValid";
|
||||
|
||||
obj.const = "isKeyword";
|
||||
obj["var"] = "isKeyword";
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
obj.foo = "isValid";
|
||||
|
||||
obj["const"] = "isKeyword";
|
||||
obj["var"] = "isKeyword";
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-member-expression-literals
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-member-expression-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-member-expression-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-member-expression-literals"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-member-expression-literals",
|
||||
"version": "6.8.0",
|
||||
"description": "Turn valid member expression property literals into plain identifiers",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-member-expression-literals",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
MemberExpression: {
|
||||
exit({ node }) {
|
||||
let prop = node.property;
|
||||
if (node.computed && t.isLiteral(prop) && t.isValidIdentifier(prop.value)) {
|
||||
// foo["bar"] => foo.bar
|
||||
node.property = t.identifier(prop.value);
|
||||
node.computed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
foo["default"];
|
||||
foo["import"];
|
||||
@ -1,2 +0,0 @@
|
||||
foo["default"];
|
||||
foo["import"];
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-member-expression-literals"]
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
foo["bar"];
|
||||
foo["foo"];
|
||||
foo.bar;
|
||||
foo.foo;
|
||||
@ -1,4 +0,0 @@
|
||||
foo.bar;
|
||||
foo.foo;
|
||||
foo.bar;
|
||||
foo.foo;
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,53 +0,0 @@
|
||||
# babel-plugin-transform-merge-sibling-variables
|
||||
|
||||
Merge sibling variables into one.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
var foo = "bar";
|
||||
var bar = "foo";
|
||||
foobar();
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
var foo = "bar",
|
||||
bar = "foo";
|
||||
foobar();
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-merge-sibling-variables
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-merge-sibling-variables"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-merge-sibling-variables script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-merge-sibling-variables"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-merge-sibling-variables",
|
||||
"version": "6.8.0",
|
||||
"description": "Merge sibling variables into one.",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-merge-sibling-variables",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,19 +0,0 @@
|
||||
export default function () {
|
||||
return {
|
||||
visitor: {
|
||||
VariableDeclaration(path) {
|
||||
if (!path.inList) return;
|
||||
|
||||
let { node } = path;
|
||||
|
||||
while (true) {
|
||||
let sibling = path.getSibling(path.key + 1);
|
||||
if (!sibling.isVariableDeclaration({ kind: node.kind })) break;
|
||||
|
||||
node.declarations = node.declarations.concat(sibling.node.declarations);
|
||||
sibling.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,35 +0,0 @@
|
||||
# babel-plugin-transform-minify-booleans
|
||||
|
||||
Turn boolean literals into !0 for true and !1 for false.
|
||||
|
||||
## 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"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-minify-booleans",
|
||||
"version": "6.8.0",
|
||||
"description": "Turn boolean literals into !0 for true and !1 for false.",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-minify-booleans ",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
Literal(path) {
|
||||
if (typeof path.node.value === "boolean") {
|
||||
path.replaceWith(t.unaryExpression("!", t.numericLiteral(+!path.node.value), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
true;
|
||||
false;
|
||||
@ -1,2 +0,0 @@
|
||||
!0;
|
||||
!1;
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-minify-booleans"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,22 +0,0 @@
|
||||
Copyright (c) 2015 Sebastian McKenzie <sebmck@gmail.com>
|
||||
|
||||
MIT License
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@ -1,56 +0,0 @@
|
||||
# babel-plugin-transform-node-env-inline
|
||||
|
||||
Inline the `NODE_ENV` environment variable and if it's a part of a binary expression
|
||||
(eg. `process.env.NODE_ENV === "development"`) then statically evaluate and replace it.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
process.env.NODE_ENV === "development";
|
||||
process.env.NODE_ENV === "production";
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```sh
|
||||
$ NODE_ENV=development babel in.js --plugins transform-node-env-inline
|
||||
```
|
||||
|
||||
```javascript
|
||||
true;
|
||||
false;
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-node-env-inline
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-node-env-inline"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-node-env-inline script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-node-env-inline"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-node-env-inline",
|
||||
"version": "6.8.0",
|
||||
"description": "",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-node-env-inline",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
MemberExpression(path) {
|
||||
if (path.matchesPattern("process.env.NODE_ENV")) {
|
||||
path.replaceWith(t.valueToNode(process.env.NODE_ENV));
|
||||
|
||||
if (path.parentPath.isBinaryExpression()) {
|
||||
let evaluated = path.parentPath.evaluate();
|
||||
if (evaluated.confident) {
|
||||
path.parentPath.replaceWith(t.valueToNode(evaluated.value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,57 +0,0 @@
|
||||
# babel-plugin-transform-property-literals
|
||||
|
||||
Turn valid property key literals to plain identifiers
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
var obj = {
|
||||
"foo": "isValid",
|
||||
var: "isKeyword",
|
||||
"const": "isKeyword"
|
||||
};
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
var obj = {
|
||||
foo: "isValid",
|
||||
"var": "isKeyword",
|
||||
"const": "isKeyword"
|
||||
};
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-property-literals
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-property-literals"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-property-literals script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-property-literals"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-property-literals",
|
||||
"version": "6.8.0",
|
||||
"description": "Turn valid property key literals to plain identifiers",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-property-literals",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,16 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
ObjectProperty: {
|
||||
exit({ node }) {
|
||||
let key = node.key;
|
||||
if (t.isLiteral(key) && t.isValidIdentifier(key.value)) {
|
||||
// "foo": "bar" -> foo: "bar"
|
||||
node.key = t.identifier(key.value);
|
||||
node.computed = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
({
|
||||
"default": null,
|
||||
"import": null
|
||||
});
|
||||
@ -1,4 +0,0 @@
|
||||
({
|
||||
"default": null,
|
||||
"import": null
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-property-literals"]
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
var obj = {
|
||||
foo: "foo",
|
||||
"bar": "bar"
|
||||
};
|
||||
@ -1,4 +0,0 @@
|
||||
var obj = {
|
||||
foo: "foo",
|
||||
bar: "bar"
|
||||
};
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,35 +0,0 @@
|
||||
# babel-plugin-transform-remove-console
|
||||
|
||||
Remove console.* calls
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-remove-console
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-remove-console"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-remove-console script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-remove-console"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-remove-console",
|
||||
"version": "6.8.0",
|
||||
"description": "Remove console.* calls",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-console",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
export default function () {
|
||||
return {
|
||||
visitor: {
|
||||
CallExpression(path) {
|
||||
if (path.get("callee").matchesPattern("console", true)) {
|
||||
path.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
function foo() {
|
||||
true && console.log("foo");
|
||||
blah();
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
function foo() {
|
||||
true;
|
||||
blah();
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
true && console.log("foo");
|
||||
blah();
|
||||
@ -1,2 +0,0 @@
|
||||
true;
|
||||
blah();
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-remove-console"]
|
||||
}
|
||||
@ -1,4 +0,0 @@
|
||||
function foo() {
|
||||
console.log("foo");
|
||||
blah();
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
function foo() {
|
||||
blah();
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
if (blah) console.log(blah);
|
||||
for (;;) console.log(blah);
|
||||
for (var blah in []) console.log(blah);
|
||||
for (var blah of []) console.log(blah);
|
||||
while (blah) console.log(blah);
|
||||
do console.log(blah); while (blah);
|
||||
@ -1,6 +0,0 @@
|
||||
if (blah) {}
|
||||
for (;;) {}
|
||||
for (var blah in []) {}
|
||||
for (var blah of []) {}
|
||||
while (blah) {}
|
||||
do {} while (blah);
|
||||
@ -1,2 +0,0 @@
|
||||
console.log("foo");
|
||||
blah();
|
||||
@ -1 +0,0 @@
|
||||
blah();
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,35 +0,0 @@
|
||||
# babel-plugin-transform-remove-debugger
|
||||
|
||||
Remove debugger statements
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-remove-debugger
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-remove-debugger"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-remove-debugger script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-remove-debugger"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-remove-debugger",
|
||||
"version": "6.8.0",
|
||||
"description": "Remove debugger statements",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-remove-debugger",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,9 +0,0 @@
|
||||
export default function () {
|
||||
return {
|
||||
visitor: {
|
||||
DebuggerStatement(path) {
|
||||
path.remove();
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-remove-debugger"]
|
||||
}
|
||||
@ -1,6 +0,0 @@
|
||||
if (blah) debugger;
|
||||
for (;;) debugger;
|
||||
for (var blah in []) debugger;
|
||||
for (var blah of []) debugger;
|
||||
while (blah) debugger;
|
||||
do debugger; while (blah);
|
||||
@ -1,6 +0,0 @@
|
||||
if (blah) {}
|
||||
for (;;) {}
|
||||
for (var blah in []) {}
|
||||
for (var blah of []) {}
|
||||
while (blah) {}
|
||||
do {} while (blah);
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,49 +0,0 @@
|
||||
# babel-plugin-transform-simplify-comparison-operators
|
||||
|
||||
Convert `===` and `!==` to `==` and `!=` if their types are inferred to be the same.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
typeof foo === "object";
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
typeof foo == "object";
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-simplify-comparison-operators
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-simplify-comparison-operators"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-simplify-comparison-operators script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-simplify-comparison-operators"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-simplify-comparison-operators",
|
||||
"version": "6.8.0",
|
||||
"description": "Convert === and !== to == and != if their types are inferred to be the same.",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-simplify-comparison-operators",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,18 +0,0 @@
|
||||
export default function () {
|
||||
return {
|
||||
visitor: {
|
||||
BinaryExpression(path) {
|
||||
let { node } = path;
|
||||
|
||||
let op = node.operator;
|
||||
if (op !== "===" && op !== "!==") return;
|
||||
|
||||
let left = path.get("left");
|
||||
let right = path.get("right");
|
||||
if (left.baseTypeStrictlyMatches(right)) {
|
||||
node.operator = node.operator.slice(0, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,7 +0,0 @@
|
||||
typeof 1 === "number";
|
||||
typeof 1 !== "string";
|
||||
|
||||
typeof 1 == "number";
|
||||
typeof 1 != "string";
|
||||
|
||||
a > b;
|
||||
@ -1,7 +0,0 @@
|
||||
typeof 1 == "number";
|
||||
typeof 1 != "string";
|
||||
|
||||
typeof 1 == "number";
|
||||
typeof 1 != "string";
|
||||
|
||||
a > b;
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-simplify-comparison-operators"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
@ -1,4 +0,0 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
test
|
||||
@ -1,53 +0,0 @@
|
||||
# babel-plugin-transform-undefined-to-void
|
||||
|
||||
Some JavaScript implementations allow `undefined` to be overwritten, this
|
||||
may lead to peculiar bugs that are extremely hard to track down.
|
||||
|
||||
This plugin transforms `undefined` into `void 0` which returns `undefined`
|
||||
regardless of if it's been reassigned.
|
||||
|
||||
## Example
|
||||
|
||||
**In**
|
||||
|
||||
```javascript
|
||||
foo === undefined;
|
||||
```
|
||||
|
||||
**Out**
|
||||
|
||||
```javascript
|
||||
foo === void 0;
|
||||
```
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-transform-undefined-to-void
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["transform-undefined-to-void"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins transform-undefined-to-void script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["transform-undefined-to-void"]
|
||||
});
|
||||
```
|
||||
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "babel-plugin-transform-undefined-to-void",
|
||||
"version": "6.8.0",
|
||||
"description": "Replace references to `undefined` with `void 0`",
|
||||
"repository": "https://github.com/babel/babel/tree/master/packages/babel-plugin-transform-undefined-to-void",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
],
|
||||
"dependencies": {
|
||||
"babel-runtime": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"babel-helper-plugin-test-runner": "^6.8.0"
|
||||
}
|
||||
}
|
||||
@ -1,11 +0,0 @@
|
||||
export default function ({ types: t }) {
|
||||
return {
|
||||
visitor: {
|
||||
ReferencedIdentifier(path) {
|
||||
if (path.node.name === "undefined") {
|
||||
path.replaceWith(t.unaryExpression("void", t.numericLiteral(0), true));
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,2 +0,0 @@
|
||||
var foo;
|
||||
foo === undefined;
|
||||
@ -1,2 +0,0 @@
|
||||
var foo;
|
||||
foo === void 0;
|
||||
@ -1,2 +0,0 @@
|
||||
var foo;
|
||||
foo === undefined.foo;
|
||||
@ -1,2 +0,0 @@
|
||||
var foo;
|
||||
foo === (void 0).foo;
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"plugins": ["transform-undefined-to-void"]
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
require("babel-helper-plugin-test-runner")(__dirname);
|
||||
Loading…
x
Reference in New Issue
Block a user