Prep the pans and oven: Heat the oven to 350°F (175°C).
Grease and line two 8-inch round cake pans with parchment, or grease a 9x13-inch pan for a sheet cake. Lightly flour the sides.
Whisk the dry ingredients: In a large bowl, whisk flour, baking powder, baking soda, salt, cinnamon, and nutmeg. This helps prevent clumps and keeps the cake tender.
Mix the wet ingredients: In another bowl, whisk oil, granulated sugar, brown sugar, eggs, and vanilla until smooth and slightly thickened.
Bring it together: Add the dry ingredients to the wet and stir gently until just combined.
Do not overmix.
Fold in the carrots: Stir in the grated carrots. If using, fold in the drained pineapple, nuts, and raisins. The batter will be thick—this is good.
Bake: Divide into the prepared round pans or pour into the sheet pan.
Bake round pans for 28–32 minutes and a 9x13 for 30–35 minutes, until a toothpick in the center comes out clean with a few moist crumbs.
Cool completely: Let the cakes rest in the pans for 10 minutes, then turn out onto racks. Cool fully before frosting. Warm cake will melt the frosting.
Make the frosting: Beat cream cheese and butter on medium speed until smooth and fluffy, 2–3 minutes.
Add powdered sugar gradually, then vanilla and a pinch of salt. Beat until creamy and spreadable. Adjust sugar for thickness and tang to taste.
Frost: For layers, level domes if needed.
Spread frosting between layers, then over the top and sides. For a sheet cake, frost the top generously. Add chopped nuts on the sides or top if you like.
Set and serve: Chill the frosted cake for 20–30 minutes to help it slice cleanly.
Serve at cool room temperature for the best texture and flavor.