INNER CODE UNIT · TypeScript
recurseNodeModules
onejs/one · packages/lllink/src/index.ts:248
async function recurseNodeModules(dir: string, depth = 0) {
// Avoid infinite recursion in nested node_modules
if (depth > 10) return
let entries: string[]
try {
entries = await readdir(dir)
} catch {
return
}
for (const entry of entries) {
const fullPath = join(dir, entry)
let entryStat
try {
entryStat = await stat(fullPath)
} catch {
continue