rollup-plugin-npm
Advanced tools
Comparing version 1.2.1 to 1.3.0
# rollup-plugin-npm changelog | ||
## 1.3.0 | ||
* `skip: true` skips all packages that don't satisfy the `main` or `jsnext` options ([#16](https://github.com/rollup/rollup-plugin-npm/pull/16)) | ||
## 1.2.1 | ||
@@ -4,0 +8,0 @@ |
@@ -32,3 +32,3 @@ 'use strict'; | ||
if (~skip.indexOf(id)) return null; | ||
if (skip !== true && ~skip.indexOf(id)) return null; | ||
@@ -42,3 +42,2 @@ // disregard entry module | ||
packageFilter: function packageFilter(pkg) { | ||
var id = pkg['name']; | ||
if (options.jsnext) { | ||
@@ -49,6 +48,6 @@ var main = pkg['jsnext:main']; | ||
} else if (!useMain) { | ||
reject(Error('Package ' + id + ' (imported by ' + importer + ') does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = [\'' + id + '\'])')); | ||
if (skip === true) accept(false);else reject(Error('Package ' + importee + ' (imported by ' + importer + ') does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = [\'' + importee + '\'])')); | ||
} | ||
} else if (!useMain) { | ||
reject(Error('To import from a package in node_modules (' + id + '), either options.jsnext or options.main must be true')); | ||
if (skip === true) accept(false);else reject(Error('To import from a package in node_modules (' + importee + '), either options.jsnext or options.main must be true')); | ||
} | ||
@@ -59,3 +58,3 @@ return pkg; | ||
if (err) { | ||
reject(err); | ||
if (skip === true) accept(false);else reject(err); | ||
} else { | ||
@@ -62,0 +61,0 @@ if (resolved === COMMONJS_BROWSER_EMPTY) resolved = ES6_BROWSER_EMPTY; |
@@ -27,3 +27,3 @@ import { resolve, dirname } from 'path'; | ||
if (~skip.indexOf(id)) return null; | ||
if (skip !== true && ~skip.indexOf(id)) return null; | ||
@@ -37,3 +37,2 @@ // disregard entry module | ||
packageFilter: function packageFilter(pkg) { | ||
var id = pkg['name']; | ||
if (options.jsnext) { | ||
@@ -44,6 +43,6 @@ var main = pkg['jsnext:main']; | ||
} else if (!useMain) { | ||
reject(Error('Package ' + id + ' (imported by ' + importer + ') does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = [\'' + id + '\'])')); | ||
if (skip === true) accept(false);else reject(Error('Package ' + importee + ' (imported by ' + importer + ') does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = [\'' + importee + '\'])')); | ||
} | ||
} else if (!useMain) { | ||
reject(Error('To import from a package in node_modules (' + id + '), either options.jsnext or options.main must be true')); | ||
if (skip === true) accept(false);else reject(Error('To import from a package in node_modules (' + importee + '), either options.jsnext or options.main must be true')); | ||
} | ||
@@ -54,3 +53,3 @@ return pkg; | ||
if (err) { | ||
reject(err); | ||
if (skip === true) accept(false);else reject(err); | ||
} else { | ||
@@ -57,0 +56,0 @@ if (resolved === COMMONJS_BROWSER_EMPTY) resolved = ES6_BROWSER_EMPTY; |
{ | ||
"name": "rollup-plugin-npm", | ||
"description": "Bundle third-party dependencies in node_modules", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"devDependencies": { | ||
@@ -6,0 +6,0 @@ "babel-preset-es2015": "^6.3.13", |
@@ -27,3 +27,3 @@ import { dirname, resolve } from 'path'; | ||
if ( ~skip.indexOf(id) ) return null; | ||
if ( skip !== true && ~skip.indexOf( id ) ) return null; | ||
@@ -39,3 +39,2 @@ // disregard entry module | ||
packageFilter ( pkg ) { | ||
const id = pkg[ 'name' ]; | ||
if ( options.jsnext ) { | ||
@@ -46,6 +45,8 @@ const main = pkg[ 'jsnext:main' ]; | ||
} else if ( !useMain ) { | ||
reject( Error( `Package ${id} (imported by ${importer}) does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = ['${id}'])` ) ); | ||
if ( skip === true ) accept( false ); | ||
else reject( Error( `Package ${importee} (imported by ${importer}) does not have a jsnext:main field. You should either allow legacy modules with options.main, or skip it with options.skip = ['${importee}'])` ) ); | ||
} | ||
} else if ( !useMain ) { | ||
reject( Error( `To import from a package in node_modules (${id}), either options.jsnext or options.main must be true` ) ); | ||
if ( skip === true ) accept( false ); | ||
else reject( Error( `To import from a package in node_modules (${importee}), either options.jsnext or options.main must be true` ) ); | ||
} | ||
@@ -57,3 +58,4 @@ return pkg; | ||
if ( err ) { | ||
reject( err ); | ||
if ( skip === true ) accept( false ); | ||
else reject( err ); | ||
} else { | ||
@@ -60,0 +62,0 @@ if ( resolved === COMMONJS_BROWSER_EMPTY ) resolved = ES6_BROWSER_EMPTY; |
10139