Socket
Socket
Sign inDemoInstall

babel-plugin-nukable-import

Package Overview
Dependencies
3
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    babel-plugin-nukable-import

Babel plugin for nuking bindings from imports


Version published
Weekly downloads
0
decreased by-100%
Maintainers
2
Install size
372 kB
Created
Weekly downloads
 

Readme

Source

Build Status

Allows you to remove bindings from a specific import declaration source. The source is also used to remove any exports as well.

Example

import {
  expectStackChange,
  assert,
  check,
  CheckInterface,
  CheckFunction
} from '@glimmer/debug';

APPEND_OPCODES.app(123, (vm) => {
  let { stack } = vm;
  let mgr = check(stack.pop(), CheckInterface({ didRenderLayout: CheckFunction }));
  mgr.didRenderLayout();
  assert(stack.pop(), 'Must have a value');
  expectStackChange(stack, -2, 'PrimitiveReference');
});

Will be compiled as:

APPEND_OPCODES.app(123, (vm) => {
  let { stack } = vm;
  let mgr = stack.pop();
  mgr.didRenderLayout();
  stack.pop();
});

Basic Usage

{
  moduleIds: true,
  getModuleId() { ... },
  plugins: [
    ['nukable-import', { source: '@glimmer/debug' }]
  ]
}

Advanced Usage

If you need fine grain control over the bindings, you can implement a delegate that will be shown all the bindings that are CallExpressions and Identifiers. Note, this should be used for one-offs like removing a specific binding from from a specific source.

{
  moduleIds: true,
  getModuleId() { ... },
  plugins: [
    ['nukable-import', {
      source: '@glimmer/vm',
      delegate(bindingName, path, types) {
        if (bindingName === 'META_DATA') {
          path.remove();
        }
      }
    }]
  ]
}

Keywords

FAQs

Last updated on 14 Feb 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