Commit graph

399 commits

Author SHA1 Message Date
overlookmotel
be958ce299
refactor(transform): transformer use Traverse (#3182)
Sliced off from #3152.

This switches the transformer over to use `Traverse` instead of
`VisitMut`.

This is incomplete - scopes are not implemented yet. At present, no
transforms use scopes anyway, so all tests pass, but regardless I don't
think should be merged until the implementation is complete.
2024-05-08 17:18:40 +08:00
Boshen
7363e14335
feat(sourcemap): add "rayon" feature (#3198) 2024-05-07 23:47:36 +08:00
overlookmotel
be87ca8419
feat(transform): oxc_traverse crate (#3169)
First part of #3152.

This adds a crate `oxc_traverse`, but doesn't connect it up to the
transformer or anything else yet.

I think we could merge this now - as it doesn't affect any code that's
in use - and then iterate on it to add scopes before using it in
transformer. Please see
https://github.com/oxc-project/oxc/pull/3152#issuecomment-2094965406 for
the broader picture.
2024-05-06 09:37:04 +08:00
renovate[bot]
46b4f4fd31
chore(deps): lock file maintenance rust crates (#3164)
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
|  |  | lockFileMaintenance | All locks refreshed |
| [base64](https://togithub.com/marshallpierce/rust-base64) |
workspace.dependencies | patch | `0.22.0` -> `0.22.1` |
| [bpaf](https://togithub.com/pacak/bpaf) | workspace.dependencies |
patch | `0.9.11` -> `0.9.12` |
| [flate2](https://togithub.com/rust-lang/flate2-rs) |
workspace.dependencies | patch | `1.0.29` -> `1.0.30` |
| [num-traits](https://togithub.com/rust-num/num-traits) |
workspace.dependencies | patch | `0.2.18` -> `0.2.19` |
| [serde](https://serde.rs)
([source](https://togithub.com/serde-rs/serde)) | workspace.dependencies
| patch | `1.0.199` -> `1.0.200` |

🔧 This Pull Request updates lock files to use the latest dependency
versions.

---

### Release Notes

<details>
<summary>marshallpierce/rust-base64 (base64)</summary>

###
[`v0.22.1`](https://togithub.com/marshallpierce/rust-base64/blob/HEAD/RELEASE-NOTES.md#0221)

[Compare
Source](https://togithub.com/marshallpierce/rust-base64/compare/v0.22.0...v0.22.1)

-   Correct the symbols used for the predefined `alphabet::BIN_HEX`.

</details>

<details>
<summary>pacak/bpaf (bpaf)</summary>

###
[`v0.9.12`](https://togithub.com/pacak/bpaf/blob/HEAD/Changelog.md#bpaf-0912---2024-04-29)

[Compare
Source](https://togithub.com/pacak/bpaf/compare/v0.9.11...v0.9.12)

-   better error messages

</details>

<details>
<summary>rust-lang/flate2-rs (flate2)</summary>

###
[`v1.0.30`](https://togithub.com/rust-lang/flate2-rs/releases/tag/1.0.30):
- docs.rs pages should build again

[Compare
Source](https://togithub.com/rust-lang/flate2-rs/compare/1.0.29...1.0.30)

#### What's Changed

- Fix typos by [@&#8203;striezel](https://togithub.com/striezel) in
[https://github.com/rust-lang/flate2-rs/pull/406](https://togithub.com/rust-lang/flate2-rs/pull/406)
- Update actions/checkout in GitHub Actions workflows to v4 by
[@&#8203;striezel](https://togithub.com/striezel) in
[https://github.com/rust-lang/flate2-rs/pull/407](https://togithub.com/rust-lang/flate2-rs/pull/407)
- fix CI - `--all-features` wasn't tested and didn't work with arrival
of `zlib-rs` by [@&#8203;Byron](https://togithub.com/Byron) in
[https://github.com/rust-lang/flate2-rs/pull/405](https://togithub.com/rust-lang/flate2-rs/pull/405)

#### New Contributors

- [@&#8203;striezel](https://togithub.com/striezel) made their first
contribution in
[https://github.com/rust-lang/flate2-rs/pull/406](https://togithub.com/rust-lang/flate2-rs/pull/406)

**Full Changelog**:
https://github.com/rust-lang/flate2-rs/compare/1.0.29...1.0.30

</details>

<details>
<summary>rust-num/num-traits (num-traits)</summary>

###
[`v0.2.19`](https://togithub.com/rust-num/num-traits/blob/HEAD/RELEASES.md#Release-0219-2024-05-03)

[Compare
Source](https://togithub.com/rust-num/num-traits/compare/num-traits-0.2.18...num-traits-0.2.19)

-   [Upgrade to 2021 edition, **MSRV 1.60**][310]
-   [The new `Float::clamp` limits values by minimum and maximum][305]

**Contributors**: [@&#8203;cuviper](https://togithub.com/cuviper),
[@&#8203;michaelciraci](https://togithub.com/michaelciraci)

[305]: https://togithub.com/rust-num/num-traits/pull/305

[310]: https://togithub.com/rust-num/num-traits/pull/310

</details>

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

###
[`v1.0.200`](https://togithub.com/serde-rs/serde/releases/tag/v1.0.200)

[Compare
Source](https://togithub.com/serde-rs/serde/compare/v1.0.199...v1.0.200)

- Fix formatting of "invalid type" and "invalid value" deserialization
error messages containing NaN or infinite floats
([#&#8203;2733](https://togithub.com/serde-rs/serde/issues/2733), thanks
[@&#8203;jamessan](https://togithub.com/jamessan))

</details>

---

### Configuration

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

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **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 has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/oxc-project/oxc).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zNDAuMTAiLCJ1cGRhdGVkSW5WZXIiOiIzNy4zNDAuMTAiLCJ0YXJnZXRCcmFuY2giOiJtYWluIiwibGFiZWxzIjpbXX0=-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2024-05-06 09:33:57 +08:00
Dunqing
a52e321b25
feat(transformer/jsx-source): get the correct lineNumber and columnNumber from the span. (#3142) 2024-05-01 00:30:47 +00:00
Boshen
67225a8091
refactor(coverage): replace yaml parsing with saphyr (#3144)
closes #3128

Profiling `cargo run -p oxc_coverage -- parser` no longer shows a
bottleneck in yaml parsing
2024-04-30 22:49:39 +08:00
Boshen
a63a45d5b2
refactor(transformer): remove the requirement of Semantic (#3140)
It seems like we need to rebuild the scopes and symbols while
traversing. We can't utilize the scopes and symbols built by semantic
because they are immutable.
2024-04-30 12:48:21 +08:00
Boshen
870d11f1bb
feat(syntax): add ToJsString trait for f64 (#3131) 2024-04-29 21:00:04 +08:00
Dunqing
843318cdbe
refactor(transformer/typescript): reimplementation of Enum conversion based on Babel (#3102)
The remaining test cases will perform better with a scope
implementation, and while we can implement them without the scope, it
still requires us to do what the scope did.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-04-29 16:26:22 +08:00
renovate[bot]
6fd6170154
chore(deps): lock file maintenance rust crates (#3125) 2024-04-29 06:00:15 +00:00
Boshen
ae6561308c
refactor(syntax): use FxHashMap for ModuleRecord::request_modules (#3124)
closes #3121

The ordering is not important here.
2024-04-29 03:37:34 +00:00
Ali Rezvani
ac72d08592
chore: cleanup the dependencies on static_assertions and oxc_index. (#3095)
We used to export `static_assertions` as part of the `oxc_index`. It
would've made sense back when it was only a vessel for exporting other
crates - although even then it wouldn't make much sense other than being
convenient - Now with it turning into a port of `index_vec` and
potentially getting bigger as the result of specific needs of the
project; It makes much more sense to stop exporting it from `oxc_index`
and use the crate directly in places that used to use what `oxc_index`
were exporting.


PS: we may want to follow up this with an `oxc_asset` crate containing
our own set of assertion tools which would also export
`static_assertions`.
2024-04-25 16:56:23 +08:00
Ali Rezvani
8618f6b32a
chore(index): fork index_vec crate. (#3092)
related to #3086
2024-04-25 06:09:53 +00:00
Boshen
559bca86c5
Release crates v0.12.5 2024-04-22 12:52:17 +08:00
renovate[bot]
df7b9ee8da
chore(deps): lock file maintenance rust crates (#3059) 2024-04-22 09:58:21 +08:00
Boshen
a05c4e39b8
Release crates v0.12.4 2024-04-19 16:40:05 +08:00
Boshen
e43c245388
feat(transformer): add import helpers to manage module imports (#2996)
closes #2971
2024-04-16 14:33:44 +08:00
Boshen
d57526103c
feat(coverage): add transformer to prevent crashes (#2970) 2024-04-14 18:52:51 +08:00
Boshen
b15bf2826b
feat(napi/parser): remove experimental flexbuffer api (#2957) 2024-04-13 14:59:31 +08:00
Boshen
f366d9bd7c
chore(minsize): remove brotlic because it takes too long to compile (#2954) 2024-04-13 13:24:25 +08:00
branchseer
f159f60084
Make ast types covariant over the allocator lifetime. (#2943)
## Why

Due to the usage of `&'alloc mut T` in `oxc_allocator::Box`, and
`bumpalo::collections::Vec` in `oxc_allocator::Vec`, ast types are
currently invariant over their allocator lifetime `'a`. This prevents
`ouroboros` from generating `borrow_*` on ast type fields, leading to
the unfriendly `with_*` api:
c250b288ef/crates/oxc_parser/examples/multi-thread.rs (L82-L84)

## How

- For `oxc_allocator::Vec`, switch to `allocator_api2::vec::Vec`, which
has a covariant relationship with the allocator lifetime.
- For `oxc_allocator::Box`, use `std::ptr::NonNull` which is
specifically designed to be covariant. I don't use
`allocator_api2::boxed::Box` because it holds the allocator for
dropping, so the size is bigger.

## Downside

Now that `oxc_allocator::Box` uses the unsafe `NonNull`. It has to be a
private field to be safe. This make it impossible to do `Box(....)`
pattern matching.
2024-04-12 18:12:18 +08:00
Boshen
0c04bf743f
feat(transformer): transform TypeScript namespace (#2942) 2024-04-12 10:19:13 +08:00
Boshen
614f73b66c
Release crates v0.12.3 2024-04-11 16:18:17 +08:00
Boshen
d43d404d61
fix: update lock file 2024-04-08 11:17:26 +08:00
renovate[bot]
cd6f4f1938
chore(deps): lock file maintenance rust crates (#2913) 2024-04-08 02:49:53 +00:00
Boshen
366a7fb0d4
Release crates v0.11.2 2024-04-03 19:36:54 +08:00
Boshen
54f7cd3978
Release crates v0.11.1 2024-04-03 16:57:52 +08:00
Boshen
93897c530c
chore: bump syn to v2 (#2888) 2024-04-02 20:57:09 +08:00
Boshen
a0532adc65
chore: bump criterion2, which removes clap and 10s compile time 2024-04-02 16:48:40 +08:00
Boshen
3ca6721783
ci: always run cargo shear 2024-03-31 16:06:22 +08:00
Boshen
293b9f482a
feat(transformer): add transform-typescript boilerplate (#2866) 2024-03-30 20:48:35 +08:00
Boshen
c1a2958a5a
chore: remove oxc_transformer for a reimplementation (#2865)
closes #2860
2024-03-30 17:19:46 +08:00
Boshen
31ed532b79
Release crates v0.11.0 2024-03-30 13:54:53 +08:00
underfin
b199cb89a2
feat: add oxc sourcemap crate (#2825)
The sourcemap implement port from
[rust-sourcemap](https://github.com/getsentry/rust-sourcemap), but has
some different with it.

- Encode sourcemap at parallel, including quote `sourceContent` and
encode token to `vlq` mappings.
- Avoid `Sourcemap` some methods overhead, like `SourceMap::tokens()`
caused extra overhead at common cases. Here using `SourceViewToken` to
instead of it.
2024-03-28 19:36:38 +08:00
renovate[bot]
8c6936ab74
chore(deps): lock file maintenance rust crates (#2827) 2024-03-26 16:04:53 +00:00
Boshen
e32a3b3783
ci: use cargo-shear (#2810) 2024-03-26 00:43:10 +08:00
renovate[bot]
3d761f17c2
chore(deps): lock file maintenance rust crates (#2804) 2024-03-25 17:24:30 +08:00
renovate[bot]
525031b7a2
chore(deps): update rust crates (#2802) 2024-03-25 09:47:26 +08:00
underfin
dc3f6e7570
chore: update sourcemap 8.0.0 (#2788) 2024-03-22 21:52:21 +08:00
Andi Pabst
4c5abb590e
feat(cli): wildcard expansion in paths for windows (#2767)
Unlike on other OS, on Windows there is no wildcard expansion/globbing
by the shell. Instead the application has to handle this. Therefore I
used the `glob` package to handle wildcards on Windows.

I also had to make the parent directory check more strict due to the
glob package resolving `..` in the middle of the path as well.

This closes #2695.
2024-03-22 00:21:30 +08:00
underfin
a2cfc867cb
feat: SourcemapVisualizer (#2773)
Export `SourcemapVisualizer` from codegen, it will be used oxc and
rolldown sourcemap test, so it support multiply source print, it will
using sourcemap `sourcesContent` as original source.
2024-03-21 11:19:09 +08:00
overlookmotel
508091314f
feat(tasks): benchmark NodeJS parser (#2770)
Add NodeJS parser to benchmarks.

Previous attempt #2724 did not work due CodSpeed producing very
inaccurate results (https://github.com/CodSpeedHQ/action/issues/96).

This version runs the actual benchmarks without CodSpeed's
instrumentation. Then another faux-benchmark runs within Codspeed's
instrumented action and just performs meaningless calculations in a loop
for as long as is required to take same amount of time as the original
uninstrumented benchmarks took.

It's unfortunate that we therefore don't get flame graphs on CodSpeed,
but this seems to be the best we can do for now.
2024-03-20 05:06:09 +00:00
renovate[bot]
1e9c0bc484
chore(deps): update rust crates (#2747) 2024-03-17 16:40:42 +00:00
Boshen
178d205d53
chore: criterion2 (#2737) 2024-03-16 18:55:04 +08:00
Boshen
a5ddb5b452
Release crates v0.10.0 2024-03-14 18:23:34 +08:00
Boshen
cbc2f5ff97
refactor: remove unused dependencies (#2718) 2024-03-14 17:50:31 +08:00
Boshen
697b6b70c0
feat: merge features serde and wasm to serialize (#2716)
This PR merges the previous confusing features `serde` and `wasm` into a
single `serialize` feature.

We'll eventually do serialize + type information for both wasm and napi
targets.

`oxc_macros` is removed from `oxc_ast`'s dependency because it requires
`syn` and friends, which goes against our policy ["Third-party
dependencies should be
minimal."](https://oxc-project.github.io/docs/contribute/rules.html#development-policy)
2024-03-14 17:13:12 +08:00
underfin
2dfc0cc28e
chore: upgrade sourcemap 7.1.1 (#2701) 2024-03-13 13:52:36 +08:00
renovate[bot]
b822b6d9eb
chore(deps): update rust crates (#2671) 2024-03-11 13:39:02 +08:00
overlookmotel
3c1e0db53f
refactor: reduce cfg_attr boilerplate with SerAttrs derive (#2669)
Closes #2641.

Also added `tsify` attribute to the `SerAttrs` derive macro, so `#[cfg_attr(feature = "wasm", tsify(...))]` can also be reduced to `#[tsify(...)]`.
2024-03-11 13:38:24 +08:00