19 lines
2.2 KiB
JavaScript
19 lines
2.2 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
const tty_1 = __importDefault(require("tty"));
|
|
const DEFAULT_VIEWPORT_WIDTH_TTY = 78;
|
|
function default_1(outStream) {
|
|
if (outStream === process.stdout && tty_1.default.isatty(1)) {
|
|
const detectedViewportWidth = process.stdout.getWindowSize ?
|
|
process.stdout.getWindowSize()[0] :
|
|
tty_1.default.getWindowSize()[1];
|
|
return Math.max(detectedViewportWidth, DEFAULT_VIEWPORT_WIDTH_TTY);
|
|
}
|
|
return Infinity;
|
|
}
|
|
exports.default = default_1;
|
|
module.exports = exports.default;
|
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZ2V0LXZpZXdwb3J0LXdpZHRoLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL3V0aWxzL2dldC12aWV3cG9ydC13aWR0aC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7OztBQUFBLDhDQUF1QztBQUd2QyxNQUFNLDBCQUEwQixHQUFHLEVBQUUsQ0FBQztBQUV0QyxtQkFBeUIsU0FBaUI7SUFDdEMsSUFBSSxTQUFTLEtBQUssT0FBTyxDQUFDLE1BQU0sSUFBSSxhQUFHLENBQUMsTUFBTSxDQUFDLENBQUMsQ0FBQyxFQUFFO1FBQy9DLE1BQU0scUJBQXFCLEdBQUcsT0FBTyxDQUFDLE1BQU0sQ0FBQyxhQUFhLENBQUMsQ0FBQztZQUN4RCxPQUFPLENBQUMsTUFBTSxDQUFDLGFBQWEsRUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7WUFDbEMsYUFBOEIsQ0FBQyxhQUFhLEVBQUUsQ0FBQyxDQUFDLENBQUMsQ0FBQztRQUV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