We show that the prompt and afterglow X-ray emission of GRB060218 , as well as its early ( t \lesssim 1 d ) optical-UV emission , can be explained by a model in which a radiation- mediated shock propagates through a compact progenitor star into a dense wind . The prompt thermal X-ray emission is produced in this model as the mildly relativistic shock , \beta \approx 0.85 carrying few \times 10 ^ { 49 } erg , reaches the wind ( Thomson ) photosphere , where the post-shock thermal radiation is released and the shock becomes collisionless . Adopting this interpretation of the thermal X-ray emission , a subsequent X-ray afterglow is predicted , due to synchrotron emission and inverse-Compton scattering of SN UV photons by electrons accelerated in the collisionless shock . Early optical-UV emission is also predicted , due to the cooling of the outer \delta M \sim 10 ^ { -3 } M _ { \odot } envelope of the star , which was heated to high temperature during shock passage . The observed X-ray afterglow and the early optical-UV emission are both consistent with those expected in this model . Detailed analysis of the early optical-UV emission may provide detailed constraints on the density distribution near the stellar surface .