Permalink
Browse files

apply kzc patch to prevent escape codes and emojis appearing in non-T…

…TY stderr (#1201)
  • Loading branch information...
1 parent a00d391 commit 23813bc4e73092ec40414d1fdfd09390bbb6c569 @Rich-Harris Rich-Harris committed Dec 30, 2016
Showing with 7 additions and 7 deletions.
  1. +1 −1 bin/src/handleError.js
  2. +5 −2 bin/src/runRollup.js
  3. +1 −4 rollup.config.cli.js
@@ -1,4 +1,4 @@
-import * as chalk from 'chalk';
+import chalk from 'chalk';
function stderr ( msg ) {
console.error( msg ); // eslint-disable-line no-console
@@ -1,14 +1,17 @@
import { realpathSync } from 'fs';
import * as rollup from 'rollup';
import relative from 'require-relative';
-import * as chalk from 'chalk';
+import chalk from 'chalk';
import handleError from './handleError';
import relativeId from '../../src/utils/relativeId.js';
import SOURCEMAPPING_URL from './sourceMappingUrl.js';
import { install as installSourcemapSupport } from 'source-map-support';
installSourcemapSupport();
+if ( !process.stderr.isTTY ) chalk.enabled = false;
+const warnSymbol = process.stderr.isTTY ? `⚠️ ` : `Warning: `;
+
// stderr to stderr to keep `rollup main.js > bundle.js` from breaking
const stderr = console.error.bind( console ); // eslint-disable-line no-console
@@ -154,7 +157,7 @@ function execute ( options, command ) {
if ( seen.has( str ) ) return;
seen.add( str );
- stderr( `⚠️ ${chalk.bold( warning.message )}` );
+ stderr( `${warnSymbol}${chalk.bold( warning.message )}` );
if ( warning.url ) {
stderr( chalk.cyan( warning.url ) );
@@ -14,10 +14,7 @@ export default {
json(),
buble(),
commonjs({
- include: 'node_modules/**',
- namedExports: {
- chalk: [ 'yellow', 'red', 'cyan', 'grey', 'dim', 'bold' ]
- }
+ include: 'node_modules/**'
}),
nodeResolve({
main: true

0 comments on commit 23813bc

Please sign in to comment.