feat(turbopack): add NEXT_TURBOPACK_TRACING_PATH to control trace output location (#93084)
### What?
Adds a new environment variable `NEXT_TURBOPACK_TRACING_PATH` that lets
users specify the full output path (including filename) for the
Turbopack trace file.
### Why?
Some users need to control where the `trace-turbopack` file is written —
for example, to redirect it outside the project directory, to a shared
volume, or to a custom filename. Previously the path was hardcoded to
`<project>/.next-profiles/trace-turbopack` with no override mechanism.
### How?
When `NEXT_TURBOPACK_TRACING` is set (tracing is enabled) and
`NEXT_TURBOPACK_TRACING_PATH` is also set, the trace is written to the
specified path instead of the default:
- **Absolute paths** are used as-is.
- **Relative paths** are resolved against the process CWD.
- The **parent directory is auto-created** recursively (equivalent to
`mkdir -p`), so pointing to a non-existent subdirectory works without
manual setup.
- Setting `NEXT_TURBOPACK_TRACING_PATH` alone (without
`NEXT_TURBOPACK_TRACING`) has no effect — tracing is not enabled by it.
- The "Trace output will be written to …" message reflects the resolved
path.
The change is confined to
`crates/next-napi-bindings/src/next_api/project.rs`.
**Example:**
```sh
NEXT_TURBOPACK_TRACING=overview \
NEXT_TURBOPACK_TRACING_PATH=/tmp/my-project-trace \
next dev
```
<!-- NEXT_JS_LLM_PR -->
Co-authored-by: Tobias Koppers <sokra@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>