move some babel-plugins into the main repo
This commit is contained in:
3
packages/babel-plugin-remove-console/.npmignore
Normal file
3
packages/babel-plugin-remove-console/.npmignore
Normal file
@@ -0,0 +1,3 @@
|
||||
node_modules
|
||||
*.log
|
||||
src
|
||||
35
packages/babel-plugin-remove-console/README.md
Normal file
35
packages/babel-plugin-remove-console/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# babel-plugin-remove-console
|
||||
|
||||
Remove console.* calls
|
||||
|
||||
## Installation
|
||||
|
||||
```sh
|
||||
$ npm install babel-plugin-remove-console
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Via `.babelrc` (Recommended)
|
||||
|
||||
**.babelrc**
|
||||
|
||||
```json
|
||||
{
|
||||
"plugins": ["remove-console"]
|
||||
}
|
||||
```
|
||||
|
||||
### Via CLI
|
||||
|
||||
```sh
|
||||
$ babel --plugins remove-console script.js
|
||||
```
|
||||
|
||||
### Via Node API
|
||||
|
||||
```javascript
|
||||
require("babel-core").transform("code", {
|
||||
plugins: ["remove-console"]
|
||||
});
|
||||
```
|
||||
11
packages/babel-plugin-remove-console/package.json
Normal file
11
packages/babel-plugin-remove-console/package.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "babel-plugin-remove-console",
|
||||
"version": "1.0.1",
|
||||
"description": "Remove console.* calls",
|
||||
"repository": "babel-plugins/babel-plugin-remove-console",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"keywords": [
|
||||
"babel-plugin"
|
||||
]
|
||||
}
|
||||
15
packages/babel-plugin-remove-console/src/index.js
Normal file
15
packages/babel-plugin-remove-console/src/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
export default function ({ Plugin, types: t }) {
|
||||
return new Plugin("remove-console", {
|
||||
metadata: {
|
||||
group: "builtin-pre"
|
||||
},
|
||||
|
||||
visitor: {
|
||||
CallExpression() {
|
||||
if (this.get("callee").matchesPattern("console", true)) {
|
||||
this.dangerouslyRemove();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user