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 thoroughly combined.
03 - In a large bowl, whisk oil, granulated sugar, brown sugar, eggs, and vanilla until smooth and well blended.
04 - Fold in the grated carrots, then gently stir in the dry ingredients until just combined. Avoid overmixing to prevent tough texture.
05 - Fold in the nuts and drained pineapple if desired for added texture and flavor.
06 - Divide batter evenly among cupcake liners, filling each about 2/3 full to allow for proper rising.
07 - Bake for 18 to 22 minutes, or until a toothpick inserted into the center comes out clean.
08 - Let cupcakes cool 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 until fully incorporated.
10 - Once cupcakes are completely cool, frost generously with cream cheese frosting using a piping bag or offset spatula.