forked from github/cordova-android
CB-14145 remove old node_modules before patch fix
This commit is contained in:
-4
@@ -1,4 +0,0 @@
|
||||
{
|
||||
"laxcomma": true,
|
||||
"asi": true
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
node_modules
|
||||
-23
@@ -1,23 +0,0 @@
|
||||
|
||||
0.3.1 / 2016-01-14
|
||||
==================
|
||||
|
||||
* add MIT LICENSE file (#23, @kasicka)
|
||||
* preserve chaining after redundant style-method calls (#19, @drewblaisdell)
|
||||
* package: add "license" field (#16, @BenjaminTsai)
|
||||
|
||||
0.3.0 / 2014-05-09
|
||||
==================
|
||||
|
||||
* package: remove "test" script and "devDependencies"
|
||||
* package: remove "engines" section
|
||||
* pacakge: remove "bin" section
|
||||
* package: beautify
|
||||
* examples: remove `starwars` example (#15)
|
||||
* Documented goto, horizontalAbsolute, and eraseLine methods in README.md (#12, @Jammerwoch)
|
||||
* add `.jshintrc` file
|
||||
|
||||
< 0.3.0
|
||||
=======
|
||||
|
||||
* Prehistoric
|
||||
-24
@@ -1,24 +0,0 @@
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person
|
||||
obtaining a copy of this software and associated documentation
|
||||
files (the "Software"), to deal in the Software without
|
||||
restriction, including without limitation the rights to use,
|
||||
copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
||||
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||
OTHER DEALINGS IN THE SOFTWARE.
|
||||
-98
@@ -1,98 +0,0 @@
|
||||
ansi.js
|
||||
=========
|
||||
### Advanced ANSI formatting tool for Node.js
|
||||
|
||||
`ansi.js` is a module for Node.js that provides an easy-to-use API for
|
||||
writing ANSI escape codes to `Stream` instances. ANSI escape codes are used to do
|
||||
fancy things in a terminal window, like render text in colors, delete characters,
|
||||
lines, the entire window, or hide and show the cursor, and lots more!
|
||||
|
||||
#### Features:
|
||||
|
||||
* 256 color support for the terminal!
|
||||
* Make a beep sound from your terminal!
|
||||
* Works with *any* writable `Stream` instance.
|
||||
* Allows you to move the cursor anywhere on the terminal window.
|
||||
* Allows you to delete existing contents from the terminal window.
|
||||
* Allows you to hide and show the cursor.
|
||||
* Converts CSS color codes and RGB values into ANSI escape codes.
|
||||
* Low-level; you are in control of when escape codes are used, it's not abstracted.
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
Install with `npm`:
|
||||
|
||||
``` bash
|
||||
$ npm install ansi
|
||||
```
|
||||
|
||||
|
||||
Example
|
||||
-------
|
||||
|
||||
``` js
|
||||
var ansi = require('ansi')
|
||||
, cursor = ansi(process.stdout)
|
||||
|
||||
// You can chain your calls forever:
|
||||
cursor
|
||||
.red() // Set font color to red
|
||||
.bg.grey() // Set background color to grey
|
||||
.write('Hello World!') // Write 'Hello World!' to stdout
|
||||
.bg.reset() // Reset the bgcolor before writing the trailing \n,
|
||||
// to avoid Terminal glitches
|
||||
.write('\n') // And a final \n to wrap things up
|
||||
|
||||
// Rendering modes are persistent:
|
||||
cursor.hex('#660000').bold().underline()
|
||||
|
||||
// You can use the regular logging functions, text will be green:
|
||||
console.log('This is blood red, bold text')
|
||||
|
||||
// To reset just the foreground color:
|
||||
cursor.fg.reset()
|
||||
|
||||
console.log('This will still be bold')
|
||||
|
||||
// to go to a location (x,y) on the console
|
||||
// note: 1-indexed, not 0-indexed:
|
||||
cursor.goto(10, 5).write('Five down, ten over')
|
||||
|
||||
// to clear the current line:
|
||||
cursor.horizontalAbsolute(0).eraseLine().write('Starting again')
|
||||
|
||||
// to go to a different column on the current line:
|
||||
cursor.horizontalAbsolute(5).write('column five')
|
||||
|
||||
// Clean up after yourself!
|
||||
cursor.reset()
|
||||
```
|
||||
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
(The MIT License)
|
||||
|
||||
Copyright (c) 2012 Nathan Rajlich <nathan@tootallnate.net>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
'Software'), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Invokes the terminal "beep" sound once per second on every exact second.
|
||||
*/
|
||||
|
||||
process.title = 'beep'
|
||||
|
||||
var cursor = require('../../')(process.stdout)
|
||||
|
||||
function beep () {
|
||||
cursor.beep()
|
||||
setTimeout(beep, 1000 - (new Date()).getMilliseconds())
|
||||
}
|
||||
|
||||
setTimeout(beep, 1000 - (new Date()).getMilliseconds())
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Like GNU ncurses "clear" command.
|
||||
* https://github.com/mscdex/node-ncurses/blob/master/deps/ncurses/progs/clear.c
|
||||
*/
|
||||
|
||||
process.title = 'clear'
|
||||
|
||||
function lf () { return '\n' }
|
||||
|
||||
require('../../')(process.stdout)
|
||||
.write(Array.apply(null, Array(process.stdout.getWindowSize()[1])).map(lf).join(''))
|
||||
.eraseData(2)
|
||||
.goto(1, 1)
|
||||
-32
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var tty = require('tty')
|
||||
var cursor = require('../')(process.stdout)
|
||||
|
||||
// listen for the queryPosition report on stdin
|
||||
process.stdin.resume()
|
||||
raw(true)
|
||||
|
||||
process.stdin.once('data', function (b) {
|
||||
var match = /\[(\d+)\;(\d+)R$/.exec(b.toString())
|
||||
if (match) {
|
||||
var xy = match.slice(1, 3).reverse().map(Number)
|
||||
console.error(xy)
|
||||
}
|
||||
|
||||
// cleanup and close stdin
|
||||
raw(false)
|
||||
process.stdin.pause()
|
||||
})
|
||||
|
||||
|
||||
// send the query position request code to stdout
|
||||
cursor.queryPosition()
|
||||
|
||||
function raw (mode) {
|
||||
if (process.stdin.setRawMode) {
|
||||
process.stdin.setRawMode(mode)
|
||||
} else {
|
||||
tty.setRawMode(mode)
|
||||
}
|
||||
}
|
||||
-87
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
var assert = require('assert')
|
||||
, ansi = require('../../')
|
||||
|
||||
function Progress (stream, width) {
|
||||
this.cursor = ansi(stream)
|
||||
this.delta = this.cursor.newlines
|
||||
this.width = width | 0 || 10
|
||||
this.open = '['
|
||||
this.close = ']'
|
||||
this.complete = '█'
|
||||
this.incomplete = '_'
|
||||
|
||||
// initial render
|
||||
this.progress = 0
|
||||
}
|
||||
|
||||
Object.defineProperty(Progress.prototype, 'progress', {
|
||||
get: get
|
||||
, set: set
|
||||
, configurable: true
|
||||
, enumerable: true
|
||||
})
|
||||
|
||||
function get () {
|
||||
return this._progress
|
||||
}
|
||||
|
||||
function set (v) {
|
||||
this._progress = Math.max(0, Math.min(v, 100))
|
||||
|
||||
var w = this.width - this.complete.length - this.incomplete.length
|
||||
, n = w * (this._progress / 100) | 0
|
||||
, i = w - n
|
||||
, com = c(this.complete, n)
|
||||
, inc = c(this.incomplete, i)
|
||||
, delta = this.cursor.newlines - this.delta
|
||||
|
||||
assert.equal(com.length + inc.length, w)
|
||||
|
||||
if (delta > 0) {
|
||||
this.cursor.up(delta)
|
||||
this.delta = this.cursor.newlines
|
||||
}
|
||||
|
||||
this.cursor
|
||||
.horizontalAbsolute(0)
|
||||
.eraseLine(2)
|
||||
.fg.white()
|
||||
.write(this.open)
|
||||
.fg.grey()
|
||||
.bold()
|
||||
.write(com)
|
||||
.resetBold()
|
||||
.write(inc)
|
||||
.fg.white()
|
||||
.write(this.close)
|
||||
.fg.reset()
|
||||
.write('\n')
|
||||
}
|
||||
|
||||
function c (char, length) {
|
||||
return Array.apply(null, Array(length)).map(function () {
|
||||
return char
|
||||
}).join('')
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// Usage
|
||||
var width = parseInt(process.argv[2], 10) || process.stdout.getWindowSize()[0] / 2
|
||||
, p = new Progress(process.stdout, width)
|
||||
|
||||
;(function tick () {
|
||||
p.progress += Math.random() * 5
|
||||
p.cursor
|
||||
.eraseLine(2)
|
||||
.write('Progress: ')
|
||||
.bold().write(p.progress.toFixed(2))
|
||||
.write('%')
|
||||
.resetBold()
|
||||
.write('\n')
|
||||
if (p.progress < 100)
|
||||
setTimeout(tick, 100)
|
||||
})()
|
||||
-405
@@ -1,405 +0,0 @@
|
||||
|
||||
/**
|
||||
* References:
|
||||
*
|
||||
* - http://en.wikipedia.org/wiki/ANSI_escape_code
|
||||
* - http://www.termsys.demon.co.uk/vtansi.htm
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var emitNewlineEvents = require('./newlines')
|
||||
, prefix = '\x1b[' // For all escape codes
|
||||
, suffix = 'm' // Only for color codes
|
||||
|
||||
/**
|
||||
* The ANSI escape sequences.
|
||||
*/
|
||||
|
||||
var codes = {
|
||||
up: 'A'
|
||||
, down: 'B'
|
||||
, forward: 'C'
|
||||
, back: 'D'
|
||||
, nextLine: 'E'
|
||||
, previousLine: 'F'
|
||||
, horizontalAbsolute: 'G'
|
||||
, eraseData: 'J'
|
||||
, eraseLine: 'K'
|
||||
, scrollUp: 'S'
|
||||
, scrollDown: 'T'
|
||||
, savePosition: 's'
|
||||
, restorePosition: 'u'
|
||||
, queryPosition: '6n'
|
||||
, hide: '?25l'
|
||||
, show: '?25h'
|
||||
}
|
||||
|
||||
/**
|
||||
* Rendering ANSI codes.
|
||||
*/
|
||||
|
||||
var styles = {
|
||||
bold: 1
|
||||
, italic: 3
|
||||
, underline: 4
|
||||
, inverse: 7
|
||||
}
|
||||
|
||||
/**
|
||||
* The negating ANSI code for the rendering modes.
|
||||
*/
|
||||
|
||||
var reset = {
|
||||
bold: 22
|
||||
, italic: 23
|
||||
, underline: 24
|
||||
, inverse: 27
|
||||
}
|
||||
|
||||
/**
|
||||
* The standard, styleable ANSI colors.
|
||||
*/
|
||||
|
||||
var colors = {
|
||||
white: 37
|
||||
, black: 30
|
||||
, blue: 34
|
||||
, cyan: 36
|
||||
, green: 32
|
||||
, magenta: 35
|
||||
, red: 31
|
||||
, yellow: 33
|
||||
, grey: 90
|
||||
, brightBlack: 90
|
||||
, brightRed: 91
|
||||
, brightGreen: 92
|
||||
, brightYellow: 93
|
||||
, brightBlue: 94
|
||||
, brightMagenta: 95
|
||||
, brightCyan: 96
|
||||
, brightWhite: 97
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Creates a Cursor instance based off the given `writable stream` instance.
|
||||
*/
|
||||
|
||||
function ansi (stream, options) {
|
||||
if (stream._ansicursor) {
|
||||
return stream._ansicursor
|
||||
} else {
|
||||
return stream._ansicursor = new Cursor(stream, options)
|
||||
}
|
||||
}
|
||||
module.exports = exports = ansi
|
||||
|
||||
/**
|
||||
* The `Cursor` class.
|
||||
*/
|
||||
|
||||
function Cursor (stream, options) {
|
||||
if (!(this instanceof Cursor)) {
|
||||
return new Cursor(stream, options)
|
||||
}
|
||||
if (typeof stream != 'object' || typeof stream.write != 'function') {
|
||||
throw new Error('a valid Stream instance must be passed in')
|
||||
}
|
||||
|
||||
// the stream to use
|
||||
this.stream = stream
|
||||
|
||||
// when 'enabled' is false then all the functions are no-ops except for write()
|
||||
this.enabled = options && options.enabled
|
||||
if (typeof this.enabled === 'undefined') {
|
||||
this.enabled = stream.isTTY
|
||||
}
|
||||
this.enabled = !!this.enabled
|
||||
|
||||
// then `buffering` is true, then `write()` calls are buffered in
|
||||
// memory until `flush()` is invoked
|
||||
this.buffering = !!(options && options.buffering)
|
||||
this._buffer = []
|
||||
|
||||
// controls the foreground and background colors
|
||||
this.fg = this.foreground = new Colorer(this, 0)
|
||||
this.bg = this.background = new Colorer(this, 10)
|
||||
|
||||
// defaults
|
||||
this.Bold = false
|
||||
this.Italic = false
|
||||
this.Underline = false
|
||||
this.Inverse = false
|
||||
|
||||
// keep track of the number of "newlines" that get encountered
|
||||
this.newlines = 0
|
||||
emitNewlineEvents(stream)
|
||||
stream.on('newline', function () {
|
||||
this.newlines++
|
||||
}.bind(this))
|
||||
}
|
||||
exports.Cursor = Cursor
|
||||
|
||||
/**
|
||||
* Helper function that calls `write()` on the underlying Stream.
|
||||
* Returns `this` instead of the write() return value to keep
|
||||
* the chaining going.
|
||||
*/
|
||||
|
||||
Cursor.prototype.write = function (data) {
|
||||
if (this.buffering) {
|
||||
this._buffer.push(arguments)
|
||||
} else {
|
||||
this.stream.write.apply(this.stream, arguments)
|
||||
}
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Buffer `write()` calls into memory.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Cursor.prototype.buffer = function () {
|
||||
this.buffering = true
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Write out the in-memory buffer.
|
||||
*
|
||||
* @api public
|
||||
*/
|
||||
|
||||
Cursor.prototype.flush = function () {
|
||||
this.buffering = false
|
||||
var str = this._buffer.map(function (args) {
|
||||
if (args.length != 1) throw new Error('unexpected args length! ' + args.length);
|
||||
return args[0];
|
||||
}).join('');
|
||||
this._buffer.splice(0); // empty
|
||||
this.write(str);
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* The `Colorer` class manages both the background and foreground colors.
|
||||
*/
|
||||
|
||||
function Colorer (cursor, base) {
|
||||
this.current = null
|
||||
this.cursor = cursor
|
||||
this.base = base
|
||||
}
|
||||
exports.Colorer = Colorer
|
||||
|
||||
/**
|
||||
* Write an ANSI color code, ensuring that the same code doesn't get rewritten.
|
||||
*/
|
||||
|
||||
Colorer.prototype._setColorCode = function setColorCode (code) {
|
||||
var c = String(code)
|
||||
if (this.current === c) return
|
||||
this.cursor.enabled && this.cursor.write(prefix + c + suffix)
|
||||
this.current = c
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set up the positional ANSI codes.
|
||||
*/
|
||||
|
||||
Object.keys(codes).forEach(function (name) {
|
||||
var code = String(codes[name])
|
||||
Cursor.prototype[name] = function () {
|
||||
var c = code
|
||||
if (arguments.length > 0) {
|
||||
c = toArray(arguments).map(Math.round).join(';') + code
|
||||
}
|
||||
this.enabled && this.write(prefix + c)
|
||||
return this
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Set up the functions for the rendering ANSI codes.
|
||||
*/
|
||||
|
||||
Object.keys(styles).forEach(function (style) {
|
||||
var name = style[0].toUpperCase() + style.substring(1)
|
||||
, c = styles[style]
|
||||
, r = reset[style]
|
||||
|
||||
Cursor.prototype[style] = function () {
|
||||
if (this[name]) return this
|
||||
this.enabled && this.write(prefix + c + suffix)
|
||||
this[name] = true
|
||||
return this
|
||||
}
|
||||
|
||||
Cursor.prototype['reset' + name] = function () {
|
||||
if (!this[name]) return this
|
||||
this.enabled && this.write(prefix + r + suffix)
|
||||
this[name] = false
|
||||
return this
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Setup the functions for the standard colors.
|
||||
*/
|
||||
|
||||
Object.keys(colors).forEach(function (color) {
|
||||
var code = colors[color]
|
||||
|
||||
Colorer.prototype[color] = function () {
|
||||
this._setColorCode(this.base + code)
|
||||
return this.cursor
|
||||
}
|
||||
|
||||
Cursor.prototype[color] = function () {
|
||||
return this.foreground[color]()
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* Makes a beep sound!
|
||||
*/
|
||||
|
||||
Cursor.prototype.beep = function () {
|
||||
this.enabled && this.write('\x07')
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Moves cursor to specific position
|
||||
*/
|
||||
|
||||
Cursor.prototype.goto = function (x, y) {
|
||||
x = x | 0
|
||||
y = y | 0
|
||||
this.enabled && this.write(prefix + y + ';' + x + 'H')
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the color.
|
||||
*/
|
||||
|
||||
Colorer.prototype.reset = function () {
|
||||
this._setColorCode(this.base + 39)
|
||||
return this.cursor
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets all ANSI formatting on the stream.
|
||||
*/
|
||||
|
||||
Cursor.prototype.reset = function () {
|
||||
this.enabled && this.write(prefix + '0' + suffix)
|
||||
this.Bold = false
|
||||
this.Italic = false
|
||||
this.Underline = false
|
||||
this.Inverse = false
|
||||
this.foreground.current = null
|
||||
this.background.current = null
|
||||
return this
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the foreground color with the given RGB values.
|
||||
* The closest match out of the 216 colors is picked.
|
||||
*/
|
||||
|
||||
Colorer.prototype.rgb = function (r, g, b) {
|
||||
var base = this.base + 38
|
||||
, code = rgb(r, g, b)
|
||||
this._setColorCode(base + ';5;' + code)
|
||||
return this.cursor
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as `cursor.fg.rgb(r, g, b)`.
|
||||
*/
|
||||
|
||||
Cursor.prototype.rgb = function (r, g, b) {
|
||||
return this.foreground.rgb(r, g, b)
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts CSS color codes for use with ANSI escape codes.
|
||||
* For example: `#FF000` would be bright red.
|
||||
*/
|
||||
|
||||
Colorer.prototype.hex = function (color) {
|
||||
return this.rgb.apply(this, hex(color))
|
||||
}
|
||||
|
||||
/**
|
||||
* Same as `cursor.fg.hex(color)`.
|
||||
*/
|
||||
|
||||
Cursor.prototype.hex = function (color) {
|
||||
return this.foreground.hex(color)
|
||||
}
|
||||
|
||||
|
||||
// UTIL FUNCTIONS //
|
||||
|
||||
/**
|
||||
* Translates a 255 RGB value to a 0-5 ANSI RGV value,
|
||||
* then returns the single ANSI color code to use.
|
||||
*/
|
||||
|
||||
function rgb (r, g, b) {
|
||||
var red = r / 255 * 5
|
||||
, green = g / 255 * 5
|
||||
, blue = b / 255 * 5
|
||||
return rgb5(red, green, blue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns rgb 0-5 values into a single ANSI color code to use.
|
||||
*/
|
||||
|
||||
function rgb5 (r, g, b) {
|
||||
var red = Math.round(r)
|
||||
, green = Math.round(g)
|
||||
, blue = Math.round(b)
|
||||
return 16 + (red*36) + (green*6) + blue
|
||||
}
|
||||
|
||||
/**
|
||||
* Accepts a hex CSS color code string (# is optional) and
|
||||
* translates it into an Array of 3 RGB 0-255 values, which
|
||||
* can then be used with rgb().
|
||||
*/
|
||||
|
||||
function hex (color) {
|
||||
var c = color[0] === '#' ? color.substring(1) : color
|
||||
, r = c.substring(0, 2)
|
||||
, g = c.substring(2, 4)
|
||||
, b = c.substring(4, 6)
|
||||
return [parseInt(r, 16), parseInt(g, 16), parseInt(b, 16)]
|
||||
}
|
||||
|
||||
/**
|
||||
* Turns an array-like object into a real array.
|
||||
*/
|
||||
|
||||
function toArray (a) {
|
||||
var i = 0
|
||||
, l = a.length
|
||||
, rtn = []
|
||||
for (; i<l; i++) {
|
||||
rtn.push(a[i])
|
||||
}
|
||||
return rtn
|
||||
}
|
||||
-71
@@ -1,71 +0,0 @@
|
||||
|
||||
/**
|
||||
* Accepts any node Stream instance and hijacks its "write()" function,
|
||||
* so that it can count any newlines that get written to the output.
|
||||
*
|
||||
* When a '\n' byte is encountered, then a "newline" event will be emitted
|
||||
* on the stream, with no arguments. It is up to the listeners to determine
|
||||
* any necessary deltas required for their use-case.
|
||||
*
|
||||
* Ex:
|
||||
*
|
||||
* var cursor = ansi(process.stdout)
|
||||
* , ln = 0
|
||||
* process.stdout.on('newline', function () {
|
||||
* ln++
|
||||
* })
|
||||
*/
|
||||
|
||||
/**
|
||||
* Module dependencies.
|
||||
*/
|
||||
|
||||
var assert = require('assert')
|
||||
var NEWLINE = '\n'.charCodeAt(0)
|
||||
|
||||
function emitNewlineEvents (stream) {
|
||||
if (stream._emittingNewlines) {
|
||||
// already emitting newline events
|
||||
return
|
||||
}
|
||||
|
||||
var write = stream.write
|
||||
|
||||
stream.write = function (data) {
|
||||
// first write the data
|
||||
var rtn = write.apply(stream, arguments)
|
||||
|
||||
if (stream.listeners('newline').length > 0) {
|
||||
var len = data.length
|
||||
, i = 0
|
||||
// now try to calculate any deltas
|
||||
if (typeof data == 'string') {
|
||||
for (; i<len; i++) {
|
||||
processByte(stream, data.charCodeAt(i))
|
||||
}
|
||||
} else {
|
||||
// buffer
|
||||
for (; i<len; i++) {
|
||||
processByte(stream, data[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return rtn
|
||||
}
|
||||
|
||||
stream._emittingNewlines = true
|
||||
}
|
||||
module.exports = emitNewlineEvents
|
||||
|
||||
|
||||
/**
|
||||
* Processes an individual byte being written to a stream
|
||||
*/
|
||||
|
||||
function processByte (stream, b) {
|
||||
assert.equal(typeof b, 'number')
|
||||
if (b === NEWLINE) {
|
||||
stream.emit('newline')
|
||||
}
|
||||
}
|
||||
-93
@@ -1,93 +0,0 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
{
|
||||
"raw": "ansi@^0.3.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi",
|
||||
"name": "ansi",
|
||||
"rawSpec": "^0.3.1",
|
||||
"spec": ">=0.3.1 <0.4.0",
|
||||
"type": "range"
|
||||
},
|
||||
"/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common"
|
||||
]
|
||||
],
|
||||
"_from": "ansi@>=0.3.1 <0.4.0",
|
||||
"_id": "ansi@0.3.1",
|
||||
"_inCache": true,
|
||||
"_location": "/ansi",
|
||||
"_nodeVersion": "5.3.0",
|
||||
"_npmUser": {
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
"_npmVersion": "3.3.12",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"raw": "ansi@^0.3.1",
|
||||
"scope": null,
|
||||
"escapedName": "ansi",
|
||||
"name": "ansi",
|
||||
"rawSpec": "^0.3.1",
|
||||
"spec": ">=0.3.1 <0.4.0",
|
||||
"type": "range"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/cordova-common"
|
||||
],
|
||||
"_resolved": "http://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz",
|
||||
"_shasum": "0c42d4fb17160d5a9af1e484bace1c66922c1b21",
|
||||
"_shrinkwrap": null,
|
||||
"_spec": "ansi@^0.3.1",
|
||||
"_where": "/Users/steveng/repo/cordova/cordova-android/node_modules/cordova-common",
|
||||
"author": {
|
||||
"name": "Nathan Rajlich",
|
||||
"email": "nathan@tootallnate.net",
|
||||
"url": "http://tootallnate.net"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/TooTallNate/ansi.js/issues"
|
||||
},
|
||||
"dependencies": {},
|
||||
"description": "Advanced ANSI formatting tool for Node.js",
|
||||
"devDependencies": {},
|
||||
"directories": {},
|
||||
"dist": {
|
||||
"shasum": "0c42d4fb17160d5a9af1e484bace1c66922c1b21",
|
||||
"tarball": "https://registry.npmjs.org/ansi/-/ansi-0.3.1.tgz"
|
||||
},
|
||||
"gitHead": "4d0d4af94e0bdaa648bd7262acd3bde4b98d5246",
|
||||
"homepage": "https://github.com/TooTallNate/ansi.js#readme",
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"formatting",
|
||||
"cursor",
|
||||
"color",
|
||||
"terminal",
|
||||
"rgb",
|
||||
"256",
|
||||
"stream"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "./lib/ansi.js",
|
||||
"maintainers": [
|
||||
{
|
||||
"name": "TooTallNate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
},
|
||||
{
|
||||
"name": "tootallnate",
|
||||
"email": "nathan@tootallnate.net"
|
||||
}
|
||||
],
|
||||
"name": "ansi",
|
||||
"optionalDependencies": {},
|
||||
"readme": "ERROR: No README data found!",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/TooTallNate/ansi.js.git"
|
||||
},
|
||||
"scripts": {},
|
||||
"version": "0.3.1"
|
||||
}
|
||||
Reference in New Issue
Block a user