HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/design.system/node_modules/@rushstack/terminal/lib/PrintUtilities.js.map
{"version":3,"file":"PrintUtilities.js","sourceRoot":"","sources":["../src/PrintUtilities.ts"],"names":[],"mappings":";AAAA,4FAA4F;AAC5F,2DAA2D;;;AAE3D,oEAAoD;AAGpD;;;;GAIG;AACU,QAAA,qBAAqB,GAAW,EAAE,CAAC;AAEhD;;;;GAIG;AACH,MAAa,cAAc;IACzB;;OAEG;IACI,MAAM,CAAC,eAAe;;QAC3B,OAAO,MAAA,OAAO,CAAC,MAAM,0CAAE,OAAO,CAAC;IACjC,CAAC;IA2BM,MAAM,CAAC,SAAS,CACrB,IAAY,EACZ,aAAsB,EACtB,kBAAoC;QAEpC,MAAM,YAAY,GAAa,cAAc,CAAC,gBAAgB,CAC5D,IAAI,EACJ,aAAa,EACb,kBAAwC,CAAC,kCAAkC;SAC5E,CAAC;QACF,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACjC,CAAC;IA+BM,MAAM,CAAC,gBAAgB,CAC5B,IAAY,EACZ,aAAsB,EACtB,kBAAoC;;QAEpC,IAAI,UAAkB,CAAC;QACvB,QAAQ,OAAO,kBAAkB,EAAE,CAAC;YAClC,KAAK,QAAQ;gBACX,UAAU,GAAG,GAAG,CAAC,MAA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AQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;YACrD,KAAK,MAAM,WAAW,IAAI,YAAY,EAAE,CAAC;gBACvC,MAAM,OAAO,GAAW,QAAQ,GAAG,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC;gBAC1D,MAAM,WAAW,GAAW,IAAI,CAAC,KAAK,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;gBACpD,MAAM,YAAY,GAAW,OAAO,GAAG,WAAW,CAAC;gBACnD,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,WAAW,CAAC,GAAG,WAAW,GAAG,GAAG,CAAC,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YAC/F,CAAC;YACD,QAAQ,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,MAAM,CAAC,QAAQ,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;QACvD,CAAC;IACH,CAAC;CACF;AArND,wCAqNC","sourcesContent":["// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.\n// See LICENSE in the project root for license information.\n\nimport { Text } from '@rushstack/node-core-library';\nimport type { ITerminal } from './ITerminal';\n\n/**\n * A sensible fallback column width for consoles.\n *\n * @public\n */\nexport const DEFAULT_CONSOLE_WIDTH: number = 80;\n\n/**\n * A collection of utilities for printing messages to the console.\n *\n * @public\n */\nexport class PrintUtilities {\n  /**\n   * Returns the width of the console, measured in columns\n   */\n  public static getConsoleWidth(): number | undefined {\n    return process.stdout?.columns;\n  }\n\n  /**\n   * Applies word wrapping.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param indent - The number of spaces to indent the wrapped lines, defaults to 0\n   */\n  public static wrapWords(text: string, maxLineLength?: number, indent?: number): string;\n  /**\n   * Applies word wrapping.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param linePrefix - The string to prefix each line with, defaults to ''\n   */\n  public static wrapWords(text: string, maxLineLength?: number, linePrefix?: string): string;\n  /**\n   * Applies word wrapping.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param indentOrLinePrefix - The number of spaces to indent the wrapped lines or the string to prefix\n   * each line with, defaults to no prefix\n   */\n  public static wrapWords(text: string, maxLineLength?: number, indentOrLinePrefix?: number | string): string;\n  public static wrapWords(\n    text: string,\n    maxLineLength?: number,\n    indentOrLinePrefix?: number | string\n  ): string {\n    const wrappedLines: string[] = PrintUtilities.wrapWordsToLines(\n      text,\n      maxLineLength,\n      indentOrLinePrefix as string | undefined // TS is confused by the overloads\n    );\n    return wrappedLines.join('\\n');\n  }\n\n  /**\n   * Applies word wrapping and returns an array of lines.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param indent - The number of spaces to indent the wrapped lines, defaults to 0\n   */\n  public static wrapWordsToLines(text: string, maxLineLength?: number, indent?: number): string[];\n  /**\n   * Applies word wrapping and returns an array of lines.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param linePrefix - The string to prefix each line with, defaults to ''\n   */\n  public static wrapWordsToLines(text: string, maxLineLength?: number, linePrefix?: string): string[];\n  /**\n   * Applies word wrapping and returns an array of lines.\n   *\n   * @param text - The text to wrap\n   * @param maxLineLength - The maximum length of a line, defaults to the console width\n   * @param indentOrLinePrefix - The number of spaces to indent the wrapped lines or the string to prefix\n   * each line with, defaults to no prefix\n   */\n  public static wrapWordsToLines(\n    text: string,\n    maxLineLength?: number,\n    indentOrLinePrefix?: number | string\n  ): string[];\n  public static wrapWordsToLines(\n    text: string,\n    maxLineLength?: number,\n    indentOrLinePrefix?: number | string\n  ): string[] {\n    let linePrefix: string;\n    switch (typeof indentOrLinePrefix) {\n      case 'number':\n        linePrefix = ' '.repeat(indentOrLinePrefix);\n        break;\n      case 'string':\n        linePrefix = indentOrLinePrefix;\n        break;\n      default:\n        linePrefix = '';\n        break;\n    }\n\n    const linePrefixLength: number = linePrefix.length;\n\n    if (!maxLineLength) {\n      maxLineLength = PrintUtilities.getConsoleWidth() || DEFAULT_CONSOLE_WIDTH;\n    }\n\n    // Apply word wrapping and the provided line prefix, while also respecting existing newlines\n    // and prefix spaces that may exist in the text string already.\n    const lines: string[] = Text.splitByNewLines(text);\n\n    const wrappedLines: string[] = [];\n    for (const line of lines) {\n      if (line.length + linePrefixLength <= maxLineLength) {\n        wrappedLines.push(linePrefix + line);\n      } else {\n        const lineAdditionalPrefix: string = line.match(/^\\s*/)?.[0] || '';\n        const whitespaceRegexp: RegExp = /\\s+/g;\n        let currentWhitespaceMatch: RegExpExecArray | null = null;\n        let previousWhitespaceMatch: RegExpExecArray | undefined;\n        let currentLineStartIndex: number = lineAdditionalPrefix.length;\n        let previousBreakRanOver: boolean = false;\n        while ((currentWhitespaceMatch = whitespaceRegexp.exec(line)) !== null) {\n          if (currentWhitespaceMatch.index + linePrefixLength - currentLineStartIndex > maxLineLength) {\n            let whitespaceToSplitAt: RegExpExecArray | undefined;\n            if (\n              !previousWhitespaceMatch ||\n              // Handle the case where there are two words longer than the maxLineLength in a row\n              previousBreakRanOver\n            ) {\n              whitespaceToSplitAt = currentWhitespaceMatch;\n            } else {\n              whitespaceToSplitAt = previousWhitespaceMatch;\n            }\n\n            wrappedLines.push(\n              linePrefix +\n                lineAdditionalPrefix +\n                line.substring(currentLineStartIndex, whitespaceToSplitAt.index)\n            );\n            previousBreakRanOver = whitespaceToSplitAt.index - currentLineStartIndex > maxLineLength;\n            currentLineStartIndex = whitespaceToSplitAt.index + whitespaceToSplitAt[0].length;\n          } else {\n            previousBreakRanOver = false;\n          }\n\n          previousWhitespaceMatch = currentWhitespaceMatch;\n        }\n\n        if (\n          previousWhitespaceMatch &&\n          line.length + linePrefixLength - currentLineStartIndex > maxLineLength\n        ) {\n          const whitespaceToSplitAt: RegExpExecArray = previousWhitespaceMatch;\n\n          wrappedLines.push(\n            linePrefix +\n              lineAdditionalPrefix +\n              line.substring(currentLineStartIndex, whitespaceToSplitAt.index)\n          );\n          currentLineStartIndex = whitespaceToSplitAt.index + whitespaceToSplitAt[0].length;\n        }\n\n        if (currentLineStartIndex < line.length) {\n          wrappedLines.push(linePrefix + lineAdditionalPrefix + line.substring(currentLineStartIndex));\n        }\n      }\n    }\n\n    return wrappedLines;\n  }\n\n  /**\n   * Displays a message in the console wrapped in a box UI.\n   *\n   * @param message - The message to display.\n   * @param terminal - The terminal to write the message to.\n   * @param boxWidth - The width of the box, defaults to half of the console width.\n   */\n  public static printMessageInBox(message: string, terminal: ITerminal, boxWidth?: number): void {\n    if (!boxWidth) {\n      const consoleWidth: number = PrintUtilities.getConsoleWidth() || DEFAULT_CONSOLE_WIDTH;\n      boxWidth = Math.floor(consoleWidth / 2);\n    }\n\n    const maxLineLength: number = boxWidth - 10;\n    const wrappedMessageLines: string[] = PrintUtilities.wrapWordsToLines(message, maxLineLength);\n    let longestLineLength: number = 0;\n    const trimmedLines: string[] = [];\n    for (const line of wrappedMessageLines) {\n      const trimmedLine: string = line.trim();\n      trimmedLines.push(trimmedLine);\n      longestLineLength = Math.max(longestLineLength, trimmedLine.length);\n    }\n\n    if (longestLineLength > boxWidth - 2) {\n      // If the longest line is longer than the box, print bars above and below the message\n      // ═════════════\n      //  Message\n      // ═════════════\n      const headerAndFooter: string = ` ${'═'.repeat(boxWidth)}`;\n      terminal.writeLine(headerAndFooter);\n      for (const line of wrappedMessageLines) {\n        terminal.writeLine(` ${line}`);\n      }\n\n      terminal.writeLine(headerAndFooter);\n    } else {\n      // ╔═══════════╗\n      // ║  Message  ║\n      // ╚═══════════╝\n      terminal.writeLine(` ╔${'═'.repeat(boxWidth - 2)}╗`);\n      for (const trimmedLine of trimmedLines) {\n        const padding: number = boxWidth - trimmedLine.length - 2;\n        const leftPadding: number = Math.floor(padding / 2);\n        const rightPadding: number = padding - leftPadding;\n        terminal.writeLine(` ║${' '.repeat(leftPadding)}${trimmedLine}${' '.repeat(rightPadding)}║`);\n      }\n      terminal.writeLine(` ╚${'═'.repeat(boxWidth - 2)}╝`);\n    }\n  }\n}\n"]}