class Sprockets::Rails::SourcemappingUrlProcessor

def sourcemap_asset_path(sourcemap_logical_path, context:)

def sourcemap_asset_path(sourcemap_logical_path, context:)
  # FIXME: Work-around for bug where if the sourcemap is nested two levels deep, it'll resolve as the source file
  # that's being mapped, rather than the map itself. So context.resolve("a/b/c.js.map") will return "c.js?"
  if context.resolve(sourcemap_logical_path) =~ /\.map/
    context.asset_path(sourcemap_logical_path)
  else
    raise Sprockets::FileNotFound, "Failed to resolve source map asset due to nesting depth"
  end
end