feat(turbopack): Print a warning about performance when starting with an invalidated cache (#80631)
We want to show a warning to the user when we start up with an invalidated cache, letting them know why `next dev` might be a little slower than usual.
This is done by writing a JSON-encoded `reason_code` value to the invalidation marker file that's then read when starting back up.
I'm using @Cy-Tek's compilation event logging to log this from the JS side, so that log styling matches other Next.js warnings. This is a little tricky because of a chicken-and-egg dependency on turbo-tasks. We must invalidate the cache before constructing the turbo-tasks backend, and then emit the event after turbo-tasks is constructed.
## Testing
Reset the cache using the web UI:
<img src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/ac47b80d-d09c-48a8-bdcf-6f6f1bfd8288.png" width="500">
And see a warning logged to the terminal:
<img src="https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/HAZVitxRNnZz8QMiPn4a/e1860d1a-defd-46c2-9a85-a0c64e26f634.png" width="700">
This user-requested use-case is a bit contrived, we mostly care about automatic invalidation upon panic, as those are the ones that may be surprising to the user.