tinyglobby icon indicating copy to clipboard operation
tinyglobby copied to clipboard

`followSymbolicLinks: false` excludes symlinks

Open benmccann opened this issue 5 months ago • 2 comments

netlify/build has some code similar to:

  const pathGroups = await glob('**', {
    absolute: true,
    dot: true,
    ignore: excludePatterns,
    onlyFiles: false,
    markDirectories: true,
    followSymbolicLinks: false,
  })
  const paths = pathGroups.filter((path) => !path.endsWith('/'))

This behaves differently in tinyglobby than in fast-glob

See here for a reproduction: https://github.com/benmccann/tinyglobby-symlinks

Blocks https://github.com/netlify/build/pull/6354

benmccann avatar Jun 18 '25 19:06 benmccann

The problem is this line:

https://github.com/SuperchupuDev/tinyglobby/blob/38f4f5bbace2524f2adcc9287d1096d026bb8d28/src/index.ts#L266

Maybe we need a new followSymlinks option in fdir?

benmccann avatar Jun 18 '25 23:06 benmccann

Maybe we could implement this using an exclude function which checks if the parent dir is a sym link? https://github.com/thecodrr/fdir/blob/master/documentation.md#excludefunction

It'd be a semi-expensive way to implement this, but users don't set followSymbolicLinks: false often (as evidenced by the fact that no one noticed it was broken until now). I've never seen it used in any project outside of the pending PR for netlify/build

benmccann avatar Jun 23 '25 15:06 benmccann