metro-core
Advanced tools
Comparing version 0.24.4 to 0.24.5
{ | ||
"version": "0.24.4", | ||
"version": "0.24.5", | ||
"name": "metro-core", | ||
@@ -13,3 +13,6 @@ "description": "🚇 Core files for Metro", | ||
"cleanup-release": "test ! -e build && mv src build && mv src.real src" | ||
}, | ||
"dependencies": { | ||
"lodash": "^4.16.6" | ||
} | ||
} |
@@ -9,4 +9,6 @@ /** | ||
* | ||
* $FlowFixMe | ||
* Note: This file runs BEFORE transforms so DO NOT ADD ES6 or Flow in code! | ||
* @format | ||
* @PrettierFixMe | ||
* Note: Cannot safely use Prettier because of trailing call arg comma rule! | ||
*/ | ||
@@ -16,3 +18,2 @@ | ||
var _ = require('lodash'); | ||
var wordwrap = require('wordwrap'); | ||
@@ -56,21 +57,11 @@ | ||
options = options || {}; | ||
_.defaults(options, { | ||
chalkFunction: _.identity, | ||
width: 80, | ||
marginLeft: 0, | ||
marginRight: 0, | ||
paddingTop: 0, | ||
paddingBottom: 0, | ||
paddingLeft: 2, | ||
paddingRight: 2 }); | ||
var width = options.width === undefined ? 80 : options.width; | ||
var marginLeft = options.marginLeft === undefined ? 0 : options.marginLeft; | ||
var marginRight = options.marginRight === undefined ? 0 : options.marginRight; | ||
var paddingTop = options.paddingTop === undefined ? 0 : options.paddingTop; | ||
var paddingBottom = options.paddingBottom === undefined ? 0 : options.paddingBottom; | ||
var paddingLeft = options.paddingLeft === undefined ? 2 : options.paddingLeft; | ||
var paddingRight = options.paddingRight === undefined ? 2 : options.paddingRight; | ||
var width = options.width; | ||
var marginLeft = options.marginLeft; | ||
var marginRight = options.marginRight; | ||
var paddingTop = options.paddingTop; | ||
var paddingBottom = options.paddingBottom; | ||
var paddingLeft = options.paddingLeft; | ||
var paddingRight = options.paddingRight; | ||
var horizSpacing = marginLeft + paddingLeft + paddingRight + marginRight; | ||
@@ -84,9 +75,9 @@ // 2 for the banner borders | ||
var right = spaces(paddingRight) + VERTICAL_LINE + spaces(marginRight); | ||
var bodyLines = _.flattenDeep([ | ||
var bodyLines = [].concat( | ||
arrayOf('', paddingTop), | ||
body.split('\n'), | ||
arrayOf('', paddingBottom)]). | ||
arrayOf('', paddingBottom)). | ||
map(function (line) { | ||
var padding = spaces(Math.max(0, maxLineWidth - line.length)); | ||
return left + options.chalkFunction(line) + padding + right; | ||
return left + (options.chalkFunction ? options.chalkFunction(line) : line) + padding + right; | ||
}); | ||
@@ -110,3 +101,3 @@ | ||
spaces(marginRight); | ||
return _.flattenDeep([top, bodyLines, bottom]).join('\n'); | ||
return [].concat(top, bodyLines, bottom).join('\n'); | ||
} | ||
@@ -123,3 +114,3 @@ | ||
function arrayOf(value, number) { | ||
return _.range(number).map(function () { | ||
return Array.apply(null, Array(number)).map(function () { | ||
return value; | ||
@@ -126,0 +117,0 @@ }); |
@@ -171,2 +171,9 @@ /** | ||
this._nextStatusStr = ''; | ||
} | ||
flush() { | ||
// Useful if you're going to start calling console.log/console.error directly | ||
// again; otherwise you could end up with mangled output when the queued | ||
// update starts writing to stream after a delay. | ||
this._scheduleUpdate.flush(); | ||
}} | ||
@@ -173,0 +180,0 @@ |
Sorry, the diff of this file is not supported yet
25325
1
376
+ Addedlodash@^4.16.6
+ Addedlodash@4.17.21(transitive)