Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

babel-plugin-transform-remove-imports

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-remove-imports - npm Package Compare versions

Comparing version 1.3.2 to 1.4.0

8

index.d.ts

@@ -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();

20

package.json
{
"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 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc