No description
Find a file
renovate[bot] ee94daee42
chore(deps): update rust crates (#4517)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [env_logger](https://togithub.com/rust-cli/env_logger) |
workspace.dependencies | patch | `0.11.3` -> `0.11.5` |
|
[json-strip-comments](https://togithub.com/oxc-project/json-strip-comments)
| workspace.dependencies | patch | `1.0.2` -> `1.0.4` |
| [oxc_resolver](https://togithub.com/oxc-project/oxc-resolver) |
workspace.dependencies | patch | `1.10.0` -> `1.10.2` |
| [similar](https://togithub.com/mitsuhiko/similar) |
workspace.dependencies | minor | `2.5.0` -> `2.6.0` |
| [tokio](https://tokio.rs)
([source](https://togithub.com/tokio-rs/tokio)) | workspace.dependencies
| minor | `1.38.0` -> `1.39.2` |

---

### Release Notes

<details>
<summary>rust-cli/env_logger (env_logger)</summary>

###
[`v0.11.5`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0115---2024-07-25)

[Compare
Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.4...v0.11.5)

###
[`v0.11.4`](https://togithub.com/rust-cli/env_logger/blob/HEAD/CHANGELOG.md#0114---2024-07-23)

[Compare
Source](https://togithub.com/rust-cli/env_logger/compare/v0.11.3...v0.11.4)

</details>

<details>
<summary>oxc-project/oxc-resolver (oxc_resolver)</summary>

###
[`v1.10.2`](https://togithub.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#1102---2024-07-16)

[Compare
Source](https://togithub.com/oxc-project/oxc-resolver/compare/oxc_resolver-v1.10.1...oxc_resolver-v1.10.2)

##### Chore

-   Release FreeBSD

###
[`v1.10.1`](https://togithub.com/oxc-project/oxc-resolver/blob/HEAD/CHANGELOG.md#1101---2024-07-15)

[Compare
Source](https://togithub.com/oxc-project/oxc-resolver/compare/oxc_resolver-v1.10.0...oxc_resolver-v1.10.1)

##### Fixed

- resolve module `ipaddr.js` correctly when `extensionAlias` is provided
([#&#8203;228](https://togithub.com/oxc-project/oxc_resolver/pull/228))

</details>

<details>
<summary>mitsuhiko/similar (similar)</summary>

###
[`v2.6.0`](https://togithub.com/mitsuhiko/similar/blob/HEAD/CHANGELOG.md#260)

[Compare
Source](https://togithub.com/mitsuhiko/similar/compare/2.5.0...2.6.0)

- Bump bstr dependency to 1.5.
[#&#8203;69](https://togithub.com/mitsuhiko/similar/issues/69)

</details>

<details>
<summary>tokio-rs/tokio (tokio)</summary>

###
[`v1.39.2`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.39.2):
Tokio v1.39.2

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.39.1...tokio-1.39.2)

### 1.39.2 (July 27th, 2024)

This release fixes a regression where the `select!` macro stopped
accepting expressions that make use of temporary lifetime extension.
([#&#8203;6722])

[#&#8203;6722]: https://togithub.com/tokio-rs/tokio/pull/6722

###
[`v1.39.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.39.1):
Tokio v1.39.1

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.39.0...tokio-1.39.1)

##### 1.39.1 (July 23rd, 2024)

This release reverts "time: avoid traversing entries in the time wheel
twice" because it contains a bug. ([#&#8203;6715])

[#&#8203;6715]: https://togithub.com/tokio-rs/tokio/pull/6715

###
[`v1.39.0`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.39.0):
Tokio v1.39.0

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.38.1...tokio-1.39.0)

### 1.39.0 (July 23rd, 2024)

-   This release bumps the MSRV to 1.70. ([#&#8203;6645])
-   This release upgrades to mio v1. ([#&#8203;6635])
-   This release upgrades to windows-sys v0.52 ([#&#8203;6154])

##### Added

-   io: implement `AsyncSeek` for `Empty` ([#&#8203;6663])
- metrics: stabilize `num_alive_tasks` ([#&#8203;6619], [#&#8203;6667])
-   process: add `Command::as_std_mut` ([#&#8203;6608])
-   sync: add `watch::Sender::same_channel` ([#&#8203;6637])
- sync: add
`{Receiver,UnboundedReceiver}::{sender_strong_count,sender_weak_count}`
([#&#8203;6661])
-   sync: implement `Default` for `watch::Sender` ([#&#8203;6626])
-   task: implement `Clone` for `AbortHandle` ([#&#8203;6621])
-   task: stabilize `consume_budget` ([#&#8203;6622])

##### Changed

-   io: improve panic message of `ReadBuf::put_slice()` ([#&#8203;6629])
- io: read during write in `copy_bidirectional` and `copy`
([#&#8203;6532])
- runtime: replace `num_cpus` with `available_parallelism`
([#&#8203;6709])
- task: avoid stack overflow when passing large future to `block_on`
([#&#8203;6692])
- time: avoid traversing entries in the time wheel twice
([#&#8203;6584])
-   time: support `IntoFuture` with `timeout` ([#&#8203;6666])
- macros: support `IntoFuture` with `join!` and `select!`
([#&#8203;6710])

##### Fixed

-   docs: fix docsrs builds with the fs feature enabled ([#&#8203;6585])
- io: only use short-read optimization on known-to-be-compatible
platforms ([#&#8203;6668])
- time: fix overflow panic when using large durations with `Interval`
([#&#8203;6612])

##### Added (unstable)

- macros: allow `unhandled_panic` behavior for `#[tokio::main]` and
`#[tokio::test]` ([#&#8203;6593])
-   metrics: add `spawned_tasks_count` ([#&#8203;6114])
-   metrics: add `worker_park_unpark_count` ([#&#8203;6696])
-   metrics: add worker thread id ([#&#8203;6695])

##### Documented

-   io: update `tokio::io::stdout` documentation ([#&#8203;6674])
-   macros: typo fix in `join.rs` and `try_join.rs` ([#&#8203;6641])
-   runtime: fix typo in `unhandled_panic` ([#&#8203;6660])
- task: document behavior of `JoinSet::try_join_next` when all tasks are
running ([#&#8203;6671])

[#&#8203;6114]: https://togithub.com/tokio-rs/tokio/pull/6114

[#&#8203;6154]: https://togithub.com/tokio-rs/tokio/pull/6154

[#&#8203;6532]: https://togithub.com/tokio-rs/tokio/pull/6532

[#&#8203;6584]: https://togithub.com/tokio-rs/tokio/pull/6584

[#&#8203;6585]: https://togithub.com/tokio-rs/tokio/pull/6585

[#&#8203;6593]: https://togithub.com/tokio-rs/tokio/pull/6593

[#&#8203;6608]: https://togithub.com/tokio-rs/tokio/pull/6608

[#&#8203;6612]: https://togithub.com/tokio-rs/tokio/pull/6612

[#&#8203;6619]: https://togithub.com/tokio-rs/tokio/pull/6619

[#&#8203;6621]: https://togithub.com/tokio-rs/tokio/pull/6621

[#&#8203;6622]: https://togithub.com/tokio-rs/tokio/pull/6622

[#&#8203;6626]: https://togithub.com/tokio-rs/tokio/pull/6626

[#&#8203;6629]: https://togithub.com/tokio-rs/tokio/pull/6629

[#&#8203;6635]: https://togithub.com/tokio-rs/tokio/pull/6635

[#&#8203;6637]: https://togithub.com/tokio-rs/tokio/pull/6637

[#&#8203;6641]: https://togithub.com/tokio-rs/tokio/pull/6641

[#&#8203;6645]: https://togithub.com/tokio-rs/tokio/pull/6645

[#&#8203;6660]: https://togithub.com/tokio-rs/tokio/pull/6660

[#&#8203;6661]: https://togithub.com/tokio-rs/tokio/pull/6661

[#&#8203;6663]: https://togithub.com/tokio-rs/tokio/pull/6663

[#&#8203;6666]: https://togithub.com/tokio-rs/tokio/pull/6666

[#&#8203;6667]: https://togithub.com/tokio-rs/tokio/pull/6667

[#&#8203;6668]: https://togithub.com/tokio-rs/tokio/pull/6668

[#&#8203;6671]: https://togithub.com/tokio-rs/tokio/pull/6671

[#&#8203;6674]: https://togithub.com/tokio-rs/tokio/pull/6674

[#&#8203;6692]: https://togithub.com/tokio-rs/tokio/pull/6692

[#&#8203;6695]: https://togithub.com/tokio-rs/tokio/pull/6695

[#&#8203;6696]: https://togithub.com/tokio-rs/tokio/pull/6696

[#&#8203;6709]: https://togithub.com/tokio-rs/tokio/pull/6709

[#&#8203;6710]: https://togithub.com/tokio-rs/tokio/pull/6710

###
[`v1.38.1`](https://togithub.com/tokio-rs/tokio/releases/tag/tokio-1.38.1):
Tokio v1.38.1

[Compare
Source](https://togithub.com/tokio-rs/tokio/compare/tokio-1.38.0...tokio-1.38.1)

### 1.38.1 (July 16th, 2024)

This release fixes the bug identified as ([#&#8203;6682]), which caused
timers not
to fire when they should.

##### Fixed

- time: update `wake_up` while holding all the locks of sharded time
wheels ([#&#8203;6683])

[#&#8203;6682]: https://togithub.com/tokio-rs/tokio/pull/6682

[#&#8203;6683]: https://togithub.com/tokio-rs/tokio/pull/6683

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "before 10am on monday" in timezone
Asia/Shanghai, Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get
[config help](https://togithub.com/renovatebot/renovate/discussions) if
that's undesired.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR was generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View the
[repository job log](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy40NDAuNyIsInVwZGF0ZWRJblZlciI6IjM3LjQ0MC43IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-07-28 17:17:46 +00:00
.cargo ci: run conformance with debug assertions (#4386) 2024-07-21 20:40:50 +08:00
.github ci: run benchmarks on rust-toolchain.toml changes (#4479) 2024-07-26 11:33:41 +01:00
.vscode chore: add some useful informantion log (#1912) 2024-01-06 22:30:01 +08:00
apps/oxlint feat(linter): support suggestions and dangerous fixes (#4223) 2024-07-18 02:20:30 +00:00
crates feat(codegen): align more esbuild implementations (#4510) 2024-07-28 13:35:37 +00:00
editors/vscode chore(deps): update vscode npm packages (#4363) 2024-07-19 21:31:23 +08:00
fuzz chore: turn off doctest for all [[bin]] 2024-07-14 16:55:19 +08:00
napi Release crates v0.22.1 (#4508) 2024-07-28 09:58:29 +08:00
npm Release crates v0.22.1 (#4508) 2024-07-28 09:58:29 +08:00
tasks chore(deps): update dependency tar to v7.4.3 (#4516) 2024-07-28 17:04:31 +00:00
wasm/parser Release crates v0.22.1 (#4508) 2024-07-28 09:58:29 +08:00
website Revert "fix(website): incorrect reference displayed" (#4506) 2024-07-28 01:58:50 +00:00
.clippy.toml chore(deps): update dependency rust to v1.80.0 (#4474) 2024-07-26 01:26:44 +00:00
.editorconfig chore: remove trailing whitespaces for all files; add .editorconfig (#3639) 2024-06-12 15:47:26 +08:00
.git-blame-ignore-revs chore: update .git-blame-ignore-revs 2023-07-28 13:57:29 +08:00
.gitignore chore: remove .idea from .gitignore (#4496) 2024-07-26 23:59:24 +00:00
.ignore
.node-version ci: use node-version-file (#3607) 2024-06-10 22:06:09 +08:00
.rustfmt.toml chore: move rustfmt.toml -> .rustfmt.toml 2024-05-12 13:14:50 +08:00
.taplo.toml chore: add .cargo/config.toml to taplo 2024-07-21 20:37:48 +08:00
.typos.toml feat(linter): add fixer for jsx-a11y/aria-props (#4176) 2024-07-11 04:33:37 +00:00
Cargo.lock chore(deps): update rust crates (#4517) 2024-07-28 17:17:46 +00:00
Cargo.toml Release crates v0.22.1 (#4508) 2024-07-28 09:58:29 +08:00
CHANGELOG.md chore: update CHANGELOG.md 2024-06-06 20:24:19 +08:00
cliff.toml chore: cliff.toml features_always_bump_minor = false 2024-06-14 14:42:20 +08:00
CONTRIBUTING.md chore: change website url to https://oxc.rs 2024-06-05 22:05:08 +08:00
Cross.toml ci: passthrough CI env variable for cross build 2024-06-27 21:11:16 +08:00
deny.toml chore: format top level toml files 2024-06-04 16:05:08 +08:00
justfile feat(linter): Add eslint-plugin-promise rules: avoid-new, no-new-statics, params-names (#4293) 2024-07-17 09:21:20 +08:00
LICENSE Change license holder to @boshen 2023-11-10 14:26:11 +08:00
MAINTENANCE.md chore: update MAINTENANCE.md 2024-06-19 20:13:12 +08:00
oxc_release.toml chore: clean up unused deps 2024-06-30 19:04:44 +08:00
README.md chore: update logo and asset links 2024-07-14 13:38:35 +08:00
rust-toolchain.toml chore(deps): update dependency rust to v1.80.0 (#4474) 2024-07-26 01:26:44 +00:00
THIRD-PARTY-LICENSE chore(index): fork index_vec crate. (#3092) 2024-04-25 06:09:53 +00:00

OXC Logo

MIT licensed Build Status Code Coverage CodSpeed Badge Sponsors

Discord chat Playground Website

Oxc

The Oxidation Compiler is creating a collection of high-performance tools for JavaScript and TypeScript.

Oxc is building a parser, linter, formatter, transpiler, minifier, resolver ... all written in Rust.

See more at oxc.rs!

🙋Who's using Oxc?

Linter Quick Start

The linter is ready to catch mistakes for you. It comes with 91 rules turned on by default (out of 340+ in total) and no configuration is required.

To get started, run oxlint or via npx:

npx oxlint@latest

To give you an idea of its capabilities, here is an example from the vscode repository, which finishes linting 4800+ files in 0.7 seconds.

Performance

  • The parser aims to be the fastest Rust-based ready-for-production parser.
  • The linter is more than 50 times faster than ESLint, and scales with the number of CPU cores.

⌨️ Rust, Node.js and Wasm Usage

Rust

Individual crates are published, you may use them to build your own JavaScript tools.

  • The umbrella crate oxc exports all public crates from this repository.
  • The AST and parser crates oxc_ast and oxc_parser are production ready.
  • The resolver crate oxc_resolver for module resolution is also production ready.
  • Example usages of these crates can be found in their respective crates/*/examples directory.

While Rust has gained a reputation for its comparatively slower compilation speed, we have dedicated significant effort to fine-tune the Rust compilation speed. Our aim is to minimize any impact on your development workflow, ensuring that developing your own Oxc based tools remains a smooth and efficient experience.

This is demonstrated by our CI runs, where warm runs complete in 3 minutes.

Node.js

Wasm


🎯 Tools

🔸 AST and Parser

Oxc maintains its own AST and parser, which is by far the fastest and most conformant JavaScript and TypeScript (including JSX and TSX) parser written in Rust.

As the parser often represents a key performance bottleneck in JavaScript tooling, any minor improvements can have a cascading effect on our downstream tools. By developing our parser, we have the opportunity to explore and implement well-researched performance techniques.

While many existing JavaScript tools rely on estree as their AST specification, a notable drawback is its abundance of ambiguous nodes. This ambiguity often leads to confusion during development with estree.

The Oxc AST differs slightly from the estree AST by removing ambiguous nodes and introducing distinct types. For example, instead of using a generic estree Identifier, the Oxc AST provides specific types such as BindingIdentifier, IdentifierReference, and IdentifierName. This clear distinction greatly enhances the development experience by aligning more closely with the ECMAScript specification.

🏆 Parser Performance

Our benchmark reveals that the Oxc parser surpasses the speed of the swc parser by approximately 3 times and the Biome parser by 5 times.

How is it so fast?
  • AST is allocated in a memory arena (bumpalo) for fast AST memory allocation and deallocation.
  • Short strings are inlined by CompactString.
  • No other heap allocations are done except the above two.
  • Scope binding, symbol resolution and some syntax errors are not done in the parser, they are delegated to the semantic analyzer.

🔸 Linter

The linter embraces convention over configuration, eliminating the need for extensive configuration and plugin setup. Unlike other linters like ESLint, which often require intricate configurations and plugin installations (e.g. @typescript-eslint), our linter only requires a single command that you can immediately run on your codebase:

npx oxlint@latest

🏆 Linter Performance

The linter is 50 - 100 times faster than ESLint depending on the number of rules and number of CPU cores used. It completes in less than a second for most codebases with a few hundred files and completes in a few seconds for larger monorepos. See bench-javascript-linter for details.

As an upside, the binary is approximately 5MB, whereas ESLint and its associated plugin dependencies can easily exceed 100.

You may also download the linter binary from the latest release tag as a standalone binary, this lets you run the linter without a Node.js installation in your CI.

How is it so fast?
  • Oxc parser is used.
  • AST visit is a fast operation due to linear memory scan from the memory arena.
  • Files are linted in a multi-threaded environment, so scales with the total number of CPU cores.
  • Every single lint rule is tuned for performance.

🔸 Resolver

Module resolution plays a crucial role in JavaScript tooling, especially for tasks like multi-file analysis or bundling. However, it can often become a performance bottleneck. To address this, we developed oxc_resolver.

The resolver is production-ready and is currently being used in Rolldown. Usage and examples can be found in its own repository.

🔸 Transformer (Transpiler)

A transformer is responsible for turning higher versions of ECMAScript to a lower version that can be used in older browsers. We are currently focusing on the architecture. See Milestone 1 for details.

🔸 Isolated Declarations

TypeScript Isolated Declarations Emit without using the TypeScript compiler.

Our benchmark indications that our implementation is at least 20 times faster than the TypeScript compiler.

The npm package or crate can be used for this task.

🔸 Minifier

JavaScript minification plays a crucial role in optimizing website performance as it reduces the amount of data sent to users, resulting in faster page loads. This holds tremendous economic value, particularly for e-commerce websites, where every second can equate to millions of dollars.

However, existing minifiers typically require a trade-off between compression quality and speed. You have to choose between the slowest for the best compression or the fastest for less compression. But what if we could develop a faster minifier without compromising on compression?

We are actively working on a prototype that aims to achieve this goal, by porting all test cases from well-known minifiers such as google-closure-compiler, terser, esbuild, and tdewolff-minify.

Preliminary results indicate that we are on track to achieve our objectives. With the Oxc minifier, you can expect faster minification times without sacrificing compression quality.

🔸 Formatter

While prettier has established itself as the de facto code formatter for JavaScript, there is a significant demand in the developer community for a less opinionated alternative. Recognizing this need, our ambition is to undertake research and development to create a new JavaScript formatter that offers increased flexibility and customization options.

The prototype is currently work in progress.


✍️ Contribute

See CONTRIBUTING.md for guidance.

Check out some of the good first issues or ask us on Discord.

If you are unable to contribute by code, you can still participate by:

📚 Learning Resources

🤝 Credits

This project was incubated with the assistance of these exceptional mentors and their projects:

Special thanks go to

❤ Who's Sponsoring Oxc?

My sponsors

📖 License

Oxc is free and open-source software licensed under the MIT License.

Oxc ports or copies code from other open source projects, their licenses are listed in Third-party library licenses.