mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
chore: Rust v1.77.0 (#2781)
This commit is contained in:
parent
2c0a7d6c23
commit
ef1108a749
16 changed files with 90 additions and 99 deletions
108
Cargo.toml
108
Cargo.toml
|
|
@ -80,64 +80,64 @@ oxc_syntax = { version = "0.10.0", path = "crates/oxc_syntax" }
|
||||||
oxc_transformer = { version = "0.10.0", path = "crates/oxc_transformer" }
|
oxc_transformer = { version = "0.10.0", path = "crates/oxc_transformer" }
|
||||||
|
|
||||||
# publish = false
|
# publish = false
|
||||||
oxc_macros = { path = "crates/oxc_macros" }
|
oxc_macros = { path = "crates/oxc_macros" }
|
||||||
oxc_linter = { path = "crates/oxc_linter" }
|
oxc_linter = { path = "crates/oxc_linter" }
|
||||||
oxc_prettier = { path = "crates/oxc_prettier" }
|
oxc_prettier = { path = "crates/oxc_prettier" }
|
||||||
oxc_tasks_common = { path = "tasks/common" }
|
oxc_tasks_common = { path = "tasks/common" }
|
||||||
|
|
||||||
napi = { version = "2" }
|
napi = { version = "2" }
|
||||||
napi-derive = { version = "2" }
|
napi-derive = { version = "2" }
|
||||||
|
|
||||||
assert-unchecked = { version = "0.1.2" }
|
assert-unchecked = { version = "0.1.2" }
|
||||||
bpaf = { version = "0.9.9" }
|
bpaf = { version = "0.9.9" }
|
||||||
bitflags = { version = "2.4.2" }
|
bitflags = { version = "2.4.2" }
|
||||||
bumpalo = { version = "3.15.4" }
|
bumpalo = { version = "3.15.4" }
|
||||||
convert_case = { version = "0.6.0" }
|
convert_case = { version = "0.6.0" }
|
||||||
dashmap = { version = "5.5.3" }
|
dashmap = { version = "5.5.3" }
|
||||||
flate2 = { version = "1.0.28" }
|
flate2 = { version = "1.0.28" }
|
||||||
futures = { version = "0.3.30" }
|
futures = { version = "0.3.30" }
|
||||||
glob = { version = "0.3.1" }
|
glob = { version = "0.3.1" }
|
||||||
ignore = { version = "0.4.22" }
|
ignore = { version = "0.4.22" }
|
||||||
itertools = { version = "0.12.1" }
|
itertools = { version = "0.12.1" }
|
||||||
jemallocator = { version = "0.5.4" }
|
jemallocator = { version = "0.5.4" }
|
||||||
lazy_static = { version = "1.4.0" }
|
lazy_static = { version = "1.4.0" }
|
||||||
miette = { version = "7.2.0", features = ["fancy-no-syscall"] }
|
miette = { version = "7.2.0", features = ["fancy-no-syscall"] }
|
||||||
mimalloc = { version = "0.1.39" }
|
mimalloc = { version = "0.1.39" }
|
||||||
num-bigint = { version = "0.4.4" }
|
num-bigint = { version = "0.4.4" }
|
||||||
num-traits = { version = "0.2.18" }
|
num-traits = { version = "0.2.18" }
|
||||||
phf = { version = "0.11" }
|
phf = { version = "0.11" }
|
||||||
pico-args = { version = "0.5.0" }
|
pico-args = { version = "0.5.0" }
|
||||||
proc-macro2 = { version = "1.0.79" }
|
proc-macro2 = { version = "1.0.79" }
|
||||||
project-root = { version = "0.2.2" }
|
project-root = { version = "0.2.2" }
|
||||||
quote = { version = "1.0.35" }
|
quote = { version = "1.0.35" }
|
||||||
rayon = { version = "1.9.0" }
|
rayon = { version = "1.9.0" }
|
||||||
regex = { version = "1.10.3" }
|
regex = { version = "1.10.3" }
|
||||||
rustc-hash = { version = "1.1.0", default-features = false, features = ["std"] }
|
rustc-hash = { version = "1.1.0", default-features = false, features = ["std"] }
|
||||||
ryu-js = { version = "1.0.1" }
|
ryu-js = { version = "1.0.1" }
|
||||||
ropey = { version = "1.6.1" }
|
ropey = { version = "1.6.1" }
|
||||||
seq-macro = { version = "0.3.5" }
|
seq-macro = { version = "0.3.5" }
|
||||||
serde = { version = "1.0.197" }
|
serde = { version = "1.0.197" }
|
||||||
serde_json = { version = "1.0.114" }
|
serde_json = { version = "1.0.114" }
|
||||||
syn = { version = "=1.0.109" }
|
syn = { version = "=1.0.109" }
|
||||||
tempfile = { version = "3.10.1" }
|
tempfile = { version = "3.10.1" }
|
||||||
thiserror = { version = "1.0.58" }
|
thiserror = { version = "1.0.58" }
|
||||||
tokio = { version = "1" }
|
tokio = { version = "1" }
|
||||||
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
tower-lsp = { version = "0.20.0", features = ["proposed"] }
|
||||||
unicode-id-start = { version = "1.1.2" }
|
unicode-id-start = { version = "1.1.2" }
|
||||||
ureq = { version = "2.9.6", default-features = false, features = ["tls", "json"] }
|
ureq = { version = "2.9.6", default-features = false, features = ["tls", "json"] }
|
||||||
url = { version = "2.5.0" }
|
url = { version = "2.5.0" }
|
||||||
walkdir = { version = "2.5.0" }
|
walkdir = { version = "2.5.0" }
|
||||||
indexmap = { version = "2.2.5" }
|
indexmap = { version = "2.2.5" }
|
||||||
index_vec = { version = "0.1.3" }
|
index_vec = { version = "0.1.3" }
|
||||||
static_assertions = { version = "1.1.0" }
|
static_assertions = { version = "1.1.0" }
|
||||||
tracing-subscriber = { version = "0.3" }
|
tracing-subscriber = { version = "0.3" }
|
||||||
insta = { version = "1.36.1", features = ["glob"] }
|
insta = { version = "1.36.1", features = ["glob"] }
|
||||||
mime_guess = { version = "2.0.4" }
|
mime_guess = { version = "2.0.4" }
|
||||||
language-tags = { version = "0.3.2" }
|
language-tags = { version = "0.3.2" }
|
||||||
tsify = { version = "0.4.5" }
|
tsify = { version = "0.4.5" }
|
||||||
wasm-bindgen = { version = "0.2" }
|
wasm-bindgen = { version = "0.2" }
|
||||||
serde-wasm-bindgen = { version = "0.6.5" }
|
serde-wasm-bindgen = { version = "0.6.5" }
|
||||||
handlebars = { version = "5.1.0" }
|
handlebars = { version = "5.1.0" }
|
||||||
|
|
||||||
[profile.release.package.oxc_wasm]
|
[profile.release.package.oxc_wasm]
|
||||||
opt-level = 'z'
|
opt-level = 'z'
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ oxc_span = { workspace = true }
|
||||||
|
|
||||||
ignore = { workspace = true, features = ["simd-accel"] }
|
ignore = { workspace = true, features = ["simd-accel"] }
|
||||||
miette = { workspace = true }
|
miette = { workspace = true }
|
||||||
tempfile = {workspace=true}
|
tempfile = { workspace = true }
|
||||||
rayon = { workspace = true }
|
rayon = { workspace = true }
|
||||||
bpaf = { workspace = true, features = ["derive", "autocomplete", "bright-color"] }
|
bpaf = { workspace = true, features = ["derive", "autocomplete", "bright-color"] }
|
||||||
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
||||||
|
|
|
||||||
|
|
@ -126,8 +126,14 @@ fn default_true() -> bool {
|
||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
enum TagNamePreference {
|
enum TagNamePreference {
|
||||||
TagNameOnly(String),
|
TagNameOnly(String),
|
||||||
ObjectWithMessageAndReplacement { message: String, replacement: String },
|
ObjectWithMessageAndReplacement {
|
||||||
ObjectWithMessage { message: String },
|
message: String,
|
||||||
|
replacement: String,
|
||||||
|
},
|
||||||
|
ObjectWithMessage {
|
||||||
|
message: String,
|
||||||
|
},
|
||||||
|
#[allow(dead_code)]
|
||||||
FalseOnly(bool), // Should care `true`...?
|
FalseOnly(bool), // Should care `true`...?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -206,9 +206,7 @@ pub fn get_array_method_name<'a>(
|
||||||
}
|
}
|
||||||
|
|
||||||
// "methods",
|
// "methods",
|
||||||
let Some(method) = callee.static_property_name() else {
|
let method = callee.static_property_name()?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
if let Some(&array_method) = TARGET_METHODS.get_key(method) {
|
if let Some(&array_method) = TARGET_METHODS.get_key(method) {
|
||||||
// Check that current node is parent's first argument
|
// Check that current node is parent's first argument
|
||||||
if call.arguments.len() == 1 && is_nth_argument(call, current_node_arg, 0) {
|
if call.arguments.len() == 1 && is_nth_argument(call, current_node_arg, 0) {
|
||||||
|
|
|
||||||
|
|
@ -121,9 +121,7 @@ fn filter_and_process_jest_result<'a>(
|
||||||
possible_jest_node: &PossibleJestNode<'a, '_>,
|
possible_jest_node: &PossibleJestNode<'a, '_>,
|
||||||
ctx: &LintContext<'a>,
|
ctx: &LintContext<'a>,
|
||||||
) -> Option<(Span, &'a Atom<'a>, JestFnKind, AstNodeId)> {
|
) -> Option<(Span, &'a Atom<'a>, JestFnKind, AstNodeId)> {
|
||||||
let Some(result) = parse_general_jest_fn_call(call_expr, possible_jest_node, ctx) else {
|
let result = parse_general_jest_fn_call(call_expr, possible_jest_node, ctx)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
let kind = result.kind;
|
let kind = result.kind;
|
||||||
// we only need check `describe` or `test` block
|
// we only need check `describe` or `test` block
|
||||||
if !matches!(kind, JestFnKind::General(JestGeneralFnKind::Describe | JestGeneralFnKind::Test)) {
|
if !matches!(kind, JestFnKind::General(JestGeneralFnKind::Describe | JestGeneralFnKind::Test)) {
|
||||||
|
|
@ -134,9 +132,7 @@ fn filter_and_process_jest_result<'a>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(parent_id) = get_closest_block(possible_jest_node.node, ctx) else {
|
let parent_id = get_closest_block(possible_jest_node.node, ctx)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
match call_expr.arguments.first() {
|
match call_expr.arguments.first() {
|
||||||
Some(Argument::Expression(Expression::StringLiteral(string_lit))) => {
|
Some(Argument::Expression(Expression::StringLiteral(string_lit))) => {
|
||||||
|
|
|
||||||
|
|
@ -134,9 +134,7 @@ fn get_jasmine_property_name<'a>(member_expr: &'a MemberExpression<'a>) -> Optio
|
||||||
if !is_jasmine_object {
|
if !is_jasmine_object {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
let Some((span, property_name)) = member_expr.static_property_info() else {
|
let (span, property_name) = member_expr.static_property_info()?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
Some((span, property_name))
|
Some((span, property_name))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -85,9 +85,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
let mut is_explicit_return = false;
|
let mut is_explicit_return = false;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let Some(parent) = ctx.nodes().parent_node(node.id()) else {
|
let parent = ctx.nodes().parent_node(node.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
match parent.kind() {
|
match parent.kind() {
|
||||||
AstKind::ArrowFunctionExpression(arrow_expr) => {
|
AstKind::ArrowFunctionExpression(arrow_expr) => {
|
||||||
|
|
@ -99,9 +97,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
|
|
||||||
let Some(parent) = ctx.nodes().parent_node(parent.id()) else {
|
let parent = ctx.nodes().parent_node(parent.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
if let AstKind::ObjectProperty(_) = parent.kind() {
|
if let AstKind::ObjectProperty(_) = parent.kind() {
|
||||||
return None;
|
return None;
|
||||||
|
|
@ -112,9 +108,7 @@ fn is_in_array_or_iter<'a, 'b>(
|
||||||
is_outside_containing_function = true;
|
is_outside_containing_function = true;
|
||||||
}
|
}
|
||||||
AstKind::Function(_) => {
|
AstKind::Function(_) => {
|
||||||
let Some(parent) = ctx.nodes().parent_node(parent.id()) else {
|
let parent = ctx.nodes().parent_node(parent.id())?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
if let AstKind::ObjectProperty(_) = parent.kind() {
|
if let AstKind::ObjectProperty(_) = parent.kind() {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ memchr = "2.7.1"
|
||||||
oxc_ast = { workspace = true, features = ["serialize"] }
|
oxc_ast = { workspace = true, features = ["serialize"] }
|
||||||
miette = { workspace = true }
|
miette = { workspace = true }
|
||||||
serde_json = { workspace = true }
|
serde_json = { workspace = true }
|
||||||
ouroboros = "0.18.3" # for `multi-thread` example
|
ouroboros = "0.18.3" # for `multi-thread` example
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
# Expose Lexer for benchmarks
|
# Expose Lexer for benchmarks
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,9 @@ fn main() {
|
||||||
let ast = ast_rx.recv().unwrap();
|
let ast = ast_rx.recv().unwrap();
|
||||||
let index = ast.borrow_index();
|
let index = ast.borrow_index();
|
||||||
println!("received ast({index}) in {:?} at {}", thread::current().id(), timestamp());
|
println!("received ast({index}) in {:?} at {}", thread::current().id(), timestamp());
|
||||||
|
ast.with_ast(|bumpalo_program| {
|
||||||
|
println!("AST span: {:?}", bumpalo_program.0.span);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,9 @@ pub(super) fn print_variable_declarator<'a>(
|
||||||
pub(super) enum AssignmentLikeNode<'a, 'b> {
|
pub(super) enum AssignmentLikeNode<'a, 'b> {
|
||||||
AssignmentExpression(&'b AssignmentExpression<'a>),
|
AssignmentExpression(&'b AssignmentExpression<'a>),
|
||||||
VariableDeclarator(&'b VariableDeclarator<'a>),
|
VariableDeclarator(&'b VariableDeclarator<'a>),
|
||||||
|
#[allow(dead_code)]
|
||||||
PropertyDefinition(&'b PropertyDefinition<'a>),
|
PropertyDefinition(&'b PropertyDefinition<'a>),
|
||||||
|
#[allow(dead_code)]
|
||||||
AccessorProperty(&'b AccessorProperty<'a>),
|
AccessorProperty(&'b AccessorProperty<'a>),
|
||||||
ObjectProperty(&'b ObjectProperty<'a>),
|
ObjectProperty(&'b ObjectProperty<'a>),
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -38,11 +38,11 @@ wasm-bindgen = { workspace = true, optional = true }
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
oxc_parser = { workspace = true }
|
oxc_parser = { workspace = true }
|
||||||
|
|
||||||
itertools = { workspace = true }
|
itertools = { workspace = true }
|
||||||
indexmap = { workspace = true }
|
indexmap = { workspace = true }
|
||||||
insta = { workspace = true }
|
insta = { workspace = true }
|
||||||
phf = { workspace = true, features = ["macros"] }
|
phf = { workspace = true, features = ["macros"] }
|
||||||
rustc-hash = { workspace = true }
|
rustc-hash = { workspace = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = []
|
default = []
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,7 @@ impl<'a> JSDocFinder<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_one_by_node<'b>(&'b self, node: &AstNode<'a>) -> Option<JSDoc<'a>> {
|
pub fn get_one_by_node<'b>(&'b self, node: &AstNode<'a>) -> Option<JSDoc<'a>> {
|
||||||
let Some(jsdocs) = self.get_all_by_node(node) else {
|
let jsdocs = self.get_all_by_node(node)?;
|
||||||
return None;
|
|
||||||
};
|
|
||||||
|
|
||||||
// If flagged, at least 1 JSDoc is attached
|
// If flagged, at least 1 JSDoc is attached
|
||||||
// If multiple JSDocs are attached, return the last = nearest
|
// If multiple JSDocs are attached, return the last = nearest
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
pub fn trim_multiline_comment(s: &str) -> String {
|
pub fn trim_multiline_comment(s: &str) -> String {
|
||||||
s.trim()
|
s.trim()
|
||||||
.split('\n')
|
.lines()
|
||||||
.map(|line| line.trim().trim_start_matches('*').trim())
|
.map(|line| line.trim().trim_start_matches('*').trim())
|
||||||
.filter(|line| !line.is_empty())
|
.filter(|line| !line.is_empty())
|
||||||
.collect::<Vec<_>>()
|
.collect::<Vec<_>>()
|
||||||
|
|
|
||||||
|
|
@ -270,14 +270,10 @@ impl<'a> TypeScript<'a> {
|
||||||
fn has_value_references(&self, name: &Atom) -> bool {
|
fn has_value_references(&self, name: &Atom) -> bool {
|
||||||
let root_scope_id = self.ctx.scopes().root_scope_id();
|
let root_scope_id = self.ctx.scopes().root_scope_id();
|
||||||
|
|
||||||
self.ctx
|
self.ctx.scopes().get_binding(root_scope_id, name).is_some_and(|symbol_id| {
|
||||||
.scopes()
|
self.ctx.symbols().get_flag(symbol_id).is_export()
|
||||||
.get_binding(root_scope_id, name)
|
|| self.ctx.symbols().get_resolved_references(symbol_id).any(|x| !x.is_type())
|
||||||
.map(|symbol_id| {
|
})
|
||||||
self.ctx.symbols().get_flag(symbol_id).is_export()
|
|
||||||
|| self.ctx.symbols().get_resolved_references(symbol_id).any(|x| !x.is_type())
|
|
||||||
})
|
|
||||||
.unwrap_or_default()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
2
justfile
2
justfile
|
|
@ -17,7 +17,7 @@ init:
|
||||||
ready:
|
ready:
|
||||||
git diff --exit-code --quiet
|
git diff --exit-code --quiet
|
||||||
typos
|
typos
|
||||||
cargo fmt
|
just fmt
|
||||||
just check
|
just check
|
||||||
just test
|
just test
|
||||||
just lint
|
just lint
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
[toolchain]
|
[toolchain]
|
||||||
channel = "1.76.0"
|
channel = "1.77.0"
|
||||||
profile = "default"
|
profile = "default"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue