Skip to content

Commit

Permalink
Allowing logging message to be type string
Browse files Browse the repository at this point in the history
Before this change, in plugins like this: 
https://github.com/rollup/rollup-plugin-babel/blob/master/src/index.js#L39
will just get `undefined` in the output.

I haven't have the time to to look very in depth at all the code, but I found a couple of places (both in rollup itself and in external plugins) where the caller is passing a string, so since fixing all the plugins is probably a non-starter, I figure making the API support strings was the easiest.

You might want to change the param name of the function or do a more strict check for strings.
  • Loading branch information
diervo committed Feb 26, 2017
1 parent 80da8ec commit 31a6e89
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion bin/src/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const errorSymbol = process.stderr.isTTY ? `🚨 ` : `Error: `;
export const stderr = console.error.bind( console ); // eslint-disable-line no-console

function log ( object, symbol ) {
const message = object.plugin ? `(${object.plugin} plugin) ${object.message}` : object.message;
const message = (object.plugin ? `(${object.plugin} plugin) ${object.message}` : object.message) || object;

stderr( `${symbol}${chalk.bold( message )}` );

Expand Down

0 comments on commit 31a6e89

Please sign in to comment.