@@ -271,37 +271,6 @@ let get_all =
271271 in
272272 fun next -> get_all_rec next SSet. empty
273273
274- let init ?(flowlibs_only =false ) (options : options ) =
275- let node_module_filter = is_node_module options in
276- let libs = if flowlibs_only then [] else options.lib_paths in
277- let libs, filter = match options.default_lib_dir with
278- | None -> libs, is_valid_path ~options
279- | Some root ->
280- let is_in_flowlib = is_prefix (Path. to_string root) in
281- let is_valid_path = is_valid_path ~options in
282- let filter path = is_in_flowlib path || is_valid_path path in
283- root::libs, filter
284- in
285- (* preserve enumeration order *)
286- let libs = if libs = []
287- then []
288- else
289- let get_next lib =
290- let lib_str = Path. to_string lib in
291- let filter' path = path = lib_str || filter path in
292- make_next_files_following_symlinks
293- ~node_module_filter
294- ~path_filter: filter'
295- ~realpath_filter: filter'
296- ~error_filter: (fun _ -> true )
297- [lib]
298- in
299- libs
300- |> Core_list. map ~f: (fun lib -> SSet. elements (get_all (get_next lib)))
301- |> List. flatten
302- in
303- (libs, SSet. of_list libs)
304-
305274(* Local reference to the module exported by a file. Like other local references
306275 to modules imported by the file, it is a member of Context.module_map. *)
307276let module_ref file =
@@ -316,6 +285,8 @@ let absolute_path_regexp = Str.regexp "^\\(/\\|[A-Za-z]:[/\\\\]\\)"
316285
317286let project_root_token = Str. regexp_string " <PROJECT_ROOT>"
318287
288+ let flowlib_root_token = Str. regexp_string " <FLOWLIB_ROOT>"
289+
319290let is_matching path pattern_list =
320291 List. fold_left (
321292 fun current (pattern , rx ) ->
@@ -361,6 +332,37 @@ let wanted ~options lib_fileset =
361332let watched_paths options =
362333 Path_matcher. stems options.includes
363334
335+ let init ?(flowlibs_only =false ) (options : options ) =
336+ let node_module_filter = is_node_module options in
337+ let libs = if flowlibs_only then [] else options.lib_paths in
338+ let libs, filter = match options.default_lib_dir with
339+ | None -> libs, is_valid_path ~options
340+ | Some root ->
341+ let is_in_flowlib = is_prefix (Path. to_string root) in
342+ let is_valid_path = is_valid_path ~options in
343+ let filter path = (is_in_flowlib path || is_valid_path path) && (not (is_ignored options path)) in
344+ root::libs, filter
345+ in
346+ (* preserve enumeration order *)
347+ let libs = if libs = []
348+ then []
349+ else
350+ let get_next lib =
351+ let lib_str = Path. to_string lib in
352+ let filter' path = path = lib_str || filter path in
353+ make_next_files_following_symlinks
354+ ~node_module_filter
355+ ~path_filter: filter'
356+ ~realpath_filter: filter'
357+ ~error_filter: (fun _ -> true )
358+ [lib]
359+ in
360+ libs
361+ |> Core_list. map ~f: (fun lib -> SSet. elements (get_all (get_next lib)))
362+ |> List. flatten
363+ in
364+ (libs, SSet. of_list libs)
365+
364366(* *
365367 * Creates a "next" function (see also: `get_all`) for finding the files in a
366368 * given FlowConfig root. This means all the files under the root and all the
0 commit comments