mirror of
https://github.com/oxc-project/oxc.git
synced 2026-09-14 19:36:11 +08:00
6365db964b
`oxc_lexer` has 2 implementations: 1\. SIMD-based on x86_64 with AVX2. 2\. Scalar/SWAR fallback which works on all platforms. Both produce the same output. This PR enables running the lexer conformance on either implementation. Which implementation is tested depends on what build flags are passed to `cargo coverage`. It turns out that it's possible to test the SIMD implementation on Mac by compiling as x86_64, and running it under Rosetta 2. This PR also adds `just` recipes to run tests and conformance on either implementation: - `just test-lexer` - `just test-lexer-simd` - `just conformance-lexer` - `just conformance-lexer-simd` These commands should work correctly on any of Linux x86, Windows x86, Mac aarch64.
355 lines
16 KiB
TOML
355 lines
16 KiB
TOML
[workspace]
|
|
resolver = "3"
|
|
members = ["apps/*", "crates/*", "napi/*", "tasks/*"]
|
|
exclude = ["apps/shared", "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.96.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"
|
|
empty_enum_variants_with_brackets = "warn"
|
|
exit = "warn"
|
|
# Performance: avoid the intermediate `String` allocation of `s.push_str(&format!(..))`.
|
|
format_push_string = "warn"
|
|
# Casting a function item/pointer to a number is almost always a mistake (a missing call).
|
|
fn_to_numeric_cast_any = "warn"
|
|
unnecessary_self_imports = "warn"
|
|
# `return Err(x)?` obscures a plain `return Err(x.into())`.
|
|
try_err = "warn"
|
|
# Don't name a type `Error` when it implements `std::error::Error`.
|
|
error_impl_error = "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"
|
|
# `OxcDiagnostic` is inlined (~176 bytes) to keep `OxcDiagnostic::error` allocation-free.
|
|
# This is a deliberate trade-off: larger `Result<T, OxcDiagnostic>` for zero malloc on the hot path.
|
|
result_large_err = "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"
|
|
# FIXME: New warnings introduced by Rust 1.97.
|
|
byte_char_slices = "allow"
|
|
question_mark = "allow"
|
|
# cargo
|
|
cargo = { level = "warn", priority = -1 }
|
|
multiple_crate_versions = "allow"
|
|
|
|
[workspace.dependencies]
|
|
# publish = true
|
|
oxc = { version = "0.148.0", path = "crates/oxc" } # Main entry point
|
|
oxc_allocator = { version = "0.148.0", path = "crates/oxc_allocator" } # Memory management
|
|
oxc_ast = { version = "0.148.0", path = "crates/oxc_ast" } # AST definitions
|
|
oxc_ast_macros = { version = "0.148.0", path = "crates/oxc_ast_macros" } # AST proc macros
|
|
oxc_ast_visit = { version = "0.148.0", path = "crates/oxc_ast_visit" } # AST visitor pattern
|
|
oxc_cfg = { version = "0.148.0", path = "crates/oxc_cfg" } # Control flow graph
|
|
oxc_codegen = { version = "0.148.0", path = "crates/oxc_codegen", default-features = false } # Code generation
|
|
oxc_compat = { version = "0.148.0", path = "crates/oxc_compat" } # Browser compatibility
|
|
oxc_data_structures = { version = "0.148.0", path = "crates/oxc_data_structures" } # Shared data structures
|
|
oxc_diagnostics = { version = "0.148.0", path = "crates/oxc_diagnostics" } # Error reporting
|
|
oxc_ecmascript = { version = "0.148.0", path = "crates/oxc_ecmascript" } # ECMAScript operations
|
|
oxc_estree = { version = "0.148.0", path = "crates/oxc_estree" } # ESTree format
|
|
oxc_estree_tokens = { version = "0.148.0", path = "crates/oxc_estree_tokens" } # ESTree token conversion
|
|
oxc_isolated_declarations = { version = "0.148.0", path = "crates/oxc_isolated_declarations" } # TS declaration generation
|
|
oxc_jsdoc = { version = "0.148.0", path = "crates/oxc_jsdoc" } # JSDoc parsing
|
|
oxc_mangler = { version = "0.148.0", path = "crates/oxc_mangler" } # Name mangling
|
|
oxc_minifier = { version = "0.148.0", path = "crates/oxc_minifier" } # Code minification
|
|
oxc_minify_napi = { version = "0.148.0", path = "napi/minify" } # Node.js minifier binding
|
|
oxc_napi = { version = "0.148.0", path = "crates/oxc_napi" } # NAPI utilities
|
|
oxc_parser = { version = "0.148.0", path = "crates/oxc_parser", features = [
|
|
"regular_expression",
|
|
] } # JS/TS parser
|
|
oxc_parser_napi = { version = "0.148.0", path = "napi/parser" } # Node.js parser binding
|
|
oxc_react_compiler = { version = "0.143.0", path = "crates/oxc_react_compiler" } # React Compiler integration (experimental)
|
|
oxc_regular_expression = { version = "0.148.0", path = "crates/oxc_regular_expression" } # Regex parser
|
|
oxc_relay = { version = "0.144.0", path = "crates/oxc_relay" } # Relay graphql tagged template transform
|
|
oxc_semantic = { version = "0.148.0", path = "crates/oxc_semantic" } # Semantic analysis
|
|
oxc_span = { version = "0.148.0", path = "crates/oxc_span" } # Source positions
|
|
oxc_str = { version = "0.148.0", path = "crates/oxc_str" } # String types
|
|
oxc_syntax = { version = "0.148.0", path = "crates/oxc_syntax" } # Syntax utilities
|
|
oxc_transform_napi = { version = "0.148.0", path = "napi/transform" } # Node.js transformer binding
|
|
oxc_transform_react_napi = { version = "0.143.0", path = "napi/transform-react" } # Node.js React Compiler binding
|
|
oxc_transform_relay_napi = { version = "0.144.0", path = "napi/transform-relay" } # Node.js Relay transform binding
|
|
oxc_transformer = { version = "0.148.0", path = "crates/oxc_transformer" } # Code transformation
|
|
oxc_transformer_plugins = { version = "0.148.0", path = "crates/oxc_transformer_plugins" } # Transformer plugins
|
|
oxc_traverse = { version = "0.148.0", path = "crates/oxc_traverse" } # AST traversal
|
|
|
|
# publish = false
|
|
oxc_config = { path = "crates/oxc_config" } # Config discovery
|
|
oxc_formatter = { path = "crates/oxc_formatter" } # Code formatting
|
|
oxc_formatter_core = { path = "crates/oxc_formatter_core" } # Language-agnostic formatter core
|
|
oxc_formatter_css = { path = "crates/oxc_formatter_css" } # CSS formatter
|
|
oxc_formatter_graphql = { path = "crates/oxc_formatter_graphql" } # GraphQL formatter
|
|
oxc_formatter_json = { path = "crates/oxc_formatter_json" } # JSON formatter
|
|
oxc_formatter_tests = { path = "crates/oxc_formatter_tests" } # Formatter test infrastructure (fixture codegen + harness)
|
|
oxc_formatter_yaml = { path = "crates/oxc_formatter_yaml" } # YAML formatter
|
|
oxc_language_server = { path = "crates/oxc_language_server", default-features = false } # Language server
|
|
oxc_lexer = { path = "crates/oxc_lexer" } # JS/TS lexer (incubating; x86_64 SIMD core, scalar fallback)
|
|
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
|
|
website_common = { path = "tasks/website_common" } # Website utilities
|
|
oxfmt = { path = "apps/oxfmt" } # Formatter CLI
|
|
oxlint = { path = "apps/oxlint" } # Linter CLI
|
|
|
|
# Relaxed version so the user can decide which version to use.
|
|
napi = { version = "3" } # 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 = "3", default-features = false } # Rust parser for macros
|
|
unicode-id-start = "1" # Unicode identifier validation
|
|
unicode-segmentation = "1.13.3" # Unicode grapheme segmentation
|
|
|
|
#
|
|
javascript-globals = "2.0.0" # JavaScript global definitions
|
|
json-strip-comments = "3.1.1" # Strip JSON comments
|
|
oxc-browserslist = "5.0.0" # Browser compatibility queries
|
|
oxc_index = { version = "5.0.0", features = ["nonmax", "serde"] } # Type-safe indices
|
|
oxc_resolver = "11.24.3" # Module resolution
|
|
oxc_sourcemap = "8.0.2" # Source map generation
|
|
|
|
#
|
|
allocator-api2 = "=0.2.21" # Allocator trait
|
|
anyhow = "1.0" # Flexible error handling
|
|
base64 = "0.23.0" # Base64 encoding
|
|
bitflags = "2.13.0" # Bitflag types
|
|
bpaf = "0.9.26" # CLI parser
|
|
bytecount = "0.6.9" # Byte counting
|
|
compact_str = "0.10.0" # Compact string type
|
|
console = "0.16.4" # Terminal utilities
|
|
constcat = "0.6.1" # Const string concatenation
|
|
convert_case = "0.12.0" # Case conversion
|
|
cow-utils = "0.1.3" # Copy-on-write utilities
|
|
criterion2 = { version = "3.0.4", default-features = false } # Benchmarking
|
|
dragonbox_ecma = "0.1.12" # Fast float formatting
|
|
editorconfig-parser = "0.0.4" # EditorConfig parsing
|
|
encoding_rs = "0.8.35" # Character encoding
|
|
encoding_rs_io = "0.1.7" # Encoding I/O
|
|
fast-glob = "1.1.1" # Fast glob matching
|
|
flate2 = "1.1.9" # Compression
|
|
futures = "0.3.32" # Async utilities
|
|
handlebars = "6.4.2" # Template engine
|
|
hashbrown = { version = "0.17.1", default-features = false } # Fast hash map
|
|
hmac-sha1-compact = "1.1.7" # Self-contained, zero-dependency SHA-1
|
|
humansize = "2.1.3" # Human-readable sizes
|
|
ignore = "0.4.30" # Gitignore matching
|
|
insta = "1.48.0" # Snapshot testing
|
|
itertools = "0.15.0" # Iterator utilities
|
|
itoa = "1.0.18" # Integer to string
|
|
language-tags = "0.3.2" # Language tag parsing
|
|
lazy-regex = "3.6.0" # Lazy regex compilation
|
|
markdown = "1.0.0" # Markdown parsing
|
|
memchr = "2.8.2" # Fast byte searching
|
|
mimalloc-safe = "0.1.64" # Fast allocator
|
|
natord = "1.0.9" # Natural string ordering
|
|
nodejs-built-in-modules = "1.0.0" # Node.js built-in modules
|
|
nonmax = "0.5.5" # Non-maximum numbers
|
|
num-bigint = "0.5.0" # Big integers
|
|
num-traits = "0.2.19" # Numeric traits
|
|
oxc-css-parser = "0.0.13" # CSS/SCSS/Less parser (raffia 0.12.3 fork: adds `template_placeholder` typed placeholders for css-in-js + valid-syntax coverage fixes (see crates/oxc_formatter_css/AGENTS.md))
|
|
oxc-graphql-parser = "0.0.9" # GraphQL parser (direct AST; apollo-parser 0.8.6 fork aligned with graphql-js 17 syntax)
|
|
oxc-toml = "0.14.5" # TOML formatter
|
|
oxc-yaml-parser = "0.0.5" # YAML 1.2 parser (comment-preserving typed AST, node naming from `yaml-unist-parser`)
|
|
papaya = "0.2.4" # Concurrent hash map
|
|
percent-encoding = "2.3.2" # URL encoding
|
|
petgraph = { version = "0.8.3", default-features = false } # Graph data structures
|
|
phf = "0.14.0" # Perfect hash function
|
|
phf_codegen = "0.14.0" # PHF codegen
|
|
pico-args = "0.5.0" # Minimal argument parser
|
|
prettyplease = "0.3.0" # Rust code formatting
|
|
project-root = "0.2.2" # Project root detection
|
|
quickcheck = "1.1.0" # Property-based testing
|
|
rand = "0.10.2" # Random number generation
|
|
rayon = "1.12.0" # Data parallelism
|
|
ropey = "1.6.1" # Rope text structure
|
|
rust-lapper = "1.3.0" # Interval tree
|
|
saphyr = "0.0.12" # YAML parser
|
|
schemars = { package = "oxc-schemars", version = "0.9.1" } # JSON schema generation
|
|
self_cell = "1.2.2" # Self-referential structs
|
|
seq-macro = "0.3.6" # Sequence macros
|
|
simdutf8 = { version = "0.1.5", features = ["aarch64_neon"] } # SIMD UTF-8 validation
|
|
similar = "3.1.1" # Text diffing
|
|
similar-asserts = "2.0.0" # Test diff assertions
|
|
smallvec = { version = "1.15.2", features = ["union", "serde"] } # Stack-allocated vectors
|
|
sort-package-json = "1.0.0" # package.json key sorting
|
|
tempfile = "3.27.0" # Temporary files
|
|
textwrap = "0.16.2" # Text wrapping
|
|
tokio = { version = "1.52.3", default-features = false } # Async runtime
|
|
toml = { version = "1.1.2" } # TOML parsing
|
|
tower-lsp-server = "0.23.0" # LSP server framework
|
|
tracing = "0.1.44" # Tracing framework
|
|
tracing-subscriber = "0.3.23" # Tracing implementation
|
|
unicode-width = "0.2" # Unicode display width
|
|
ureq = { version = "3.3.0", default-features = false } # HTTP client
|
|
url = { version = "2.5.8" } # URL parsing
|
|
walkdir = "2.5.0" # Directory traversal
|
|
windows-sys = { version = "0.61.2" } # Windows API bindings
|
|
|
|
[workspace.metadata.cargo-shear]
|
|
ignored = [
|
|
"oxc_transform_napi",
|
|
"oxc_transform_react_napi",
|
|
"oxc_transform_relay_napi",
|
|
"oxc_parser_napi",
|
|
"oxc_minify_napi",
|
|
]
|
|
|
|
# `oxc_allocator` is both dogfooded here (workspace path) and published to crates.io.
|
|
# External workspace-dependencies (e.g. `oxc-css-parser`) pull it from the registry,
|
|
# and cargo treats `oxc_allocator (path)` and `oxc_allocator (registry)` as separate crate instances
|
|
# even at the same version.
|
|
# Force the registry request to resolve to the workspace copy so there's a single instance.
|
|
[patch.crates-io]
|
|
oxc_allocator = { path = "crates/oxc_allocator" }
|
|
|
|
[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"
|
|
# The conformance harnesses catch panics.
|
|
# Inheriting the release profile's `panic = "abort"` would prevent `catch_unwind` working.
|
|
panic = "unwind"
|
|
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
|