@contrast/agent 4.16.2 → 4.18.0

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 (147) hide show
  1. package/esm.mjs +21 -11
  2. package/lib/assess/policy/propagators.json +4 -0
  3. package/lib/assess/policy/signatures.json +5 -0
  4. package/lib/assess/propagators/fastify-static/allowed-path.js +85 -0
  5. package/lib/assess/sources/index.js +26 -5
  6. package/lib/cli-rewriter/index.js +1 -1
  7. package/lib/contrast.js +1 -1
  8. package/lib/core/config/options.js +14 -1
  9. package/lib/core/config/util.js +39 -11
  10. package/lib/core/rewrite/index.js +2 -2
  11. package/lib/protect/service.js +2 -0
  12. package/lib/util/trace-util.js +5 -4
  13. package/node_modules/@colors/colors/LICENSE +26 -0
  14. package/node_modules/@colors/colors/README.md +219 -0
  15. package/node_modules/@colors/colors/examples/normal-usage.js +83 -0
  16. package/node_modules/@colors/colors/examples/safe-string.js +80 -0
  17. package/node_modules/@colors/colors/index.d.ts +136 -0
  18. package/node_modules/@colors/colors/lib/colors.js +211 -0
  19. package/node_modules/@colors/colors/lib/custom/trap.js +46 -0
  20. package/node_modules/@colors/colors/lib/custom/zalgo.js +110 -0
  21. package/node_modules/@colors/colors/lib/extendStringPrototype.js +110 -0
  22. package/node_modules/@colors/colors/lib/index.js +13 -0
  23. package/node_modules/@colors/colors/lib/maps/america.js +10 -0
  24. package/node_modules/@colors/colors/lib/maps/rainbow.js +12 -0
  25. package/node_modules/@colors/colors/lib/maps/random.js +11 -0
  26. package/node_modules/@colors/colors/lib/maps/zebra.js +5 -0
  27. package/node_modules/@colors/colors/lib/styles.js +95 -0
  28. package/node_modules/@colors/colors/lib/system/has-flag.js +35 -0
  29. package/node_modules/@colors/colors/lib/system/supports-colors.js +151 -0
  30. package/node_modules/@colors/colors/package.json +49 -0
  31. package/node_modules/@colors/colors/safe.d.ts +48 -0
  32. package/node_modules/@colors/colors/safe.js +10 -0
  33. package/node_modules/@colors/colors/themes/generic-logging.js +12 -0
  34. package/node_modules/@dabh/diagnostics/README.md +16 -16
  35. package/node_modules/@dabh/diagnostics/package.json +9 -9
  36. package/node_modules/color/README.md +9 -0
  37. package/node_modules/color/index.js +4 -1
  38. package/node_modules/color/package.json +8 -8
  39. package/node_modules/color-string/README.md +6 -2
  40. package/node_modules/color-string/index.js +21 -13
  41. package/node_modules/color-string/package.json +4 -4
  42. package/node_modules/colorspace/package.json +5 -5
  43. package/node_modules/fecha/dist/fecha.min.js +1 -1
  44. package/node_modules/fecha/dist/fecha.min.js.map +1 -0
  45. package/node_modules/fecha/lib/fecha.d.ts +2 -2
  46. package/node_modules/fecha/lib/fecha.js +35 -18
  47. package/node_modules/fecha/lib/fecha.js.map +1 -0
  48. package/node_modules/fecha/lib/fecha.umd.js +35 -18
  49. package/node_modules/fecha/lib/fecha.umd.js.map +1 -0
  50. package/node_modules/fecha/package.json +9 -10
  51. package/node_modules/fecha/src/fecha.ts +524 -0
  52. package/node_modules/logform/.eslintrc +1 -1
  53. package/node_modules/logform/CHANGELOG.md +24 -0
  54. package/node_modules/logform/README.md +15 -17
  55. package/node_modules/logform/browser.js +3 -1
  56. package/node_modules/logform/cli.js +1 -1
  57. package/node_modules/logform/colorize.js +2 -2
  58. package/node_modules/logform/dist/browser.js +8 -2
  59. package/node_modules/logform/dist/cli.js +2 -2
  60. package/node_modules/logform/dist/colorize.js +5 -5
  61. package/node_modules/logform/dist/errors.js +1 -1
  62. package/node_modules/logform/dist/format.js +9 -5
  63. package/node_modules/logform/dist/index.js +53 -20
  64. package/node_modules/logform/dist/json.js +7 -6
  65. package/node_modules/logform/dist/logstash.js +1 -1
  66. package/node_modules/logform/dist/pad-levels.js +4 -4
  67. package/node_modules/logform/dist/printf.js +1 -1
  68. package/node_modules/logform/dist/simple.js +1 -1
  69. package/node_modules/logform/dist/splat.js +2 -2
  70. package/node_modules/logform/dist/uncolorize.js +1 -1
  71. package/node_modules/logform/errors.js +1 -1
  72. package/node_modules/logform/index.d.ts +36 -0
  73. package/node_modules/logform/index.js +19 -20
  74. package/node_modules/logform/json.js +7 -7
  75. package/node_modules/logform/logstash.js +1 -1
  76. package/node_modules/logform/package.json +10 -9
  77. package/node_modules/logform/simple.js +1 -1
  78. package/node_modules/logform/uncolorize.js +1 -1
  79. package/node_modules/safe-stable-stringify/CHANGELOG.md +75 -0
  80. package/node_modules/safe-stable-stringify/LICENSE +21 -0
  81. package/node_modules/safe-stable-stringify/esm/package.json +4 -0
  82. package/node_modules/safe-stable-stringify/esm/wrapper.js +6 -0
  83. package/node_modules/safe-stable-stringify/index.d.ts +18 -0
  84. package/node_modules/safe-stable-stringify/index.js +618 -0
  85. package/node_modules/safe-stable-stringify/package.json +69 -0
  86. package/node_modules/safe-stable-stringify/readme.md +170 -0
  87. package/node_modules/safe-stable-stringify/tsconfig.json +22 -0
  88. package/node_modules/winston/LICENSE +18 -18
  89. package/node_modules/winston/README.md +1231 -1230
  90. package/node_modules/winston/dist/winston/common.js +10 -10
  91. package/node_modules/winston/dist/winston/config/index.js +17 -17
  92. package/node_modules/winston/dist/winston/container.js +46 -46
  93. package/node_modules/winston/dist/winston/create-logger.js +28 -24
  94. package/node_modules/winston/dist/winston/exception-handler.js +49 -49
  95. package/node_modules/winston/dist/winston/exception-stream.js +27 -27
  96. package/node_modules/winston/dist/winston/logger.js +152 -138
  97. package/node_modules/winston/dist/winston/profiler.js +22 -22
  98. package/node_modules/winston/dist/winston/rejection-handler.js +54 -54
  99. package/node_modules/winston/dist/winston/tail-file.js +14 -14
  100. package/node_modules/winston/dist/winston/transports/console.js +31 -31
  101. package/node_modules/winston/dist/winston/transports/file.js +101 -101
  102. package/node_modules/winston/dist/winston/transports/http.js +119 -41
  103. package/node_modules/winston/dist/winston/transports/index.js +17 -17
  104. package/node_modules/winston/dist/winston/transports/stream.js +24 -24
  105. package/node_modules/winston/dist/winston.js +91 -97
  106. package/node_modules/winston/index.d.ts +213 -193
  107. package/node_modules/winston/lib/winston/common.js +61 -61
  108. package/node_modules/winston/lib/winston/config/index.d.ts +99 -98
  109. package/node_modules/winston/lib/winston/config/index.js +35 -35
  110. package/node_modules/winston/lib/winston/container.js +114 -114
  111. package/node_modules/winston/lib/winston/create-logger.js +104 -104
  112. package/node_modules/winston/lib/winston/exception-handler.js +245 -245
  113. package/node_modules/winston/lib/winston/exception-stream.js +54 -54
  114. package/node_modules/winston/lib/winston/logger.js +676 -667
  115. package/node_modules/winston/lib/winston/profiler.js +51 -51
  116. package/node_modules/winston/lib/winston/rejection-handler.js +251 -251
  117. package/node_modules/winston/lib/winston/tail-file.js +124 -124
  118. package/node_modules/winston/lib/winston/transports/console.js +117 -117
  119. package/node_modules/winston/lib/winston/transports/file.js +695 -695
  120. package/node_modules/winston/lib/winston/transports/http.js +267 -202
  121. package/node_modules/winston/lib/winston/transports/index.d.ts +103 -100
  122. package/node_modules/winston/lib/winston/transports/index.js +56 -56
  123. package/node_modules/winston/lib/winston/transports/stream.js +63 -63
  124. package/node_modules/winston/lib/winston.js +176 -182
  125. package/node_modules/winston/node_modules/winston-transport/.babelrc +3 -0
  126. package/node_modules/winston/node_modules/winston-transport/.eslintrc +7 -0
  127. package/node_modules/winston/node_modules/winston-transport/.gitattributes +1 -0
  128. package/node_modules/winston/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  129. package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
  130. package/node_modules/winston/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -0
  131. package/node_modules/winston/node_modules/winston-transport/CHANGELOG.md +126 -0
  132. package/node_modules/winston/node_modules/winston-transport/LICENSE +22 -0
  133. package/node_modules/winston/node_modules/winston-transport/README.md +50 -0
  134. package/node_modules/winston/node_modules/winston-transport/dist/index.js +215 -0
  135. package/node_modules/winston/node_modules/winston-transport/dist/legacy.js +116 -0
  136. package/node_modules/winston/node_modules/winston-transport/index.d.ts +39 -0
  137. package/node_modules/winston/node_modules/winston-transport/index.js +215 -0
  138. package/node_modules/winston/node_modules/winston-transport/legacy.js +119 -0
  139. package/node_modules/winston/node_modules/winston-transport/package.json +56 -0
  140. package/node_modules/winston/package.json +76 -75
  141. package/package.json +9 -6
  142. package/node_modules/@dabh/diagnostics/example.png +0 -0
  143. package/node_modules/color-string/CHANGELOG.md +0 -18
  144. package/node_modules/colorspace/test.js +0 -14
  145. package/node_modules/fecha/CHANGELOG.md +0 -67
  146. package/node_modules/logform/.travis.yml +0 -17
  147. package/node_modules/winston/CHANGELOG.md +0 -560
@@ -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
+ };
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@colors/colors",
3
+ "description": "get colors in your node.js console",
4
+ "version": "1.5.0",
5
+ "author": "DABH",
6
+ "contributors": [
7
+ {
8
+ "name": "DABH",
9
+ "url": "https://github.com/DABH"
10
+ }
11
+ ],
12
+ "homepage": "https://github.com/DABH/colors.js",
13
+ "bugs": "https://github.com/DABH/colors.js/issues",
14
+ "keywords": [
15
+ "ansi",
16
+ "terminal",
17
+ "colors"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "http://github.com/DABH/colors.js.git"
22
+ },
23
+ "license": "MIT",
24
+ "scripts": {
25
+ "lint": "eslint . --fix",
26
+ "test": "export FORCE_COLOR=1 && node tests/basic-test.js && node tests/safe-test.js"
27
+ },
28
+ "engines": {
29
+ "node": ">=0.1.90"
30
+ },
31
+ "main": "lib/index.js",
32
+ "files": [
33
+ "examples",
34
+ "lib",
35
+ "LICENSE",
36
+ "safe.js",
37
+ "themes",
38
+ "index.d.ts",
39
+ "safe.d.ts"
40
+ ],
41
+ "devDependencies": {
42
+ "eslint": "^5.2.0",
43
+ "eslint-config-google": "^0.11.0"
44
+ }
45
+
46
+ ,"_resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz"
47
+ ,"_integrity": "sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ=="
48
+ ,"_from": "@colors/colors@1.5.0"
49
+ }
@@ -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;
@@ -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
+ };
@@ -19,7 +19,7 @@ The module is released in the public npm registry and can be installed by
19
19
  running:
20
20
 
21
21
  ```
22
- npm install --save diagnostics
22
+ npm install --save @dabh/diagnostics
23
23
  ```
24
24
 
25
25
  ## Usage
@@ -47,7 +47,7 @@ npm install --save diagnostics
47
47
 
48
48
  ### Introduction
49
49
 
50
- To create a new logger simply `require` the `diagnostics` module and call
50
+ To create a new logger simply `require` the `@dabh/diagnostics` module and call
51
51
  the returned function. It accepts 2 arguments:
52
52
 
53
53
  1. `namespace` **Required** This is the namespace of your logger so we know if we need to
@@ -62,8 +62,8 @@ the returned function. It accepts 2 arguments:
62
62
  option to `false` to disable it.
63
63
 
64
64
  ```js
65
- const debug = require('diagnostics')('foo:bar:baz');
66
- const debug = require('diagnostics')('foo:bar:baz', { options });
65
+ const debug = require('@dabh/diagnostics')('foo:bar:baz');
66
+ const debug = require('@dabh/diagnostics')('foo:bar:baz', { options });
67
67
 
68
68
  debug('this is a log message %s', 'that will only show up when enabled');
69
69
  debug('that is pretty neat', { log: 'more', data: 1337 });
@@ -102,7 +102,7 @@ of past log messages, and output those when an uncaught exception happens in
102
102
  your application so you have additional context
103
103
 
104
104
  ```js
105
- const diagnostics = require('diagnostics');
105
+ const diagnostics = require('@dabh/diagnostics');
106
106
 
107
107
  let index = 0;
108
108
  const limit = 200;
@@ -133,7 +133,7 @@ queue of all debug messages that can be referenced when your application crashes
133
133
 
134
134
  #### Production and development builds
135
135
 
136
- When you `require` the `diagnostics` module you will be given a logger that is
136
+ When you `require` the `@dabh/diagnostics` module you will be given a logger that is
137
137
  optimized for `development` so it can provide the best developer experience
138
138
  possible.
139
139
 
@@ -149,7 +149,7 @@ messages in production. You can `force` the debugger to be enabled, and
149
149
  supply a [custom logger](#loggers).
150
150
 
151
151
  ```js
152
- const diagnostics = require('diagnostics');
152
+ const diagnostics = require('@dabh/diagnostics');
153
153
  const debug = debug('foo:bar', { force: true });
154
154
 
155
155
  //
@@ -197,7 +197,7 @@ The returned logger will have a `.enabled` property assigned to it. This boolean
197
197
  can be used to check if the logger was enabled:
198
198
 
199
199
  ```js
200
- const debug = require('diagnostics')('foo:bar');
200
+ const debug = require('@dabh/diagnostics')('foo:bar');
201
201
 
202
202
  if (debug.enabled) {
203
203
  //
@@ -216,7 +216,7 @@ This property is exposed as:
216
216
  This is the namespace that you originally provided to the function.
217
217
 
218
218
  ```js
219
- const debug = require('diagnostics')('foo:bar');
219
+ const debug = require('@dabh/diagnostics')('foo:bar');
220
220
 
221
221
  console.log(debug.namespace); // foo:bar
222
222
  ```
@@ -235,7 +235,7 @@ The `dev` and `prod` booleans on the returned logger indicate if you have a
235
235
  production or development version of the logger.
236
236
 
237
237
  ```js
238
- const debug = require('diagnostics')('foo:bar');
238
+ const debug = require('@dabh/diagnostics')('foo:bar');
239
239
 
240
240
  if (debug.prod) {
241
241
  // do stuff
@@ -260,7 +260,7 @@ want. It receives 2 arguments:
260
260
  2. `args` An array of the log messages that needs to be written.
261
261
 
262
262
  ```js
263
- const debug = require('diagnostics')('foo:more:namespaces');
263
+ const debug = require('@dabh/diagnostics')('foo:more:namespaces');
264
264
 
265
265
  debug.use(function logger(meta, args) {
266
266
  console.log(meta);
@@ -285,7 +285,7 @@ message after modification. The function receives 2 arguments:
285
285
  initially created.
286
286
 
287
287
  ```js
288
- const debug = require('diagnostics')('example:modifiers');
288
+ const debug = require('@dabh/diagnostics')('example:modifiers');
289
289
 
290
290
  debug.modify(function (message, options) {
291
291
  return messages;
@@ -307,7 +307,7 @@ should be a function returns a boolean that indicates if the passed in
307
307
  `namespace` is allowed to write log messages.
308
308
 
309
309
  ```js
310
- const diagnostics = require('diagnostics');
310
+ const diagnostics = require('@dabh/diagnostics');
311
311
  const debug = diagnostics('foo:bar');
312
312
 
313
313
  debug.use(function (namespace) {
@@ -335,7 +335,7 @@ For example, you want the messages to be prefixed with the date-time of when
335
335
  the log message occured:
336
336
 
337
337
  ```js
338
- const diagnostics = require('diagnostics');
338
+ const diagnostics = require('@dabh/diagnostics');
339
339
 
340
340
  diagnostics.modify(function datetime(args, options) {
341
341
  args.unshift(new Date());
@@ -378,9 +378,9 @@ will receive the `namespace` of a logger as argument and it should return a
378
378
  boolean that indicates if that logger should be enabled or not.
379
379
 
380
380
  ```js
381
- const debug = require('diagnostics')('example:namespace');
381
+ const debug = require('@dabh/diagnostics')('example:namespace');
382
382
 
383
- debug.adapter(require('diagnostics/adapters/localstorage'));
383
+ debug.adapter(require('@dabh/diagnostics/adapters/localstorage'));
384
384
  ```
385
385
 
386
386
  The modifiers are only enabled for `development`. The following adapters are
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dabh/diagnostics",
3
- "version": "2.0.2",
3
+ "version": "2.0.3",
4
4
  "description": "Tools for debugging your node.js modules and event loop",
5
5
  "main": "./node",
6
6
  "browser": "./browser",
@@ -37,16 +37,16 @@
37
37
  },
38
38
  "homepage": "https://github.com/3rd-Eden/diagnostics",
39
39
  "devDependencies": {
40
- "assume": "2.1.x",
40
+ "assume": "2.3.x",
41
41
  "asyncstorageapi": "^1.0.2",
42
- "mocha": "5.2.x",
43
- "nyc": "^14.1.1",
42
+ "mocha": "9.2.x",
43
+ "nyc": "^15.1.0",
44
44
  "objstorage": "^1.0.0",
45
45
  "pre-commit": "1.2.x",
46
46
  "require-poisoning": "^2.0.0",
47
- "webpack": "^4.29.5",
47
+ "webpack": "4.x",
48
48
  "webpack-bundle-size-analyzer": "^3.0.0",
49
- "webpack-cli": "^3.2.3"
49
+ "webpack-cli": "3.x"
50
50
  },
51
51
  "dependencies": {
52
52
  "colorspace": "1.1.x",
@@ -62,7 +62,7 @@
62
62
  "test": "test"
63
63
  }
64
64
 
65
- ,"_resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.2.tgz"
66
- ,"_integrity": "sha512-+A1YivoVDNNVCdfozHSR8v/jyuuLTMXwjWuxPFlFlUapXoGc+Gj9mDlTDDfrwl7rXCl2tNZ0kE8sIBO6YOn96Q=="
67
- ,"_from": "@dabh/diagnostics@2.0.2"
65
+ ,"_resolved": "https://registry.npmjs.org/@dabh/diagnostics/-/diagnostics-2.0.3.tgz"
66
+ ,"_integrity": "sha512-hrlQOIi7hAfzsMqlGSFyVucrx38O+j6wiGOf//H2ecvIEqYN4ADBSS2iLMh5UFyDunCNniUIPk/q3riFv45xRA=="
67
+ ,"_from": "@dabh/diagnostics@2.0.3"
68
68
  }
@@ -54,6 +54,11 @@ color.rgbNumber() // 16777215 (0xffffff)
54
54
  ```
55
55
  Get the rgb number value.
56
56
 
57
+ ```js
58
+ color.hex() // #ffffff
59
+ ```
60
+ Get the hex value.
61
+
57
62
  ```js
58
63
  color.red() // 255
59
64
  ```
@@ -88,7 +93,11 @@ Get whether the color is "light" or "dark", useful for deciding text color.
88
93
  color.negate() // rgb(0, 100, 255) -> rgb(255, 155, 0)
89
94
 
90
95
  color.lighten(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 75%)
96
+ color.lighten(0.5) // hsl(100, 50%, 0) -> hsl(100, 50%, 0)
91
97
  color.darken(0.5) // hsl(100, 50%, 50%) -> hsl(100, 50%, 25%)
98
+ color.darken(0.5) // hsl(100, 50%, 0) -> hsl(100, 50%, 0)
99
+
100
+ color.lightness(50) // hsl(100, 50%, 10%) -> hsl(100, 50%, 50%)
92
101
 
93
102
  color.saturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 75%, 50%)
94
103
  color.desaturate(0.5) // hsl(100, 50%, 50%) -> hsl(100, 25%, 50%)
@@ -39,7 +39,7 @@ function Color(obj, model) {
39
39
  var i;
40
40
  var channels;
41
41
 
42
- if (!obj) {
42
+ if (obj == null) { // eslint-disable-line no-eq-null,eqeqeq
43
43
  this.model = 'rgb';
44
44
  this.color = [0, 0, 0];
45
45
  this.valpha = 1;
@@ -366,6 +366,9 @@ Color.prototype = {
366
366
  mix: function (mixinColor, weight) {
367
367
  // ported from sass implementation in C
368
368
  // https://github.com/sass/libsass/blob/0e6b4a2850092356aa3ece07c6b249f0221caced/functions.cpp#L209
369
+ if (!mixinColor || !mixinColor.rgb) {
370
+ throw new Error('Argument to "mix" was not a Color instance, but rather an instance of ' + typeof mixinColor);
371
+ }
369
372
  var color1 = mixinColor.rgb();
370
373
  var color2 = this.rgb();
371
374
  var p = weight === undefined ? 0.5 : weight;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "color",
3
- "version": "3.0.0",
3
+ "version": "3.2.1",
4
4
  "description": "Color conversion and manipulation with CSS string support",
5
5
  "keywords": [
6
6
  "color",
@@ -30,15 +30,15 @@
30
30
  "test": "mocha"
31
31
  },
32
32
  "dependencies": {
33
- "color-convert": "^1.9.1",
34
- "color-string": "^1.5.2"
33
+ "color-convert": "^1.9.3",
34
+ "color-string": "^1.6.0"
35
35
  },
36
36
  "devDependencies": {
37
- "mocha": "^2.2.5",
38
- "xo": "^0.12.1"
37
+ "mocha": "9.0.2",
38
+ "xo": "0.12.1"
39
39
  }
40
40
 
41
- ,"_resolved": "https://registry.npmjs.org/color/-/color-3.0.0.tgz"
42
- ,"_integrity": "sha512-jCpd5+s0s0t7p3pHQKpnJ0TpQKKdleP71LWcA0aqiljpiuAkOSUFN/dyH8ZwF0hRmFlrIuRhufds1QyEP9EB+w=="
43
- ,"_from": "color@3.0.0"
41
+ ,"_resolved": "https://registry.npmjs.org/color/-/color-3.2.1.tgz"
42
+ ,"_integrity": "sha512-aBl7dZI9ENN6fUGC7mWpMTPNHmWUSNan9tuWN6ahh5ZLNk9baLJOnSMlrQkHcrfFgz2/RigjUVAjdx36VcemKA=="
43
+ ,"_from": "color@3.2.1"
44
44
  }
@@ -1,7 +1,5 @@
1
1
  # color-string
2
2
 
3
- [![Build Status](https://travis-ci.org/Qix-/color-string.svg?branch=master)](https://travis-ci.org/Qix-/color-string)
4
-
5
3
  > library for parsing and generating CSS color strings.
6
4
 
7
5
  ## Install
@@ -21,15 +19,21 @@ colorString.get('#FFF') // {model: 'rgb', value: [255,
21
19
  colorString.get('#FFFA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
22
20
  colorString.get('#FFFFFFAA') // {model: 'rgb', value: [255, 255, 255, 0.67]}
23
21
  colorString.get('hsl(360, 100%, 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
22
+ colorString.get('hsl(360 100% 50%)') // {model: 'hsl', value: [0, 100, 50, 1]}
24
23
  colorString.get('hwb(60, 3%, 60%)') // {model: 'hwb', value: [60, 3, 60, 1]}
25
24
 
26
25
  colorString.get.rgb('#FFF') // [255, 255, 255, 1]
27
26
  colorString.get.rgb('blue') // [0, 0, 255, 1]
28
27
  colorString.get.rgb('rgba(200, 60, 60, 0.3)') // [200, 60, 60, 0.3]
28
+ colorString.get.rgb('rgba(200 60 60 / 0.3)') // [200, 60, 60, 0.3]
29
+ colorString.get.rgb('rgba(200 60 60 / 30%)') // [200, 60, 60, 0.3]
29
30
  colorString.get.rgb('rgb(200, 200, 200)') // [200, 200, 200, 1]
31
+ colorString.get.rgb('rgb(200 200 200)') // [200, 200, 200, 1]
30
32
 
31
33
  colorString.get.hsl('hsl(360, 100%, 50%)') // [0, 100, 50, 1]
34
+ colorString.get.hsl('hsl(360 100% 50%)') // [0, 100, 50, 1]
32
35
  colorString.get.hsl('hsla(360, 60%, 50%, 0.4)') // [0, 60, 50, 0.4]
36
+ colorString.get.hsl('hsl(360 60% 50% / 0.4)') // [0, 60, 50, 0.4]
33
37
 
34
38
  colorString.get.hwb('hwb(60, 3%, 60%)') // [60, 3, 60, 1]
35
39
  colorString.get.hwb('hwb(60, 3%, 60%, 0.6)') // [60, 3, 60, 0.6]
@@ -1,12 +1,13 @@
1
1
  /* MIT license */
2
2
  var colorNames = require('color-name');
3
3
  var swizzle = require('simple-swizzle');
4
+ var hasOwnProperty = Object.hasOwnProperty;
4
5
 
5
6
  var reverseNames = {};
6
7
 
7
8
  // create a list of reverse color names
8
9
  for (var name in colorNames) {
9
- if (colorNames.hasOwnProperty(name)) {
10
+ if (hasOwnProperty.call(colorNames, name)) {
10
11
  reverseNames[colorNames[name]] = name;
11
12
  }
12
13
  }
@@ -49,9 +50,9 @@ cs.get.rgb = function (string) {
49
50
 
50
51
  var abbr = /^#([a-f0-9]{3,4})$/i;
51
52
  var hex = /^#([a-f0-9]{6})([a-f0-9]{2})?$/i;
52
- var rgba = /^rgba?\(\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*,\s*([+-]?\d+)\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
53
- var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*,\s*([+-]?[\d\.]+)\%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
54
- var keyword = /(\D+)/;
53
+ var rgba = /^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
54
+ var per = /^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/;
55
+ var keyword = /^(\w+)$/;
55
56
 
56
57
  var rgb = [0, 0, 0, 1];
57
58
  var match;
@@ -88,7 +89,11 @@ cs.get.rgb = function (string) {
88
89
  }
89
90
 
90
91
  if (match[4]) {
91
- rgb[3] = parseFloat(match[4]);
92
+ if (match[5]) {
93
+ rgb[3] = parseFloat(match[4]) * 0.01;
94
+ } else {
95
+ rgb[3] = parseFloat(match[4]);
96
+ }
92
97
  }
93
98
  } else if (match = string.match(per)) {
94
99
  for (i = 0; i < 3; i++) {
@@ -96,19 +101,22 @@ cs.get.rgb = function (string) {
96
101
  }
97
102
 
98
103
  if (match[4]) {
99
- rgb[3] = parseFloat(match[4]);
104
+ if (match[5]) {
105
+ rgb[3] = parseFloat(match[4]) * 0.01;
106
+ } else {
107
+ rgb[3] = parseFloat(match[4]);
108
+ }
100
109
  }
101
110
  } else if (match = string.match(keyword)) {
102
111
  if (match[1] === 'transparent') {
103
112
  return [0, 0, 0, 0];
104
113
  }
105
114
 
106
- rgb = colorNames[match[1]];
107
-
108
- if (!rgb) {
115
+ if (!hasOwnProperty.call(colorNames, match[1])) {
109
116
  return null;
110
117
  }
111
118
 
119
+ rgb = colorNames[match[1]];
112
120
  rgb[3] = 1;
113
121
 
114
122
  return rgb;
@@ -129,12 +137,12 @@ cs.get.hsl = function (string) {
129
137
  return null;
130
138
  }
131
139
 
132
- var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
140
+ var hsl = /^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
133
141
  var match = string.match(hsl);
134
142
 
135
143
  if (match) {
136
144
  var alpha = parseFloat(match[4]);
137
- var h = (parseFloat(match[1]) + 360) % 360;
145
+ var h = ((parseFloat(match[1]) % 360) + 360) % 360;
138
146
  var s = clamp(parseFloat(match[2]), 0, 100);
139
147
  var l = clamp(parseFloat(match[3]), 0, 100);
140
148
  var a = clamp(isNaN(alpha) ? 1 : alpha, 0, 1);
@@ -150,7 +158,7 @@ cs.get.hwb = function (string) {
150
158
  return null;
151
159
  }
152
160
 
153
- var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?[\d\.]+)\s*)?\)$/;
161
+ var hwb = /^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/;
154
162
  var match = string.match(hwb);
155
163
 
156
164
  if (match) {
@@ -229,6 +237,6 @@ function clamp(num, min, max) {
229
237
  }
230
238
 
231
239
  function hexDouble(num) {
232
- var str = num.toString(16).toUpperCase();
240
+ var str = Math.round(num).toString(16).toUpperCase();
233
241
  return (str.length < 2) ? '0' + str : str;
234
242
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "color-string",
3
3
  "description": "Parser and generator for CSS color strings",
4
- "version": "1.5.5",
4
+ "version": "1.9.0",
5
5
  "author": "Heather Arthur <fayearthur@gmail.com>",
6
6
  "contributors": [
7
7
  "Maxime Thirouin",
@@ -37,7 +37,7 @@
37
37
  "css"
38
38
  ]
39
39
 
40
- ,"_resolved": "https://registry.npmjs.org/color-string/-/color-string-1.5.5.tgz"
41
- ,"_integrity": "sha512-jgIoum0OfQfq9Whcfc2z/VhCNcmQjWbey6qBX0vqt7YICflUmBCh9E9CiQD5GSJ+Uehixm3NUwHVhqUAWRivZg=="
42
- ,"_from": "color-string@1.5.5"
40
+ ,"_resolved": "https://registry.npmjs.org/color-string/-/color-string-1.9.0.tgz"
41
+ ,"_integrity": "sha512-9Mrz2AQLefkH1UvASKj6v6hj/7eWgjnT/cVsR8CumieLoT+g900exWeNogqtweI8dxloXN9BDQTYro1oWu/5CQ=="
42
+ ,"_from": "color-string@1.9.0"
43
43
  }