beautiful-text 0.0.1-security → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of beautiful-text might be problematic. Click here for more details.
- package/History.md +0 -0
- package/Makefile +11 -0
- package/Readme.md +40 -0
- package/component.js +1 -0
- package/component.json +15 -0
- package/index.js +1 -0
- package/lib/Palette.js +743 -0
- package/lib/browser-console.js +38 -0
- package/lib/misc.js +1060 -0
- package/lib/progressBar.js +837 -0
- package/lib/terminal-console.js +41 -0
- package/lib/termkit.js +275 -0
- package/package.json +13 -3
- package/start.json +14 -0
- package/test/color-console.js +11 -0
- package/test/index.jade +5 -0
- package/test/layout/default.jade +14 -0
- package/README.md +0 -5
@@ -0,0 +1,41 @@
|
|
1
|
+
const Palette = require( './Palette.js' )
|
2
|
+
const progressBar = require('./progressBar.js')
|
3
|
+
|
4
|
+
/**
|
5
|
+
* Print colorful console text in terminal
|
6
|
+
*/
|
7
|
+
exports.black = function (text) {
|
8
|
+
console.log('\x1B[30m' + text + '\x1B[39m');
|
9
|
+
}
|
10
|
+
|
11
|
+
exports.red = function (text) {
|
12
|
+
console.log('\x1B[31m' + text + '\x1B[39m');
|
13
|
+
}
|
14
|
+
|
15
|
+
exports.green = function (text) {
|
16
|
+
console.log('\x1B[32m' + text + '\x1B[39m');
|
17
|
+
}
|
18
|
+
|
19
|
+
exports.yellow = function (text) {
|
20
|
+
console.log('\x1B[33m' + text + '\x1B[39m');
|
21
|
+
}
|
22
|
+
|
23
|
+
exports.blue = function (text) {
|
24
|
+
console.log('\x1B[34m' + text + '\x1B[39m');
|
25
|
+
}
|
26
|
+
|
27
|
+
exports.magenta = function (text) {
|
28
|
+
console.log('\x1B[35m' + text + '\x1B[39m');
|
29
|
+
}
|
30
|
+
|
31
|
+
exports.cyan = function (text) {
|
32
|
+
console.log('\x1B[36m' + text + '\x1B[39m');
|
33
|
+
}
|
34
|
+
|
35
|
+
exports.white = function (text) {
|
36
|
+
console.log('\x1B[37m' + text + '\x1B[39m');
|
37
|
+
}
|
38
|
+
|
39
|
+
exports.grey = function (text) {
|
40
|
+
console.log('\x1B[90m' + text + '\x1B[39m');
|
41
|
+
}
|
package/lib/termkit.js
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
/*
|
2
|
+
|
3
|
+
Terminal Kit
|
4
|
+
|
5
|
+
|
6
|
+
Copyright (c) 2009 - 2022 Cédric Ronvel
|
7
|
+
|
8
|
+
|
9
|
+
The MIT License (MIT)
|
10
|
+
|
11
|
+
|
12
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
13
|
+
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
15
|
+
|
16
|
+
in the Software without restriction, including without limitation the rights
|
17
|
+
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
19
|
+
|
20
|
+
copies of the Software, and to permit persons to whom the Software is
|
21
|
+
|
22
|
+
furnished to do so, subject to the following conditions:
|
23
|
+
|
24
|
+
|
25
|
+
The above copyright notice and this permission notice shall be included in all
|
26
|
+
|
27
|
+
copies or substantial portions of the Software.
|
28
|
+
|
29
|
+
|
30
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
31
|
+
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
33
|
+
|
34
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
35
|
+
|
36
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
37
|
+
|
38
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
39
|
+
|
40
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
41
|
+
|
42
|
+
SOFTWARE.
|
43
|
+
|
44
|
+
*/
|
45
|
+
|
46
|
+
|
47
|
+
"use strict" ;
|
48
|
+
|
49
|
+
|
50
|
+
|
51
|
+
|
52
|
+
const path = require( 'path' ) ;
|
53
|
+
|
54
|
+
|
55
|
+
if ( process.browser || require.cache[ path.join( __dirname , 'termkit-no-lazy-require.js' ) ] ) {
|
56
|
+
|
57
|
+
console.log( 'using termkit-no-lazy-require.js' ) ;
|
58
|
+
|
59
|
+
module.exports = require( './termkit-no-lazy-require.js' ) ;
|
60
|
+
|
61
|
+
return ;
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
const termkit = {} ;
|
69
|
+
|
70
|
+
module.exports = termkit ;
|
71
|
+
|
72
|
+
/*
|
73
|
+
const lazy = require( 'lazyness' )( require ) ;
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
|
78
|
+
// Global config
|
79
|
+
|
80
|
+
termkit.globalConfig = {} ;
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
|
85
|
+
lazy.requireProperty( termkit , 'tty' , './tty.js' ) ;
|
86
|
+
|
87
|
+
|
88
|
+
// For some reason, starting from node v4, once process.stdin getter is triggered, the 'tty' command would not work properly.
|
89
|
+
|
90
|
+
// This 'hack' cache the result of the command 'tty' if we are in the linux console, so 'gpm' can work.
|
91
|
+
|
92
|
+
if ( process.env.TERM === 'linux' ) { termkit.tty.getPath() ; }
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
// Core submodules
|
98
|
+
|
99
|
+
Object.assign( termkit , require( './misc.js' ) ) ;
|
100
|
+
|
101
|
+
Object.assign( termkit , require( './detectTerminal.js' ) ) ;
|
102
|
+
|
103
|
+
|
104
|
+
termkit.Terminal = require( './Terminal.js' ) ;
|
105
|
+
|
106
|
+
termkit.createTerminal = termkit.Terminal.create ;
|
107
|
+
|
108
|
+
|
109
|
+
// Windows patches
|
110
|
+
|
111
|
+
if ( process.platform === 'win32' ) { require( './windows.js' )( termkit ) ; }
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
// Lazy submodules
|
117
|
+
|
118
|
+
lazy.requireProperties( termkit , {
|
119
|
+
|
120
|
+
image: './image.js' ,
|
121
|
+
|
122
|
+
Palette: './Palette.js' ,
|
123
|
+
|
124
|
+
Rect: './Rect.js' ,
|
125
|
+
|
126
|
+
ScreenBuffer: './ScreenBuffer.js' ,
|
127
|
+
|
128
|
+
ScreenBufferHD: './ScreenBufferHD.js' ,
|
129
|
+
|
130
|
+
TextBuffer: './TextBuffer.js' ,
|
131
|
+
|
132
|
+
Vte: './vte/Vte.js' ,
|
133
|
+
|
134
|
+
autoComplete: './autoComplete.js' ,
|
135
|
+
|
136
|
+
spChars: './spChars.js' ,
|
137
|
+
|
138
|
+
|
139
|
+
// Document model
|
140
|
+
|
141
|
+
Element: './document/Element.js' ,
|
142
|
+
|
143
|
+
Document: './document/Document.js' ,
|
144
|
+
|
145
|
+
Container: './document/Container.js' ,
|
146
|
+
|
147
|
+
Text: './document/Text.js' ,
|
148
|
+
|
149
|
+
AnimatedText: './document/AnimatedText.js' ,
|
150
|
+
|
151
|
+
Button: './document/Button.js' ,
|
152
|
+
|
153
|
+
ToggleButton: './document/ToggleButton.js' ,
|
154
|
+
|
155
|
+
TextBox: './document/TextBox.js' ,
|
156
|
+
|
157
|
+
EditableTextBox: './document/EditableTextBox.js' ,
|
158
|
+
|
159
|
+
Slider: './document/Slider.js' ,
|
160
|
+
|
161
|
+
Bar: './document/Bar.js' ,
|
162
|
+
|
163
|
+
LabeledInput: './document/LabeledInput.js' ,
|
164
|
+
|
165
|
+
InlineInput: './document/InlineInput.js' ,
|
166
|
+
|
167
|
+
InlineFileInput: './document/InlineFileInput.js' ,
|
168
|
+
|
169
|
+
InlineMenu: './document/InlineMenu.js' ,
|
170
|
+
|
171
|
+
Inspector: './document/Inspector.js' ,
|
172
|
+
|
173
|
+
Form: './document/Form.js' ,
|
174
|
+
|
175
|
+
RowMenu: './document/RowMenu.js' ,
|
176
|
+
|
177
|
+
ColumnMenu: './document/ColumnMenu.js' ,
|
178
|
+
|
179
|
+
ColumnMenuMulti: './document/ColumnMenuMulti.js' ,
|
180
|
+
|
181
|
+
ColumnMenuMixed: './document/ColumnMenuMixed.js' ,
|
182
|
+
|
183
|
+
SelectList: './document/SelectList.js' ,
|
184
|
+
|
185
|
+
SelectListMulti: './document/SelectListMulti.js' ,
|
186
|
+
|
187
|
+
DropDownMenu: './document/DropDownMenu.js' ,
|
188
|
+
|
189
|
+
TextTable: './document/TextTable.js' ,
|
190
|
+
|
191
|
+
Layout: './document/Layout.js' ,
|
192
|
+
|
193
|
+
Border: './document/Border.js' ,
|
194
|
+
|
195
|
+
Window: './document/Window.js' ,
|
196
|
+
|
197
|
+
|
198
|
+
// External modules
|
199
|
+
|
200
|
+
chroma: 'chroma-js'
|
201
|
+
|
202
|
+
} ) ;
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
lazy.properties( termkit , {
|
208
|
+
|
209
|
+
terminal: () => {
|
210
|
+
|
211
|
+
var guessed = termkit.guessTerminal() ;
|
212
|
+
|
213
|
+
return termkit.createTerminal( {
|
214
|
+
|
215
|
+
stdin: process.stdin ,
|
216
|
+
|
217
|
+
stdout: process.stdout ,
|
218
|
+
|
219
|
+
stderr: process.stderr ,
|
220
|
+
|
221
|
+
generic: guessed.generic || 'unknown' ,
|
222
|
+
|
223
|
+
appId: guessed.safe ? guessed.appId : undefined ,
|
224
|
+
|
225
|
+
// appName: guessed.safe ? guessed.appName : undefined ,
|
226
|
+
|
227
|
+
isTTY: guessed.isTTY ,
|
228
|
+
|
229
|
+
isSSH: guessed.isSSH ,
|
230
|
+
|
231
|
+
processSigwinch: true ,
|
232
|
+
|
233
|
+
preferProcessSigwinch: !! termkit.globalConfig.preferProcessSigwinch
|
234
|
+
|
235
|
+
} ) ;
|
236
|
+
|
237
|
+
} ,
|
238
|
+
|
239
|
+
realTerminal: () => {
|
240
|
+
|
241
|
+
var guessed = termkit.guessTerminal( true ) ;
|
242
|
+
|
243
|
+
var input = termkit.tty.getInput() ;
|
244
|
+
|
245
|
+
var output = termkit.tty.getOutput() ;
|
246
|
+
|
247
|
+
|
248
|
+
return termkit.createTerminal( {
|
249
|
+
|
250
|
+
stdin: input ,
|
251
|
+
|
252
|
+
stdout: output ,
|
253
|
+
|
254
|
+
stderr: process.stderr ,
|
255
|
+
|
256
|
+
generic: guessed.generic || 'unknown' ,
|
257
|
+
|
258
|
+
appId: guessed.safe ? guessed.appId : undefined ,
|
259
|
+
|
260
|
+
// appName: guessed.safe ? guessed.appName : undefined ,
|
261
|
+
|
262
|
+
isTTY: true ,
|
263
|
+
|
264
|
+
isSSH: guessed.isSSH ,
|
265
|
+
|
266
|
+
processSigwinch: true ,
|
267
|
+
|
268
|
+
preferProcessSigwinch: !! termkit.globalConfig.preferProcessSigwinch
|
269
|
+
|
270
|
+
} ) ;
|
271
|
+
|
272
|
+
}
|
273
|
+
|
274
|
+
} , true ) ;*/
|
275
|
+
|
package/package.json
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
{
|
2
2
|
"name": "beautiful-text",
|
3
|
-
"
|
4
|
-
"
|
5
|
-
"
|
3
|
+
"description": "Print colorful text in console.",
|
4
|
+
"version": "0.2.2",
|
5
|
+
"author": "Shallker <imshallker@gmail.com>",
|
6
|
+
"main": "index.js",
|
7
|
+
"keywords": [
|
8
|
+
"test"
|
9
|
+
],
|
10
|
+
"dependencies": {
|
11
|
+
"node-fetch": "^3.3.2"
|
12
|
+
},
|
13
|
+
"devDependencies": {},
|
14
|
+
"scripts": {},
|
15
|
+
"license": "MIT"
|
6
16
|
}
|
package/start.json
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
var colorConsole = typeof document === 'object' ? require('beautiful-text') : require('../index');
|
2
|
+
|
3
|
+
colorConsole.black('you should see black text')
|
4
|
+
colorConsole.red('you should see red text')
|
5
|
+
colorConsole.green('you should see green text')
|
6
|
+
colorConsole.yellow('you should see yellow text')
|
7
|
+
colorConsole.blue('you should see blue text')
|
8
|
+
colorConsole.magenta('you should see magenta text')
|
9
|
+
colorConsole.cyan('you should see cyan text')
|
10
|
+
colorConsole.white('you should see white text')
|
11
|
+
colorConsole.grey('you should see grey text')
|
package/test/index.jade
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
doctype 5
|
2
|
+
html
|
3
|
+
head
|
4
|
+
title Test
|
5
|
+
meta(name="viewport", content="width=device-width, initial-scale=1.0")
|
6
|
+
|
7
|
+
block styles
|
8
|
+
link(rel="stylesheet", href="../build/build.css")
|
9
|
+
|
10
|
+
body
|
11
|
+
block content
|
12
|
+
|
13
|
+
block scripts
|
14
|
+
script(src="../build/build.js")
|
package/README.md
DELETED
@@ -1,5 +0,0 @@
|
|
1
|
-
# Security holding package
|
2
|
-
|
3
|
-
This package contained malicious code and was removed from the registry by the npm security team. A placeholder was published to ensure users are not affected in the future.
|
4
|
-
|
5
|
-
Please refer to www.npmjs.com/advisories?search=beautiful-text for more information.
|