Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
bd391108
Unverified
Commit
bd391108
authored
Apr 17, 2025
by
Will Binns-Smith
Committed by
GitHub
Apr 17, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: Include Next.js version in panic handler report (#78263)
parent
1411821c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
2 deletions
+27
-2
build.rs
crates/napi/build.rs
+22
-1
util.rs
crates/napi/src/util.rs
+5
-1
No files found.
crates/napi/build.rs
View file @
bd391108
use
std
::{
env
,
process
::
Command
,
str
};
use
std
::{
env
,
fs
,
path
::
Path
,
process
::
Command
,
str
};
use
serde_json
::
Value
;
extern
crate
napi_build
;
extern
crate
napi_build
;
...
@@ -6,6 +8,25 @@ fn main() -> anyhow::Result<()> {
...
@@ -6,6 +8,25 @@ fn main() -> anyhow::Result<()> {
println!
(
"cargo:rerun-if-env-changed=CI"
);
println!
(
"cargo:rerun-if-env-changed=CI"
);
let
is_ci
=
env
::
var
(
"CI"
)
.is_ok_and
(|
value
|
!
value
.is_empty
());
let
is_ci
=
env
::
var
(
"CI"
)
.is_ok_and
(|
value
|
!
value
.is_empty
());
let
nextjs_version
=
{
let
package_json_path
=
Path
::
new
(
env!
(
"CARGO_MANIFEST_DIR"
))
.join
(
"../.."
)
.join
(
"packages/next/package.json"
);
println!
(
"cargo:rerun-if-changed={}"
,
package_json_path
.display
());
let
package_json_content
=
fs
::
read_to_string
(
&
package_json_path
)
?
;
let
package_json
:
Value
=
serde_json
::
from_str
(
&
package_json_content
)
?
;
package_json
[
"version"
]
.as_str
()
.expect
(
"Expected a Next.js `version` string in its package.json"
)
.to_string
()
};
// Make the Next.js version available as a build-time environment variable
println!
(
"cargo:rustc-env=NEXTJS_VERSION={}"
,
nextjs_version
);
// Generates, stores build-time information as static values.
// Generates, stores build-time information as static values.
// There are some places relying on correct values for this (i.e telemetry),
// There are some places relying on correct values for this (i.e telemetry),
// So failing build if this fails.
// So failing build if this fails.
...
...
crates/napi/src/util.rs
View file @
bd391108
...
@@ -131,7 +131,11 @@ pub fn log_internal_error_and_inform(internal_error: &anyhow::Error) {
...
@@ -131,7 +131,11 @@ pub fn log_internal_error_and_inform(internal_error: &anyhow::Error) {
"Turbopack Error: {}"
,
"Turbopack Error: {}"
,
internal_error_str
.lines
()
.next
()
.unwrap_or
(
"Unknown"
)
internal_error_str
.lines
()
.next
()
.unwrap_or
(
"Unknown"
)
);
);
let
version_str
=
format!
(
"Turbopack version: `{}`"
,
env!
(
"VERGEN_GIT_DESCRIBE"
));
let
version_str
=
format!
(
"Turbopack version: `{}`
\n
Next.js version: `{}`"
,
env!
(
"VERGEN_GIT_DESCRIBE"
),
env!
(
"NEXTJS_VERSION"
)
);
let
new_discussion_url
=
if
supports_hyperlinks
::
supports_hyperlinks
()
{
let
new_discussion_url
=
if
supports_hyperlinks
::
supports_hyperlinks
()
{
"clicking here."
.hyperlink
(
"clicking here."
.hyperlink
(
format!
(
format!
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment