Heat a frying pan over medium-low heat. Melt butter and add onions, salt, and sugar to pan. Cook, stirring occasionally, until translucent and golden.
Meanwhile, add the other 9 ingredients to a blender. Whirl until smooth.
Add caramelized onions to blender. Whirl until smooth.
Pour sauce into the same pan used for onions. Reduce heat to low and simmer, covered (the sauce is thick and will splatter, so don't skip the cover), at least 30 minutes, stirring occasionally.
At this point you can serve it as desired, can it, or freeze it.