(target)
| 9 | const CONDITIONS = ['require', 'import', 'default']; |
| 10 | |
| 11 | function pickTarget(target) { |
| 12 | if (typeof target === 'string') return target; |
| 13 | if (Array.isArray(target)) { |
| 14 | for (const item of target) { |
| 15 | const picked = pickTarget(item); |
| 16 | if (picked) return picked; |
| 17 | } |
| 18 | return null; |
| 19 | } |
| 20 | if (target && typeof target === 'object') { |
| 21 | for (const condition of CONDITIONS) { |
| 22 | if (condition in target) { |
| 23 | const picked = pickTarget(target[condition]); |
| 24 | if (picked) return picked; |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | return null; |
| 29 | } |
| 30 | |
| 31 | /** |
| 32 | * Jest 27 ignores package.json `exports`, so it can't find subpath imports |
no outgoing calls
no test coverage detected