Socket
Socket
Sign inDemoInstall

rollup-plugin-node-resolve

Package Overview
Dependencies
Maintainers
1
Versions
34
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 1.4.0 to 1.5.0

4

CHANGELOG.md
# rollup-plugin-node-resolve changelog
## 1.5.0
* Prefer built-in options, but allow opting out ([#28](https://github.com/rollup/rollup-plugin-node-resolve/pull/28))
## 1.4.0

@@ -4,0 +8,0 @@

@@ -13,3 +13,8 @@ 'use strict';

var ES6_BROWSER_EMPTY = path.resolve(__dirname, '../src/empty.js');
var CONSOLE_WARN = function CONSOLE_WARN() {
var _console;
return (_console = console).warn.apply(_console, arguments);
};
function nodeResolve(options) {

@@ -20,3 +25,6 @@ options = options || {};

var useMain = options.main !== false;
var isPreferBuiltinsSet = options.preferBuiltins === true || options.preferBuiltins === false;
var preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true;
var onwarn = options.onwarn || CONSOLE_WARN;
var _resolveId = options.browser ? browserResolve : _nodeResolve;

@@ -61,6 +69,14 @@

} else {
if (resolved === COMMONJS_BROWSER_EMPTY) resolved = ES6_BROWSER_EMPTY;
if (~builtins.indexOf(resolved)) resolved = null;
accept(resolved);
if (resolved === COMMONJS_BROWSER_EMPTY) {
accept(ES6_BROWSER_EMPTY);
} else if (~builtins.indexOf(resolved)) {
accept(null);
} else if (~builtins.indexOf(importee) && preferBuiltins) {
if (!isPreferBuiltinsSet) {
onwarn('preferring built-in module \'' + importee + '\' over local alternative ' + ('at \'' + resolved + '\', pass \'preferBuiltins: false\' to disable this ') + 'behavior or \'preferBuiltins: true\' to disable this warning');
}
accept(null);
} else {
accept(resolved);
}
}

@@ -67,0 +83,0 @@ });

@@ -8,3 +8,8 @@ import { resolve, dirname } from 'path';

var ES6_BROWSER_EMPTY = resolve(__dirname, '../src/empty.js');
var CONSOLE_WARN = function CONSOLE_WARN() {
var _console;
return (_console = console).warn.apply(_console, arguments);
};
function nodeResolve(options) {

@@ -15,3 +20,6 @@ options = options || {};

var useMain = options.main !== false;
var isPreferBuiltinsSet = options.preferBuiltins === true || options.preferBuiltins === false;
var preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true;
var onwarn = options.onwarn || CONSOLE_WARN;
var _resolveId = options.browser ? browserResolve : _nodeResolve;

@@ -56,6 +64,14 @@

} else {
if (resolved === COMMONJS_BROWSER_EMPTY) resolved = ES6_BROWSER_EMPTY;
if (~builtins.indexOf(resolved)) resolved = null;
accept(resolved);
if (resolved === COMMONJS_BROWSER_EMPTY) {
accept(ES6_BROWSER_EMPTY);
} else if (~builtins.indexOf(resolved)) {
accept(null);
} else if (~builtins.indexOf(importee) && preferBuiltins) {
if (!isPreferBuiltinsSet) {
onwarn('preferring built-in module \'' + importee + '\' over local alternative ' + ('at \'' + resolved + '\', pass \'preferBuiltins: false\' to disable this ') + 'behavior or \'preferBuiltins: true\' to disable this warning');
}
accept(null);
} else {
accept(resolved);
}
}

@@ -62,0 +78,0 @@ });

2

package.json
{
"name": "rollup-plugin-node-resolve",
"description": "Bundle third-party dependencies in node_modules",
"version": "1.4.0",
"version": "1.5.0",
"devDependencies": {

@@ -6,0 +6,0 @@ "babel-preset-es2015": "^6.3.13",

# rollup-plugin-node-resolve
*This plugin used to be called rollup-plugin-npm*
Locate modules using the [Node resolution algorithm](https://nodejs.org/api/modules.html#modules_all_together), for using third party modules in `node_modules`

@@ -34,8 +36,2 @@

// by default, built-in modules such as `fs` and `path` are
// treated as external if a local module with the same name
// can't be found. If you really want to turn off this
// behaviour for some reason, use `builtins: false`
builtins: false,
// some package.json files have a `browser` field which

@@ -42,0 +38,0 @@ // specifies alternative files to load for people bundling

@@ -8,2 +8,3 @@ import { dirname, resolve } from 'path';

const ES6_BROWSER_EMPTY = resolve( __dirname, '../src/empty.js' );
const CONSOLE_WARN = ( ...args ) => console.warn( ...args );

@@ -15,3 +16,6 @@ export default function nodeResolve ( options ) {

const useMain = options.main !== false;
const isPreferBuiltinsSet = options.preferBuiltins === true || options.preferBuiltins === false;
const preferBuiltins = isPreferBuiltinsSet ? options.preferBuiltins : true;
const onwarn = options.onwarn || CONSOLE_WARN;
const resolveId = options.browser ? browserResolve : _nodeResolve;

@@ -61,6 +65,18 @@

} else {
if ( resolved === COMMONJS_BROWSER_EMPTY ) resolved = ES6_BROWSER_EMPTY;
if ( ~builtins.indexOf( resolved ) ) resolved = null;
accept( resolved );
if ( resolved === COMMONJS_BROWSER_EMPTY ) {
accept( ES6_BROWSER_EMPTY );
} else if ( ~builtins.indexOf( resolved ) ) {
accept( null );
} else if ( ~builtins.indexOf( importee ) && preferBuiltins ) {
if ( !isPreferBuiltinsSet ) {
onwarn(
`preferring built-in module '${importee}' over local alternative ` +
`at '${resolved}', pass 'preferBuiltins: false' to disable this ` +
`behavior or 'preferBuiltins: true' to disable this warning`
);
}
accept( null );
} else {
accept( resolved );
}
}

@@ -67,0 +83,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