No description
Find a file
renovate 56f5506ca9 chore(deps): update rust crates (#6961)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [encoding_rs](https://docs.rs/encoding_rs/) ([source](https://redirect.github.com/hsivonen/encoding_rs)) | workspace.dependencies | patch | `0.8.34` -> `0.8.35` |
| [handlebars](https://redirect.github.com/sunng87/handlebars-rust) | workspace.dependencies | minor | `6.1.0` -> `6.2.0` |
| [insta](https://insta.rs/) ([source](https://redirect.github.com/mitsuhiko/insta)) | workspace.dependencies | minor | `1.40.0` -> `1.41.0` |
| [prettyplease](https://redirect.github.com/dtolnay/prettyplease) | workspace.dependencies | patch | `0.2.24` -> `0.2.25` |
| [regex](https://redirect.github.com/rust-lang/regex) | workspace.dependencies | patch | `1.11.0` -> `1.11.1` |
| [saphyr](https://redirect.github.com/saphyr-rs/saphyr) | workspace.dependencies | patch | `0.0.1` -> `0.0.3` |
| [serde](https://serde.rs) ([source](https://redirect.github.com/serde-rs/serde)) | workspace.dependencies | patch | `1.0.210` -> `1.0.213` |
| [tokio](https://tokio.rs) ([source](https://redirect.github.com/tokio-rs/tokio)) | workspace.dependencies | minor | `1.40.0` -> `1.41.0` |

---

### Release Notes

<details>
<summary>hsivonen/encoding_rs (encoding_rs)</summary>

### [`v0.8.35`](https://redirect.github.com/hsivonen/encoding_rs/compare/v0.8.34...v0.8.35)

[Compare Source](https://redirect.github.com/hsivonen/encoding_rs/compare/v0.8.34...v0.8.35)

</details>

<details>
<summary>sunng87/handlebars-rust (handlebars)</summary>

### [`v6.2.0`](https://redirect.github.com/sunng87/handlebars-rust/blob/HEAD/CHANGELOG.md#620---2024-10-26)

[Compare Source](https://redirect.github.com/sunng87/handlebars-rust/compare/v6.1.0...v6.2.0)

-   \[Added] `@index` variable for object iteration \[[#&#8203;682](https://redirect.github.com/sunng87/handlebars-rust/issues/682)]
-   \[Changed] improve number comparison between different types \[[#&#8203;679](https://redirect.github.com/sunng87/handlebars-rust/issues/679)]

</details>

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

### [`v1.41.0`](https://redirect.github.com/mitsuhiko/insta/blob/HEAD/CHANGELOG.md#1410)

[Compare Source](https://redirect.github.com/mitsuhiko/insta/compare/1.40.0...1.41.0)

-   Experimental support for binary snapshots.  [#&#8203;610](https://redirect.github.com/mitsuhiko/insta/issues/610) (Florian Plattner)

-   `--force-update-snapshots` now causes `cargo-insta` to write every snapshot, regardless of whether
    snapshots fully match, and now implies `--accept`.  This
    allows for `--force-update-snapshots` to update inline snapshots'
    delimiters and indentation.

    For the previous behavior of `--force-update-snapshots`, which limited writes to
    snapshots which didn't fully match, use `--require-full-match`.
    The main difference between `--require-full-match` and the existing behavior of `--force-update-snapshots`
    is a non-zero exit code on any snapshots which don't fully match.

    Like the previous behavior or `--force-update-snapshots`, `--require-full-match`
    doesn't track inline snapshots' delimiters or
    indentation, so can't update if those don't match.  [#&#8203;644](https://redirect.github.com/mitsuhiko/insta/issues/644)

-   Inline snapshots only use `#` characters as delimiters when required.  [#&#8203;603](https://redirect.github.com/mitsuhiko/insta/issues/603)

-   Warnings for undiscovered snapshots are more robust, and include files with
    custom snapshot extensions.  [#&#8203;637](https://redirect.github.com/mitsuhiko/insta/issues/637)

-   Insta runs correctly on packages which reference rust files in a parent path.  [#&#8203;626](https://redirect.github.com/mitsuhiko/insta/issues/626)

-   Warnings are printed when any snapshot uses a legacy format.  [#&#8203;599](https://redirect.github.com/mitsuhiko/insta/issues/599)

-   `cargo insta --version` now prints a version.  [#&#8203;665](https://redirect.github.com/mitsuhiko/insta/issues/665)

-   `insta` now internally uses `INSTA_UPDATE=force` rather than
    `INSTA_FORCE_UPDATE=1`.  (This doesn't affect users of `cargo-insta`, which
    handles this internally.)  [#&#8203;482](https://redirect.github.com/mitsuhiko/insta/issues/482)

-   `cargo-insta`'s integration tests continue to grow over the past couple of versions,
    and now offer coverage of most of `cargo-insta`'s interface.

</details>

<details>
<summary>dtolnay/prettyplease (prettyplease)</summary>

### [`v0.2.25`](https://redirect.github.com/dtolnay/prettyplease/releases/tag/0.2.25)

[Compare Source](https://redirect.github.com/dtolnay/prettyplease/compare/0.2.24...0.2.25)

-   Print safe and explicitly unsafe foreign items ([#&#8203;85](https://redirect.github.com/dtolnay/prettyplease/issues/85), [https://github.com/rust-lang/rust/issues/123743](https://redirect.github.com/rust-lang/rust/issues/123743))

</details>

<details>
<summary>rust-lang/regex (regex)</summary>

### [`v1.11.1`](https://redirect.github.com/rust-lang/regex/blob/HEAD/CHANGELOG.md#1111-2024-10-24)

[Compare Source](https://redirect.github.com/rust-lang/regex/compare/1.11.0...1.11.1)

\===================
This is a new patch release of `regex` that fixes compilation on nightly
Rust when the unstable `pattern` crate feature is enabled. Users on nightly
Rust without this feature enabled are unaffected.

Bug fixes:

-   [BUG #&#8203;1231](https://redirect.github.com/rust-lang/regex/issues/1231):
    Fix the `Pattern` trait implementation as a result of nightly API breakage.

</details>

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

### [`v0.0.3`](https://redirect.github.com/saphyr-rs/saphyr/compare/v0.0.1...v0.0.3)

[Compare Source](https://redirect.github.com/saphyr-rs/saphyr/compare/v0.0.1...v0.0.3)

</details>

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

### [`v1.0.213`](https://redirect.github.com/serde-rs/serde/releases/tag/v1.0.213)

[Compare Source](https://redirect.github.com/serde-rs/serde/compare/v1.0.212...v1.0.213)

-   Fix support for macro-generated `with` attributes inside a newtype struct ([#&#8203;2847](https://redirect.github.com/serde-rs/serde/issues/2847))

### [`v1.0.212`](https://redirect.github.com/serde-rs/serde/releases/tag/v1.0.212)

[Compare Source](https://redirect.github.com/serde-rs/serde/compare/v1.0.211...v1.0.212)

-   Fix hygiene of macro-generated local variable accesses in serde(with) wrappers ([#&#8203;2845](https://redirect.github.com/serde-rs/serde/issues/2845))

### [`v1.0.211`](https://redirect.github.com/serde-rs/serde/releases/tag/v1.0.211)

[Compare Source](https://redirect.github.com/serde-rs/serde/compare/v1.0.210...v1.0.211)

-   Improve error reporting about mismatched signature in `with` and `default` attributes ([#&#8203;2558](https://redirect.github.com/serde-rs/serde/issues/2558), thanks [@&#8203;Mingun](https://redirect.github.com/Mingun))
-   Show variant aliases in error message when variant deserialization fails ([#&#8203;2566](https://redirect.github.com/serde-rs/serde/issues/2566), thanks [@&#8203;Mingun](https://redirect.github.com/Mingun))
-   Improve binary size of untagged enum and internally tagged enum deserialization by about 12% ([#&#8203;2821](https://redirect.github.com/serde-rs/serde/issues/2821))

</details>

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

### [`v1.41.0`](https://redirect.github.com/tokio-rs/tokio/releases/tag/tokio-1.41.0): Tokio v1.41.0

[Compare Source](https://redirect.github.com/tokio-rs/tokio/compare/tokio-1.40.0...tokio-1.41.0)

##### 1.41.0 (Oct 22th, 2024)

##### Added

-   metrics: stabilize `global_queue_depth` ([#&#8203;6854], [#&#8203;6918])
-   net: add conversions for unix `SocketAddr` ([#&#8203;6868])
-   sync: add `watch::Sender::sender_count` ([#&#8203;6836])
-   sync: add `mpsc::Receiver::blocking_recv_many` ([#&#8203;6867])
-   task: stabilize `Id` apis ([#&#8203;6793], [#&#8203;6891])

##### Added (unstable)

-   metrics: add H2 Histogram option to improve histogram granularity ([#&#8203;6897])
-   metrics: rename some histogram apis ([#&#8203;6924])
-   runtime: add `LocalRuntime` ([#&#8203;6808])

##### Changed

-   runtime: box futures larger than 16k on release mode ([#&#8203;6826])
-   sync: add `#[must_use]` to `Notified` ([#&#8203;6828])
-   sync: make `watch` cooperative ([#&#8203;6846])
-   sync: make `broadcast::Receiver` cooperative ([#&#8203;6870])
-   task: add task size to tracing instrumentation ([#&#8203;6881])
-   wasm: enable `cfg_fs` for `wasi` target ([#&#8203;6822])

##### Fixed

-   net: fix regression of abstract socket path in unix socket ([#&#8203;6838])

##### Documented

-   io: recommend `OwnedFd` with `AsyncFd` ([#&#8203;6821])
-   io: document cancel safety of `AsyncFd` methods ([#&#8203;6890])
-   macros: render more comprehensible documentation for `join` and `try_join` ([#&#8203;6814], [#&#8203;6841])
-   net: fix swapped examples for `TcpSocket::set_nodelay` and `TcpSocket::nodelay` ([#&#8203;6840])
-   sync: document runtime compatibility ([#&#8203;6833])

[#&#8203;6793]: https://redirect.github.com/tokio-rs/tokio/pull/6793

[#&#8203;6808]: https://redirect.github.com/tokio-rs/tokio/pull/6808

[#&#8203;6810]: https://redirect.github.com/tokio-rs/tokio/pull/6810

[#&#8203;6814]: https://redirect.github.com/tokio-rs/tokio/pull/6814

[#&#8203;6821]: https://redirect.github.com/tokio-rs/tokio/pull/6821

[#&#8203;6822]: https://redirect.github.com/tokio-rs/tokio/pull/6822

[#&#8203;6826]: https://redirect.github.com/tokio-rs/tokio/pull/6826

[#&#8203;6828]: https://redirect.github.com/tokio-rs/tokio/pull/6828

[#&#8203;6833]: https://redirect.github.com/tokio-rs/tokio/pull/6833

[#&#8203;6836]: https://redirect.github.com/tokio-rs/tokio/pull/6836

[#&#8203;6838]: https://redirect.github.com/tokio-rs/tokio/pull/6838

[#&#8203;6840]: https://redirect.github.com/tokio-rs/tokio/pull/6840

[#&#8203;6841]: https://redirect.github.com/tokio-rs/tokio/pull/6841

[#&#8203;6846]: https://redirect.github.com/tokio-rs/tokio/pull/6846

[#&#8203;6854]: https://redirect.github.com/tokio-rs/tokio/pull/6854

[#&#8203;6867]: https://redirect.github.com/tokio-rs/tokio/pull/6867

[#&#8203;6868]: https://redirect.github.com/tokio-rs/tokio/pull/6868

[#&#8203;6870]: https://redirect.github.com/tokio-rs/tokio/pull/6870

[#&#8203;6881]: https://redirect.github.com/tokio-rs/tokio/pull/6881

[#&#8203;6890]: https://redirect.github.com/tokio-rs/tokio/pull/6890

[#&#8203;6891]: https://redirect.github.com/tokio-rs/tokio/pull/6891

[#&#8203;6897]: https://redirect.github.com/tokio-rs/tokio/pull/6897

[#&#8203;6918]: https://redirect.github.com/tokio-rs/tokio/pull/6918

[#&#8203;6924]: https://redirect.github.com/tokio-rs/tokio/pull/6924

</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 is behind base branch, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.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://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/oxc-project/oxc).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOC4xMjAuMSIsInVwZGF0ZWRJblZlciI6IjM4LjEyMC4xIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2024-10-28 06:22:28 +00:00
.cargo feat(minifier): implement part of StatementFusion (#5936) 2024-09-21 09:24:01 +00:00
.devcontainer chore: add dev container config (#6433) 2024-10-11 10:04:09 +08:00
.github ci: run napi build and test for all changes 2024-10-28 09:10:54 +08:00
.vscode chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
apps/oxlint release(oxlint): v0.10.3 (#6911) 2024-10-26 17:13:06 +08:00
crates refactor(transformer/react-refresh): small refactor (#6973) 2024-10-28 02:57:55 +00:00
editors feat(editor): Listen to config file changes and trigger a didChangeConfiguration update (#6964) 2024-10-28 08:39:24 +08:00
napi refactor(ast_tools): faster formatting Rust code (#6972) 2024-10-28 01:13:36 +00:00
npm feat(ast_tools): Add #[estree(always_flatten)] to Span (#6935) 2024-10-28 02:13:24 +00:00
tasks chore(deps): update rust crates (#6961) 2024-10-28 06:22:28 +00:00
wasm/parser fix(types): move @oxc-project/types to dependencies (#6909) 2024-10-26 10:26:54 +08:00
.clippy.toml perf(linter, ast-tools, coverage): Use FxHashSet instead of std::collections::HashSet (#6001) 2024-09-24 19:29:08 +08:00
.editorconfig chore: remove trailing whitespaces for all files; add .editorconfig (#3639) 2024-06-12 15:47:26 +08:00
.git-blame-ignore-revs
.gitignore chore: clean up .gitignore 2024-09-23 12:03:55 +08:00
.ignore
.node-version chore: bump node to v22.7.0 (#5388) 2024-09-01 21:52:01 +08:00
.rustfmt.toml chore: move rustfmt.toml -> .rustfmt.toml 2024-05-12 13:14:50 +08:00
.typos.toml fix(transformer): exponentiation transform: fix temp var names (#6318) 2024-10-06 23:08:10 +00:00
bacon.toml fix(codegen): print negative bigint 1n- -1n correctly after constant folding (#6798) 2024-10-23 04:56:50 +00:00
Cargo.lock chore(deps): update rust crates (#6961) 2024-10-28 06:22:28 +00:00
Cargo.toml chore(deps): update rust crates (#6961) 2024-10-28 06:22:28 +00:00
CHANGELOG.md docs(CHANGELOG): mention summarized relese PR 2024-09-23 11:50:06 +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 chore: format Cross.toml 2024-09-06 18:51:08 +08:00
deny.toml chore(dprint): format toml files (#5599) 2024-09-08 14:26:16 +08:00
dprint.json fix(napi/transform): fix test 2024-10-28 09:10:54 +08:00
justfile feat(ast_tools): output typescript to a separate package (#6755) 2024-10-24 13:08:57 +00:00
LICENSE chore: update license copyright holder 2024-10-02 22:37:53 +08:00
MAINTENANCE.md chore: use dprint to format js, json and markdown 2024-09-08 13:24:58 +08:00
oxc_release.toml chore(oxc_release.toml): add npm/oxc-types/package.json 2024-10-25 11:22:29 +08:00
package.json chore(deps): update pnpm to v9.12.1 (#6365) 2024-10-08 14:54:27 +00:00
pnpm-lock.yaml chore(renovate): let renovate bump all npm versions because this is a pnpmm onorepo now 2024-10-28 09:10:54 +08:00
pnpm-workspace.yaml feat(ast_tools): output typescript to a separate package (#6755) 2024-10-24 13:08:57 +00:00
README.md refactor(isolated-declarations): mark return struct as non exhaustive (#6374) 2024-10-08 22:02:14 -04:00
rust-toolchain.toml chore(deps): update dependency rust to v1.81.0 (#5502) 2024-09-05 16:57:47 +00:00
THIRD-PARTY-LICENSE

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, transformer, minifier, resolver ... all written in Rust.

See more at oxc.rs!

VoidZero Inc.

Oxc is a project of VoidZero, see our announcement Announcing VoidZero - Next Generation Toolchain for JavaScript.

If you have requirements for JavaScript tools at scale, please get in touch!

🙋Who's using Oxc?

Linter Quick Start

The linter is ready to catch mistakes for you. It comes with 93 rules turned on by default (out of 430+ 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

A transformer is responsible for turning higher versions of ECMAScript to a lower version that can be used in older browsers.

TypeScript and React transforms are complete. See Milestone 2 for current goals.

oxc-transform can be used for experimentation.

🔸 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.


🧪Test Infrastructure

In Oxc, correctness and reliability are taken extremely seriously.

We spend half of our time on strengthening the test infrastructure to prevent problems from propagating to downstream tools.

Test Infrastructure documents our test procedures:

  • Conformance suite on Test262, Babel, TypeScript
  • Lots of fuzzing
  • Linter snapshot diagnostics
  • oxlint ecosystem ci
  • Idempotency testing
  • Code coverage
  • End to end 3000 top npm packages

✍️ 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.