(source)
| 397 | } |
| 398 | |
| 399 | function parseRelativeRequires(source) { |
| 400 | const map = new Map() |
| 401 | for (const match of source.matchAll(/const\s+\{([^}]+)\}\s*=\s*require\('(\.[^']+)'\)/gm)) { |
| 402 | const names = match[1] |
| 403 | .split(',') |
| 404 | .map(s => s.trim()) |
| 405 | .filter(Boolean) |
| 406 | .map(s => s.split(/\s+as\s+/)[0].trim()) |
| 407 | for (const name of names) { |
| 408 | map.set(name, match[2]) |
| 409 | } |
| 410 | } |
| 411 | return map |
| 412 | } |
| 413 | |
| 414 | function parseConditionalRequires(source) { |
| 415 | const map = new Map() |
no test coverage detected