MCPcopy
hub / github.com/vitejs/vite / formatAndTruncateFileList

Function formatAndTruncateFileList

packages/vite/src/node/utils.ts:1888–1908  ·  view source on GitHub ↗
(files: string[])

Source from the content-addressed store, hash-verified

1886}
1887
1888export function formatAndTruncateFileList(files: string[]): {
1889 formatted: string
1890 truncated: boolean
1891} {
1892 const MAX_LOG_LENGTH = 500
1893 let log = ''
1894 let truncated = false
1895 for (let i = 0; i < files.length; i++) {
1896 const file = files[i]
1897 if (log === '') {
1898 log = file
1899 } else if (log.length + 2 + file.length < MAX_LOG_LENGTH) {
1900 log += ', ' + file
1901 } else {
1902 log += ` and ${files.length - i} more`
1903 truncated = true
1904 break
1905 }
1906 }
1907 return { formatted: log, truncated }
1908}
1909
1910const hashbangRE = /^#!.*\n/
1911

Callers 2

handleHmrOutputMethod · 0.90
updateModulesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected