diff --git a/CHANGELOG.md b/CHANGELOG.md index ef5780ff..9cb86926 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,10 @@ master === +# 4.1.5-4.1.6 + +* Fix file recursion when looking for possible asset dependencies. Major preview server performance improvement. + # 4.1.4 * Unify default extensions for all URL processing extensions. #1855 diff --git a/middleman-core/lib/middleman-core/sources/source_watcher.rb b/middleman-core/lib/middleman-core/sources/source_watcher.rb index 21d6d7b2..2c034570 100644 --- a/middleman-core/lib/middleman-core/sources/source_watcher.rb +++ b/middleman-core/lib/middleman-core/sources/source_watcher.rb @@ -2,6 +2,7 @@ require 'listen' require 'middleman-core/contracts' require 'digest' +require 'set' # Monkey patch Listen silencer so `only` works on directories too module Listen @@ -49,7 +50,7 @@ module Middleman # Reference to lower level listener attr_reader :listener - IGNORED_DIRECTORIES = %w(.git node_modules .sass-cache).freeze + IGNORED_DIRECTORIES = Set.new(%w(.git node_modules .sass-cache vendor/bundle .bundle)) # Construct a new SourceWatcher # @@ -167,7 +168,8 @@ module Middleman @listener = ::Listen.to(@directory.to_s, config, &method(:on_listener_change)) @listener.ignore(/^\.sass-cache/) - # @listener.only(@only) unless @only.empty? + @listener.ignore(/^node_modules/) + @listener.ignore(/^vendor\/bundle/) @listener.start end @@ -222,7 +224,8 @@ module Middleman Contract Pathname => Bool def should_not_recurse?(p) - IGNORED_DIRECTORIES.include?(p.basename.to_s) + relative_path = p.relative_path_from(@directory).to_s + IGNORED_DIRECTORIES.include?(relative_path) end # The `listen` gem callback. @@ -255,7 +258,8 @@ module Middleman logger.debug "== Change (#{f[:types].inspect}): #{f[:relative_path]}" end - related_updates = ::Middleman::Util.find_related_files(app, (updated_paths + removed_paths)).select(&method(:valid?)) + related_sources = valid_updates.map { |u| u[:full_path] } + removed_paths + related_updates = ::Middleman::Util.find_related_files(app, related_sources).select(&method(:valid?)) related_updates.each do |f| logger.debug "== Possible Change (#{f[:types].inspect}): #{f[:relative_path]}" diff --git a/middleman-core/lib/middleman-core/version.rb b/middleman-core/lib/middleman-core/version.rb index 35bcf57b..364ca123 100644 --- a/middleman-core/lib/middleman-core/version.rb +++ b/middleman-core/lib/middleman-core/version.rb @@ -1,5 +1,5 @@ module Middleman # Current Version # @return [String] - VERSION = '4.1.5'.freeze unless const_defined?(:VERSION) + VERSION = '4.1.6'.freeze unless const_defined?(:VERSION) end