File tree Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Expand file tree Collapse file tree 3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ const { codes: {
3333const { AssertionError, errorCache } = require ( 'internal/assert' ) ;
3434const { openSync, closeSync, readSync } = require ( 'fs' ) ;
3535const { inspect, types : { isPromise, isRegExp } } = require ( 'util' ) ;
36- const { EOL } = require ( 'os ' ) ;
36+ const { EOL } = require ( 'internal/constants ' ) ;
3737const { NativeModule } = require ( 'internal/bootstrap/loaders' ) ;
3838
3939// Escape control characters but not \n and \t to keep the line breaks and
Original file line number Diff line number Diff line change 11'use strict' ;
22
3+ const isWindows = process . platform === 'win32' ;
4+
35module . exports = {
46 // Alphabet chars.
57 CHAR_UPPERCASE_A : 65 , /* A */
@@ -45,4 +47,6 @@ module.exports = {
4547 // Digits
4648 CHAR_0 : 48 , /* 0 */
4749 CHAR_9 : 57 , /* 9 */
50+
51+ EOL : isWindows ? '\r\n' : '\n'
4852} ;
Original file line number Diff line number Diff line change 2222
2323'use strict' ;
2424
25- const { release } = require ( 'os' ) ;
26-
27- const OSRelease = release ( ) . split ( '.' ) ;
25+ let OSRelease ;
2826
2927const COLORS_2 = 1 ;
3028const COLORS_16 = 4 ;
@@ -75,6 +73,11 @@ function getColorDepth(env = process.env) {
7573 }
7674
7775 if ( process . platform === 'win32' ) {
76+ // Lazy load for startup performance.
77+ if ( OSRelease === undefined ) {
78+ const { release } = require ( 'os' ) ;
79+ OSRelease = release ( ) . split ( '.' ) ;
80+ }
7881 // Windows 10 build 10586 is the first Windows release that supports 256
7982 // colors. Windows 10 build 14931 is the first release that supports
8083 // 16m/TrueColor.
You can’t perform that action at this time.
0 commit comments