[devtools] save user config inside `.next/cache` (#81807)
### Why?
It's common for developers to clear `localStorage` during development.
Since the current DevTools config is saved there, this can hurt the
developer experience when `localStorage` is cleared for any reason.
To avoid this, we decided to store the DevTools config in the app’s
cache directory, which is `{distDir}/cache/`. The content inside this
directory is expected to remain during Next.js’ workflow (i.e., `next
build`) unless it's manually removed.
### How?
Added the `/__nextjs_devtools_config` endpoint to handle config writing.
The client sends a POST request to this endpoint, passing the config
data. After the config is successfully written, HMR is triggered to
update the client state accordingly.
---------
Co-authored-by: Jiachi Liu <inbox@huozhi.im>