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
cbc4888b
Unverified
Commit
cbc4888b
authored
Feb 23, 2026
by
Sebastian "Sebbie" Silbermann
Committed by
GitHub
Feb 23, 2026
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[turbopack] Consider `ignoreList` of 3rd party sourcemaps in Redbox (#90317)
parent
9b6e563f
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
21 deletions
+42
-21
project.rs
crates/next-napi-bindings/src/next_api/project.rs
+5
-2
generated-native.d.ts
packages/next/src/build/swc/generated-native.d.ts
+1
-0
types.ts
packages/next/src/build/swc/types.ts
+1
-0
middleware-turbopack.ts
packages/next/src/server/dev/middleware-turbopack.ts
+2
-1
server-source-maps.test.ts
...e2e/app-dir/server-source-maps/server-source-maps.test.ts
+0
-2
mod.rs
turbopack/crates/turbopack-core/src/source_map/mod.rs
+33
-16
No files found.
crates/next-napi-bindings/src/next_api/project.rs
View file @
cbc4888b
...
@@ -2128,6 +2128,7 @@ pub fn project_compilation_events_subscribe(
...
@@ -2128,6 +2128,7 @@ pub fn project_compilation_events_subscribe(
pub
struct
StackFrame
{
pub
struct
StackFrame
{
pub
is_server
:
bool
,
pub
is_server
:
bool
,
pub
is_internal
:
Option
<
bool
>
,
pub
is_internal
:
Option
<
bool
>
,
pub
is_ignored
:
Option
<
bool
>
,
pub
original_file
:
Option
<
RcStr
>
,
pub
original_file
:
Option
<
RcStr
>
,
pub
file
:
RcStr
,
pub
file
:
RcStr
,
/// 1-indexed, unlike source map tokens
/// 1-indexed, unlike source map tokens
...
@@ -2235,7 +2236,7 @@ pub async fn project_trace_source_operation(
...
@@ -2235,7 +2236,7 @@ pub async fn project_trace_source_operation(
frame
.column
.unwrap_or
(
1
)
.saturating_sub
(
1
),
frame
.column
.unwrap_or
(
1
)
.saturating_sub
(
1
),
);
);
let
(
original_file
,
line
,
column
,
method_name
)
=
match
token
{
let
(
original_file
,
line
,
column
,
method_name
,
is_ignored
)
=
match
token
{
Token
::
Original
(
token
)
=>
(
Token
::
Original
(
token
)
=>
(
match
urlencoding
::
decode
(
&
token
.original_file
)
?
{
match
urlencoding
::
decode
(
&
token
.original_file
)
?
{
Cow
::
Borrowed
(
_
)
=>
token
.original_file
,
Cow
::
Borrowed
(
_
)
=>
token
.original_file
,
...
@@ -2245,12 +2246,13 @@ pub async fn project_trace_source_operation(
...
@@ -2245,12 +2246,13 @@ pub async fn project_trace_source_operation(
Some
(
token
.original_line
+
1
),
Some
(
token
.original_line
+
1
),
Some
(
token
.original_column
+
1
),
Some
(
token
.original_column
+
1
),
token
.name
,
token
.name
,
token
.is_ignored
,
),
),
Token
::
Synthetic
(
token
)
=>
{
Token
::
Synthetic
(
token
)
=>
{
let
Some
(
original_file
)
=
token
.guessed_original_file
else
{
let
Some
(
original_file
)
=
token
.guessed_original_file
else
{
return
Ok
(
Vc
::
cell
(
None
));
return
Ok
(
Vc
::
cell
(
None
));
};
};
(
original_file
,
None
,
None
,
None
)
(
original_file
,
None
,
None
,
None
,
false
)
}
}
};
};
...
@@ -2303,6 +2305,7 @@ pub async fn project_trace_source_operation(
...
@@ -2303,6 +2305,7 @@ pub async fn project_trace_source_operation(
column
,
column
,
is_server
:
frame
.is_server
,
is_server
:
frame
.is_server
,
is_internal
:
Some
(
is_internal
),
is_internal
:
Some
(
is_internal
),
is_ignored
:
Some
(
is_ignored
),
})))
})))
}
}
...
...
packages/next/src/build/swc/generated-native.d.ts
View file @
cbc4888b
...
@@ -363,6 +363,7 @@ export declare function projectCompilationEventsSubscribe(
...
@@ -363,6 +363,7 @@ export declare function projectCompilationEventsSubscribe(
export
interface
StackFrame
{
export
interface
StackFrame
{
isServer
:
boolean
isServer
:
boolean
isInternal
?:
boolean
isInternal
?:
boolean
isIgnored
?:
boolean
originalFile
?:
RcStr
originalFile
?:
RcStr
file
:
RcStr
file
:
RcStr
/** 1-indexed, unlike source map tokens */
/** 1-indexed, unlike source map tokens */
...
...
packages/next/src/build/swc/types.ts
View file @
cbc4888b
...
@@ -230,6 +230,7 @@ export interface HmrChunkNames {
...
@@ -230,6 +230,7 @@ export interface HmrChunkNames {
export
interface
TurbopackStackFrame
{
export
interface
TurbopackStackFrame
{
isServer
:
boolean
isServer
:
boolean
isInternal
?:
boolean
isInternal
?:
boolean
isIgnored
?:
boolean
file
:
string
file
:
string
originalFile
?:
string
originalFile
?:
string
/** 1-indexed, unlike source map tokens */
/** 1-indexed, unlike source map tokens */
...
...
packages/next/src/server/dev/middleware-turbopack.ts
View file @
cbc4888b
...
@@ -87,6 +87,8 @@ async function batchedTraceSource(
...
@@ -87,6 +87,8 @@ async function batchedTraceSource(
// Don't look up source for node_modules or internals. These can often be large bundled files.
// Don't look up source for node_modules or internals. These can often be large bundled files.
const
ignored
=
const
ignored
=
// Check the sourcemap's ignoreList (e.g. from 3rd party packages)
!!
sourceFrame
.
isIgnored
||
shouldIgnorePath
(
originalFile
??
sourceFrame
.
file
)
||
shouldIgnorePath
(
originalFile
??
sourceFrame
.
file
)
||
// isInternal means resource starts with turbopack:///[turbopack]
// isInternal means resource starts with turbopack:///[turbopack]
!!
sourceFrame
.
isInternal
!!
sourceFrame
.
isInternal
...
@@ -104,7 +106,6 @@ async function batchedTraceSource(
...
@@ -104,7 +106,6 @@ async function batchedTraceSource(
source
=
await
sourcePromise
source
=
await
sourcePromise
}
}
// TODO: get ignoredList from turbopack source map
const
ignorableFrame
:
IgnorableStackFrame
=
{
const
ignorableFrame
:
IgnorableStackFrame
=
{
file
:
sourceFrame
.
file
,
file
:
sourceFrame
.
file
,
line1
:
sourceFrame
.
line
??
null
,
line1
:
sourceFrame
.
line
??
null
,
...
...
test/e2e/app-dir/server-source-maps/server-source-maps.test.ts
View file @
cbc4888b
...
@@ -318,7 +318,6 @@ describe('app-dir - server source maps', () => {
...
@@ -318,7 +318,6 @@ describe('app-dir - server source maps', () => {
)
)
if
(
isTurbopack
)
{
if
(
isTurbopack
)
{
// TODO(veil): Turbopack errors because it thinks the sources are not part of the project.
// TODO(veil): Turbopack errors because it thinks the sources are not part of the project.
// TODO(veil-NDX-910): Turbopack's sourcemap loader drops `ignoreList` in browser sourcemaps.
await
expect
(
browser
).
toDisplayCollapsedRedbox
(
`
await
expect
(
browser
).
toDisplayCollapsedRedbox
(
`
{
{
"description": "ssr-error-log-ignore-listed",
"description": "ssr-error-log-ignore-listed",
...
@@ -330,7 +329,6 @@ describe('app-dir - server source maps', () => {
...
@@ -330,7 +329,6 @@ describe('app-dir - server source maps', () => {
"stack": [
"stack": [
"logError app/ssr-error-log-ignore-listed/page.js (9:17)",
"logError app/ssr-error-log-ignore-listed/page.js (9:17)",
"runWithInternalIgnored app/ssr-error-log-ignore-listed/page.js (19:13)",
"runWithInternalIgnored app/ssr-error-log-ignore-listed/page.js (19:13)",
"runInternalIgnored internal-pkg/ignored.ts (6:10)",
"runWithExternalSourceMapped app/ssr-error-log-ignore-listed/page.js (18:29)",
"runWithExternalSourceMapped app/ssr-error-log-ignore-listed/page.js (18:29)",
"runWithExternal app/ssr-error-log-ignore-listed/page.js (17:32)",
"runWithExternal app/ssr-error-log-ignore-listed/page.js (17:32)",
"runWithInternalSourceMapped app/ssr-error-log-ignore-listed/page.js (16:18)",
"runWithInternalSourceMapped app/ssr-error-log-ignore-listed/page.js (16:18)",
...
...
turbopack/crates/turbopack-core/src/source_map/mod.rs
View file @
cbc4888b
...
@@ -129,6 +129,8 @@ pub struct OriginalToken {
...
@@ -129,6 +129,8 @@ pub struct OriginalToken {
pub
original_line
:
u32
,
pub
original_line
:
u32
,
pub
original_column
:
u32
,
pub
original_column
:
u32
,
pub
name
:
Option
<
RcStr
>
,
pub
name
:
Option
<
RcStr
>
,
/// Whether this token's source is in the sourcemap's `ignoreList`.
pub
is_ignored
:
bool
,
}
}
impl
Token
{
impl
Token
{
...
@@ -159,6 +161,7 @@ impl Token {
...
@@ -159,6 +161,7 @@ impl Token {
original_line
:
t
.original_line
,
original_line
:
t
.original_line
,
original_column
:
t
.original_column
,
original_column
:
t
.original_column
,
name
:
t
.name
.clone
(),
name
:
t
.name
.clone
(),
is_ignored
:
t
.is_ignored
,
}),
}),
Self
::
Synthetic
(
t
)
=>
Self
::
Synthetic
(
SyntheticToken
{
Self
::
Synthetic
(
t
)
=>
Self
::
Synthetic
(
SyntheticToken
{
generated_line
:
t
.generated_line
+
line_offset
,
generated_line
:
t
.generated_line
+
line_offset
,
...
@@ -187,6 +190,10 @@ impl From<swc_sourcemap::Token<'_>> for Token {
...
@@ -187,6 +190,10 @@ impl From<swc_sourcemap::Token<'_>> for Token {
original_line
:
t
.get_src_line
(),
original_line
:
t
.get_src_line
(),
original_column
:
t
.get_src_col
(),
original_column
:
t
.get_src_col
(),
name
:
t
.get_name
()
.cloned
()
.map
(
RcStr
::
from
),
name
:
t
.get_name
()
.cloned
()
.map
(
RcStr
::
from
),
// Set to false initially; will be updated by
// lookup_token_and_source_internal which has access to the full
// source map's ignoreList.
is_ignored
:
false
,
})
})
}
else
{
}
else
{
Token
::
Synthetic
(
SyntheticToken
{
Token
::
Synthetic
(
SyntheticToken
{
...
@@ -546,22 +553,32 @@ impl SourceMap {
...
@@ -546,22 +553,32 @@ impl SourceMap {
*
guessed_original_file
=
Some
(
RcStr
::
from
(
source
));
*
guessed_original_file
=
Some
(
RcStr
::
from
(
source
));
}
}
if
need_source_content
// Check ignoreList and resolve source content using the regular
&&
content
.is_none
()
// (possibly flattened) source map. For Index maps,
&&
let
Some
(
map
)
=
map
.as_regular_source_map
()
// SourceMapIndex::flatten() correctly transfers ignoreList entries
{
// from each section into the flattened map.
content
=
tok
.and_then
(|
tok
|
{
if
let
Some
(
flat_map
)
=
map
.as_regular_source_map
()
{
let
src_id
=
tok
.get_src_id
();
if
let
Token
::
Original
(
ref
mut
orig
)
=
token
&&
let
Some
(
source_name
)
=
tok
.and_then
(|
t
|
t
.get_source
()
.cloned
())
let
name
=
map
.get_source
(
src_id
);
&&
let
Some
(
idx
)
=
flat_map
.sources
()
.position
(|
s
|
*
s
==
*
source_name
)
let
content
=
map
.get_source_contents
(
src_id
);
{
orig
.is_ignored
=
flat_map
.ignore_list
()
.any
(|
id
|
*
id
==
idx
as
u32
);
let
(
name
,
content
)
=
name
.zip
(
content
)
?
;
}
Some
(
sourcemap_content_source
(
name
.clone
()
.into
(),
if
need_source_content
&&
content
.is_none
()
{
content
.clone
()
.into
(),
content
=
tok
.and_then
(|
tok
|
{
))
let
src_id
=
tok
.get_src_id
();
});
let
name
=
flat_map
.get_source
(
src_id
);
let
content
=
flat_map
.get_source_contents
(
src_id
);
let
(
name
,
content
)
=
name
.zip
(
content
)
?
;
Some
(
sourcemap_content_source
(
name
.clone
()
.into
(),
content
.clone
()
.into
(),
))
});
}
}
}
token
token
...
...
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