isUnicodeSupported.cjs 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. const process = require('node:process');
  5. /**
  6. * Originally copied from https://github.com/sindresorhus/is-unicode-supported/blob/506f27260df3636555714bf10ed40ab9e6a6c96e/index.js
  7. * @version 2.0.0
  8. * @summary Detect whether the terminal supports Unicode
  9. * @see https://github.com/sindresorhus/is-unicode-supported/pull/1#issuecomment-827321546
  10. * @see microsoft/terminal#13680
  11. */
  12. function isUnicodeSupported() {
  13. if (process.platform !== 'win32') {
  14. return process.env.TERM !== 'linux'; // Linux console (kernel)
  15. }
  16. return (
  17. Boolean(process.env.WT_SESSION) || // Windows Terminal
  18. Boolean(process.env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
  19. process.env.ConEmuTask === '{cmd::Cmder}' || // ConEmu and cmder
  20. process.env.TERM_PROGRAM === 'Terminus-Sublime' ||
  21. process.env.TERM_PROGRAM === 'vscode' ||
  22. process.env.TERM === 'xterm-256color' ||
  23. process.env.TERM === 'alacritty' ||
  24. process.env.TERMINAL_EMULATOR === 'JetBrains-JediTerm' ||
  25. process.env.TERM?.startsWith('rxvt-unicode') // fork of rxvt
  26. );
  27. }
  28. module.exports = isUnicodeSupported;