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
3f09e569
Unverified
Commit
3f09e569
authored
Oct 21, 2025
by
Niklas Mischkulnig
Committed by
GitHub
Oct 21, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: don't fail on export type in use server (#85054)
Allow `export type ... from "...";`
parent
bf99e962
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
50 deletions
+100
-50
server_actions.rs
...s/next-custom-transforms/src/transforms/server_actions.rs
+70
-50
input.ts
...rms/tests/fixture/server-actions/server-graph/62/input.ts
+13
-0
output.ts
...ms/tests/fixture/server-actions/server-graph/62/output.ts
+17
-0
No files found.
crates/next-custom-transforms/src/transforms/server_actions.rs
View file @
3f09e569
...
@@ -1534,19 +1534,30 @@ impl<C: Comments> VisitMut for ServerActions<C> {
...
@@ -1534,19 +1534,30 @@ impl<C: Comments> VisitMut for ServerActions<C> {
}
}
}
}
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportNamed
(
named
))
=>
{
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportNamed
(
named
))
=>
{
if
!
named
.type_only
{
if
named
.src
.is_some
()
{
if
named
.src
.is_some
()
{
if
named
.specifiers
.iter
()
.any
(|
s
|
match
s
{
ExportSpecifier
::
Namespace
(
_
)
|
ExportSpecifier
::
Default
(
_
)
=>
{
true
}
ExportSpecifier
::
Named
(
s
)
=>
!
s
.is_type_only
,
})
{
disallowed_export_span
=
named
.span
;
disallowed_export_span
=
named
.span
;
}
}
else
{
}
else
{
for
spec
in
&
mut
named
.specifiers
{
for
spec
in
&
mut
named
.specifiers
{
if
let
ExportSpecifier
::
Named
(
ExportNamedSpecifier
{
if
let
ExportSpecifier
::
Named
(
ExportNamedSpecifier
{
orig
:
ModuleExportName
::
Ident
(
ident
),
orig
:
ModuleExportName
::
Ident
(
ident
),
exported
,
exported
,
is_type_only
,
..
..
})
=
spec
})
=
spec
{
{
if
!*
is_type_only
{
if
let
Some
(
export_name
)
=
exported
{
if
let
Some
(
export_name
)
=
exported
{
if
let
ModuleExportName
::
Ident
(
Ident
{
sym
,
..
})
=
if
let
ModuleExportName
::
Ident
(
Ident
{
export_name
sym
,
..
})
=
export_name
{
{
// export { foo as bar }
// export { foo as bar }
self
.exported_idents
.push
((
self
.exported_idents
.push
((
...
@@ -1558,7 +1569,9 @@ impl<C: Comments> VisitMut for ServerActions<C> {
...
@@ -1558,7 +1569,9 @@ impl<C: Comments> VisitMut for ServerActions<C> {
None
,
None
,
),
),
));
));
}
else
if
let
ModuleExportName
::
Str
(
str
)
=
export_name
{
}
else
if
let
ModuleExportName
::
Str
(
str
)
=
export_name
{
// export { foo as "bar" }
// export { foo as "bar" }
self
.exported_idents
.push
((
self
.exported_idents
.push
((
ident
.clone
(),
ident
.clone
(),
...
@@ -1582,16 +1595,17 @@ impl<C: Comments> VisitMut for ServerActions<C> {
...
@@ -1582,16 +1595,17 @@ impl<C: Comments> VisitMut for ServerActions<C> {
),
),
));
));
}
}
}
}
else
{
}
else
{
disallowed_export_span
=
named
.span
;
disallowed_export_span
=
named
.span
;
}
}
}
}
}
}
}
}
}
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportDefaultDecl
(
ExportDefaultDecl
{
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportDefaultDecl
(
ExportDefaultDecl
{
decl
,
decl
,
span
,
span
,
..
}))
=>
match
decl
{
}))
=>
match
decl
{
DefaultDecl
::
Fn
(
f
)
=>
{
DefaultDecl
::
Fn
(
f
)
=>
{
let
(
is_action_fn
,
is_cache_fn
)
=
has_body_directive
(
&
f
.function.body
);
let
(
is_action_fn
,
is_cache_fn
)
=
has_body_directive
(
&
f
.function.body
);
...
@@ -1760,9 +1774,15 @@ impl<C: Comments> VisitMut for ServerActions<C> {
...
@@ -1760,9 +1774,15 @@ impl<C: Comments> VisitMut for ServerActions<C> {
}
}
}
}
}
}
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportAll
(
ExportAll
{
span
,
..
}))
=>
{
ModuleItem
::
ModuleDecl
(
ModuleDecl
::
ExportAll
(
ExportAll
{
span
,
type_only
,
..
}))
=>
{
if
!*
type_only
{
disallowed_export_span
=
*
span
;
disallowed_export_span
=
*
span
;
}
}
}
_
=>
{}
_
=>
{}
}
}
...
...
crates/next-custom-transforms/tests/fixture/server-actions/server-graph/62/input.ts
0 → 100644
View file @
3f09e569
'use server'
export
type
X
=
string
// @ts-ignore -- that file does not exist
export
{
type
A
}
from
'./a'
// @ts-ignore -- that file does not exist
export
type
{
B
}
from
'./b'
// @ts-ignore -- that file does not exist
export
type
*
from
'./c'
export
async
function
actionA
():
Promise
<
string
>
{
return
'hello from actionA'
}
crates/next-custom-transforms/tests/fixture/server-actions/server-graph/62/output.ts
0 → 100644
View file @
3f09e569
/* __next_internal_action_entry_do_not_use__ {"0095ef8ede0a8a4c822fcbdb018cb264731cb15281":"actionA"} */
import
{
registerServerReference
}
from
"private-next-rsc-server-reference"
;
import
{
encryptActionBoundArgs
,
decryptActionBoundArgs
}
from
"private-next-rsc-action-encryption"
;
export
type
X
=
string
;
// @ts-ignore -- that file does not exist
export
{
type
A
}
from
'./a'
;
// @ts-ignore -- that file does not exist
export
type
{
B
}
from
'./b'
;
// @ts-ignore -- that file does not exist
export
type
*
from
'./c'
;
export
async
function
actionA
():
Promise
<
string
>
{
return
'hello from actionA'
;
}
import
{
ensureServerEntryExports
}
from
"private-next-rsc-action-validate"
;
ensureServerEntryExports
([
actionA
]);
registerServerReference
(
actionA
,
"0095ef8ede0a8a4c822fcbdb018cb264731cb15281"
,
null
);
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