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

babel-plugin-transform-inline-imports-commonjs

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-transform-inline-imports-commonjs - npm Package Compare versions

Comparing version 1.1.0 to 1.2.0

4

CHANGELOG.md
# Changelog
## v1.2.0 (2016-10-19)
* Added `excludeModules` option.
## v1.1.0 (2016-10-17)
* Added `excludeNodeBuiltins` option.

2

package.json
{
"name": "babel-plugin-transform-inline-imports-commonjs",
"version": "1.1.0",
"version": "1.2.0",
"description": "A Babel transform that turns imports into lazily loaded commonjs requires",

@@ -5,0 +5,0 @@ "keywords": [

@@ -77,4 +77,12 @@ # babel-plugin-transform-inline-imports-commonjs

* `excludeModules`:
- An array of strings that correspond to module IDs that should not be "inline-import"'ed. For the config `"excludeModules": ["atom"]`:
```js
import {TextEditor} from 'atom'; // transforms to plain `require` with interop
import foo from 'bar'; // transforms to inline import
```
* `excludeNodeBuiltins` (default: `false`)
- Do not apply "inline-imports" to[Node builtin modules](https://github.com/sindresorhus/builtin-modules/blob/v1.1.1/builtin-modules.json). These modules are usually already in the module cache, so there may be no need to lazily load them.
- Do not apply "inline-imports" to [Node builtin modules](https://github.com/sindresorhus/builtin-modules/blob/v1.1.1/builtin-modules.json). These modules are usually already in the module cache, so there may be no need to lazily load them.

@@ -81,0 +89,0 @@ ```js

@@ -185,2 +185,9 @@ 'use strict';

const excludeNodeBuiltins = this.opts.excludeNodeBuiltins
? builtinModules
: null;
const excludeModules = Array.isArray(this.opts.excludeModules)
? new Set(this.opts.excludeModules)
: null;
const addRequire = (source, blockHoist, interop) => {

@@ -200,3 +207,6 @@ const cacheKey = JSON.stringify({source, interop});

if (this.opts.excludeNodeBuiltins && builtinModules.has(source)) {
if (
(excludeNodeBuiltins && excludeNodeBuiltins.has(source)) ||
(excludeModules && excludeModules.has(source))
) {
// var memoizedID;

@@ -203,0 +213,0 @@ const declID = path.scope.generateUidIdentifier(source);

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