(dir: string)
| 2366 | pathMod = await import('path'); |
| 2367 | } |
| 2368 | async function walk(dir: string) { |
| 2369 | for (const name of fs.readdirSync(dir)) { |
| 2370 | const full = pathMod.join(dir, name); |
| 2371 | if (name === 'node_modules' || name.startsWith('.')) continue; |
| 2372 | try { |
| 2373 | const stat = fs.statSync(full); |
| 2374 | if (stat.isDirectory()) await walk(full); |
| 2375 | else if (stat.isFile()) { |
| 2376 | if (/\.(vue|ts|js|mjs|tsx|jsx)$/.test(name)) { |
| 2377 | const rel = '/' + pathMod.relative(root, full).split(pathMod.sep).join('/'); |
| 2378 | // Transform via Vite to gather deps (ignore failures) |
| 2379 | try { |
| 2380 | const transformed = await server.transformRequest(rel); |
| 2381 | const code = transformed?.code || ''; |
| 2382 | const deps: string[] = []; |
| 2383 | // fallback to import relationships via moduleGraph |
| 2384 | const modNode = server.moduleGraph.getModuleById(full) || server.moduleGraph.getModuleById(rel); |
| 2385 | if (modNode) { |
| 2386 | for (const m of modNode.importedModules) { |
| 2387 | if (m.id) deps.push(m.id.split('?')[0]); |
| 2388 | } |
| 2389 | } |
| 2390 | upsertGraphModule(rel, code, deps); |
| 2391 | } catch {} |
| 2392 | } |
| 2393 | } |
| 2394 | } catch {} |
| 2395 | } |
| 2396 | } |
| 2397 | try { |
| 2398 | await walk(pathMod.join(root, 'src')); |
| 2399 | } catch {} |
no test coverage detected