File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const { codes: {
33
33
const { AssertionError, errorCache } = require ( 'internal/assert' ) ;
34
34
const { openSync, closeSync, readSync } = require ( 'fs' ) ;
35
35
const { inspect, types : { isPromise, isRegExp } } = require ( 'util' ) ;
36
- const { EOL } = require ( 'os ' ) ;
36
+ const { EOL } = require ( 'internal/constants ' ) ;
37
37
const { NativeModule } = require ( 'internal/bootstrap/loaders' ) ;
38
38
39
39
// Escape control characters but not \n and \t to keep the line breaks and
Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
+ const isWindows = process . platform === 'win32' ;
4
+
3
5
module . exports = {
4
6
// Alphabet chars.
5
7
CHAR_UPPERCASE_A : 65 , /* A */
@@ -45,4 +47,6 @@ module.exports = {
45
47
// Digits
46
48
CHAR_0 : 48 , /* 0 */
47
49
CHAR_9 : 57 , /* 9 */
50
+
51
+ EOL : isWindows ? '\r\n' : '\n'
48
52
} ;
Original file line number Diff line number Diff line change 22
22
23
23
'use strict' ;
24
24
25
- const { release } = require ( 'os' ) ;
26
-
27
- const OSRelease = release ( ) . split ( '.' ) ;
25
+ let OSRelease ;
28
26
29
27
const COLORS_2 = 1 ;
30
28
const COLORS_16 = 4 ;
@@ -75,6 +73,11 @@ function getColorDepth(env = process.env) {
75
73
}
76
74
77
75
if ( process . platform === 'win32' ) {
76
+ // Lazy load for startup performance.
77
+ if ( OSRelease === undefined ) {
78
+ const { release } = require ( 'os' ) ;
79
+ OSRelease = release ( ) . split ( '.' ) ;
80
+ }
78
81
// Windows 10 build 10586 is the first Windows release that supports 256
79
82
// colors. Windows 10 build 14931 is the first release that supports
80
83
// 16m/TrueColor.
You can’t perform that action at this time.
0 commit comments