-
-
Notifications
You must be signed in to change notification settings - Fork 985
Expand file tree
/
Copy pathCargo.toml
More file actions
305 lines (286 loc) · 13.2 KB
/
Cargo.toml
File metadata and controls
305 lines (286 loc) · 13.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
[workspace]
resolver = "3"
members = ["apps/*", "crates/*", "napi/*", "tasks/*"]
exclude = ["tasks/lint_rules", "tasks/e2e"]
[workspace.package]
authors = ["Boshen <boshenc@gmail.com>", "Oxc contributors"]
categories = ["compilers", "development-tools", "web-programming"]
homepage = "https://oxc.rs"
keywords = ["JavaScript", "TypeScript", "linter", "minifier", "parser"]
license = "MIT"
repository = "https://github.com/oxc-project/oxc"
description = "A collection of JavaScript tools written in Rust."
edition = "2024"
# MSRV Policy N-2 (12 weeks).
# Balance between the core contributors enjoying the latest version of rustc, while waiting for dependents to catch up.
rust-version = "1.93.0"
# <https://doc.rust-lang.org/rustc/lints/listing/allowed-by-default.html>
[workspace.lints.rust]
absolute_paths_not_starting_with_crate = "warn"
non_ascii_idents = "warn"
unit-bindings = "warn"
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage)', 'cfg(coverage_nightly)'] }
tail_expr_drop_order = "warn"
unsafe_op_in_unsafe_fn = "warn"
unused_unsafe = "warn"
[workspace.lints.clippy]
all = { level = "warn", priority = -1 }
# restriction
dbg_macro = "warn"
todo = "warn"
unimplemented = "warn"
print_stdout = "warn" # Must be opt-in
print_stderr = "warn" # Must be opt-in
allow_attributes = "warn"
# I like the explicitness of this rule as it removes confusion around `clone`.
# This increases readability, avoids `clone` mindlessly and heap allocating by accident.
clone_on_ref_ptr = "warn"
# These two are mutually exclusive, I like `mod.rs` files for better fuzzy searches on module entries.
self_named_module_files = "warn" # "-Wclippy::mod_module_files"
empty_drop = "warn"
empty_structs_with_brackets = "warn"
exit = "warn"
filetype_is_file = "warn"
get_unwrap = "warn"
rc_buffer = "warn"
rc_mutex = "warn"
rest_pat_in_fully_bound_structs = "warn"
unnecessary_safety_comment = "warn"
undocumented_unsafe_blocks = "warn"
infinite_loop = "warn"
map_with_unused_argument_over_ranges = "warn"
unused_result_ok = "warn"
pathbuf_init_then_push = "warn"
pub_underscore_fields = "warn"
non_zero_suggestions = "warn"
precedence_bits = "warn"
# I want to write the best Rust code so pedantic is enabled.
# We should only disable rules globally if they are either false positives, chaotic, or does not make sense.
pedantic = { level = "warn", priority = -1 }
# Allowed rules
# pedantic
# All triggers are mostly ignored in our codebase, so this is ignored globally.
struct_excessive_bools = "allow"
too_many_lines = "allow"
# `#[must_use]` is creating too much noise for this codebase, it does not add much value
# except nagging the programmer to add a `#[must_use]` after clippy has been run.
# Having `#[must_use]` everywhere also hinders readability.
must_use_candidate = "allow"
# Too annoying, we import by name anyway.
wildcard_imports = "allow"
doc_markdown = "allow"
similar_names = "allow"
fn_params_excessive_bools = "allow"
complexity = { level = "warn", priority = -1 }
too_many_arguments = "allow"
non_std_lazy_statics = "allow"
# nursery
nursery = { level = "warn", priority = -1 }
# `const` functions do not make sense for our project because this is not a `const` library.
# This rule also confuses newcomers and forces them to add `const` blindlessly without any reason.
missing_const_for_fn = "allow"
option_if_let_else = "allow"
or_fun_call = "allow"
cognitive_complexity = "allow"
non_send_fields_in_send_ty = "allow"
use_self = "allow"
significant_drop_tightening = "allow"
branches_sharing_code = "allow"
fallible_impl_from = "allow"
useless_let_if_seq = "allow"
impl_trait_in_params = "allow"
significant_drop_in_scrutinee = "warn"
iter_on_single_items = "warn"
unused_peekable = "warn"
too_long_first_doc_paragraph = "warn"
suspicious_operation_groupings = "warn"
redundant_clone = "warn"
# cargo
cargo = { level = "warn", priority = -1 }
multiple_crate_versions = "allow"
[workspace.dependencies]
# publish = true
oxc = { version = "0.126.0", path = "crates/oxc" } # Main entry point
oxc_allocator = { version = "0.126.0", path = "crates/oxc_allocator" } # Memory management
oxc_ast = { version = "0.126.0", path = "crates/oxc_ast" } # AST definitions
oxc_ast_macros = { version = "0.126.0", path = "crates/oxc_ast_macros" } # AST proc macros
oxc_ast_visit = { version = "0.126.0", path = "crates/oxc_ast_visit" } # AST visitor pattern
oxc_cfg = { version = "0.126.0", path = "crates/oxc_cfg" } # Control flow graph
oxc_codegen = { version = "0.126.0", path = "crates/oxc_codegen", default-features = false } # Code generation
oxc_compat = { version = "0.126.0", path = "crates/oxc_compat" } # Browser compatibility
oxc_data_structures = { version = "0.126.0", path = "crates/oxc_data_structures" } # Shared data structures
oxc_diagnostics = { version = "0.126.0", path = "crates/oxc_diagnostics" } # Error reporting
oxc_ecmascript = { version = "0.126.0", path = "crates/oxc_ecmascript" } # ECMAScript operations
oxc_estree = { version = "0.126.0", path = "crates/oxc_estree" } # ESTree format
oxc_estree_tokens = { version = "0.126.0", path = "crates/oxc_estree_tokens" } # ESTree token conversion
oxc_isolated_declarations = { version = "0.126.0", path = "crates/oxc_isolated_declarations" } # TS declaration generation
oxc_jsdoc = { version = "0.126.0", path = "crates/oxc_jsdoc" } # JSDoc parsing
oxc_mangler = { version = "0.126.0", path = "crates/oxc_mangler" } # Name mangling
oxc_minifier = { version = "0.126.0", path = "crates/oxc_minifier" } # Code minification
oxc_minify_napi = { version = "0.126.0", path = "napi/minify" } # Node.js minifier binding
oxc_napi = { version = "0.126.0", path = "crates/oxc_napi" } # NAPI utilities
oxc_parser = { version = "0.126.0", path = "crates/oxc_parser", features = [
"regular_expression",
] } # JS/TS parser
oxc_parser_napi = { version = "0.126.0", path = "napi/parser" } # Node.js parser binding
oxc_regular_expression = { version = "0.126.0", path = "crates/oxc_regular_expression" } # Regex parser
oxc_semantic = { version = "0.126.0", path = "crates/oxc_semantic" } # Semantic analysis
oxc_span = { version = "0.126.0", path = "crates/oxc_span" } # Source positions
oxc_str = { version = "0.126.0", path = "crates/oxc_str" } # String types
oxc_syntax = { version = "0.126.0", path = "crates/oxc_syntax" } # Syntax utilities
oxc_transform_napi = { version = "0.126.0", path = "napi/transform" } # Node.js transformer binding
oxc_transformer = { version = "0.126.0", path = "crates/oxc_transformer" } # Code transformation
oxc_transformer_plugins = { version = "0.126.0", path = "crates/oxc_transformer_plugins" } # Transformer plugins
oxc_traverse = { version = "0.126.0", path = "crates/oxc_traverse" } # AST traversal
# publish = false
oxc_formatter = { path = "crates/oxc_formatter" } # Code formatting
oxc_language_server = { path = "crates/oxc_language_server", default-features = false } # Language server
oxc_linter = { path = "crates/oxc_linter" } # Linting engine
oxc_macros = { path = "crates/oxc_macros" } # Proc macros
oxc_tasks_common = { path = "tasks/common" } # Task utilities
oxc_tasks_transform_checker = { path = "tasks/transform_checker" } # Transform validation
oxlint = { path = "apps/oxlint" } # Linter CLI
# Relaxed version so the user can decide which version to use.
napi = { version = "3", features = ["tokio_rt"] } # Node.js native bindings
napi-build = "2" # NAPI build tool
napi-derive = "3" # NAPI proc macros
# Relaxed version so the user can decide which version to use.
indexmap = "2" # Ordered hash map
proc-macro2 = "1" # Proc macro API
quote = "1" # Quasi-quoting for macros
rustc-hash = "2" # Fast hash algorithm
serde = "1" # Serialization framework
serde_json = "1" # JSON serialization
syn = { version = "2", default-features = false } # Rust parser for macros
unicode-id-start = "1" # Unicode identifier validation
#
javascript-globals = "1.5.0" # JavaScript global definitions
json-strip-comments = "3.1.0" # Strip JSON comments
oxc-browserslist = "3.0.0" # Browser compatibility queries
oxc_index = { version = "4.1.0", features = ["nonmax", "serde"] } # Type-safe indices
oxc_resolver = "11.16.3" # Module resolution
oxc_sourcemap = "6.0.1" # Source map generation
#
allocator-api2 = "=0.2.21" # Allocator trait
base64 = "0.22.1" # Base64 encoding
bitflags = "2.10.0" # Bitflag types
bpaf = "0.9.20" # CLI parser
compact_str = "0.9.0" # Compact string type
console = "0.16.2" # Terminal utilities
constcat = "0.6.1" # Const string concatenation
convert_case = "0.11.0" # Case conversion
cow-utils = "0.1.3" # Copy-on-write utilities
criterion2 = { version = "3.0.2", default-features = false } # Benchmarking
dragonbox_ecma = "0.1.0" # Fast float formatting
encoding_rs = "0.8.35" # Character encoding
encoding_rs_io = "0.1.7" # Encoding I/O
fast-glob = "1.0.0" # Fast glob matching
flate2 = "1.1.8" # Compression
futures = "0.3.31" # Async utilities
handlebars = "6.4.0" # Template engine
hashbrown = { version = "0.17.0", default-features = false } # Fast hash map
humansize = "2.1.3" # Human-readable sizes
icu_segmenter = "2.1.2" # Unicode segmentation
ignore = "0.4.25" # Gitignore matching
insta = "1.43.2" # Snapshot testing
itertools = "0.14.0" # Iterator utilities
itoa = "1.0.17" # Integer to string
language-tags = "0.3.2" # Language tag parsing
lazy-regex = "3.5.1" # Lazy regex compilation
markdown = "1.0.0" # Markdown parsing
memchr = "2.7.6" # Fast byte searching
miette = { package = "oxc-miette", version = "2.7.1", features = [
"fancy-no-syscall",
] } # Error reporting
mimalloc-safe = "0.1.56" # Fast allocator
nodejs-built-in-modules = "1.0.0" # Node.js built-in modules
nonmax = "0.5.5" # Non-maximum numbers
num-bigint = "0.4.6" # Big integers
num-traits = "0.2.19" # Numeric traits
papaya = "0.2.3" # Concurrent hash map
percent-encoding = "2.3.2" # URL encoding
petgraph = { version = "0.8.3", default-features = false } # Graph data structures
phf = "0.13.1" # Perfect hash function
phf_codegen = "0.13.1" # PHF codegen
pico-args = "0.5.0" # Minimal argument parser
prettyplease = "0.2.37" # Rust code formatting
project-root = "0.2.2" # Project root detection
quickcheck = "1.1.0" # Property-based testing
rand = "0.10.0" # Random number generation
rayon = "1.11.0" # Data parallelism
ropey = "1.6.1" # Rope text structure
rust-lapper = "1.2.0" # Interval tree
saphyr = "0.0.6" # YAML parser
schemars = { package = "oxc-schemars", version = "0.8.27" } # JSON schema generation
self_cell = "1.2.2" # Self-referential structs
seq-macro = "0.3.6" # Sequence macros
sha1 = "0.11.0" # SHA-1 hashing
simdutf8 = { version = "0.1.5", features = ["aarch64_neon"] } # SIMD UTF-8 validation
similar = "3.0.0" # Text diffing
similar-asserts = "2.0.0" # Test diff assertions
smallvec = { version = "1.15.1", features = ["union", "serde"] } # Stack-allocated vectors
tempfile = "3.24.0" # Temporary files
tokio = { version = "1.49.0", default-features = false } # Async runtime
toml = { version = "1.0.0" }
tower-lsp-server = "0.23.0" # LSP server framework
tracing = "0.1.44"
tracing-subscriber = "0.3.22" # Tracing implementation
ureq = { version = "3.1.4", default-features = false } # HTTP client
url = { version = "2.5.8" } # URL parsing
walkdir = "2.5.0" # Directory traversal
editorconfig-parser = "0.0.4"
natord = "1.0.9"
oxfmt = { path = "apps/oxfmt" }
sort-package-json = "0.0.12"
oxc-toml = "0.14.2"
unicode-width = "0.2"
website_common = { path = "tasks/website_common" }
[workspace.metadata.cargo-shear]
ignored = ["oxc_transform_napi", "oxc_parser_napi", "oxc_minify_napi"]
[profile.dev]
# Disabling debug info speeds up local and CI builds,
# and we don't rely on it for debugging that much.
debug = false
[profile.test]
# Disabling debug info speeds up local and CI builds,
# and we don't rely on it for debugging that much.
debug = false
[profile.dev.package]
# Compile macros with some optimizations to make consuming crates build faster
oxc_macros.opt-level = 1
oxc_ast_macros.opt-level = 1
# Compile insta and its dependencies in release mode for faster snapshot tests
# See: https://insta.rs/docs/quickstart/#optional-faster-runs
insta.opt-level = 3
similar.opt-level = 3
[profile.release.package.oxc_playground_napi]
opt-level = 'z'
[profile.release]
# Configurations explicitly listed here for clarity.
# Using the best options for performance.
opt-level = 3
lto = "fat"
codegen-units = 1
strip = "symbols" # Set to `false` for debug information
debug = false # Set to `true` for debug information
panic = "abort" # Let it crash and force ourselves to write safe Rust
# Profile used for release mode, but with debugging information for profiling
# and debugging. Use `cargo build --profile=release-with-debug` to build with this profile.
[profile.release-with-debug]
inherits = "release"
strip = false # Keep debug information in binary
debug = true # Include maximum amount of debug information
# Profile for `cargo coverage`
[profile.coverage]
inherits = "release"
opt-level = 2 # Compile faster
codegen-units = 256 # Compile faster
lto = "thin" # Faster compile time with thin LTO
debug-assertions = true # Make sure `debug_assert!`s pass
overflow-checks = true # Catch arithmetic overflow errors
# Profile for linting with release mode-like settings.
# Catches lint errors which only appear in release mode.
# `cargo lint --profile dev-no-debug-assertions` is about 35% faster than `cargo lint --release`.
[profile.dev-no-debug-assertions]
inherits = "dev"
debug-assertions = false