| 33 | const roots = [appRoot]; |
| 34 | const styleExtsSet = new Set(['css', 'scss', 'less', 'sass']); |
| 35 | function walk(dir: string, out: string[]) { |
| 36 | let entries: string[] = []; |
| 37 | try { |
| 38 | entries = readdirSync(dir); |
| 39 | } catch { |
| 40 | return out; |
| 41 | } |
| 42 | for (const entry of entries) { |
| 43 | const full = path.posix.join(dir, entry); |
| 44 | let st: any; |
| 45 | try { |
| 46 | st = statSync(full); |
| 47 | } catch { |
| 48 | continue; |
| 49 | } |
| 50 | if (st.isDirectory()) walk(full, out); |
| 51 | else out.push(full); |
| 52 | } |
| 53 | return out; |
| 54 | } |
| 55 | function enumerate(filter: (ext: string) => boolean) { |
| 56 | const files: string[] = []; |
| 57 | for (const r of roots) walk(r, files); |