babel-plugin-transform-remove-imports
Advanced tools
Comparing version 1.3.2 to 1.4.0
@@ -1,1 +0,7 @@ | ||
export default function _default(): any; | ||
interface Options { | ||
remove?: 'effects'; | ||
removeAll?: boolean; | ||
test?: string | RegExp; | ||
} | ||
export default function _default(code: string, options: Options): any; |
@@ -16,4 +16,11 @@ "use strict"; | ||
var source = node.source; | ||
var opts = state.opts; | ||
var _state$opts = state.opts, | ||
opts = _state$opts === void 0 ? {} : _state$opts; // https://github.com/uiwjs/babel-plugin-transform-remove-imports/issues/3 | ||
if (opts.remove === 'effects') { | ||
if (node.specifiers && node.specifiers.length === 0) { | ||
path.remove(); | ||
} | ||
} | ||
if (opts.removeAll) { | ||
@@ -20,0 +27,0 @@ path.remove(); |
{ | ||
"name": "babel-plugin-transform-remove-imports", | ||
"version": "1.3.2", | ||
"version": "1.4.0", | ||
"description": "Remove the specified import declaration when you use the babel transform to build the package.", | ||
@@ -33,11 +33,11 @@ "repository": "https://github.com/uiwjs/babel-plugin-transform-remove-imports", | ||
"devDependencies": { | ||
"@babel/cli": "^7.7.5", | ||
"@babel/core": "^7.7.5", | ||
"@babel/plugin-proposal-class-properties": "^7.7.4", | ||
"@babel/plugin-proposal-do-expressions": "^7.7.4", | ||
"@babel/plugin-proposal-export-default-from": "^7.7.4", | ||
"@babel/preset-env": "^7.7.5", | ||
"@babel/preset-react": "^7.7.4", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"jest": "^24.9.0" | ||
"@babel/cli": "7.10.1", | ||
"@babel/core": "7.10.2", | ||
"@babel/plugin-proposal-class-properties": "7.10.1", | ||
"@babel/plugin-proposal-do-expressions": "7.10.1", | ||
"@babel/plugin-proposal-export-default-from": "7.10.1", | ||
"@babel/preset-env": "7.10.2", | ||
"@babel/preset-react": "7.10.1", | ||
"babel-core": "7.0.0-bridge.0", | ||
"jest": "26.0.1" | ||
}, | ||
@@ -44,0 +44,0 @@ "files": [ |
@@ -55,10 +55,23 @@ babel-plugin-transform-remove-imports | ||
A regular expression to match the imports that will be removed. | ||
It could be a string or a RegExp object. | ||
You could also pass an array here. | ||
A regular expression to match the imports that will be removed. | ||
It could be a string or a RegExp object. | ||
You could also pass an array here. | ||
- `removeAll: boolean` | ||
Deletes all imports. | ||
Deletes all imports. | ||
- `remove?: 'effects'` | ||
Removing only side effects imports | ||
```js | ||
// Input Code | ||
import 'foo'; | ||
import Foo from 'foo'; | ||
// Output Code ↓ ↓ ↓ ↓ ↓ ↓ | ||
import Foo from 'foo'; | ||
``` | ||
## Programmatic Usage | ||
@@ -65,0 +78,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5419
57
98