metro-core
Advanced tools
Comparing version 0.40.0 to 0.40.1
{ | ||
"version": "0.40.0", | ||
"version": "0.40.1", | ||
"name": "metro-core", | ||
@@ -17,5 +17,5 @@ "description": "🚇 Core files for Metro", | ||
"lodash.throttle": "^4.1.1", | ||
"metro-resolver": "0.40.0", | ||
"metro-resolver": "0.40.1", | ||
"wordwrap": "^1.0.0" | ||
} | ||
} |
@@ -25,28 +25,28 @@ /** | ||
/** | ||
* Prints a banner with a border around it containing the given message. The | ||
* following options are supported: | ||
* | ||
* type Options = { | ||
* // A function to apply to each line of text to decorate it | ||
* chalkFunction: (string: message) => string; | ||
* // The total width (max line length) of the banner, including margin and | ||
* // padding (default = 80) | ||
* width: number; | ||
* // How much leading space to prepend to each line (default = 0) | ||
* marginLeft: number; | ||
* // How much trailing space to append to each line (default = 0) | ||
* marginRight: number; | ||
* // Space between the top banner border and the text (default = 0) | ||
* paddingTop: number; | ||
* // Space between the bottom banner border and the text (default = 0) | ||
* paddingBottom: number; | ||
* // Space between the left banner border and the text (default = 2) | ||
* paddingLeft: number; | ||
* // Space between the right banner border and the text (default = 2) | ||
* paddingRight: number; | ||
* }; | ||
* | ||
* @PrettierFixMe can't use comment-style flow syntax because prettier strips it | ||
* https://github.com/prettier/prettier/issues/204 | ||
*/ | ||
* Prints a banner with a border around it containing the given message. The | ||
* following options are supported: | ||
* | ||
* type Options = { | ||
* // A function to apply to each line of text to decorate it | ||
* chalkFunction: (string: message) => string; | ||
* // The total width (max line length) of the banner, including margin and | ||
* // padding (default = 80) | ||
* width: number; | ||
* // How much leading space to prepend to each line (default = 0) | ||
* marginLeft: number; | ||
* // How much trailing space to append to each line (default = 0) | ||
* marginRight: number; | ||
* // Space between the top banner border and the text (default = 0) | ||
* paddingTop: number; | ||
* // Space between the bottom banner border and the text (default = 0) | ||
* paddingBottom: number; | ||
* // Space between the left banner border and the text (default = 2) | ||
* paddingLeft: number; | ||
* // Space between the right banner border and the text (default = 2) | ||
* paddingRight: number; | ||
* }; | ||
* | ||
* @PrettierFixMe can't use comment-style flow syntax because prettier strips it | ||
* https://github.com/prettier/prettier/issues/204 | ||
*/ | ||
function formatBanner(message, options) { | ||
@@ -53,0 +53,0 @@ options = options || {}; |
@@ -21,6 +21,6 @@ /** | ||
/** | ||
* Clear some text that was previously printed on an interactive stream, | ||
* without trailing newline character (so we have to move back to the | ||
* beginning of the line). | ||
*/ | ||
* Clear some text that was previously printed on an interactive stream, | ||
* without trailing newline character (so we have to move back to the | ||
* beginning of the line). | ||
*/ | ||
function clearStringBackwards(stream, str) { | ||
@@ -38,10 +38,10 @@ readline.moveCursor(stream, -stream.columns, 0); | ||
/** | ||
* Cut a string into an array of string of the specific maximum size. A newline | ||
* ends a chunk immediately (it's not included in the "." RexExp operator), and | ||
* is not included in the result. | ||
* When counting we should ignore non-printable characters. In particular the | ||
* ANSI escape sequences (regex: /\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?m/) | ||
* (Not an exhaustive match, intended to match ANSI color escapes) | ||
* https://en.wikipedia.org/wiki/ANSI_escape_code | ||
*/ | ||
* Cut a string into an array of string of the specific maximum size. A newline | ||
* ends a chunk immediately (it's not included in the "." RexExp operator), and | ||
* is not included in the result. | ||
* When counting we should ignore non-printable characters. In particular the | ||
* ANSI escape sequences (regex: /\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?m/) | ||
* (Not an exhaustive match, intended to match ANSI color escapes) | ||
* https://en.wikipedia.org/wiki/ANSI_escape_code | ||
*/ | ||
function chunkString(str, size) { | ||
@@ -54,4 +54,4 @@ const ANSI_COLOR = '\x1B\\[([0-9]{1,2}(;[0-9]{1,2})?)?m'; | ||
/** | ||
* Get the stream as a TTY if it effectively looks like a valid TTY. | ||
*/ | ||
* Get the stream as a TTY if it effectively looks like a valid TTY. | ||
*/ | ||
function getTTYStream(stream) { | ||
@@ -69,29 +69,29 @@ if ( | ||
/** | ||
* We don't just print things to the console, sometimes we also want to show | ||
* and update progress. This utility just ensures the output stays neat: no | ||
* missing newlines, no mangled log lines. | ||
* | ||
* const terminal = Terminal.default; | ||
* terminal.status('Updating... 38%'); | ||
* terminal.log('warning: Something happened.'); | ||
* terminal.status('Updating, done.'); | ||
* terminal.persistStatus(); | ||
* | ||
* The final output: | ||
* | ||
* warning: Something happened. | ||
* Updating, done. | ||
* | ||
* Without the status feature, we may get a mangled output: | ||
* | ||
* Updating... 38%warning: Something happened. | ||
* Updating, done. | ||
* | ||
* This is meant to be user-readable and TTY-oriented. We use stdout by default | ||
* because it's more about status information than diagnostics/errors (stderr). | ||
* | ||
* Do not add any higher-level functionality in this class such as "warning" and | ||
* "error" printers, as it is not meant for formatting/reporting. It has the | ||
* single responsibility of handling status messages. | ||
*/ | ||
* We don't just print things to the console, sometimes we also want to show | ||
* and update progress. This utility just ensures the output stays neat: no | ||
* missing newlines, no mangled log lines. | ||
* | ||
* const terminal = Terminal.default; | ||
* terminal.status('Updating... 38%'); | ||
* terminal.log('warning: Something happened.'); | ||
* terminal.status('Updating, done.'); | ||
* terminal.persistStatus(); | ||
* | ||
* The final output: | ||
* | ||
* warning: Something happened. | ||
* Updating, done. | ||
* | ||
* Without the status feature, we may get a mangled output: | ||
* | ||
* Updating... 38%warning: Something happened. | ||
* Updating, done. | ||
* | ||
* This is meant to be user-readable and TTY-oriented. We use stdout by default | ||
* because it's more about status information than diagnostics/errors (stderr). | ||
* | ||
* Do not add any higher-level functionality in this class such as "warning" and | ||
* "error" printers, as it is not meant for formatting/reporting. It has the | ||
* single responsibility of handling status messages. | ||
*/ | ||
class Terminal { | ||
@@ -113,7 +113,7 @@ | ||
/** | ||
* Clear and write the new status, logging in bulk in-between. Doing this in a | ||
* throttled way (in a different tick than the calls to `log()` and | ||
* `status()`) prevents us from repeatedly rewriting the status in case | ||
* `terminal.log()` is called several times. | ||
*/ | ||
* Clear and write the new status, logging in bulk in-between. Doing this in a | ||
* throttled way (in a different tick than the calls to `log()` and | ||
* `status()`) prevents us from repeatedly rewriting the status in case | ||
* `terminal.log()` is called several times. | ||
*/ | ||
_update() {const | ||
@@ -144,8 +144,8 @@ _statusStr = this._statusStr,_stream = this._stream; | ||
/** | ||
* Shows some text that is meant to be overriden later. Return the previous | ||
* status that was shown and is no more. Calling `status()` with no argument | ||
* removes the status altogether. The status is never shown in a | ||
* non-interactive terminal: for example, if the output is redirected to a | ||
* file, then we don't care too much about having a progress bar. | ||
*/ | ||
* Shows some text that is meant to be overriden later. Return the previous | ||
* status that was shown and is no more. Calling `status()` with no argument | ||
* removes the status altogether. The status is never shown in a | ||
* non-interactive terminal: for example, if the output is redirected to a | ||
* file, then we don't care too much about having a progress bar. | ||
*/ | ||
status(format) {const | ||
@@ -159,6 +159,6 @@ _nextStatusStr = this._nextStatusStr;for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {args[_key - 1] = arguments[_key];} | ||
/** | ||
* Similar to `console.log`, except it moves the status/progress text out of | ||
* the way correctly. In non-interactive terminals this is the same as | ||
* `console.log`. | ||
*/ | ||
* Similar to `console.log`, except it moves the status/progress text out of | ||
* the way correctly. In non-interactive terminals this is the same as | ||
* `console.log`. | ||
*/ | ||
log(format) {for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {args[_key2 - 1] = arguments[_key2];} | ||
@@ -170,5 +170,5 @@ this._logLines.push(util.format.apply(util, [format].concat(args))); | ||
/** | ||
* Log the current status and start from scratch. This is useful if the last | ||
* status was the last one of a series of updates. | ||
*/ | ||
* Log the current status and start from scratch. This is useful if the last | ||
* status was the last one of a series of updates. | ||
*/ | ||
persistStatus() { | ||
@@ -175,0 +175,0 @@ this.log(this._nextStatusStr); |
28608
+ Addedmetro-resolver@0.40.1(transitive)
- Removedmetro-resolver@0.40.0(transitive)
Updatedmetro-resolver@0.40.1