class Importmap::Map

def cache_sweeper(watches: nil)

and test to ensure the map caches are reset when javascript files are changed.
when the directories passed on initialization via `watches:` have changes. This is used in development
Returns an instance of ActiveSupport::EventedFileUpdateChecker configured to clear the cache of the map
def cache_sweeper(watches: nil)
  if watches
    @cache_sweeper =
      Rails.application.config.file_watcher.new([], Array(watches).collect { |dir| [ dir.to_s, "js"] }.to_h) do
        clear_cache
      end
  else
    @cache_sweeper
  end
end