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 well blended.
03 - In a large bowl, whisk oil, granulated sugar, brown sugar, eggs, and vanilla extract until smooth and fully incorporated.
04 - Add grated carrots to the wet mixture and fold until evenly distributed throughout the batter.
05 - Gently stir the dry ingredients into the wet mixture until just combined. Take care not to overmix the batter.
06 - If using, fold in chopped nuts and drained crushed pineapple until evenly dispersed.
07 - Divide batter evenly among the 12 cupcake liners, filling each approximately 2/3 full.
08 - Bake for 18 to 22 minutes, or until a toothpick inserted into the center comes out clean.
09 - Allow cupcakes to cool in the pan for 5 minutes, then transfer to a wire rack to cool completely.
10 - Beat softened cream cheese and butter together in a mixing bowl until completely smooth and creamy.
11 - Gradually add sifted powdered sugar while beating, continuing until the frosting becomes light and fluffy.
12 - Beat in vanilla extract and a pinch of salt until fully incorporated.
13 - Once cupcakes have cooled completely, generously frost each one with the prepared cream cheese frosting.