Commit Graph

13 Commits

Author SHA1 Message Date
leaysgur c323187f37 refactor(formatter): Split oxc_formatter and oxc_formatter_core (#22611)
Split `oxc_formatter` into:

- `oxc_formatter(_js)`: JS/TS specific formatter, comment handling, sortImports, jsdoc, etc
- `oxc_formatter_core`: Language agnostic IR, printer, etc

The naming convention is different from Biome or Ruff (they do not have `_core`, and `_formatter` is equivalent to the core), but this is because in Oxc, items without `_js` are the default.

As a basic task, I have added `Context` as a generic to all relevant parts to ensure support for multiple languages.

There might still be other components that could be refactored into the core, but I would like to finish them as I implement support for other languages.

Also moved some shared utilities to the core in advance.
2026-05-29 00:49:49 +00:00
renovate 6cf7173c29 chore(deps): update dependency oxfmt to ^0.20.0 (#17263)
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Adoption](https://docs.renovatebot.com/merge-confidence/) | [Passing](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|---|---|
| [oxfmt](https://oxc.rs) ([source](https://redirect.github.com/oxc-project/oxc/tree/HEAD/npm/oxfmt)) | [`^0.19.0` -> `^0.20.0`](https://renovatebot.com/diffs/npm/oxfmt/0.19.0/0.20.0) | ![age](https://developer.mend.io/api/mc/badges/age/npm/oxfmt/0.20.0?slim=true) | ![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/oxfmt/0.20.0?slim=true) | ![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/oxfmt/0.19.0/0.20.0?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/oxfmt/0.19.0/0.20.0?slim=true) |

---

### Release Notes

<details>
<summary>oxc-project/oxc (oxfmt)</summary>

### [`v0.20.0`](https://redirect.github.com/oxc-project/oxc/blob/HEAD/npm/oxfmt/CHANGELOG.md#0200---2025-12-22)

[Compare Source](https://redirect.github.com/oxc-project/oxc/compare/oxfmt_v0.19.0...oxfmt_v0.20.0)

##### 🚀 Features

- [`97a02d1`](https://redirect.github.com/oxc-project/oxc/commit/97a02d1) oxfmt: Add `insertFinalNewline` option ([#&#8203;17251](https://redirect.github.com/oxc-project/oxc/issues/17251)) (leaysgur)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- 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:eyJjcmVhdGVkSW5WZXIiOiI0Mi41OS4wIiwidXBkYXRlZEluVmVyIjoiNDIuNTkuMCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOltdfQ==-->
2025-12-22 12:52:43 +00:00
camc314 4cbedc9437 fix(playground): pass transform target to minifier (#16910)
The playground minifier was not respecting the transform target option, causing ES features like optional chaining to be used even when targeting older browsers that do not support them.

Closes #16889
2025-12-16 11:49:07 +00:00
Boshen 4f8c414a71 ci(rust): fix cargo shear warnings (#15960) 2025-11-22 08:32:33 +00:00
Boshen 3656908d0e feat(rust): oxc-index-vec v4.0 (#14254)
Closes https://github.com/oxc-project/backlog/issues/109

Also did a bunch of macro stuff to reduce the boilerplates.
2025-10-04 04:58:42 +00:00
Boshen b68c5a202e feat(playground): add inject and replace plugins (#13805) 2025-09-16 14:37:04 +08:00
Boshen 08c05df60c perf(semantic): make CFG construction a compile-time feature (#13678)
part of #13646

## Summary

This PR converts the Control Flow Graph (CFG) functionality in `oxc_semantic` from runtime checks to a compile-time cargo feature, eliminating runtime overhead when CFG is not needed.

## Changes

- Added `cfg` cargo feature to `oxc_semantic/Cargo.toml` with `oxc_cfg` as optional dependency
- Feature-gated all CFG-related code using `#[cfg(feature = "cfg")]`
- Updated `oxc_linter` to enable the `cfg` feature (since it requires CFG)
- Made the `control_flow!` macro work correctly with and without the feature

## Benefits

- **Performance**: Eliminates runtime `Option<CFG>` checks when feature is disabled
- **Binary size**: Smaller binaries for crates that don't need CFG
- **Cleaner API**: CFG methods only available when feature is enabled

## Test Plan

- [x] All existing tests pass with `cargo test -p oxc_semantic --features cfg`
- [x] `oxc_linter` builds and works correctly (it enables the feature)
- [x] Feature is backward compatible - existing code continues to work

🤖 Generated with [Claude Code](https://claude.ai/code)
2025-09-11 12:44:19 +00:00
Boshen ddaebf7571 feat(napi/playground): add more options (#13523) 2025-09-02 17:52:19 +08:00
camc314 bde1ef1a79 feat(linter): load custom JS plugins (#11980) 2025-07-08 17:48:09 +00:00
camc314 79819cc12b refactor(linter): move around some config store logic (#10861)
this PR moves all of the config resolution for a single file into the `ConfigStore` structure, rather than half existing in `oxc_linter` and half in `oxlint` crates
2025-05-08 11:21:19 +00:00
Boshen d82dff91c8 feat(formatter): new implementation based on biome formatter (#10108)
Part of #5068, suggested by @ematipico and @MichaReiser, where @leaysgur
and I explored using biome formatter as the base and made a success. All
credits to the old Rome and the new Biome team.

This PR is in a boilerplate state where some of the functions are marked
as `todo!()`.

I also made the following changes:

* changed the base to be less generic, removed the `Language` and
`Context` generics
* expanded the formatter lifetime to include an `'ast` lifetime
* added access to the source text and comments
* added a mechanism for tracking and accessing parent ast nodes (done by
our codegen)
* removed most of the unit tests because they no longer compile
* removed the `oxc_prettier` crate
2025-03-30 16:54:37 +08:00
Toshit a9a47a6e1a feat(parser): Add regex cargo feature to oxc_parser (#9879)
Fixes #9839.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2025-03-19 20:57:20 +08:00
Hiroshi Ogawa 30a03a3348 refactor(napi/playground): use napi-rs wasm for playground (#9803)
playground side PR: https://github.com/oxc-project/playground/pull/71

I went ahead testing out this. Let me know if this is not the plan.

I think the benefit is that this allows rust-side playground code to
reuse some code from other napi crates, for example, `oxc_napi` and
`oxc_parser_napi`. For now, I started as mostly copying paste it and
replacing `#[wasm_bindgen]` with `#[napi]`, but I also used `oxc_napi`
for `OxcError` which replaced diagnostic serialization code from
playground.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2025-03-17 23:45:55 +08:00