* Check and warn if `path` includes characters that don't work well in Vite, * such as `#` and `?` and `*`.
( name: string, type: 'directory' | 'file', path: string, logger: Logger, )
| 1051 | * such as `#` and `?` and `*`. |
| 1052 | */ |
| 1053 | function checkBadCharactersInPath( |
| 1054 | name: string, |
| 1055 | type: 'directory' | 'file', |
| 1056 | path: string, |
| 1057 | logger: Logger, |
| 1058 | ): void { |
| 1059 | const badChars = [] |
| 1060 | |
| 1061 | if (path.includes('#')) { |
| 1062 | badChars.push('#') |
| 1063 | } |
| 1064 | if (path.includes('?')) { |
| 1065 | badChars.push('?') |
| 1066 | } |
| 1067 | if (path.includes('*')) { |
| 1068 | badChars.push('*') |
| 1069 | } |
| 1070 | |
| 1071 | if (badChars.length > 0) { |
| 1072 | const charString = badChars.map((c) => `"${c}"`).join(' and ') |
| 1073 | const inflectedChars = badChars.length > 1 ? 'characters' : 'character' |
| 1074 | |
| 1075 | logger.warn( |
| 1076 | colors.yellow( |
| 1077 | `${name} contains the ${charString} ${inflectedChars} (${colors.cyan( |
| 1078 | path, |
| 1079 | )}), which may not work when running Vite. Consider renaming the ${type} without the characters.`, |
| 1080 | ), |
| 1081 | ) |
| 1082 | } |
| 1083 | } |
| 1084 | |
| 1085 | const clientAlias = [ |
| 1086 | { |
no test coverage detected