(itemPath, filename, appNames)
| 230 | const pathCache = new Map(); |
| 231 | |
| 232 | function processPath(itemPath, filename, appNames) { |
| 233 | const cacheKey = itemPath + '|' + filename; |
| 234 | if (pathCache.has(cacheKey)) { |
| 235 | return pathCache.get(cacheKey); |
| 236 | } |
| 237 | |
| 238 | let path = itemPath.replace(/\\/g, '/'); // sync windows paths to macOS |
| 239 | let index = path.indexOf('/ai/'); |
| 240 | |
| 241 | if (index > -1) { |
| 242 | path = 'ai.' + path.substr(index + 4) + '.'; |
| 243 | } else if (path.endsWith('/ai')) { |
| 244 | path = 'ai.'; |
| 245 | } else { |
| 246 | index = path.indexOf('/src/'); |
| 247 | |
| 248 | if (index > -1) { |
| 249 | path = path.substr(index + 5) + '.'; |
| 250 | } else { |
| 251 | index = path.indexOf('/src'); |
| 252 | |
| 253 | if (index > -1) { |
| 254 | path = path.substr(index + 4); // top level files |
| 255 | } else { |
| 256 | index = path.indexOf('/apps/'); |
| 257 | |
| 258 | if (index > -1) { |
| 259 | for (const appName of appNames) { |
| 260 | const lAppName = appName.toLowerCase(); |
| 261 | let pathLen = path.lastIndexOf('/' + lAppName); |
| 262 | |
| 263 | if (pathLen !== -1) { |
| 264 | // top level files |
| 265 | if (pathLen === path.length - appName.length - 1) { |
| 266 | path = appName + path.substr(index + appName.length + 6) + '.'; |
| 267 | break; |
| 268 | } else { |
| 269 | pathLen = path.indexOf(lAppName + '/'); |
| 270 | |
| 271 | if (pathLen > -1) { |
| 272 | path = appName + path.substr(index + appName.length + 6) + '.'; |
| 273 | break; |
| 274 | } |
| 275 | } |
| 276 | } |
| 277 | } |
| 278 | } else { |
| 279 | index = path.indexOf('/docs/'); |
| 280 | |
| 281 | if (index > -1) { |
| 282 | path = 'Docs.' + path.substr(index + 10) + '.'; |
| 283 | } |
| 284 | } |
| 285 | } |
| 286 | } |
| 287 | } |
| 288 | |
| 289 | path = path.replace(/\//g, '.'); |
no test coverage detected