(packageRoot, filePath, selected)
| 127 | } |
| 128 | |
| 129 | async function addRuntimeDependencyFiles(packageRoot, filePath, selected) { |
| 130 | const extension = extname(filePath); |
| 131 | if (!['.js', '.cjs', '.mjs'].includes(extension)) return; |
| 132 | |
| 133 | let text; |
| 134 | try { |
| 135 | text = await readFile(filePath, 'utf-8'); |
| 136 | } catch { |
| 137 | return; |
| 138 | } |
| 139 | |
| 140 | for (const specifier of relativeRuntimeSpecifiers(text)) { |
| 141 | const candidate = resolveFileCandidate(resolve(dirname(filePath), specifier)); |
| 142 | if (candidate === null) continue; |
| 143 | if (candidate.endsWith('.node')) continue; |
| 144 | const packageRelativePath = relative(packageRoot, candidate); |
| 145 | if ( |
| 146 | packageRelativePath.startsWith('..') || |
| 147 | isAbsolute(packageRelativePath) || |
| 148 | packageRelativePath.length === 0 |
| 149 | ) { |
| 150 | continue; |
| 151 | } |
| 152 | if (selected.has(candidate)) continue; |
| 153 | selected.add(candidate); |
| 154 | await addRuntimeDependencyFiles(packageRoot, candidate, selected); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | async function collectPackageFiles({ |
| 159 | packageName, |
no test coverage detected