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
0f288c40
Unverified
Commit
0f288c40
authored
Dec 16, 2024
by
Jude Gao
Committed by
GitHub
Dec 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix error code check in windows (#73981)
parent
ac89400a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
lib.rs
crates/next-error-code-swc-plugin/src/lib.rs
+6
-1
next_error_code_swc_plugin.wasm
packages/next/next_error_code_swc_plugin.wasm
+0
-0
No files found.
crates/next-error-code-swc-plugin/src/lib.rs
View file @
0f288c40
...
...
@@ -16,6 +16,7 @@ struct NewError {
}
fn
is_error_class_name
(
name
:
&
str
)
->
bool
{
// Error classes are collected by https://gist.github.com/eps1lon/6cce3059dfa061f2a7dc28305fdaddae#file-collect-error-constructors-mjs
name
==
"AggregateError"
// built-in error classes
||
name
==
"Error"
...
...
@@ -150,9 +151,13 @@ impl VisitMut for TransformVisitor {
}
let
new_error_expr
:
NewExpr
=
new_error_expr
.unwrap
();
let
error_message
=
error_message
.unwrap
();
// Normalize line endings by converting Windows CRLF (\r\n) to Unix LF (\n)
// This ensures the comparison works consistently across different operating systems
let
error_message
=
error_message
.unwrap
()
.replace
(
"
\r\n
"
,
"
\n
"
);
let
code
=
self
.errors
.iter
()
.find_map
(|(
key
,
value
)|
{
// We assume `errors.json` uses Unix LF (\n) as line endings
if
*
value
==
error_message
{
Some
(
key
)
}
else
{
...
...
packages/next/next_error_code_swc_plugin.wasm
View file @
0f288c40
No preview for this file type
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