(code)
| 38 | }; |
| 39 | |
| 40 | function extractFilesFromCodeBlock(code) { |
| 41 | const fileMatches = code.matchAll(/(?:\/\/\s(?<fileName>[\w.]+\.tsx?))/g); |
| 42 | |
| 43 | let lastIndex = code.length - 1; |
| 44 | |
| 45 | return Array.from(fileMatches, (match) => ({ |
| 46 | ...match.groups, |
| 47 | index: match.index, |
| 48 | })).reduceRight((acc, curr) => { |
| 49 | const result = [ |
| 50 | { |
| 51 | fileName: curr.fileName, |
| 52 | contents: code |
| 53 | .slice(curr.index + `// ${curr.fileName}`.length, lastIndex) |
| 54 | .trim(), |
| 55 | }, |
| 56 | ...acc, |
| 57 | ]; |
| 58 | lastIndex = curr.index; |
| 59 | |
| 60 | return result; |
| 61 | }, []); |
| 62 | } |
| 63 | |
| 64 | async function getCss(entrypointFile, files, rootContext) { |
| 65 | // Any relative file is considered virtual |
no outgoing calls
no test coverage detected
searching dependent graphs…