mirror of https://github.com/nodejs/node.git
os: lazy loaded
PR-URL: https://github.com/nodejs/node/pull/20567 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>pull/20567/merge
parent
2bfba0dd33
commit
d478e52fe0
|
@ -34,7 +34,7 @@ const { codes: {
|
||||||
const { AssertionError, errorCache } = require('internal/assert');
|
const { AssertionError, errorCache } = require('internal/assert');
|
||||||
const { openSync, closeSync, readSync } = require('fs');
|
const { openSync, closeSync, readSync } = require('fs');
|
||||||
const { inspect, types: { isPromise, isRegExp } } = require('util');
|
const { inspect, types: { isPromise, isRegExp } } = require('util');
|
||||||
const { EOL } = require('os');
|
const { EOL } = require('internal/constants');
|
||||||
const { NativeModule } = require('internal/bootstrap/loaders');
|
const { NativeModule } = require('internal/bootstrap/loaders');
|
||||||
|
|
||||||
// Escape control characters but not \n and \t to keep the line breaks and
|
// Escape control characters but not \n and \t to keep the line breaks and
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
const isWindows = process.platform === 'win32';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
// Alphabet chars.
|
// Alphabet chars.
|
||||||
CHAR_UPPERCASE_A: 65, /* A */
|
CHAR_UPPERCASE_A: 65, /* A */
|
||||||
|
@ -45,4 +47,6 @@ module.exports = {
|
||||||
// Digits
|
// Digits
|
||||||
CHAR_0: 48, /* 0 */
|
CHAR_0: 48, /* 0 */
|
||||||
CHAR_9: 57, /* 9 */
|
CHAR_9: 57, /* 9 */
|
||||||
|
|
||||||
|
EOL: isWindows ? '\r\n' : '\n'
|
||||||
};
|
};
|
||||||
|
|
|
@ -22,9 +22,7 @@
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const { release } = require('os');
|
let OSRelease;
|
||||||
|
|
||||||
const OSRelease = release().split('.');
|
|
||||||
|
|
||||||
const COLORS_2 = 1;
|
const COLORS_2 = 1;
|
||||||
const COLORS_16 = 4;
|
const COLORS_16 = 4;
|
||||||
|
@ -75,6 +73,11 @@ function getColorDepth(env = process.env) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
// Lazy load for startup performance.
|
||||||
|
if (OSRelease === undefined) {
|
||||||
|
const { release } = require('os');
|
||||||
|
OSRelease = release().split('.');
|
||||||
|
}
|
||||||
// Windows 10 build 10586 is the first Windows release that supports 256
|
// Windows 10 build 10586 is the first Windows release that supports 256
|
||||||
// colors. Windows 10 build 14931 is the first release that supports
|
// colors. Windows 10 build 14931 is the first release that supports
|
||||||
// 16m/TrueColor.
|
// 16m/TrueColor.
|
||||||
|
|
Loading…
Reference in New Issue