feat(turbopack): add `experimental.turbo.root` config option (#69737)
### TL;DR
Added support for a new `experimental.turbo.root` configuration option
in Next.js.
### What changed?
- Introduced a new `root` property in the `ExperimentalTurboOptions`
interface.
- Updated the build process and hot reloader to use the new
`experimental.turbo.root` configuration.
- Added fallback logic to use `outputFileTracingRoot` or the project
directory if `experimental.turbo.root` is not set.
- Implemented warning messages for non-absolute paths in
`experimental.turbo.root` and `outputFileTracingRoot`.
- Added a utility function `dset` for safely setting nested object
properties.
### How to test?
1. Set up a Next.js project with Turbopack enabled.
2. Add the `experimental.turbo.root` option to your `next.config.js`:
```javascript
module.exports = {
experimental: {
turbo: {
root: '/path/to/your/root'
}
}
}
```
3. Run the development server and build process to ensure they use the
new root path.
4. Verify that file resolution works correctly with the new root path.
### Why make this change?
This change allows developers to explicitly set the root directory for
Turbopack, providing more control over file resolution and project
structure. It enhances flexibility for monorepo setups and projects with
complex directory structures, ensuring that Turbopack can correctly
resolve files above the project directory when necessary.
Closes PACK-2646
Fixes #62409