-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
3,709 additions
and
3,687 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,8 +9,9 @@ var getStdin = _interopDefault(require('get-stdin')); | |
var updateNotifier = _interopDefault(require('update-notifier')); | ||
var commonTags = require('common-tags'); | ||
var string = require('@thebespokepixel/string'); | ||
var _merge = _interopDefault(require('lodash/merge')); | ||
var trucolor = require('trucolor'); | ||
var deepAssign = _interopDefault(require('deep-assign')); | ||
var path = require('path'); | ||
var terminalFeatures = _interopDefault(require('term-ng')); | ||
var columnify = _interopDefault(require('columnify')); | ||
var osLocale = _interopDefault(require('os-locale')); | ||
|
@@ -19,14 +20,13 @@ var meta = _interopDefault(require('@thebespokepixel/meta')); | |
var nSelector = require('@thebespokepixel/n-selector'); | ||
var ansiRegex = _interopDefault(require('ansi-regex')); | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var _min = _interopDefault(require('lodash/min')); | ||
var _max = _interopDefault(require('lodash/max')); | ||
var _split = _interopDefault(require('lodash/split')); | ||
var _forEach = _interopDefault(require('lodash/forEach')); | ||
|
||
const name = "truwrap"; | ||
const version = "2.0.2"; | ||
const version = "2.0.3"; | ||
const description = "Smarter terminal text wrapping (handles 24bit color)"; | ||
const author = "Mark Griffiths <[email protected]> (http://thebespokepixel.com/)"; | ||
const main = "index.js"; | ||
|
@@ -57,42 +57,42 @@ const scripts = { | |
}; | ||
const devDependencies = { | ||
"@ava/babel": "^1.0.1", | ||
"@babel/core": "^7.8.4", | ||
"@babel/preset-env": "^7.8.4", | ||
ava: "^3.3.0", | ||
"@babel/core": "^7.10.5", | ||
"@babel/preset-env": "^7.10.4", | ||
ava: "^3.10.1", | ||
"babel-plugin-lodash": "^3.3.4", | ||
"documentation-theme-bespoke": "^1.1.3", | ||
"documentation-theme-bespoke": "^1.1.6", | ||
gulp: "^4.0.2", | ||
"gulp-better-rollup": "^4.0.1", | ||
"gulp-chmod": "^3.0.0", | ||
"gulp-rename": "^2.0.0", | ||
nyc: "^15.0.0", | ||
rollup: "^1.31.1", | ||
"rollup-plugin-babel": "^4.3.3", | ||
nyc: "^15.1.0", | ||
rollup: "^2.21.0", | ||
"rollup-plugin-babel": "^4.4.0", | ||
"rollup-plugin-commonjs": "^10.1.0", | ||
"rollup-plugin-json": "^4.0.0", | ||
"rollup-plugin-node-resolve": "^5.2.0", | ||
"semver-regex": "^3.1.1", | ||
xo: "^0.26.1" | ||
xo: "^0.32.1" | ||
}; | ||
const dependencies = { | ||
"@thebespokepixel/meta": "^2.0.2", | ||
"@thebespokepixel/n-selector": "^2.0.1", | ||
"@thebespokepixel/string": "^1.0.1", | ||
"@thebespokepixel/meta": "^2.0.4", | ||
"@thebespokepixel/n-selector": "^2.0.2", | ||
"@thebespokepixel/string": "^1.0.3", | ||
"ansi-regex": "^5.0.0", | ||
columnify: "^1.5.4", | ||
"common-tags": "^1.8.0", | ||
"deep-assign": "^3.0.0", | ||
"es6-promisify": "^6.0.2", | ||
"get-stdin": "^7.0.0", | ||
lodash: "^4.17.15", | ||
"os-locale": "^4.0.0", | ||
"es6-promisify": "^6.1.1", | ||
"get-stdin": "^8.0.0", | ||
lodash: "^4.17.19", | ||
"os-locale": "^5.0.0", | ||
"read-pkg-up": "^7.0.1", | ||
"term-ng": "^2.0.1", | ||
trucolor: "^2.0.1", | ||
"term-ng": "^2.0.2", | ||
trucolor: "^2.0.2", | ||
"update-notifier": "^4.1.0", | ||
verbosity: "^2.0.1", | ||
yargs: "^15.1.0" | ||
verbosity: "^2.0.2", | ||
yargs: "^15.4.1" | ||
}; | ||
const engines = { | ||
node: ">=10.0" | ||
|
@@ -157,10 +157,7 @@ const badges = { | |
], | ||
"Development Status": [ | ||
[ | ||
"greenkeeper", | ||
"travis-com-dev" | ||
], | ||
[ | ||
"travis-com-dev", | ||
"david-dev", | ||
"david-devdeps-dev" | ||
], | ||
|
@@ -214,14 +211,14 @@ var pkg = { | |
badges: badges | ||
}; | ||
|
||
const clr = deepAssign(trucolor.simple({ | ||
const clr = _merge(trucolor.simple({ | ||
format: 'sgr' | ||
}), trucolor.palette({ | ||
format: 'sgr' | ||
}, { | ||
}), { | ||
bright: 'bold rgb(255,255,255)', | ||
dark: '#333' | ||
})); | ||
}); | ||
const colorReplacer = new commonTags.TemplateTag(commonTags.replaceSubstitutionTransformer(/([a-zA-Z]+?)[:/|](.+)/, (match, colorName, content) => `${clr[colorName]}${content}${clr[colorName].out}`)); | ||
|
||
const tabRegex = /\t/g; | ||
|
@@ -232,7 +229,7 @@ class Tokeniser { | |
this.tokenisingRegex = tokenisingRegex || function () { | ||
switch (renderMode.selected) { | ||
case 'keep': | ||
return /^.*$/mg; | ||
return /^.*$/gm; | ||
|
||
default: | ||
return /\S+\s+/g; | ||
|
@@ -250,7 +247,9 @@ class Tokeniser { | |
|
||
} | ||
|
||
var createTokeniser = (tokenisingRegex => new Tokeniser(tokenisingRegex)); | ||
function createTokeniser(tokenisingRegex) { | ||
return new Tokeniser(tokenisingRegex); | ||
} | ||
|
||
const newlineRegex$1 = /^>\/\\\/\/__<$/; | ||
const tabRegex$1 = /^>T\/\\B<$/; | ||
|
@@ -333,7 +332,9 @@ class LineFitter { | |
|
||
} | ||
|
||
var createLineFitter = ((margin, width, tabWidth) => new LineFitter([margin, width, tabWidth])); | ||
function createLineFitter(margin, width, tabWidth) { | ||
return new LineFitter([margin, width, tabWidth]); | ||
} | ||
|
||
class WrapTool { | ||
constructor({ | ||
|
@@ -369,16 +370,18 @@ class WrapTool { | |
} | ||
|
||
this.lines.push(currentLine.toString()); | ||
return this.lines.map(this.tokeniser.restore).join('\n'); | ||
return this.lines.map(line => this.tokeniser.restore(line)).join('\n'); | ||
} | ||
|
||
} | ||
|
||
var createWrapTool = (options => new WrapTool(options)); | ||
function createWrapTool(options) { | ||
return new WrapTool(options); | ||
} | ||
|
||
const prefix = '\u001B]1337;File=inline=1;'; | ||
const suffix = '\u0007'; | ||
const broken = `${__dirname}/../media/broken.png`; | ||
const broken = path.join(__dirname, '/../media/broken.png'); | ||
|
||
class Image { | ||
constructor({ | ||
|
@@ -427,9 +430,11 @@ class Image { | |
|
||
} | ||
|
||
var createImage = (source => new Image(source)); | ||
function createImage(source) { | ||
return new Image(source); | ||
} | ||
|
||
function parsePanel (buffer_, delimiter_, width_) { | ||
function panel(buffer_, delimiter_, width_) { | ||
let longIdx = 0; | ||
let maxCols = 0; | ||
const spacerCols = []; | ||
|
@@ -616,7 +621,7 @@ const images = function () { | |
space: '\t', | ||
cc: createImage({ | ||
name: 'logo', | ||
file: `${__dirname}/../media/CCLogo.png`, | ||
file: path.join(__dirname, '/../media/CCLogo.png'), | ||
height: 3 | ||
}) | ||
}; | ||
|
@@ -841,12 +846,12 @@ if (argv.stamp) { | |
|
||
getStdin().then(input => { | ||
if (argv.panel) { | ||
const panel = parsePanel(input, argv.delimiter, renderer.getWidth()); | ||
renderer.panel(panel.content, { | ||
const panel$1 = panel(input, argv.delimiter, renderer.getWidth()); | ||
renderer.panel(panel$1.content, { | ||
maxLineWidth: renderer.getWidth(), | ||
showHeaders: false, | ||
truncate: argv.truncate, | ||
config: panel.configuration | ||
config: panel$1.configuration | ||
}); | ||
} else { | ||
renderer.write(input); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.