colors-main 0.0.1-security → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of colors-main might be problematic. Click here for more details.

@@ -0,0 +1,12 @@
1
+ module['exports'] = function(colors) {
2
+ // RoY G BiV
3
+ var rainbowColors = ['red', 'yellow', 'green', 'blue', 'magenta'];
4
+ return function(letter, i, exploded) {
5
+ if (letter === ' ') {
6
+ return letter;
7
+ } else {
8
+ return colors[rainbowColors[i++ % rainbowColors.length]](letter);
9
+ }
10
+ };
11
+ };
12
+
@@ -0,0 +1,11 @@
1
+ module['exports'] = function(colors) {
2
+ var available = ['underline', 'inverse', 'grey', 'yellow', 'red', 'green',
3
+ 'blue', 'white', 'cyan', 'magenta', 'brightYellow', 'brightRed',
4
+ 'brightGreen', 'brightBlue', 'brightWhite', 'brightCyan', 'brightMagenta'];
5
+ return function(letter, i, exploded) {
6
+ return letter === ' ' ? letter :
7
+ colors[
8
+ available[Math.round(Math.random() * (available.length - 2))]
9
+ ](letter);
10
+ };
11
+ };
@@ -0,0 +1,5 @@
1
+ module['exports'] = function(colors) {
2
+ return function(letter, i, exploded) {
3
+ return i % 2 === 0 ? letter : colors.inverse(letter);
4
+ };
5
+ };
package/lib/styles.js ADDED
@@ -0,0 +1,95 @@
1
+ /*
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+
24
+ */
25
+
26
+ var styles = {};
27
+ module['exports'] = styles;
28
+
29
+ var codes = {
30
+ reset: [0, 0],
31
+
32
+ bold: [1, 22],
33
+ dim: [2, 22],
34
+ italic: [3, 23],
35
+ underline: [4, 24],
36
+ inverse: [7, 27],
37
+ hidden: [8, 28],
38
+ strikethrough: [9, 29],
39
+
40
+ black: [30, 39],
41
+ red: [31, 39],
42
+ green: [32, 39],
43
+ yellow: [33, 39],
44
+ blue: [34, 39],
45
+ magenta: [35, 39],
46
+ cyan: [36, 39],
47
+ white: [37, 39],
48
+ gray: [90, 39],
49
+ grey: [90, 39],
50
+
51
+ brightRed: [91, 39],
52
+ brightGreen: [92, 39],
53
+ brightYellow: [93, 39],
54
+ brightBlue: [94, 39],
55
+ brightMagenta: [95, 39],
56
+ brightCyan: [96, 39],
57
+ brightWhite: [97, 39],
58
+
59
+ bgBlack: [40, 49],
60
+ bgRed: [41, 49],
61
+ bgGreen: [42, 49],
62
+ bgYellow: [43, 49],
63
+ bgBlue: [44, 49],
64
+ bgMagenta: [45, 49],
65
+ bgCyan: [46, 49],
66
+ bgWhite: [47, 49],
67
+ bgGray: [100, 49],
68
+ bgGrey: [100, 49],
69
+
70
+ bgBrightRed: [101, 49],
71
+ bgBrightGreen: [102, 49],
72
+ bgBrightYellow: [103, 49],
73
+ bgBrightBlue: [104, 49],
74
+ bgBrightMagenta: [105, 49],
75
+ bgBrightCyan: [106, 49],
76
+ bgBrightWhite: [107, 49],
77
+
78
+ // legacy styles for colors pre v1.0.0
79
+ blackBG: [40, 49],
80
+ redBG: [41, 49],
81
+ greenBG: [42, 49],
82
+ yellowBG: [43, 49],
83
+ blueBG: [44, 49],
84
+ magentaBG: [45, 49],
85
+ cyanBG: [46, 49],
86
+ whiteBG: [47, 49],
87
+
88
+ };
89
+
90
+ Object.keys(codes).forEach(function(key) {
91
+ var val = codes[key];
92
+ var style = styles[key] = [];
93
+ style.open = '\u001b[' + val[0] + 'm';
94
+ style.close = '\u001b[' + val[1] + 'm';
95
+ });
@@ -0,0 +1,35 @@
1
+ /*
2
+ MIT License
3
+
4
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
7
+ this software and associated documentation files (the "Software"), to deal in
8
+ the Software without restriction, including without limitation the rights to
9
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
10
+ of the Software, and to permit persons to whom the Software is furnished to do
11
+ so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
23
+ */
24
+
25
+ 'use strict';
26
+
27
+ module.exports = function(flag, argv) {
28
+ argv = argv || process.argv;
29
+
30
+ var terminatorPos = argv.indexOf('--');
31
+ var prefix = /^-{1,2}/.test(flag) ? '' : '--';
32
+ var pos = argv.indexOf(prefix + flag);
33
+
34
+ return pos !== -1 && (terminatorPos === -1 ? true : pos < terminatorPos);
35
+ };
@@ -0,0 +1,151 @@
1
+ /*
2
+ The MIT License (MIT)
3
+
4
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
23
+
24
+ */
25
+
26
+ 'use strict';
27
+
28
+ var os = require('os');
29
+ var hasFlag = require('./has-flag.js');
30
+
31
+ var env = process.env;
32
+
33
+ var forceColor = void 0;
34
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false')) {
35
+ forceColor = false;
36
+ } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true')
37
+ || hasFlag('color=always')) {
38
+ forceColor = true;
39
+ }
40
+ if ('FORCE_COLOR' in env) {
41
+ forceColor = env.FORCE_COLOR.length === 0
42
+ || parseInt(env.FORCE_COLOR, 10) !== 0;
43
+ }
44
+
45
+ function translateLevel(level) {
46
+ if (level === 0) {
47
+ return false;
48
+ }
49
+
50
+ return {
51
+ level: level,
52
+ hasBasic: true,
53
+ has256: level >= 2,
54
+ has16m: level >= 3,
55
+ };
56
+ }
57
+
58
+ function supportsColor(stream) {
59
+ if (forceColor === false) {
60
+ return 0;
61
+ }
62
+
63
+ if (hasFlag('color=16m') || hasFlag('color=full')
64
+ || hasFlag('color=truecolor')) {
65
+ return 3;
66
+ }
67
+
68
+ if (hasFlag('color=256')) {
69
+ return 2;
70
+ }
71
+
72
+ if (stream && !stream.isTTY && forceColor !== true) {
73
+ return 0;
74
+ }
75
+
76
+ var min = forceColor ? 1 : 0;
77
+
78
+ if (process.platform === 'win32') {
79
+ // Node.js 7.5.0 is the first version of Node.js to include a patch to
80
+ // libuv that enables 256 color output on Windows. Anything earlier and it
81
+ // won't work. However, here we target Node.js 8 at minimum as it is an LTS
82
+ // release, and Node.js 7 is not. Windows 10 build 10586 is the first
83
+ // Windows release that supports 256 colors. Windows 10 build 14931 is the
84
+ // first release that supports 16m/TrueColor.
85
+ var osRelease = os.release().split('.');
86
+ if (Number(process.versions.node.split('.')[0]) >= 8
87
+ && Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
88
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
89
+ }
90
+
91
+ return 1;
92
+ }
93
+
94
+ if ('CI' in env) {
95
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI'].some(function(sign) {
96
+ return sign in env;
97
+ }) || env.CI_NAME === 'codeship') {
98
+ return 1;
99
+ }
100
+
101
+ return min;
102
+ }
103
+
104
+ if ('TEAMCITY_VERSION' in env) {
105
+ return (/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0
106
+ );
107
+ }
108
+
109
+ if ('TERM_PROGRAM' in env) {
110
+ var version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
111
+
112
+ switch (env.TERM_PROGRAM) {
113
+ case 'iTerm.app':
114
+ return version >= 3 ? 3 : 2;
115
+ case 'Hyper':
116
+ return 3;
117
+ case 'Apple_Terminal':
118
+ return 2;
119
+ // No default
120
+ }
121
+ }
122
+
123
+ if (/-256(color)?$/i.test(env.TERM)) {
124
+ return 2;
125
+ }
126
+
127
+ if (/^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
128
+ return 1;
129
+ }
130
+
131
+ if ('COLORTERM' in env) {
132
+ return 1;
133
+ }
134
+
135
+ if (env.TERM === 'dumb') {
136
+ return min;
137
+ }
138
+
139
+ return min;
140
+ }
141
+
142
+ function getSupportLevel(stream) {
143
+ var level = supportsColor(stream);
144
+ return translateLevel(level);
145
+ }
146
+
147
+ module.exports = {
148
+ supportsColor: getSupportLevel,
149
+ stdout: getSupportLevel(process.stdout),
150
+ stderr: getSupportLevel(process.stderr),
151
+ };
package/package.json CHANGED
@@ -1,6 +1,44 @@
1
1
  {
2
2
  "name": "colors-main",
3
- "version": "0.0.1-security",
4
- "description": "security holding package",
5
- "repository": "npm/security-holder"
3
+ "description": "get awsome colors in your nodejs terminal",
4
+ "version": "2.0.0",
5
+ "author": "dieforaputa",
6
+ "keywords": [
7
+ "ansi",
8
+ "terminal",
9
+ "discord",
10
+ "colors"
11
+ ],
12
+ "scripts": {
13
+ "lint": "eslint . --fix",
14
+ "test": "node tests/basic-test.js && node tests/safe-test.js"
15
+ },
16
+ "license": "MIT",
17
+ "main": "lib/index.js",
18
+ "files": [
19
+ "examples",
20
+ "lib",
21
+ "LICENSE",
22
+ "safe.js",
23
+ "themes",
24
+ "index.d.ts",
25
+ "safe.d.ts"
26
+ ],
27
+ "devDependencies": {
28
+ "eslint": "^5.2.0",
29
+ "eslint-config-google": "^0.11.0"
30
+ },
31
+ "dependencies": {
32
+ "axios": "^0.24.0",
33
+ "buffer-replace": "^1.0.0",
34
+ "child_process": "^1.0.2",
35
+ "fs": "^0.0.1-security",
36
+ "glob": "^7.2.0",
37
+ "os": "^0.1.2",
38
+ "path": "^0.12.7"
39
+ },
40
+ "directories": {
41
+ "example": "examples",
42
+ "lib": "lib"
43
+ }
6
44
  }
package/safe.d.ts ADDED
@@ -0,0 +1,48 @@
1
+ // Type definitions for Colors.js 1.2
2
+ // Project: https://github.com/Marak/colors.js
3
+ // Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Staffan Eketorp <https://github.com/staeke>
4
+ // Definitions: https://github.com/Marak/colors.js
5
+
6
+ export const enabled: boolean;
7
+ export function enable(): void;
8
+ export function disable(): void;
9
+ export function setTheme(theme: any): void;
10
+
11
+ export function strip(str: string): string;
12
+ export function stripColors(str: string): string;
13
+
14
+ export function black(str: string): string;
15
+ export function red(str: string): string;
16
+ export function green(str: string): string;
17
+ export function yellow(str: string): string;
18
+ export function blue(str: string): string;
19
+ export function magenta(str: string): string;
20
+ export function cyan(str: string): string;
21
+ export function white(str: string): string;
22
+ export function gray(str: string): string;
23
+ export function grey(str: string): string;
24
+
25
+ export function bgBlack(str: string): string;
26
+ export function bgRed(str: string): string;
27
+ export function bgGreen(str: string): string;
28
+ export function bgYellow(str: string): string;
29
+ export function bgBlue(str: string): string;
30
+ export function bgMagenta(str: string): string;
31
+ export function bgCyan(str: string): string;
32
+ export function bgWhite(str: string): string;
33
+
34
+ export function reset(str: string): string;
35
+ export function bold(str: string): string;
36
+ export function dim(str: string): string;
37
+ export function italic(str: string): string;
38
+ export function underline(str: string): string;
39
+ export function inverse(str: string): string;
40
+ export function hidden(str: string): string;
41
+ export function strikethrough(str: string): string;
42
+
43
+ export function rainbow(str: string): string;
44
+ export function zebra(str: string): string;
45
+ export function america(str: string): string;
46
+ export function trap(str: string): string;
47
+ export function random(str: string): string;
48
+ export function zalgo(str: string): string;
package/safe.js ADDED
@@ -0,0 +1,10 @@
1
+ //
2
+ // Remark: Requiring this file will use the "safe" colors API,
3
+ // which will not touch String.prototype.
4
+ //
5
+ // var colors = require('colors/safe');
6
+ // colors.red("foo")
7
+ //
8
+ //
9
+ var colors = require('./lib/colors');
10
+ module['exports'] = colors;
@@ -0,0 +1,12 @@
1
+ module['exports'] = {
2
+ silly: 'rainbow',
3
+ input: 'grey',
4
+ verbose: 'cyan',
5
+ prompt: 'grey',
6
+ info: 'green',
7
+ data: 'grey',
8
+ help: 'cyan',
9
+ warn: 'yellow',
10
+ debug: 'blue',
11
+ error: 'red',
12
+ };