| 79 | const PRIVATE_PACKAGE_RE = /Cannot find package '(@executor-js\/[^']+)'/; |
| 80 | |
| 81 | const firstMeaningfulLine = (stderr: string): string => { |
| 82 | const lines = stderr |
| 83 | .split("\n") |
| 84 | .map((line) => line.trim()) |
| 85 | .filter(Boolean); |
| 86 | const errorLine = lines.find((line) => /^(\w*Error|Cannot find)/i.test(line)); |
| 87 | if (errorLine) return errorLine; |
| 88 | for (const line of lines) { |
| 89 | if (line.startsWith("node:")) continue; |
| 90 | if (line.startsWith("file://")) continue; |
| 91 | if (line.startsWith("at ")) continue; |
| 92 | if (line.startsWith("import ")) continue; |
| 93 | if (line.startsWith("throw ")) continue; |
| 94 | if (line === "^" || /^\^+$/.test(line)) continue; |
| 95 | return line; |
| 96 | } |
| 97 | return lines[0] ?? "(no stderr)"; |
| 98 | }; |
| 99 | |
| 100 | type Tarballs = ReadonlyMap<string, string>; |
| 101 | |