Skip to content

Commit 14d19b5

Browse files
committedNov 3, 2021
Update for esm
1 parent 789414b commit 14d19b5

22 files changed

+29912
-9313
lines changed
 

‎.codeclimate.yml

+7-5
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ engines:
77
- javascript
88
eslint:
99
enabled: true
10+
checks:
11+
comma-dangle:
12+
enabled: false
1013
config:
1114
config: test/fixtures/config/.eslintrc
1215
fixme:
@@ -15,8 +18,7 @@ ratings:
1518
paths:
1619
- "src/**.js"
1720
exclude_paths:
18-
- test/
19-
- docs/
20-
- index.js
21-
- index.mjs
22-
- gulpfile.js
21+
- test/
22+
- docs/
23+
- index.js
24+
- index.d.ts

‎.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/coverage
2+
/node_modules
3+
*.sublime-project
4+
*.sublime-workspace

‎.travis.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ branches:
77
language: node_js
88
node_js:
99
- stable
10-
- 12
11-
- 10
10+
- "--lts"
1211
env:
1312
global:
1413
- CC_TEST_REPORTER_ID=dd40883297d249d8283f121d8613705b46ecd75bdc0787a8fc5ca82048def316
@@ -20,7 +19,7 @@ before_script:
2019
- chmod +x ./cc-test-reporter
2120
- ./cc-test-reporter before-build
2221
after_script:
23-
- "[ $TRAVIS_NODE_VERSION = stable ] && nyc report --reporter=lcov && ./cc-test-reporter
22+
- "[ $TRAVIS_NODE_VERSION = stable ] && c8 report --reporter=lcov --reporter=text && ./cc-test-reporter
2423
after-build --debug -t lcov --exit-code $TRAVIS_TEST_RESULT || echo 'Coverage skipped'"
2524
notifications:
2625
slack:

‎ava.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const config = {
2+
files: ['test/*.js'],
3+
}
4+
5+
export default config

‎gulpfile.js

-51
This file was deleted.

‎index.d.ts

+129
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
/**
2+
* Generate a verbosity console
3+
* @param {object} options - Configuration options.
4+
* @param {stream.writable} options.outStream - Stream to write normal output
5+
* @param {stream.writable} options.errorStream - Stream to write error output
6+
* @param {number} options.verbosity - The verboseness of output:
7+
* 0: Mute
8+
* 1: Errors
9+
* 2: Notice
10+
* 3: Log
11+
* 4: Info
12+
* 5: Debug
13+
* @param {string} options.timestamp - Timestamp format.
14+
* @param {string} options.namespace - Sparkles namespace to emit events to.
15+
* @param {boolean} options.global - Should changes to verbosity be made globally?
16+
* @param {string} options.prefix - Logging message prefix.
17+
* @return {Verbosity} Verbosity's console object.
18+
*/
19+
export class Verbosity extends Console {
20+
constructor({ outStream, errorStream, verbosity, timestamp, namespace, global, prefix, }?: {
21+
outStream: any;
22+
errorStream: any;
23+
verbosity?: number;
24+
timestamp: any;
25+
namespace: any;
26+
global: any;
27+
prefix: any;
28+
});
29+
willEmit: boolean;
30+
globalControl: boolean;
31+
timeFormatter: () => string;
32+
prefixFormatter: () => string;
33+
_stdout: any;
34+
_stderr: any;
35+
threshold: number;
36+
globalVerbosityController: any;
37+
emitter: any;
38+
matrix: any;
39+
/**
40+
* Set the current verbosity.
41+
* @param {number|string} level - The current level (0 to 5) or level name.
42+
* @return {number} The current verboseness (0 to 5).
43+
*/
44+
verbosity(level: number | string): number;
45+
/**
46+
* Can the requested logging level be written at this time.
47+
* @param {number} level - The requested level (0 to 5).
48+
* @return {boolean} `true` if ok to write.
49+
*/
50+
canWrite(level: number): boolean;
51+
/**
52+
* Route message and emit if required.
53+
* @private
54+
* @param {number} level Source logging level
55+
* @param {string} message Message to log
56+
* @param {...string} a Additional arguments to log
57+
*/
58+
private route;
59+
/**
60+
* Log a critical error message, if something breaks. (Level 1)
61+
* @param {string} message The critical error message to log.
62+
* @param {...string} args Additional arguments to log.
63+
*/
64+
critical(message: string, ...args: string[]): void;
65+
/**
66+
* Log a panic error message if something unexpected happens. (Level 1)
67+
* @param {string} message The panic message to log.
68+
* @param {...string} args Additional arguments to log.
69+
*/
70+
panic(message: string, ...args: string[]): void;
71+
/**
72+
* Log a emergency message, for when something needs emergency attention. (Level 1)
73+
* @param {string} message The debug message to log.
74+
* @param {...string} args Additional arguments to log.
75+
*/
76+
emergency(message: string, ...args: string[]): void;
77+
/**
78+
* Pretty prints object, similar to OS X's plutil -p. Defaults to zero depth.
79+
* @param {object} object The Object to print.
80+
* @param {number} depth How many object levels to print.
81+
* @param {boolean} color Print output in color, if supported.
82+
* @example
83+
* console.pretty(console)
84+
*
85+
* // Outputs:
86+
* Object: VerbosityMatrix
87+
* critical ▸ [Function]
88+
* error ▸ [Function ▸ bound ]
89+
* warn ▸ [Function ▸ bound ]
90+
* log ▸ [Function ▸ bound ]
91+
* info ▸ [Function ▸ bound ]
92+
* debug ▸ [Function]
93+
* canWrite ▸ [Function]
94+
* ...
95+
*/
96+
pretty(object: object, depth?: number, color?: boolean): void;
97+
/**
98+
* Helper function for pretty printing a summary of the current 'yargs' options.
99+
*
100+
* Only prints 'long options', `._` as 'arguments' and `$0` as 'self'.
101+
* @param {object} object The Yargs argv object to print.
102+
* @param {boolean} color Print output in color, if supported.
103+
* @example
104+
* console.yargs(yargs)
105+
*
106+
* // Outputs:
107+
* Object (yargs):
108+
* left ▸ 2
109+
* right ▸ 2
110+
* mode ▸ 'hard'
111+
* encoding ▸ 'utf8'
112+
* ...
113+
* self ▸ '/usr/local/bin/truwrap'
114+
*/
115+
yargs(object: object, color?: boolean): void;
116+
}
117+
/**
118+
* Create a new Verbosity object.
119+
* @param {object} options Options to pass to the factory.
120+
* @return {Verbosity} Verbosity's console object.
121+
*/
122+
export function createConsole(options: object): Verbosity;
123+
/**
124+
* Return the modules version metadata.
125+
* @function
126+
* @param {number} level Version format required.
127+
* @return {string} The version string.
128+
*/
129+
export function getVersion(level: number): string;

0 commit comments

Comments
 (0)
Please sign in to comment.