* 检查包目录是否包含 WASM 文件
(dirPath: string)
| 411 | * 检查包目录是否包含 WASM 文件 |
| 412 | */ |
| 413 | function hasWasmFiles(dirPath: string): boolean { |
| 414 | try { |
| 415 | const files = fs.readdirSync(dirPath); |
| 416 | for (const file of files) { |
| 417 | if (file.endsWith('.wasm')) return true; |
| 418 | if (file === 'pkg') { |
| 419 | const pkgPath = path.join(dirPath, file); |
| 420 | const pkgFiles = fs.readdirSync(pkgPath); |
| 421 | if (pkgFiles.some(f => f.endsWith('.wasm'))) return true; |
| 422 | } |
| 423 | } |
| 424 | } catch { |
| 425 | // Ignore errors |
| 426 | } |
| 427 | return false; |
| 428 | } |
| 429 | |
| 430 | /** |
| 431 | * 扫描 packages 目录检测 WASM 包 |
no test coverage detected