(names)
| 38 | } |
| 39 | |
| 40 | async function getLibDirs(names) { |
| 41 | names ??= (await fs.readdir(indexDirLib)).filter(n => !n.startsWith('.')) |
| 42 | |
| 43 | return await Promise.all( |
| 44 | names.map(name => { |
| 45 | const dir = `${indexDirLib}/${name}` |
| 46 | |
| 47 | return fs.stat(`${dir}/index.js`).then( |
| 48 | () => [name, dir], |
| 49 | () => { |
| 50 | throw new Error(`${dir}/index.js could not be found.`) |
| 51 | }, |
| 52 | ) |
| 53 | }), |
| 54 | ) |
| 55 | } |
| 56 | |
| 57 | async function getEnvFiles(names) { |
| 58 | names ??= (await fs.readdir(indexDirEnv)) |