-
-
Notifications
You must be signed in to change notification settings - Fork 733
chore(deps)!: bump swc_core to v46 #12032
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5bc7073
a012a33
2861573
19da4f2
c50e76c
748d477
c769808
1670056
7a54be6
d501cd4
531387e
2f12945
6015b4a
d5ef524
c8662d3
74899bc
463c0ec
fda983d
29fbada
2ffc289
78608f6
3bf7f7f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,7 +3,7 @@ use rspack_swc_plugin_ts_collector::{ | |
| EnumMemberValue, ExportedEnumCollector, TypeExportsCollector, | ||
| }; | ||
| use rustc_hash::FxHashMap; | ||
| use swc::atoms::Atom; | ||
| use swc::atoms::{Atom, Wtf8Atom}; | ||
| use swc_core::{ | ||
| common::SyntaxContext, | ||
| ecma::{ast::Program, visit::VisitWith}, | ||
|
|
@@ -20,7 +20,8 @@ pub fn collect_typescript_info( | |
| if options.type_exports.unwrap_or_default() { | ||
| program.visit_with(&mut TypeExportsCollector::new(&mut type_exports)); | ||
| } | ||
| let mut exported_enums: FxHashMap<Atom, FxHashMap<Atom, EnumMemberValue>> = Default::default(); | ||
| let mut exported_enums: FxHashMap<Atom, FxHashMap<Wtf8Atom, EnumMemberValue>> = | ||
| Default::default(); | ||
| if let Some(kind) = &options.exported_enum { | ||
| program.visit_with(&mut ExportedEnumCollector::new( | ||
| matches!(kind, CollectingEnumKind::ConstOnly), | ||
|
|
@@ -39,10 +40,12 @@ pub fn collect_typescript_info( | |
| .map(|(id, v)| { | ||
| let value = match v { | ||
| EnumMemberValue::Number(n) => Some(EvaluatedInlinableValue::new_number(n)), | ||
| EnumMemberValue::String(s) => Some(EvaluatedInlinableValue::new_string(s)), | ||
| EnumMemberValue::String(s) => Some(EvaluatedInlinableValue::new_string( | ||
| s.to_atom_lossy().into_owned(), | ||
| )), | ||
| EnumMemberValue::Unknown => None, | ||
| }; | ||
| (id, value) | ||
| (id.to_atom_lossy().into_owned(), value) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enum name would contain unpaired surrogates as well |
||
| }) | ||
| .collect(), | ||
| ); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,7 +9,7 @@ use super::BasicEvaluatedExpression; | |
| #[inline] | ||
| pub fn eval_str(str: &Str) -> BasicEvaluatedExpression<'_> { | ||
| let mut res = BasicEvaluatedExpression::with_range(str.span().real_lo(), str.span().real_hi()); | ||
| res.set_string(str.value.to_string()); | ||
| res.set_string(str.value.to_string_lossy().to_string()); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe use |
||
| res | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should use
Wtf8Atomhere? Enum values may contain unpaired surrogates.