Socket
Socket
Sign inDemoInstall

rollup-plugin-auto-external

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rollup-plugin-auto-external - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0-alpha.0

36

index.js
const getBuiltins = require('builtins');
const path = require('path');
const readPkg = require('read-pkg');

@@ -29,19 +30,30 @@ const safeResolve = require('safe-resolve');

let external = ids;
ids = ids.map(safeResolve).filter(Boolean);
if (typeof opts.external === 'function') {
external = id =>
opts.external(id) ||
ids
.map(safeResolve)
.filter(Boolean)
.includes(id);
}
const external = id => {
if (typeof opts.external === 'function' && opts.external(id)) {
return true;
}
if (Array.isArray(opts.external)) {
external = Array.from(new Set(opts.external.concat(ids)));
}
if (Array.isArray(opts.external) && opts.external.includes(id)) {
return true;
}
/**
* The `id` argument is a resolved path if `rollup-plugin-node-resolve`
* and `rollup-plugin-commonjs` are included.
*/
const resolvedPath = safeResolve(id);
if (resolvedPath === null) {
return false;
}
const resolvedDirname = path.dirname(resolvedPath);
return ids.some(idx => resolvedDirname.startsWith(path.dirname(idx)));
};
return Object.assign({}, opts, { external });
},
});
{
"name": "rollup-plugin-auto-external",
"version": "2.0.0",
"version": "3.0.0-alpha.0",
"description": "Rollup plugin to automatically exclude package.json dependencies and peerDependencies from your bundle",

@@ -8,3 +8,3 @@ "main": "index.js",

"prepublishOnly": "npm test",
"test": "$(npm bin)/jest"
"test": "$(npm bin)/jest --modulePaths=__fixtures__/node_modules"
},

@@ -30,3 +30,7 @@ "keywords": [

"devDependencies": {
"jest": "^20.0.4"
"jest": "^24.1.0",
"rollup": "^1.3.2",
"rollup-plugin-node-resolve": "^4.0.1",
"rollup-plugin-commonjs": "^9.2.1",
"rollup-plugin-node-builtins": "^2.1.2"
},

@@ -40,3 +44,3 @@ "peerDependencies": {

"safe-resolve": "^1.0.0",
"semver": "^5.5.0"
"semver": "^5.6.0"
},

@@ -43,0 +47,0 @@ "files": [

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