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
9bf932c0
Commit
9bf932c0
authored
Jul 23, 2025
by
Niklas Mischkulnig
Committed by
Luke Sandberg
Jul 24, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: fix scope hoisting variable renaming bug (#81640)
parent
6d0ffcc7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
2 deletions
+18
-2
lib.rs
turbopack/crates/turbopack-ecmascript/src/lib.rs
+2
-2
index.js
...cution/turbopack/scope-hoisting/renaming-2/input/index.js
+5
-0
index.js
...rbopack/scope-hoisting/renaming-2/input/internal/index.js
+5
-0
patch-other.js
...k/scope-hoisting/renaming-2/input/internal/patch-other.js
+3
-0
patch.js
...rbopack/scope-hoisting/renaming-2/input/internal/patch.js
+3
-0
No files found.
turbopack/crates/turbopack-ecmascript/src/lib.rs
View file @
9bf932c0
...
...
@@ -2062,7 +2062,7 @@ fn hygiene_rename_only(
}
// Copied from `hygiene_with_config`'s HygieneRenamer, but added an `preserved_exports`
impl
swc_core
::
ecma
::
transforms
::
base
::
rename
::
Renamer
for
HygieneRenamer
<
'_
>
{
type
Target
=
Atom
;
type
Target
=
Id
;
const
MANGLE
:
bool
=
false
;
const
RESET_N
:
bool
=
true
;
...
...
@@ -2081,7 +2081,7 @@ fn hygiene_rename_only(
self
.preserved_exports
.contains
(
orig
)
||
orig
.
1
.has_mark
(
self
.is_import_mark
)
}
}
swc_core
::
ecma
::
transforms
::
base
::
rename
::
renamer
(
swc_core
::
ecma
::
transforms
::
base
::
rename
::
renamer
_keep_contexts
(
swc_core
::
ecma
::
transforms
::
base
::
hygiene
::
Config
{
top_level_mark
:
top_level_mark
.unwrap_or_default
(),
..
Default
::
default
()
...
...
turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/renaming-2/input/index.js
0 → 100644
View file @
9bf932c0
import
{
foo
}
from
'./internal/index.js'
it
(
'should correctly rename imports'
,
()
=>
{
expect
(
foo
({})).
toBe
(
true
)
})
turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/renaming-2/input/internal/index.js
0 → 100644
View file @
9bf932c0
import
'./patch-other.js'
import
{
patch
as
patch2
}
from
'./patch.js'
export
const
bar
=
(
patch
)
=>
patch
+
1
export
const
foo
=
(
patch
)
=>
patch
!==
patch2
turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/renaming-2/input/internal/patch-other.js
0 → 100644
View file @
9bf932c0
export
function
patch
()
{
return
2
}
turbopack/crates/turbopack-tests/tests/execution/turbopack/scope-hoisting/renaming-2/input/internal/patch.js
0 → 100644
View file @
9bf932c0
export
function
patch
()
{
return
1
}
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