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
49371dc3
Unverified
Commit
49371dc3
authored
Aug 19, 2025
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Aug 19, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[sourcemaps] Fix sourcemapping in Redbox on Windows (#82078)
parent
15653f3a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
14 deletions
+25
-14
project.rs
crates/napi/src/next_api/project.rs
+25
-14
No files found.
crates/napi/src/next_api/project.rs
View file @
49371dc3
...
@@ -41,7 +41,7 @@ use turbo_tasks_backend::{BackingStorage, db_invalidation::invalidation_reasons}
...
@@ -41,7 +41,7 @@ use turbo_tasks_backend::{BackingStorage, db_invalidation::invalidation_reasons}
use
turbo_tasks_fs
::{
use
turbo_tasks_fs
::{
DiskFileSystem
,
FileContent
,
FileSystem
,
FileSystemPath
,
util
::
uri_from_file
,
DiskFileSystem
,
FileContent
,
FileSystem
,
FileSystemPath
,
util
::
uri_from_file
,
};
};
use
turbo_unix_path
::
get_relative_path_to
;
use
turbo_unix_path
::
{
get_relative_path_to
,
sys_to_unix
}
;
use
turbopack_core
::{
use
turbopack_core
::{
PROJECT_FILESYSTEM_NAME
,
SOURCE_URL_PROTOCOL
,
PROJECT_FILESYSTEM_NAME
,
SOURCE_URL_PROTOCOL
,
diagnostics
::
PlainDiagnostic
,
diagnostics
::
PlainDiagnostic
,
...
@@ -1409,12 +1409,17 @@ pub struct OptionStackFrame(Option<StackFrame>);
...
@@ -1409,12 +1409,17 @@ pub struct OptionStackFrame(Option<StackFrame>);
#[turbo_tasks
::
function]
#[turbo_tasks
::
function]
pub
async
fn
get_source_map_rope
(
pub
async
fn
get_source_map_rope
(
container
:
Vc
<
ProjectContainer
>
,
container
:
Vc
<
ProjectContainer
>
,
file_path
:
RcStr
,
source_url
:
RcStr
,
)
->
Result
<
Vc
<
OptionStringifiedSourceMap
>>
{
)
->
Result
<
Vc
<
OptionStringifiedSourceMap
>>
{
let
(
file
,
module
)
=
match
Url
::
parse
(
&
file_path
)
{
let
(
file
_path_sys
,
module
)
=
match
Url
::
parse
(
&
source_url
)
{
Ok
(
url
)
=>
match
url
.scheme
()
{
Ok
(
url
)
=>
match
url
.scheme
()
{
"file"
=>
{
"file"
=>
{
let
path
=
urlencoding
::
decode
(
url
.path
())
?
.to_string
();
let
path
=
match
url
.to_file_path
()
{
Ok
(
path
)
=>
path
.to_string_lossy
()
.into
(),
Err
(
_
)
=>
{
bail!
(
"Failed to convert file URL to file path: {url}"
);
}
};
let
module
=
url
.query_pairs
()
.find
(|(
k
,
_
)|
k
==
"id"
);
let
module
=
url
.query_pairs
()
.find
(|(
k
,
_
)|
k
==
"id"
);
(
(
path
,
path
,
...
@@ -1426,23 +1431,29 @@ pub async fn get_source_map_rope(
...
@@ -1426,23 +1431,29 @@ pub async fn get_source_map_rope(
}
}
_
=>
bail!
(
"Unknown url scheme '{}'"
,
url
.scheme
()),
_
=>
bail!
(
"Unknown url scheme '{}'"
,
url
.scheme
()),
},
},
Err
(
_
)
=>
(
file_path
.to_string
(),
None
),
Err
(
_
)
=>
(
source_url
.to_string
(),
None
),
};
};
let
Some
(
chunk_base
)
=
let
chunk_base_unix
=
file
.strip_prefix
(
container
.project
()
.dist_dir_absolute
()
.await
?
.as_str
())
match
file_path_sys
.strip_prefix
(
container
.project
()
.dist_dir_absolute
()
.await
?
.as_str
())
{
else
{
Some
(
relative_path
)
=>
sys_to_unix
(
relative_path
),
None
=>
{
// File doesn't exist within the dist dir
// File doesn't exist within the dist dir
return
Ok
(
OptionStringifiedSourceMap
::
none
());
return
Ok
(
OptionStringifiedSourceMap
::
none
());
}
};
};
let
server_path
=
container
.project
()
.node_root
()
.await
?
.join
(
chunk_base
)
?
;
let
server_path
=
container
.project
()
.node_root
()
.await
?
.join
(
&
chunk_base_unix
)
?
;
let
client_path
=
container
let
client_path
=
container
.project
()
.project
()
.client_relative_path
()
.client_relative_path
()
.await
?
.await
?
.join
(
chunk_base
)
?
;
.join
(
&
chunk_base_unix
)
?
;
let
mut
map
=
container
.get_source_map
(
server_path
,
module
.clone
());
let
mut
map
=
container
.get_source_map
(
server_path
,
module
.clone
());
...
@@ -1453,7 +1464,7 @@ pub async fn get_source_map_rope(
...
@@ -1453,7 +1464,7 @@ pub async fn get_source_map_rope(
// chunks.
// chunks.
map
=
container
.get_source_map
(
client_path
,
module
);
map
=
container
.get_source_map
(
client_path
,
module
);
if
map
.await
?
.is_none
()
{
if
map
.await
?
.is_none
()
{
bail!
(
"chunk/module '{}' is missing a sourcemap"
,
file_path
);
bail!
(
"chunk/module '{}' is missing a sourcemap"
,
source_url
);
}
}
}
}
...
...
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