@@ -300,43 +300,6 @@ let get_all =
300300 in
301301 (fun next -> get_all_rec next SSet. empty)
302302
303- let init ?(flowlibs_only = false ) (options : options ) =
304- let node_module_filter = is_node_module options in
305- let libs =
306- if flowlibs_only then
307- []
308- else
309- options.lib_paths
310- in
311- let (libs, filter) =
312- match options.default_lib_dir with
313- | None -> (libs, is_valid_path ~options )
314- | Some root ->
315- let is_in_flowlib = is_prefix (Path. to_string root) in
316- let is_valid_path = is_valid_path ~options in
317- let filter path = is_in_flowlib path || is_valid_path path in
318- (root :: libs, filter)
319- in
320- (* preserve enumeration order *)
321- let libs =
322- if libs = [] then
323- []
324- else
325- let get_next lib =
326- let lib_str = Path. to_string lib in
327- (* TODO: better to parse json files, not ignore them *)
328- let filter' path = (path = lib_str || filter path) && not (is_json_file path) in
329- make_next_files_following_symlinks
330- ~node_module_filter
331- ~path_filter: filter'
332- ~realpath_filter: filter'
333- ~error_filter: (fun _ -> true )
334- [lib]
335- in
336- libs |> Core_list. map ~f: (fun lib -> SSet. elements (get_all (get_next lib))) |> List. flatten
337- in
338- (libs, SSet. of_list libs)
339-
340303(* Local reference to the module exported by a file. Like other local references
341304 to modules imported by the file, it is a member of Context.module_map. *)
342305let module_ref file = File_key. to_string file
@@ -353,6 +316,8 @@ let absolute_path_regexp = Str.regexp "^\\(/\\|[A-Za-z]:[/\\\\]\\)"
353316
354317let project_root_token = Str. regexp_string " <PROJECT_ROOT>"
355318
319+ let flowlib_root_token = Str. regexp_string " <FLOWLIB_ROOT>"
320+
356321let is_matching path pattern_list =
357322 List. fold_left
358323 (fun current (pattern , rx ) ->
@@ -393,6 +358,37 @@ let wanted ~options lib_fileset =
393358
394359let watched_paths options = Path_matcher. stems options.includes
395360
361+ let init ?(flowlibs_only =false ) (options : options ) =
362+ let node_module_filter = is_node_module options in
363+ let libs = if flowlibs_only then [] else options.lib_paths in
364+ let libs, filter = match options.default_lib_dir with
365+ | None -> libs, is_valid_path ~options
366+ | Some root ->
367+ let is_in_flowlib = is_prefix (Path. to_string root) in
368+ let is_valid_path = is_valid_path ~options in
369+ let filter path = (is_in_flowlib path || is_valid_path path) && (not (is_ignored options path)) in
370+ root::libs, filter
371+ in
372+ (* preserve enumeration order *)
373+ let libs = if libs = []
374+ then []
375+ else
376+ let get_next lib =
377+ let lib_str = Path. to_string lib in
378+ let filter' path = path = lib_str || filter path in
379+ make_next_files_following_symlinks
380+ ~node_module_filter
381+ ~path_filter: filter'
382+ ~realpath_filter: filter'
383+ ~error_filter: (fun _ -> true )
384+ [lib]
385+ in
386+ libs
387+ |> Core_list. map ~f: (fun lib -> SSet. elements (get_all (get_next lib)))
388+ |> List. flatten
389+ in
390+ (libs, SSet. of_list libs)
391+
396392(* *
397393 * Creates a "next" function (see also: `get_all`) for finding the files in a
398394 * given FlowConfig root. This means all the files under the root and all the
0 commit comments