Skip to content

Commit

Permalink
Merge branch 'main' into feat/jest-valid-expect-in-promise
Browse files Browse the repository at this point in the history
  • Loading branch information
eryue0220 committed Apr 30, 2024
2 parents 82abe19 + bdae6b0 commit 22264a9
Show file tree
Hide file tree
Showing 30 changed files with 768 additions and 332 deletions.
96 changes: 74 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,10 @@ owo-colors = "4.0.0"
oxc_resolver = "1.7.0"
petgraph = "0.6.4"
rust-lapper = "1.1.0"
serde_yaml = "0.9.34"
similar = "2.5.0"
textwrap = "0.16.0"
unicode-width = "0.1.12"
saphyr = "0.0.1"

[workspace.metadata.cargo-shear]
ignored = ["napi"]
Expand Down
6 changes: 5 additions & 1 deletion crates/oxc_ast/src/ast/jsx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,12 @@ pub struct JSXAttribute<'a> {
}

impl<'a> JSXAttribute<'a> {
pub fn is_identifier(&self, name: &str) -> bool {
matches!(&self.name, JSXAttributeName::Identifier(ident) if ident.name == name)
}

pub fn is_key(&self) -> bool {
matches!(&self.name, JSXAttributeName::Identifier(ident) if ident.name == "key")
self.is_identifier("key")
}
}

Expand Down
10 changes: 8 additions & 2 deletions crates/oxc_ast/src/serialize.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ impl serde_json::ser::Formatter for EcmaFormatter {
impl<'a> Program<'a> {
/// # Panics
pub fn to_json(&self) -> String {
let ser = self.serializer();
String::from_utf8(ser.into_inner()).unwrap()
}

/// # Panics
pub fn serializer(&self) -> serde_json::Serializer<std::vec::Vec<u8>, EcmaFormatter> {
let buf = std::vec::Vec::new();
let mut ser = serde_json::Serializer::with_formatter(buf, crate::serialize::EcmaFormatter);
let mut ser = serde_json::Serializer::with_formatter(buf, EcmaFormatter);
self.serialize(&mut ser).unwrap();
String::from_utf8(ser.into_inner()).unwrap()
ser
}
}

Expand Down

0 comments on commit 22264a9

Please sign in to comment.