1 | ;
|
2 | /**
|
3 | * @license
|
4 | * Copyright Google LLC All Rights Reserved.
|
5 | *
|
6 | * Use of this source code is governed by an MIT-style license that can be
|
7 | * found in the LICENSE file at https://angular.io/license
|
8 | */
|
9 | Object.defineProperty(exports, "__esModule", { value: true });
|
10 | exports.colors = exports.removeColor = void 0;
|
11 | const ansiColors = require("ansi-colors");
|
12 | const tty_1 = require("tty");
|
13 | const supportsColor = process.stdout instanceof tty_1.WriteStream && process.stdout.getColorDepth() > 1;
|
14 | function removeColor(text) {
|
15 | // This has been created because when colors.enabled is false unstyle doesn't work
|
16 | // see: https://github.com/doowb/ansi-colors/blob/a4794363369d7b4d1872d248fc43a12761640d8e/index.js#L38
|
17 | return text.replace(ansiColors.ansiRegex, '');
|
18 | }
|
19 | exports.removeColor = removeColor;
|
20 | // Create a separate instance to prevent unintended global changes to the color configuration
|
21 | // Create function is not defined in the typings. See: https://github.com/doowb/ansi-colors/pull/44
|
22 | const colors = ansiColors.create();
|
23 | exports.colors = colors;
|
24 | colors.enabled = supportsColor;
|