@@ -2,6 +2,7 @@ import { normalize, resolve } from 'path'
22
33import fastGlob from 'fast-glob'
44
5+ import { type FeatureFlags } from '../../../feature_flags.js'
56import { minimatch } from '../../../utils/matching.js'
67
78// Returns the subset of `paths` that don't match any of the glob expressions
@@ -18,6 +19,7 @@ export const filterExcludedPaths = (paths: string[], excludePattern: string[] =
1819
1920export const getPathsOfIncludedFiles = async (
2021 includedFiles : string [ ] ,
22+ featureFlags : FeatureFlags ,
2123 basePath ?: string ,
2224) : Promise < { excludePatterns : string [ ] ; paths : string [ ] } > => {
2325 if ( basePath === undefined ) {
@@ -53,13 +55,24 @@ export const getPathsOfIncludedFiles = async (
5355 cwd : basePath ,
5456 dot : true ,
5557 ignore : excludePatterns ,
56- onlyFiles : false ,
57- // get directories as well to get symlinked directories,
58- // to filter the regular non symlinked directories out mark them with a slash at the end to filter them out.
59- markDirectories : true ,
60- followSymbolicLinks : false ,
58+ ...( featureFlags . zisi_fix_symlinks
59+ ? {
60+ onlyFiles : false ,
61+ // get directories as well to get symlinked directories,
62+ // to filter the regular non symlinked directories out mark them with a slash at the end to filter them out.
63+ markDirectories : true ,
64+ followSymbolicLinks : false ,
65+ }
66+ : {
67+ followSymbolicLinks : true ,
68+ throwErrorOnBrokenSymbolicLink : true ,
69+ } ) ,
6170 } )
6271
72+ const paths = featureFlags . zisi_fix_symlinks
73+ ? pathGroups . filter ( ( path ) => ! path . endsWith ( '/' ) ) . map ( normalize )
74+ : pathGroups . map ( normalize )
75+
6376 // now filter the non symlinked directories out that got marked with a trailing slash
64- return { excludePatterns, paths : pathGroups . filter ( ( path ) => ! path . endsWith ( '/' ) ) . map ( normalize ) }
77+ return { excludePatterns, paths }
6578}
0 commit comments