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
7e32b38b
Unverified
Commit
7e32b38b
authored
Sep 25, 2024
by
Niklas Mischkulnig
Committed by
GitHub
Sep 25, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Turbopack: fix another case of edge runtime warnings (#70455)
Closes PACK-3276
parent
178f8a00
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
16 additions
and
4 deletions
+16
-4
warn_for_edge_runtime.rs
...custom-transforms/src/transforms/warn_for_edge_runtime.rs
+10
-4
input.js
...sforms/tests/fixture/edge-assert/guarded-process/input.js
+5
-0
output.js
...forms/tests/fixture/edge-assert/guarded-process/output.js
+1
-0
No files found.
crates/next-custom-transforms/src/transforms/warn_for_edge_runtime.rs
View file @
7e32b38b
...
@@ -298,10 +298,16 @@ impl Visit for WarnForEdgeRuntime {
...
@@ -298,10 +298,16 @@ impl Visit for WarnForEdgeRuntime {
fn
visit_bin_expr
(
&
mut
self
,
node
:
&
BinExpr
)
{
fn
visit_bin_expr
(
&
mut
self
,
node
:
&
BinExpr
)
{
match
node
.op
{
match
node
.op
{
op!
(
"&&"
)
|
op!
(
"||"
)
|
op!
(
"??"
)
=>
{
op!
(
"&&"
)
|
op!
(
"||"
)
|
op!
(
"??"
)
=>
{
self
.with_new_scope
(
move
|
this
|
{
if
self
.should_add_guards
{
this
.add_guards
(
&
node
.left
);
// This is a condition and not a shorthand for if-then
node
.right
.visit_with
(
this
);
self
.add_guards
(
&
node
.left
);
});
node
.right
.visit_with
(
self
);
}
else
{
self
.with_new_scope
(
move
|
this
|
{
this
.add_guards
(
&
node
.left
);
node
.right
.visit_with
(
this
);
});
}
}
}
op!
(
"=="
)
|
op!
(
"==="
)
=>
{
op!
(
"=="
)
|
op!
(
"==="
)
=>
{
self
.add_guard_for_test
(
&
node
.left
);
self
.add_guard_for_test
(
&
node
.left
);
...
...
crates/next-custom-transforms/tests/fixture/edge-assert/guarded-process/input.js
View file @
7e32b38b
if
(
typeof
process
.
loadEnvFile
===
'function'
)
{
if
(
typeof
process
.
loadEnvFile
===
'function'
)
{
console
.
log
(
process
.
loadEnvFile
())
console
.
log
(
process
.
loadEnvFile
())
}
}
typeof
process
<
'u'
&&
typeof
process
.
off
==
'function'
&&
(
process
.
off
(
'uncaughtException'
,
this
.
onUncaughtException
),
process
.
off
(
'unhandledRejection'
,
this
.
onUncaughtRejection
))
crates/next-custom-transforms/tests/fixture/edge-assert/guarded-process/output.js
View file @
7e32b38b
if
(
typeof
process
.
loadEnvFile
===
'function'
)
{
if
(
typeof
process
.
loadEnvFile
===
'function'
)
{
console
.
log
(
process
.
loadEnvFile
());
console
.
log
(
process
.
loadEnvFile
());
}
}
typeof
process
<
'u'
&&
typeof
process
.
off
==
'function'
&&
(
process
.
off
(
'uncaughtException'
,
this
.
onUncaughtException
),
process
.
off
(
'unhandledRejection'
,
this
.
onUncaughtRejection
));
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