01 - Preheat oven to 350°F. Line a 12-cup muffin tin with paper liners.
02 - In a medium bowl, whisk together flour, baking powder, baking soda, salt, cinnamon, and nutmeg until evenly combined.
03 - In a large bowl, whisk oil, granulated sugar, brown sugar, eggs, and vanilla until smooth and fully incorporated.
04 - Fold in the grated carrots, then gently stir in the dry ingredients until just combined. Avoid overmixing to maintain tenderness.
05 - If desired, fold in chopped nuts and drained pineapple for added texture and moisture.
06 - Divide batter evenly among cupcake liners, filling each about two-thirds full.
07 - Bake for 18 to 22 minutes, until a toothpick inserted into the center emerges clean.
08 - Cool cupcakes in the pan for 5 minutes, then transfer to a wire rack to cool completely before frosting.
09 - Beat cream cheese and butter together until smooth. Gradually add powdered sugar, beating until fluffy. Beat in vanilla and salt.
10 - Once cupcakes are completely cool, apply cream cheese frosting generously.