Skip to content

Commit

Permalink
Improve log message (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
esasse authored Dec 11, 2023
1 parent 0237135 commit 3611afa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/propshaft/compiler/source_mapping_urls.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class Propshaft::Compiler::SourceMappingUrls < Propshaft::Compiler
SOURCE_MAPPING_PATTERN = %r{(//|/\*)# sourceMappingURL=(.+\.map)(\s*?\*\/)?\s*?\Z}

def compile(logical_path, input)
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(asset_path($2, logical_path), $1, $3) }
input.gsub(SOURCE_MAPPING_PATTERN) { source_mapping_url(logical_path, asset_path($2, logical_path), $1, $3) }
end

private
Expand All @@ -18,11 +18,11 @@ def asset_path(source_mapping_url, logical_path)
end
end

def source_mapping_url(resolved_path, comment_start, comment_end)
def source_mapping_url(logical_path, resolved_path, comment_start, comment_end)
if asset = assembly.load_path.find(resolved_path)
"#{comment_start}# sourceMappingURL=#{url_prefix}/#{asset.digested_path}#{comment_end}"
else
Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{resolved_path}"
Propshaft.logger.warn "Removed sourceMappingURL comment for missing asset '#{resolved_path}' from #{logical_path}"
"#{comment_start}#{comment_end}"
end
end
Expand Down

0 comments on commit 3611afa

Please sign in to comment.