Preheat the oven to 450°F.
Line a baking sheet with parchment paper.
Slice the heads of garlic in half horizontally and place them on a large piece of foil. Add the shallots, drizzle with olive oil, season with salt, and wrap everything in the foil.
Place the eggplant halves cut-side up on the prepared baking sheet and brush them lightly with olive oil.
Roast for about 45 minutes or until soft.
Remove the eggplant, garlic, and shallots from the oven and let them cool.
Peel the eggplant and squeeze the garlic out of its skin.
In a food processor, combine the canned tomatoes, roasted eggplant, shallots, and garlic. Season with salt, black pepper, and 1 teaspoon of chili flakes. Add the basil and process until everything is combined.
Cook the pasta in a pot of boiling salted water according to the package instructions (al dente), then drain, reserving a cup of the cooking water.
Heat ¼ cup of olive oil in a pan over medium-high heat. Add the tomato paste and sizzle for one minute.
Add the tomato-eggplant mixture to the pan, and cook for 2-3 minutes, allowing the liquids to evaporate. Then add the heavy cream and cook for an additional 3-4 minutes. Adjust salt and black pepper to taste.
Add the al dente penne, Parmesan, and reserved pasta water. Mix over medium heat for about 3 minutes, or until you achieve a smooth and creamy texture and the pasta is fully cooked.
Serve topped with grated Parmesan cheese and additional chili flakes if you prefer extra heat.