Position a rack in the middle of the oven and heat to 350 degrees. Line a standard 12-cup muffin tin with paper liners.
Step 2
In a large bowl, whisk together the melted butter, light brown sugar, vanilla extract and salt until smooth and glossy, about 20 seconds. Add the eggs one at a time, whisking until smooth and no streaks of unincorporated whites remain before adding the next.
Step 3
In a medium bowl, whisk together the flour, cinnamon, baking soda and baking powder. Add to the butter mixture and stir with a rubber spatula just until no pockets of unincorporated flour remain. (Try not to overmix.) Add the grated carrots and optional nuts and raisins (if using) and stir just until the carrot shreds are evenly distributed throughout the batter.
Step 4
Scoop the batter into the prepared muffin cups using a cookie scoop or two spoons until they are about three-fourths of the way full. Bake until the tops of the cupcakes are slightly domed and a toothpick inserted into the center comes out clean with just a few moist crumbs attached, 17 to 20 minutes. Remove from the oven and let cool completely in the muffin tin.
Step 5
While the cupcakes are cooling, make the frosting: Combine the cream cheese, butter, vanilla extract and salt in the bowl of a stand mixer fitted with a whisk attachment (or in a large bowl, if using a hand mixer). Beat on medium speed until thoroughly combined, 1 to 2 minutes. Decrease the speed to low and add the confectioners’ sugar, one spoonful at a time with the mixer running, stopping and scraping down the sides of the bowl as needed, until completely incorporated. Increase the speed to high and beat the frosting until light and fluffy, adding additional confectioners’ sugar as needed to achieve a firm frosting consistency, 2 to 3 minutes.
Step 6
Once the cupcakes have fully cooled, frost the tops using a pastry bag, offset spatula or large spoon.