Socket
Socket
Sign inDemoInstall

@rollup/plugin-node-resolve

Package Overview
Dependencies
Maintainers
4
Versions
45
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rollup/plugin-node-resolve - npm Package Compare versions

Comparing version 6.1.0 to 7.0.0

8

CHANGELOG.md
# @rollup/plugin-node-resolve ChangeLog
## v7.0.0
_2020-01-07_
### Breaking Changes
- feat: dedupe by package name (#99)
## v6.1.0

@@ -4,0 +12,0 @@

20

dist/index.es.js

@@ -160,2 +160,20 @@ import { dirname, resolve, normalize, sep, extname } from 'path';

return p;
} // returns the imported package name for bare module imports
function getPackageName(id) {
if (id.startsWith('.') || id.startsWith('/')) {
return null;
}
const split = id.split('/'); // @my-scope/my-package/foo.js -> @my-scope/my-package
// @my-scope/my-package -> @my-scope/my-package
if (split[0][0] === '@') {
return `${split[0]}/${split[1]}`;
} // my-package/foo.js -> my-package
// my-package -> my-package
return split[0];
}

@@ -183,3 +201,3 @@

const idToPackageInfo = new Map();
const shouldDedupe = typeof dedupe === 'function' ? dedupe : importee => dedupe.includes(importee);
const shouldDedupe = typeof dedupe === 'function' ? dedupe : importee => dedupe.includes(importee) || dedupe.includes(getPackageName(importee));

@@ -186,0 +204,0 @@ function getCachedPackageInfo(pkg, pkgPath) {

@@ -165,2 +165,20 @@ 'use strict';

return p;
} // returns the imported package name for bare module imports
function getPackageName(id) {
if (id.startsWith('.') || id.startsWith('/')) {
return null;
}
const split = id.split('/'); // @my-scope/my-package/foo.js -> @my-scope/my-package
// @my-scope/my-package -> @my-scope/my-package
if (split[0][0] === '@') {
return `${split[0]}/${split[1]}`;
} // my-package/foo.js -> my-package
// my-package -> my-package
return split[0];
}

@@ -188,3 +206,3 @@

const idToPackageInfo = new Map();
const shouldDedupe = typeof dedupe === 'function' ? dedupe : importee => dedupe.includes(importee);
const shouldDedupe = typeof dedupe === 'function' ? dedupe : importee => dedupe.includes(importee) || dedupe.includes(getPackageName(importee));

@@ -191,0 +209,0 @@ function getCachedPackageInfo(pkg, pkgPath) {

2

package.json
{
"name": "@rollup/plugin-node-resolve",
"version": "6.1.0",
"version": "7.0.0",
"publishConfig": {

@@ -5,0 +5,0 @@ "access": "public"

@@ -123,5 +123,19 @@ [npm]: https://img.shields.io/npm/v/@rollup/plugin-node-resolve

```
dedupe: [ 'react', 'react-dom' ]
dedupe: [ 'my-package', '@namespace/my-package' ]
```
This will deduplicate bare imports such as:
```js
import 'my-package';
import '@namespace/my-package';
```
And it will deduplicate deep imports such as:
```js
import 'my-package/foo.js';
import '@namespace/my-package/bar.js';
```
### `customResolveOptions`

@@ -128,0 +142,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