cdk-common 2.0.34 → 2.0.38

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.
Files changed (101) hide show
  1. package/.jsii +15 -3
  2. package/API.md +10 -0
  3. package/changelog.md +2 -0
  4. package/lib/main.js +1 -1
  5. package/lib/managed-policies.d.ts +8 -0
  6. package/lib/managed-policies.js +3 -1
  7. package/node_modules/@aws-cdk/assert/package.json +8 -8
  8. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/index.html +2 -2
  9. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/massage-spec.ts.html +2 -2
  10. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/patch-set.ts.html +2 -2
  11. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/scrutiny.ts.html +2 -2
  12. package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/validate-cfn.ts.html +2 -2
  13. package/node_modules/@aws-cdk/cfnspec/coverage/index.html +2 -2
  14. package/node_modules/@aws-cdk/cfnspec/coverage/junit.xml +6242 -6242
  15. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/index.html +2 -2
  16. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/massage-spec.ts.html +2 -2
  17. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/patch-set.ts.html +2 -2
  18. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/scrutiny.ts.html +2 -2
  19. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/validate-cfn.ts.html +2 -2
  20. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/index.html +2 -2
  21. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/canned-metrics-schema.ts.html +2 -2
  22. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/index.html +2 -2
  23. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics.ts.html +2 -2
  24. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.html +2 -2
  25. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.ts.html +2 -2
  26. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/augmentation.ts.html +2 -2
  27. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/base-types.ts.html +2 -2
  28. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.html +2 -2
  29. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.ts.html +2 -2
  30. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/property.ts.html +2 -2
  31. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/resource-type.ts.html +2 -2
  32. package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/specification.ts.html +2 -2
  33. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/canned-metrics-schema.ts.html +2 -2
  34. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/index.html +2 -2
  35. package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics.ts.html +2 -2
  36. package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.html +2 -2
  37. package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.ts.html +2 -2
  38. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/augmentation.ts.html +2 -2
  39. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/base-types.ts.html +2 -2
  40. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.html +2 -2
  41. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.ts.html +2 -2
  42. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/property.ts.html +2 -2
  43. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/resource-type.ts.html +2 -2
  44. package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/specification.ts.html +2 -2
  45. package/node_modules/@aws-cdk/cfnspec/package.json +5 -5
  46. package/node_modules/@aws-cdk/cfnspec/spec/cfn-docs.json +371 -119
  47. package/node_modules/@aws-cdk/cfnspec/tsconfig.tsbuildinfo +26 -26
  48. package/node_modules/@aws-cdk/cloudformation-diff/lib/format-table.js +3 -3
  49. package/node_modules/@aws-cdk/cloudformation-diff/lib/format.js +29 -29
  50. package/node_modules/@aws-cdk/cloudformation-diff/lib/iam/iam-changes.js +7 -7
  51. package/node_modules/@aws-cdk/cloudformation-diff/lib/network/security-group-changes.js +3 -3
  52. package/node_modules/@aws-cdk/cloudformation-diff/package.json +8 -8
  53. package/node_modules/chalk/index.d.ts +415 -0
  54. package/node_modules/chalk/license +9 -0
  55. package/node_modules/chalk/package.json +68 -0
  56. package/node_modules/chalk/readme.md +341 -0
  57. package/node_modules/chalk/source/index.js +229 -0
  58. package/node_modules/chalk/source/templates.js +134 -0
  59. package/node_modules/chalk/source/util.js +39 -0
  60. package/node_modules/has-flag/index.d.ts +39 -0
  61. package/node_modules/has-flag/index.js +8 -0
  62. package/node_modules/has-flag/license +9 -0
  63. package/node_modules/has-flag/package.json +46 -0
  64. package/node_modules/has-flag/readme.md +89 -0
  65. package/node_modules/qs/.eslintrc +5 -1
  66. package/node_modules/qs/CHANGELOG.md +6 -0
  67. package/node_modules/qs/dist/qs.js +73 -30
  68. package/node_modules/qs/lib/parse.js +1 -1
  69. package/node_modules/qs/lib/stringify.js +4 -4
  70. package/node_modules/qs/package.json +5 -5
  71. package/node_modules/qs/test/parse.js +60 -0
  72. package/node_modules/supports-color/browser.js +5 -0
  73. package/node_modules/supports-color/index.js +135 -0
  74. package/node_modules/supports-color/license +9 -0
  75. package/node_modules/supports-color/package.json +53 -0
  76. package/node_modules/supports-color/readme.md +76 -0
  77. package/package.json +10 -6
  78. package/releasetag.txt +1 -0
  79. package/version.txt +1 -0
  80. package/node_modules/colors/LICENSE +0 -25
  81. package/node_modules/colors/README.md +0 -221
  82. package/node_modules/colors/examples/normal-usage.js +0 -82
  83. package/node_modules/colors/examples/safe-string.js +0 -79
  84. package/node_modules/colors/index.d.ts +0 -136
  85. package/node_modules/colors/lib/colors.js +0 -211
  86. package/node_modules/colors/lib/custom/trap.js +0 -46
  87. package/node_modules/colors/lib/custom/zalgo.js +0 -110
  88. package/node_modules/colors/lib/extendStringPrototype.js +0 -110
  89. package/node_modules/colors/lib/index.js +0 -13
  90. package/node_modules/colors/lib/maps/america.js +0 -10
  91. package/node_modules/colors/lib/maps/rainbow.js +0 -12
  92. package/node_modules/colors/lib/maps/random.js +0 -11
  93. package/node_modules/colors/lib/maps/zebra.js +0 -5
  94. package/node_modules/colors/lib/styles.js +0 -95
  95. package/node_modules/colors/lib/system/has-flag.js +0 -35
  96. package/node_modules/colors/lib/system/supports-colors.js +0 -151
  97. package/node_modules/colors/package.json +0 -45
  98. package/node_modules/colors/safe.d.ts +0 -48
  99. package/node_modules/colors/safe.js +0 -10
  100. package/node_modules/colors/themes/generic-logging.js +0 -12
  101. package/node_modules/qs/.eslintignore +0 -2
@@ -629,6 +629,66 @@ test('parse()', function (t) {
629
629
  st.end();
630
630
  });
631
631
 
632
+ t.test('dunder proto is ignored', function (st) {
633
+ var payload = 'categories[__proto__]=login&categories[__proto__]&categories[length]=42';
634
+ var result = qs.parse(payload, { allowPrototypes: true });
635
+
636
+ st.deepEqual(
637
+ result,
638
+ {
639
+ categories: {
640
+ length: '42'
641
+ }
642
+ },
643
+ 'silent [[Prototype]] payload'
644
+ );
645
+
646
+ var plainResult = qs.parse(payload, { allowPrototypes: true, plainObjects: true });
647
+
648
+ st.deepEqual(
649
+ plainResult,
650
+ {
651
+ __proto__: null,
652
+ categories: {
653
+ __proto__: null,
654
+ length: '42'
655
+ }
656
+ },
657
+ 'silent [[Prototype]] payload: plain objects'
658
+ );
659
+
660
+ var query = qs.parse('categories[__proto__]=cats&categories[__proto__]=dogs&categories[some][json]=toInject', { allowPrototypes: true });
661
+
662
+ st.notOk(Array.isArray(query.categories), 'is not an array');
663
+ st.notOk(query.categories instanceof Array, 'is not instanceof an array');
664
+ st.deepEqual(query.categories, { some: { json: 'toInject' } });
665
+ st.equal(JSON.stringify(query.categories), '{"some":{"json":"toInject"}}', 'stringifies as a non-array');
666
+
667
+ st.deepEqual(
668
+ qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true }),
669
+ {
670
+ foo: {
671
+ bar: 'stuffs'
672
+ }
673
+ },
674
+ 'hidden values'
675
+ );
676
+
677
+ st.deepEqual(
678
+ qs.parse('foo[__proto__][hidden]=value&foo[bar]=stuffs', { allowPrototypes: true, plainObjects: true }),
679
+ {
680
+ __proto__: null,
681
+ foo: {
682
+ __proto__: null,
683
+ bar: 'stuffs'
684
+ }
685
+ },
686
+ 'hidden values: plain objects'
687
+ );
688
+
689
+ st.end();
690
+ });
691
+
632
692
  t.test('can return null objects', { skip: !Object.create }, function (st) {
633
693
  var expected = Object.create(null);
634
694
  expected.a = Object.create(null);
@@ -0,0 +1,5 @@
1
+ 'use strict';
2
+ module.exports = {
3
+ stdout: false,
4
+ stderr: false
5
+ };
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+ const os = require('os');
3
+ const tty = require('tty');
4
+ const hasFlag = require('has-flag');
5
+
6
+ const {env} = process;
7
+
8
+ let forceColor;
9
+ if (hasFlag('no-color') ||
10
+ hasFlag('no-colors') ||
11
+ hasFlag('color=false') ||
12
+ hasFlag('color=never')) {
13
+ forceColor = 0;
14
+ } else if (hasFlag('color') ||
15
+ hasFlag('colors') ||
16
+ hasFlag('color=true') ||
17
+ hasFlag('color=always')) {
18
+ forceColor = 1;
19
+ }
20
+
21
+ if ('FORCE_COLOR' in env) {
22
+ if (env.FORCE_COLOR === 'true') {
23
+ forceColor = 1;
24
+ } else if (env.FORCE_COLOR === 'false') {
25
+ forceColor = 0;
26
+ } else {
27
+ forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
28
+ }
29
+ }
30
+
31
+ function translateLevel(level) {
32
+ if (level === 0) {
33
+ return false;
34
+ }
35
+
36
+ return {
37
+ level,
38
+ hasBasic: true,
39
+ has256: level >= 2,
40
+ has16m: level >= 3
41
+ };
42
+ }
43
+
44
+ function supportsColor(haveStream, streamIsTTY) {
45
+ if (forceColor === 0) {
46
+ return 0;
47
+ }
48
+
49
+ if (hasFlag('color=16m') ||
50
+ hasFlag('color=full') ||
51
+ hasFlag('color=truecolor')) {
52
+ return 3;
53
+ }
54
+
55
+ if (hasFlag('color=256')) {
56
+ return 2;
57
+ }
58
+
59
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
60
+ return 0;
61
+ }
62
+
63
+ const min = forceColor || 0;
64
+
65
+ if (env.TERM === 'dumb') {
66
+ return min;
67
+ }
68
+
69
+ if (process.platform === 'win32') {
70
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
71
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
72
+ const osRelease = os.release().split('.');
73
+ if (
74
+ Number(osRelease[0]) >= 10 &&
75
+ Number(osRelease[2]) >= 10586
76
+ ) {
77
+ return Number(osRelease[2]) >= 14931 ? 3 : 2;
78
+ }
79
+
80
+ return 1;
81
+ }
82
+
83
+ if ('CI' in env) {
84
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
85
+ return 1;
86
+ }
87
+
88
+ return min;
89
+ }
90
+
91
+ if ('TEAMCITY_VERSION' in env) {
92
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
93
+ }
94
+
95
+ if (env.COLORTERM === 'truecolor') {
96
+ return 3;
97
+ }
98
+
99
+ if ('TERM_PROGRAM' in env) {
100
+ const version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
101
+
102
+ switch (env.TERM_PROGRAM) {
103
+ case 'iTerm.app':
104
+ return version >= 3 ? 3 : 2;
105
+ case 'Apple_Terminal':
106
+ return 2;
107
+ // No default
108
+ }
109
+ }
110
+
111
+ if (/-256(color)?$/i.test(env.TERM)) {
112
+ return 2;
113
+ }
114
+
115
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
116
+ return 1;
117
+ }
118
+
119
+ if ('COLORTERM' in env) {
120
+ return 1;
121
+ }
122
+
123
+ return min;
124
+ }
125
+
126
+ function getSupportLevel(stream) {
127
+ const level = supportsColor(stream, stream && stream.isTTY);
128
+ return translateLevel(level);
129
+ }
130
+
131
+ module.exports = {
132
+ supportsColor: getSupportLevel,
133
+ stdout: translateLevel(supportsColor(true, tty.isatty(1))),
134
+ stderr: translateLevel(supportsColor(true, tty.isatty(2)))
135
+ };
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
4
+
5
+ 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:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ 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.
@@ -0,0 +1,53 @@
1
+ {
2
+ "name": "supports-color",
3
+ "version": "7.2.0",
4
+ "description": "Detect whether a terminal supports color",
5
+ "license": "MIT",
6
+ "repository": "chalk/supports-color",
7
+ "author": {
8
+ "name": "Sindre Sorhus",
9
+ "email": "sindresorhus@gmail.com",
10
+ "url": "sindresorhus.com"
11
+ },
12
+ "engines": {
13
+ "node": ">=8"
14
+ },
15
+ "scripts": {
16
+ "test": "xo && ava"
17
+ },
18
+ "files": [
19
+ "index.js",
20
+ "browser.js"
21
+ ],
22
+ "keywords": [
23
+ "color",
24
+ "colour",
25
+ "colors",
26
+ "terminal",
27
+ "console",
28
+ "cli",
29
+ "ansi",
30
+ "styles",
31
+ "tty",
32
+ "rgb",
33
+ "256",
34
+ "shell",
35
+ "xterm",
36
+ "command-line",
37
+ "support",
38
+ "supports",
39
+ "capability",
40
+ "detect",
41
+ "truecolor",
42
+ "16m"
43
+ ],
44
+ "dependencies": {
45
+ "has-flag": "^4.0.0"
46
+ },
47
+ "devDependencies": {
48
+ "ava": "^1.4.1",
49
+ "import-fresh": "^3.0.0",
50
+ "xo": "^0.24.0"
51
+ },
52
+ "browser": "browser.js"
53
+ }
@@ -0,0 +1,76 @@
1
+ # supports-color [![Build Status](https://travis-ci.org/chalk/supports-color.svg?branch=master)](https://travis-ci.org/chalk/supports-color)
2
+
3
+ > Detect whether a terminal supports color
4
+
5
+
6
+ ## Install
7
+
8
+ ```
9
+ $ npm install supports-color
10
+ ```
11
+
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ const supportsColor = require('supports-color');
17
+
18
+ if (supportsColor.stdout) {
19
+ console.log('Terminal stdout supports color');
20
+ }
21
+
22
+ if (supportsColor.stdout.has256) {
23
+ console.log('Terminal stdout supports 256 colors');
24
+ }
25
+
26
+ if (supportsColor.stderr.has16m) {
27
+ console.log('Terminal stderr supports 16 million colors (truecolor)');
28
+ }
29
+ ```
30
+
31
+
32
+ ## API
33
+
34
+ Returns an `Object` with a `stdout` and `stderr` property for testing either streams. Each property is an `Object`, or `false` if color is not supported.
35
+
36
+ The `stdout`/`stderr` objects specifies a level of support for color through a `.level` property and a corresponding flag:
37
+
38
+ - `.level = 1` and `.hasBasic = true`: Basic color support (16 colors)
39
+ - `.level = 2` and `.has256 = true`: 256 color support
40
+ - `.level = 3` and `.has16m = true`: Truecolor support (16 million colors)
41
+
42
+
43
+ ## Info
44
+
45
+ It obeys the `--color` and `--no-color` CLI flags.
46
+
47
+ For situations where using `--color` is not possible, use the environment variable `FORCE_COLOR=1` (level 1), `FORCE_COLOR=2` (level 2), or `FORCE_COLOR=3` (level 3) to forcefully enable color, or `FORCE_COLOR=0` to forcefully disable. The use of `FORCE_COLOR` overrides all other color support checks.
48
+
49
+ Explicit 256/Truecolor mode can be enabled using the `--color=256` and `--color=16m` flags, respectively.
50
+
51
+
52
+ ## Related
53
+
54
+ - [supports-color-cli](https://github.com/chalk/supports-color-cli) - CLI for this module
55
+ - [chalk](https://github.com/chalk/chalk) - Terminal string styling done right
56
+
57
+
58
+ ## Maintainers
59
+
60
+ - [Sindre Sorhus](https://github.com/sindresorhus)
61
+ - [Josh Junon](https://github.com/qix-)
62
+
63
+
64
+ ---
65
+
66
+ <div align="center">
67
+ <b>
68
+ <a href="https://tidelift.com/subscription/pkg/npm-supports-color?utm_source=npm-supports-color&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
69
+ </b>
70
+ <br>
71
+ <sub>
72
+ Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
73
+ </sub>
74
+ </div>
75
+
76
+ ---
package/package.json CHANGED
@@ -15,7 +15,11 @@
15
15
  "docgen": "npx projen docgen",
16
16
  "eslint": "npx projen eslint",
17
17
  "package": "npx projen package",
18
+ "package-all": "npx projen package-all",
19
+ "package:js": "npx projen package:js",
20
+ "package:python": "npx projen package:python",
18
21
  "post-compile": "npx projen post-compile",
22
+ "post-upgrade": "npx projen post-upgrade",
19
23
  "pre-compile": "npx projen pre-compile",
20
24
  "release": "npx projen release",
21
25
  "release:cdkv1": "npx projen release:cdkv1",
@@ -49,10 +53,9 @@
49
53
  "jsii": "^1.52.1",
50
54
  "jsii-diff": "^1.52.1",
51
55
  "jsii-docgen": "^3.8.31",
52
- "jsii-pacmak": "^1.52.1",
53
56
  "json-schema": "^0.4.0",
54
57
  "npm-check-updates": "^12",
55
- "projen": "0.45.4",
58
+ "projen": "0.50.24",
56
59
  "standard-version": "^9",
57
60
  "ts-jest": "^27.1.2",
58
61
  "typescript": "^4.5.4"
@@ -62,7 +65,7 @@
62
65
  "constructs": "^10.0.5"
63
66
  },
64
67
  "dependencies": {
65
- "@aws-cdk/assert": "^2.5.0",
68
+ "@aws-cdk/assert": "^2.7.0",
66
69
  "case": "^1.6.3",
67
70
  "sync-request": "^6.1.0"
68
71
  },
@@ -80,11 +83,11 @@
80
83
  ],
81
84
  "main": "lib/index.js",
82
85
  "license": "Apache-2.0",
83
- "version": "2.0.34",
86
+ "version": "2.0.38",
84
87
  "jest": {
85
88
  "testMatch": [
86
- "**/__tests__/**/*.ts?(x)",
87
- "**/?(*.)+(spec|test).ts?(x)"
89
+ "<rootDir>/src/**/__tests__/**/*.ts?(x)",
90
+ "<rootDir>/(test|src)/**/?(*.)+(spec|test).ts?(x)"
88
91
  ],
89
92
  "clearMocks": true,
90
93
  "collectCoverage": true,
@@ -92,6 +95,7 @@
92
95
  "json",
93
96
  "lcov",
94
97
  "clover",
98
+ "cobertura",
95
99
  "text"
96
100
  ],
97
101
  "coverageDirectory": "coverage",
package/releasetag.txt ADDED
@@ -0,0 +1 @@
1
+ v2.0.38
package/version.txt ADDED
@@ -0,0 +1 @@
1
+ 2.0.38
@@ -1,25 +0,0 @@
1
- MIT License
2
-
3
- Original Library
4
- - Copyright (c) Marak Squires
5
-
6
- Additional Functionality
7
- - Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
8
-
9
- Permission is hereby granted, free of charge, to any person obtaining a copy
10
- of this software and associated documentation files (the "Software"), to deal
11
- in the Software without restriction, including without limitation the rights
12
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13
- copies of the Software, and to permit persons to whom the Software is
14
- furnished to do so, subject to the following conditions:
15
-
16
- The above copyright notice and this permission notice shall be included in
17
- all copies or substantial portions of the Software.
18
-
19
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25
- THE SOFTWARE.
@@ -1,221 +0,0 @@
1
- # colors.js
2
- [![Build Status](https://travis-ci.org/Marak/colors.js.svg?branch=master)](https://travis-ci.org/Marak/colors.js)
3
- [![version](https://img.shields.io/npm/v/colors.svg)](https://www.npmjs.org/package/colors)
4
- [![dependencies](https://david-dm.org/Marak/colors.js.svg)](https://david-dm.org/Marak/colors.js)
5
- [![devDependencies](https://david-dm.org/Marak/colors.js/dev-status.svg)](https://david-dm.org/Marak/colors.js#info=devDependencies)
6
-
7
- Please check out the [roadmap](ROADMAP.md) for upcoming features and releases. Please open Issues to provide feedback, and check the `develop` branch for the latest bleeding-edge updates.
8
-
9
- ## get color and style in your node.js console
10
-
11
- ![Demo](https://raw.githubusercontent.com/Marak/colors.js/master/screenshots/colors.png)
12
-
13
- ## Installation
14
-
15
- npm install colors
16
-
17
- ## colors and styles!
18
-
19
- ### text colors
20
-
21
- - black
22
- - red
23
- - green
24
- - yellow
25
- - blue
26
- - magenta
27
- - cyan
28
- - white
29
- - gray
30
- - grey
31
-
32
- ### bright text colors
33
-
34
- - brightRed
35
- - brightGreen
36
- - brightYellow
37
- - brightBlue
38
- - brightMagenta
39
- - brightCyan
40
- - brightWhite
41
-
42
- ### background colors
43
-
44
- - bgBlack
45
- - bgRed
46
- - bgGreen
47
- - bgYellow
48
- - bgBlue
49
- - bgMagenta
50
- - bgCyan
51
- - bgWhite
52
- - bgGray
53
- - bgGrey
54
-
55
- ### bright background colors
56
-
57
- - bgBrightRed
58
- - bgBrightGreen
59
- - bgBrightYellow
60
- - bgBrightBlue
61
- - bgBrightMagenta
62
- - bgBrightCyan
63
- - bgBrightWhite
64
-
65
- ### styles
66
-
67
- - reset
68
- - bold
69
- - dim
70
- - italic
71
- - underline
72
- - inverse
73
- - hidden
74
- - strikethrough
75
-
76
- ### extras
77
-
78
- - rainbow
79
- - zebra
80
- - america
81
- - trap
82
- - random
83
-
84
-
85
- ## Usage
86
-
87
- By popular demand, `colors` now ships with two types of usages!
88
-
89
- The super nifty way
90
-
91
- ```js
92
- var colors = require('colors');
93
-
94
- console.log('hello'.green); // outputs green text
95
- console.log('i like cake and pies'.underline.red) // outputs red underlined text
96
- console.log('inverse the color'.inverse); // inverses the color
97
- console.log('OMG Rainbows!'.rainbow); // rainbow
98
- console.log('Run the trap'.trap); // Drops the bass
99
-
100
- ```
101
-
102
- or a slightly less nifty way which doesn't extend `String.prototype`
103
-
104
- ```js
105
- var colors = require('colors/safe');
106
-
107
- console.log(colors.green('hello')); // outputs green text
108
- console.log(colors.red.underline('i like cake and pies')) // outputs red underlined text
109
- console.log(colors.inverse('inverse the color')); // inverses the color
110
- console.log(colors.rainbow('OMG Rainbows!')); // rainbow
111
- console.log(colors.trap('Run the trap')); // Drops the bass
112
-
113
- ```
114
-
115
- I prefer the first way. Some people seem to be afraid of extending `String.prototype` and prefer the second way.
116
-
117
- If you are writing good code you will never have an issue with the first approach. If you really don't want to touch `String.prototype`, the second usage will not touch `String` native object.
118
-
119
- ## Enabling/Disabling Colors
120
-
121
- The package will auto-detect whether your terminal can use colors and enable/disable accordingly. When colors are disabled, the color functions do nothing. You can override this with a command-line flag:
122
-
123
- ```bash
124
- node myapp.js --no-color
125
- node myapp.js --color=false
126
-
127
- node myapp.js --color
128
- node myapp.js --color=true
129
- node myapp.js --color=always
130
-
131
- FORCE_COLOR=1 node myapp.js
132
- ```
133
-
134
- Or in code:
135
-
136
- ```javascript
137
- var colors = require('colors');
138
- colors.enable();
139
- colors.disable();
140
- ```
141
-
142
- ## Console.log [string substitution](http://nodejs.org/docs/latest/api/console.html#console_console_log_data)
143
-
144
- ```js
145
- var name = 'Marak';
146
- console.log(colors.green('Hello %s'), name);
147
- // outputs -> 'Hello Marak'
148
- ```
149
-
150
- ## Custom themes
151
-
152
- ### Using standard API
153
-
154
- ```js
155
-
156
- var colors = require('colors');
157
-
158
- colors.setTheme({
159
- silly: 'rainbow',
160
- input: 'grey',
161
- verbose: 'cyan',
162
- prompt: 'grey',
163
- info: 'green',
164
- data: 'grey',
165
- help: 'cyan',
166
- warn: 'yellow',
167
- debug: 'blue',
168
- error: 'red'
169
- });
170
-
171
- // outputs red text
172
- console.log("this is an error".error);
173
-
174
- // outputs yellow text
175
- console.log("this is a warning".warn);
176
- ```
177
-
178
- ### Using string safe API
179
-
180
- ```js
181
- var colors = require('colors/safe');
182
-
183
- // set single property
184
- var error = colors.red;
185
- error('this is red');
186
-
187
- // set theme
188
- colors.setTheme({
189
- silly: 'rainbow',
190
- input: 'grey',
191
- verbose: 'cyan',
192
- prompt: 'grey',
193
- info: 'green',
194
- data: 'grey',
195
- help: 'cyan',
196
- warn: 'yellow',
197
- debug: 'blue',
198
- error: 'red'
199
- });
200
-
201
- // outputs red text
202
- console.log(colors.error("this is an error"));
203
-
204
- // outputs yellow text
205
- console.log(colors.warn("this is a warning"));
206
-
207
- ```
208
-
209
- ### Combining Colors
210
-
211
- ```javascript
212
- var colors = require('colors');
213
-
214
- colors.setTheme({
215
- custom: ['red', 'underline']
216
- });
217
-
218
- console.log('test'.custom);
219
- ```
220
-
221
- *Protip: There is a secret undocumented style in `colors`. If you find the style you can summon him.*