Boshen
9386435efb
feat(transform_conformance): use node instead of bun for exec tests ( #7121 )
2024-11-05 14:20:48 +08:00
overlookmotel
cc8a1917e5
feat(ast): methods on AST nodes to get scope_id etc ( #7127 )
...
Add getter and setter methods to all AST types which have a `ScopeId`, `SymbolId` or `ReferenceId` field to get the contents of that field.
Before:
```rs
let symbol_id = ident.symbol_id.get().unwrap();
```
After:
```rs
let symbol_id = ident.symbol_id();
```
This allows removing boilerplate code from the transformer, and discouraging the anti-pattern of treating these fields as if they may contain either `Some` or `None` (after semantic, they will always be `Some`).
2024-11-05 02:25:27 +00:00
Boshen
c2802e63fc
feat(transform_conformance): add babel runtime to exec tests ( #7114 )
2024-11-04 14:38:15 +00:00
Dunqing
f80085c683
refactor(transformer/async-to-generator): move handling of MethodDefinition's value to exit_function ( #7105 )
...
Part of #7074
We need to handle this before the `arrow_function` plugin inserts `_this = this` because, in the `async-to-generator` plugin, we will move the body to an inner generator function. However, we don't want `_this = this` moved to the inner generator function as well. So as long as we move first, and then insert, we can fix this problem.
The new semantic error is related to another tricky problem, I will fix it in another PR
2024-11-04 14:32:42 +00:00
Boshen
50646a49ea
refactor(tasks/website): remove scraper dependency ( #7116 )
2024-11-04 14:16:11 +00:00
overlookmotel
25d7554ec4
refactor(ast_tools): rename visitable to is_visitable ( #7104 )
...
Pure refactor. Just rename fields and vars from `visitable` to `is_visitable`, to be more descriptive.
2024-11-03 17:20:25 +00:00
Dunqing
70e2582726
ci(transformer): enable unfinished plugins in benchmark ( #7040 )
...
Even the plugins are unfinished, we still want to enable all of them to track the performance changes during the development.
2024-11-02 15:17:21 +00:00
overlookmotel
f543a8d495
refactor(ast)!: remove AstBuilder::*_from_* methods ( #7073 )
...
Remove `AstBuilder::*_from_*` methods for constructing enums. In my opinion, it's not a great pattern, and this removes 2000 of lines of code from [ast_builder.rs](https://github.com/oxc-project/oxc/pull/7073/files#diff-e34fd45077ed0a48b7fee440fdbe4c22a01d787a70a311afebfc1d310785fb70 ).
2024-11-02 01:22:56 +00:00
overlookmotel
32b4a53692
refactor(ast_tools): remove LateCtx abstraction ( #7083 )
...
`LateCtx` is just a wrapper around `Schema`. Remove it and use `Schema` instead.
2024-11-01 22:31:03 +00:00
overlookmotel
2eb9aa9b89
refactor(ast_tools): remove dead code ( #7080 )
2024-11-01 21:59:28 +00:00
overlookmotel
d89fe2c326
refactor(ast_tools): shorten code ( #7079 )
...
Shorten code by importing `rust_ast::Module` at top level.
2024-11-01 21:51:29 +00:00
overlookmotel
00cc156fb5
refactor(ast_tools): simplify module loading ( #7078 )
...
Rename var for clarity and remove unnecessary `From` impl.
2024-11-01 21:51:29 +00:00
overlookmotel
f2d10683a8
refactor(ast_tools): remove dead code ( #7077 )
2024-11-01 21:42:14 +00:00
overlookmotel
248ff18ddd
refactor(ast_tools): output progress ( #7076 )
...
Flush `stdout` after writing progress.
2024-11-01 21:26:45 +00:00
Dunqing
a2244ff089
fix(transformer/async-to-generator): output is incorrect when arrow function without params ( #7052 )
2024-11-01 15:35:57 +00:00
Boshen
f83a760d8a
refactor(transformer): deserialize BabelOptions::presets ( #7047 )
2024-11-01 06:56:27 +00:00
Boshen
52c20d633c
refactor(transformer): deserialize BabelOptions::plugins ( #7045 )
2024-11-01 05:44:57 +00:00
Boshen
4bef99c80b
chore(coverage): update runtime snapshot
2024-11-01 13:05:42 +08:00
tomoya yanagibashi
0601271b2c
fix(ast): Fix StaticMemberExpression.get_first_object ( #6969 )
...
I think `get_first_object` does not return expected expression.
For example, in case of `foo.bar.a`, it doesn't return `foo` but
`foo.bar`.
**Expected**
```
{
"type": "Identifier",
"start": 0,
"end": 3,
"name": "foo"
}
```
**Actual**
```
{
"type":"StaticMemberExpression",
"start":0,
"end":7,
"object":{
"type":"Identifier",
"start":0,
"end":3,
"name":"foo"
},
"property":{
"type":"Identifier",
"start":4,
"end":7,
"name":"bar"
},
"optional":false
}
```
---------
Co-authored-by: Dunqing <dengqing0821@gmail.com>
2024-11-01 12:28:48 +08:00
Boshen
fcaba4a92a
feat(transformer): add TransformerOptions::env with EnvOptions ( #7037 )
2024-10-31 12:30:32 +00:00
Dunqing
934cb5e746
feat(transformer): add async_generator_functions plugin ( #6573 )
...
Passed 15/19 tests. The remaining 4 failed tests related to `this` expression, the problem same as I mentioned in #6658 . I will fix them in follow-up PRs.
2024-10-31 09:14:17 +00:00
overlookmotel
2a57a66753
test(transformer): support exec tests in Oxc folder ( #7030 )
...
Fix error when `tasks/transform_conformance/tests` contains exec tests.
2024-10-31 01:18:09 +00:00
Boshen
76947e2aec
refactor(transform): refactor Babel Targets ( #7026 )
...
Found a trick from serde to get us from `BabelTargets` to `Targets`.
2024-10-30 14:08:19 +00:00
Boshen
b8daab3663
refactor(transformer)!: API to TryFrom<&EnvOptions> for TransformOptions and TryFrom<&BabelOptions> TransformOptions ( #7020 )
...
…ions` and `TryFrom<&BabelOptions> TransformOptions`
2024-10-30 09:40:09 +00:00
Boshen
caaf00e081
fix(parser): fix incorrect parsed TSIndexSignature ( #7016 )
...
closes #6985
2024-10-30 07:34:22 +00:00
Boshen
9fd9f4f5b9
feat(linter)!: sync sindresorhus/globals; removed Object.prototype properties from builtin and es* globals ( #6991 )
2024-10-29 04:13:20 +00:00
Boshen
b518670582
chore(coverage): remove known runtime issues
2024-10-28 21:38:37 +08:00
Boshen
14f36ce3f9
chore(task/lint_rules): change not supported to "no need to implement"
...
closes #6822
2024-10-28 17:29:29 +08:00
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 \[[#​682](https://redirect.github.com/sunng87/handlebars-rust/issues/682 )]
- \[Changed] improve number comparison between different types \[[#​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. [#​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. [#​644](https://redirect.github.com/mitsuhiko/insta/issues/644 )
- Inline snapshots only use `#` characters as delimiters when required. [#​603](https://redirect.github.com/mitsuhiko/insta/issues/603 )
- Warnings for undiscovered snapshots are more robust, and include files with
custom snapshot extensions. [#​637](https://redirect.github.com/mitsuhiko/insta/issues/637 )
- Insta runs correctly on packages which reference rust files in a parent path. [#​626](https://redirect.github.com/mitsuhiko/insta/issues/626 )
- Warnings are printed when any snapshot uses a legacy format. [#​599](https://redirect.github.com/mitsuhiko/insta/issues/599 )
- `cargo insta --version` now prints a version. [#​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.) [#​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 ([#​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 #​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 ([#​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 ([#​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 ([#​2558](https://redirect.github.com/serde-rs/serde/issues/2558 ), thanks [@​Mingun](https://redirect.github.com/Mingun ))
- Show variant aliases in error message when variant deserialization fails ([#​2566](https://redirect.github.com/serde-rs/serde/issues/2566 ), thanks [@​Mingun](https://redirect.github.com/Mingun ))
- Improve binary size of untagged enum and internally tagged enum deserialization by about 12% ([#​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` ([#​6854], [#​6918])
- net: add conversions for unix `SocketAddr` ([#​6868])
- sync: add `watch::Sender::sender_count` ([#​6836])
- sync: add `mpsc::Receiver::blocking_recv_many` ([#​6867])
- task: stabilize `Id` apis ([#​6793], [#​6891])
##### Added (unstable)
- metrics: add H2 Histogram option to improve histogram granularity ([#​6897])
- metrics: rename some histogram apis ([#​6924])
- runtime: add `LocalRuntime` ([#​6808])
##### Changed
- runtime: box futures larger than 16k on release mode ([#​6826])
- sync: add `#[must_use]` to `Notified` ([#​6828])
- sync: make `watch` cooperative ([#​6846])
- sync: make `broadcast::Receiver` cooperative ([#​6870])
- task: add task size to tracing instrumentation ([#​6881])
- wasm: enable `cfg_fs` for `wasi` target ([#​6822])
##### Fixed
- net: fix regression of abstract socket path in unix socket ([#​6838])
##### Documented
- io: recommend `OwnedFd` with `AsyncFd` ([#​6821])
- io: document cancel safety of `AsyncFd` methods ([#​6890])
- macros: render more comprehensible documentation for `join` and `try_join` ([#​6814], [#​6841])
- net: fix swapped examples for `TcpSocket::set_nodelay` and `TcpSocket::nodelay` ([#​6840])
- sync: document runtime compatibility ([#​6833])
[#​6793]: https://redirect.github.com/tokio-rs/tokio/pull/6793
[#​6808]: https://redirect.github.com/tokio-rs/tokio/pull/6808
[#​6810]: https://redirect.github.com/tokio-rs/tokio/pull/6810
[#​6814]: https://redirect.github.com/tokio-rs/tokio/pull/6814
[#​6821]: https://redirect.github.com/tokio-rs/tokio/pull/6821
[#​6822]: https://redirect.github.com/tokio-rs/tokio/pull/6822
[#​6826]: https://redirect.github.com/tokio-rs/tokio/pull/6826
[#​6828]: https://redirect.github.com/tokio-rs/tokio/pull/6828
[#​6833]: https://redirect.github.com/tokio-rs/tokio/pull/6833
[#​6836]: https://redirect.github.com/tokio-rs/tokio/pull/6836
[#​6838]: https://redirect.github.com/tokio-rs/tokio/pull/6838
[#​6840]: https://redirect.github.com/tokio-rs/tokio/pull/6840
[#​6841]: https://redirect.github.com/tokio-rs/tokio/pull/6841
[#​6846]: https://redirect.github.com/tokio-rs/tokio/pull/6846
[#​6854]: https://redirect.github.com/tokio-rs/tokio/pull/6854
[#​6867]: https://redirect.github.com/tokio-rs/tokio/pull/6867
[#​6868]: https://redirect.github.com/tokio-rs/tokio/pull/6868
[#​6870]: https://redirect.github.com/tokio-rs/tokio/pull/6870
[#​6881]: https://redirect.github.com/tokio-rs/tokio/pull/6881
[#​6890]: https://redirect.github.com/tokio-rs/tokio/pull/6890
[#​6891]: https://redirect.github.com/tokio-rs/tokio/pull/6891
[#​6897]: https://redirect.github.com/tokio-rs/tokio/pull/6897
[#​6918]: https://redirect.github.com/tokio-rs/tokio/pull/6918
[#​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
ottomated
9725e3c2ec
feat(ast_tools): Add #[estree(always_flatten)] to Span ( #6935 )
...
Part of #6347
Other changes:
- added #[estree(skip)] to thisSpan in TSThisParameter
- Flattened the span in BoundaryAssertion (regex)
2024-10-28 02:13:24 +00:00
ottomated
fbc297ec7b
feat(ast_tools): Move tsify custom types to estree attribute macro ( #6934 )
...
Part of #6347
2024-10-28 01:45:27 +00:00
ottomated
169fa22350
feat(ast_tools): Default enums to rename_all = "camelCase" ( #6933 )
...
Part of #6347
2024-10-28 01:39:25 +00:00
Dunqing
1ca8cd2fd9
refactor(transformer/react-refresh): avoid panic for init of VariableDeclarator isn't a BindingIdentifier ( #6937 )
...
related: https://github.com/oxc-project/oxc/pull/6881#discussion_r1816597462
2024-10-28 01:19:53 +00:00
overlookmotel
335eb38be6
refactor(ast_tools): faster formatting Rust code ( #6972 )
...
Speed up formatting Rust code. Don't convert to string and then re-parse, allow `syn` to skip a step by using existing `TokenStream`.
2024-10-28 01:13:36 +00:00
overlookmotel
7fcc4f7211
refactor(ast_tools): one function to add header to generated files ( #6971 )
...
Centralize logic for adding header to generated files.
2024-10-28 00:47:49 +00:00
overlookmotel
c7bec098fa
docs(ast_tools): correct doc comments for Output ( #6970 )
2024-10-28 00:47:48 +00:00
overlookmotel
3aed3eb543
refactor(ast_tools): remove well_known! macro ( #6957 )
...
Remove `well_known!` macro by expanding code manually.
2024-10-28 00:47:46 +00:00
overlookmotel
54e78d9ea3
refactor(ast_tools): reduce macro usage ( #6956 )
...
Pure refactor. Expand simple macros.
2024-10-28 00:47:45 +00:00
overlookmotel
83d1f69f75
refactor(ast_tools): replace str::replace with CowUtils::cow_replace ( #6954 )
...
Obey our clippy-enforced policy to prefer `CowUtils::cow_replace`.
2024-10-28 00:23:34 +00:00
overlookmotel
ac6b3091ab
refactor(ast_tools): remove repeated code in Output methods ( #6953 )
...
`generator_path.replace('\\', "/")` was repeated in each module for that generates outputs. Move it, to reduce repetition.
2024-10-28 00:23:33 +00:00
overlookmotel
2b10e5cd52
refactor(ast_tools): move logger into separate module ( #6952 )
...
Reduce the amount of code in `main.rs` by moving logger functionality to a separate module.
2024-10-28 00:23:33 +00:00
overlookmotel
06f05659c5
refactor(ast_tools): refactor writing outputs ( #6951 )
...
`write_all_to` no longer needs to be public. Remove it, and compact the code for writing files.
2024-10-27 23:56:22 +00:00
overlookmotel
6b88798253
refactor(ast_tools): generate JSON schema as Output::Raw ( #6950 )
...
Add `Output::Raw`, and use it for the JSON schema file.
2024-10-27 23:56:21 +00:00
overlookmotel
2fc6ca374f
refactor(ast_tools): hardcode schema output path ( #6949 )
...
Hard-code the output file path for JSON schema file. This will allow generating it as an `Output`, same as all other generated files.
2024-10-27 23:40:57 +00:00
overlookmotel
ef2f73ebed
refactor(ast_tools): rename Output::into_raw method ( #6948 )
...
Rename `Output::output` to `Output::into_raw` - more descriptive name.
2024-10-27 23:40:56 +00:00
overlookmotel
524d9c069f
refactor(ast_tools): generate CI filter as Output::Yaml ( #6947 )
...
Add `Output::Yaml` and use it for generating CI filter file.
2024-10-27 19:18:10 +00:00
overlookmotel
11539e61fd
refactor(ast_tools): add CI filter file to outputs ( #6946 )
...
Generate CI filter file as a `RawOutput`, same as the rest, rather than
specific code to write it to a file.
2024-10-27 19:09:42 +00:00
overlookmotel
87db9eeeed
refactor(ast_tools): simplify logging ( #6945 )
...
* Replace `logln!` macro with `log_result!` to log result of an action.
* Move logging for writing files into one place.
2024-10-27 18:53:24 +00:00
overlookmotel
dde095c7e1
refactor(ast_tools): combine derives into generators ( #6944 )
...
`Generator`s and `Derive`s now work the same. Combine them into a single `Vec`.
2024-10-27 15:37:25 +00:00
overlookmotel
80a163e691
refactor(ast_tools): reduce repeated code ( #6943 )
...
Use one function to process all passes.
2024-10-27 15:37:24 +00:00