Prepare squash puree if necessary by roasting a halved squash, cut side down and seeds left in, with a bit of oil. Roast at 400F until completely fork tender. Allow to cool, then scrape out seeds and discard. Scrape out flesh and puree until smooth. Reserve extra and freeze, or make some soup! Puree can be prepared a few days ahead, and frozen if necessary.
Prepare a metal loaf tin with a sheet of parchment. Alternatively, lightly grease and flour. Set aside.
In a large bowl with a whisk, combine the brown sugar, eggs and olive oil. Whisk until the mixture becomes pale, about 3-4 minutes. Add squash puree and mix to combine. Add in the spices and sea salt.
Add the flour, baking powder and baking soda. Whisk briefly to just combine, then switch to a spatula to finish mixing, adding the chopped chocolate when you switch to the spatula, if using.
Pour batter into prepared loaf tin. Bake 45-55 minutes, until the loaf is just firm in the center and a tester comes out clean. Cool for 15 minutes in the loaf pan, then transfer to a cooling rack and completely cool.
Meanwhile, toast pepitas in the 350F oven for 10 minutes, or toast them on the stovetop. Do this while the cake bakes.
Prepare the icing as you wait for the cake to cool: combine all ingredients, and mix thoroughly. Adjust texture of icing by adding 1/2 tsp of water, until the icing just holds a ribbon when you lift your whisk out of the bowl. You want it to be semi-thick so it adheres to the cake, and not drip right off.
Once cool, pour the icing over the loaf, then sprinkle the toasted pepitas and pinches of sea salt on top of the still wet icing. Serve and enjoy! Store leftovers covered, or slice the loaf and store in a container. Can be kept at room temperature for 2-3 days, or in the fridge for up to 1 week.