1994 and earlier Rangers used EEC-IV 60-wire computers, OBD1
So wiring was less complicated than the EEC-V 104-wire computers, OBD2, 1995 and up
You will need the 4.0l computer and engine wiring harness, it will/should also include the EDIS-6 module(no distributor spark system), it is part of the engine wiring harness.
EDIS module was mounted to the Radiator support, back or front side
1987 used TFI/distributor for spark
Automatic trans computer has different software than manual trans computer, and added wiring to automatic for shift control.
And you need 4.0l transmission, 2.3l won't fit, or work, with 4.0l
The engine wiring will be plug n' play if you have original wiring from the 1991 donor
Look in electrical section:
http://www.therangerstation.com/tech_library/index-electrical_diagrams.shtml
Also Conversion section:
http://www.therangerstation.com/tech_library/index-conversions.shtml
4.0l swaps
Your splicing will be more about the year of the Ranger than engine size.
Engine size was all about the computer and its wiring which is already done if you have correct harness
The year was about power and ground wires, which changed by years
There won't be a color matching of wires specific to '87/'91, but if you check out the other swaps you will find some common wiring
Ford didn't change wiring all that much, and if you use your head and a volt/ohm meter you can do it