Socket
Socket
Sign inDemoInstall

babel-plugin-remove-dts-export

Package Overview
Dependencies
4
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-remove-dts-export

Babel plugin for removing exports from d.ts files


Version published
Weekly downloads
5
increased by150%
Maintainers
1
Install size
2.39 MB
Created
Weekly downloads
 

Readme

Source

babel-plugin-remove-dts-export

Latest Stable Version License Build Status Test Coverage

For now official Babel typescript plugin has a Babel#6065 issue that forbids re-exporting types from d.ts files. It can cause a lot of problems connected with using types from d.ts files freely. This plugin is designed to be a kind of patch for this issue.

With default settings it checks every import in file processing right now and checks if the source is d.ts file. If it's true, it remembers all specifiers you imported from d.ts file and removes them from all exports defined in current file. Import declaration is removed as well.

Also you can set up a configuration. You can disable default checks for source to be a d.ts file (to avoid penalty of synchronous file system reading) and set specific sources or even custom specifiers for source you want to be erased.

Installation

$ npm install --save-dev babel-plugin-remove-dts-export

Configuration

Default behavior (checking every imports to be a d.ts file)(original, compiled):

{
  "plugins": [
    "babel-plugin-remove-dts-export"
  ]
}

Remove import declaration and all imported specifiers from all exports declared in a file (original, compiled):

{
  "plugins": [
    ["babel-plugin-remove-dts-export", {
      "sources": [
        "path/to/declaration/from/cwd.d.ts",
        "path/to/declaration/from/cwd2.d.ts"
      ]
    }]
  ]
}

Remove only specific specifiers from all exports declared in a file (original, compiled):

{
  "plugins": [
    ["babel-plugin-remove-dts-export", {
      "specifiersBySource": {
        "path/to/declaration/from/cwd.ts": ["A", "B"]
      }
    }]
  ]
}

Disable checking all imports to be d.ts files (following configuration will disable plugin completely!):

{
  "plugins": [
    ["babel-plugin-remove-dts-export", {
      "disableDefaultBehavior": true
    }]
  ]
}

Keywords

FAQs

Last updated on 09 Jan 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc