Boshen
3f6014a042
chore(semantic): add PostTransformChecker ( #4967 )
2024-08-19 05:38:27 +00:00
Boshen
6800e694e3
feat(oxc): add Compiler and CompilerInterface ( #4954 )
...
This PR adds a full compiler pipeline to the `oxc` crate, to stop us
from implementing the same pipeline over and over again.
relates #4455
2024-08-19 10:20:05 +08:00
Boshen
c7a86865f3
fix(coverage): handle transformer errors
2024-08-18 22:19:58 +08:00
Boshen
873d502993
refactor(coverage): use the oxc crate
2024-08-17 22:40:08 +08:00
Boshen
bea76f0f24
fix(coverage): fix babel cases
2024-08-17 11:22:00 +08:00
Boshen
81439403fd
chore(coverage): print path relative to snapshot file ( #4938 )
...
Ctrl + click in terminal can open the file with this change.
I don't know about vscode, but maybe a plugin can help?
<img width="1399" alt="image" src="https://github.com/user-attachments/assets/9bb4609b-14e9-4df8-b5ee-cb96b72b2f7d ">
<img width="1131" alt="image" src="https://github.com/user-attachments/assets/e0293693-f755-4b91-8712-bbd2a0e615cc ">
2024-08-17 03:09:25 +00:00
Boshen
7ecf0efd40
chore(coverage): remove arrow functions plugin from semantic check
2024-08-16 19:12:17 +08:00
Boshen
61cdfef5c7
chore(coverage): remove quotes around path from snapshot files
...
to make it easier to triple click and copy the path
2024-08-16 16:03:50 +08:00
Boshen
c220730779
feat(coverage): check symbols and scopes after transformation ( #4917 )
...
closes https://github.com/oxc-project/oxc/issues/4790
@overlookmotel enjoy ... take a look at the snapshots and probably nothing else.
The snapshots are minimal right now, but it's already showing symbols from import specifiers are not being removed. We can iterate on the snapshot representation to aid debugging later.
I'll extend this to `transformer_conformance` and `oxc-monitor` in an up coming PR.
2024-08-16 07:05:11 +00:00
Boshen
34aa93bda3
feat(coverage): add checker for correctness of semantic data ( #4908 )
...
Part of https://github.com/oxc-project/oxc/issues/4790
2024-08-15 04:46:07 +00:00
Boshen
117ae36775
refactor(coverage): add driver struct for adding common checks later ( #4893 )
2024-08-14 11:11:13 +00:00
Boshen
2afccd75fb
refactor(coverage): move tools into src/tools/
2024-08-14 15:44:03 +08:00
Boshen
e78cba6464
refactor(minifier): ast passes infrastructure ( #4625 )
...
After studying google closure compiler, I'm leaning towards a multi-ast-pass infrastructure for the minifier.
This is one of the few places where we are going to trade maintainability over performance, given the goal of the minifier is compression size not performance.
All of the terminologies and separation of concerns are aligned with google closure compiler.
Infrastructure of `terser` and `esbuild` are not suitable for us to study nor pursuit. Their code are so tightly coupled - I failed to comprehend any of them every time I try to walk through a piece of optmization. Google closure compiler despite being written in Java, it's actually the most readable minifier out there.
To improve performance between ast passes, I envision a change detection system over a portion of the code.
The benchmark will demonstrate the performance regression of running 5 ast passes instead of 2.
To complete this PR, I need to figure out "fix-point" and order of these ast passes.
2024-08-04 11:58:39 +00:00
Boshen
107e57019c
feat(coverage): run multi-file typescript tests ( #4256 )
...
The code is really ugly because I didn't anticipate multi-test files from typescript when I started writing the runner :-(
2024-07-16 06:15:04 +00:00
Boshen
ca0b4fa08a
refactor(tasks): clean up test files and remove libs.txt ( #4172 )
2024-07-10 17:38:06 +00:00
Luca Bruno
5731e3957f
refactor(ast)!: store span details inside comment struct ( #4132 )
...
This tweaks `Comment` definition in order to internally store the start
and end position of its span.
Closes: https://github.com/oxc-project/oxc/issues/4069
2024-07-09 23:23:43 +08:00
Boshen
6e5447e5d5
chore(coverage): add test for huge binary expression and nested if statements ( #4084 )
...
relates https://github.com/oxc-project/backlog/issues/58
2024-07-08 00:15:26 +08:00
Dunqing
dc8e2b8dc0
feat(coverage/transpile): compare error message ( #3789 )
2024-06-20 10:13:36 +00:00
Boshen
4e9d8a5585
chore: fix some nightly clippy warnings
2024-06-19 00:53:58 +08:00
Boshen
051ceb6539
chore: improve some format by running cargo +nightly fmt
2024-06-19 00:48:30 +08:00
Boshen
5c38a0fd69
feat(codegen)!: new code gen API ( #3740 )
...
This PR introduces two type alias to avoid the confusing const generic `pub struct Codegen<'a, const MINIFY: bool>`
* CodeGenerator - Code generator without whitespace removal.
* WhitespaceRemover - Code generator with whitespace removal.
Usage is changed to a builder pattern:
```rust
CodeGenerator::new()
.enable_comment(...)
.enable_sourcemap(...)
.build(&program);
```
2024-06-18 15:50:12 +00:00
Boshen
bf9b38a197
feat(codegen): improve codegen formatting ( #3731 )
2024-06-18 04:14:10 +00:00
Boshen
41b3c24f98
feat(coverage): snapshot isolated declarations dts emit ( #3723 )
2024-06-17 18:31:03 +00:00
Dunqing
889198ae60
fix(coverage/transpiler): diff comparison results are reversed ( #3727 )
...
<img width="963" alt="image" src="https://github.com/oxc-project/oxc/assets/29533304/fbec74bc-e06e-42f3-9963-f2fdce3ae784 ">
2024-06-17 16:47:05 +00:00
Boshen
0b8098a442
feat(napi): isolated-declaration ( #3718 )
2024-06-17 13:06:00 +00:00
Boshen
815260ed2f
refactor(isolated-declarations): decouple codegen ( #3715 )
2024-06-17 11:45:29 +00:00
Boshen
87c3282deb
chore(transformer-dts): change crate to oxc_isolated_declarations ( #3713 )
2024-06-17 11:14:13 +00:00
Boshen
982e6f08df
chore: make println and eprintln opt-in ( #3712 )
...
I noticed accidental `println` can be merged, which isn't really nice.
2024-06-17 10:40:34 +00:00
Boshen
da1e2d0e9b
fix(codegen): improve typescript codegen ( #3708 )
...
Remaining issues are tracked in https://github.com/oxc-project/oxc/issues/3692
2024-06-17 09:34:54 +00:00
Boshen
750a534455
feat(coverage): transformer idempotency test ( #3691 )
2024-06-15 13:59:53 +00:00
Boshen
568b6479ae
feat(coverage): use oxc printend text for comparing dts transform ( #3686 )
2024-06-15 11:00:16 +00:00
Boshen
4f166642a0
refactor(transformer_dts): create a Program for codegen ( #3679 )
2024-06-15 05:44:25 +00:00
Boshen
eff9cff048
feat(coverage): add dts transform coverage test ( #3675 )
2024-06-14 14:29:27 +00:00
Boshen
534242a729
feat(codegen)!: remove CodegenOptions::enable_typescript ( #3674 )
...
The typescript transform pass is now required to strip typescript syntax
for codegen to print things properly.
Codegen will now print whatever is in the AST.
2024-06-14 21:56:00 +08:00
renovate
c1b34ff011
chore(deps): update dependency rust to v1.79.0 ( #3661 )
...
[](https://renovatebot.com )
This PR contains the following updates:
| Package | Update | Change |
|---|---|---|
| [rust](https://togithub.com/rust-lang/rust ) | minor | `1.78.0` -> `1.79.0` |
---
### Release Notes
<details>
<summary>rust-lang/rust (rust)</summary>
### [`v1.79.0`](https://togithub.com/rust-lang/rust/blob/HEAD/RELEASES.md#Version-1790-2024-06-13 )
[Compare Source](https://togithub.com/rust-lang/rust/compare/1.78.0...1.79.0 )
\==========================
<a id="1.79.0-Language"></a>
## Language
- [Stabilize inline `const {}` expressions.](https://togithub.com/rust-lang/rust/pull/104087/ )
- [Prevent opaque types being instantiated twice with different regions within the same function.](https://togithub.com/rust-lang/rust/pull/116935/ )
- [Stabilize WebAssembly target features that are in phase 4 and 5.](https://togithub.com/rust-lang/rust/pull/117457/ )
- [Add the `redundant_lifetimes` lint to detect lifetimes which are semantically redundant.](https://togithub.com/rust-lang/rust/pull/118391/ )
- [Stabilize the `unnameable_types` lint for public types that can't be named.](https://togithub.com/rust-lang/rust/pull/120144/ )
- [Enable debuginfo in macros, and stabilize `-C collapse-macro-debuginfo` and `#[collapse_debuginfo]`.](https://togithub.com/rust-lang/rust/pull/120845/ )
- [Propagate temporary lifetime extension into `if` and `match` expressions.](https://togithub.com/rust-lang/rust/pull/121346/ )
- [Restrict promotion of `const fn` calls.](https://togithub.com/rust-lang/rust/pull/121557/ )
- [Warn against refining impls of crate-private traits with `refining_impl_trait` lint.](https://togithub.com/rust-lang/rust/pull/121720/ )
- [Stabilize associated type bounds (RFC 2289).](https://togithub.com/rust-lang/rust/pull/122055/ )
- [Stabilize importing `main` from other modules or crates.](https://togithub.com/rust-lang/rust/pull/122060/ )
- [Check return types of function types for well-formedness](https://togithub.com/rust-lang/rust/pull/115538 )
- [Rework `impl Trait` lifetime inference](https://togithub.com/rust-lang/rust/pull/116891/ )
- [Change inductive trait solver cycles to be ambiguous](https://togithub.com/rust-lang/rust/pull/122791 )
<a id="1.79.0-Compiler"></a>
## Compiler
- [Define `-C strip` to only affect binaries, not artifacts like `.pdb`.](https://togithub.com/rust-lang/rust/pull/115120/ )
- [Stabilize `-Crelro-level` for controlling runtime link hardening.](https://togithub.com/rust-lang/rust/pull/121694/ )
- [Stabilize checking of `cfg` names and values at compile-time with `--check-cfg`.](https://togithub.com/rust-lang/rust/pull/123501/ )
*Note that this only stabilizes the compiler part, the Cargo part is still unstable in this release.*
- [Add `aarch64-apple-visionos` and `aarch64-apple-visionos-sim` tier 3 targets.](https://togithub.com/rust-lang/rust/pull/121419/ )
- [Add `riscv32ima-unknown-none-elf` tier 3 target.](https://togithub.com/rust-lang/rust/pull/122696/ )
- [Promote several Windows targets to tier 2](https://togithub.com/rust-lang/rust/pull/121712 ): `aarch64-pc-windows-gnullvm`, `i686-pc-windows-gnullvm`, and `x86_64-pc-windows-gnullvm`.
Refer to Rust's \[platform support page]\[platform-support-doc]
for more information on Rust's tiered platform support.
<a id="1.79.0-Libraries"></a>
## Libraries
- [Implement `FromIterator` for `(impl Default + Extend, impl Default + Extend)`.](https://togithub.com/rust-lang/rust/pull/107462/ )
- [Implement `{Div,Rem}Assign<NonZero<X>>` on `X`.](https://togithub.com/rust-lang/rust/pull/121952/ )
- [Document overrides of `clone_from()` in core/std.](https://togithub.com/rust-lang/rust/pull/122201/ )
- [Link MSVC default lib in core.](https://togithub.com/rust-lang/rust/pull/122268/ )
- [Caution against using `transmute` between pointers and integers.](https://togithub.com/rust-lang/rust/pull/122379/ )
- [Enable frame pointers for the standard library.](https://togithub.com/rust-lang/rust/pull/122646/ )
<a id="1.79.0-Stabilized-APIs"></a>
## Stabilized APIs
- [`{integer}::unchecked_add`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_add )
- [`{integer}::unchecked_mul`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_mul )
- [`{integer}::unchecked_sub`](https://doc.rust-lang.org/stable/core/primitive.i32.html#method.unchecked_sub )
- [`<[T]>::split_at_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_unchecked )
- [`<[T]>::split_at_mut_unchecked`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.split_at_mut_unchecked )
- [`<[u8]>::utf8_chunks`](https://doc.rust-lang.org/stable/core/primitive.slice.html#method.utf8\_chunks )
- [`str::Utf8Chunks`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunks.html )
- [`str::Utf8Chunk`](https://doc.rust-lang.org/stable/core/str/struct.Utf8Chunk.html )
- [`<*const T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned )
- [`<*mut T>::is_aligned`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_aligned-1 )
- [`NonNull::is_aligned`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_aligned )
- [`<*const [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len )
- [`<*mut [T]>::len`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.len-1 )
- [`<*const [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty )
- [`<*mut [T]>::is_empty`](https://doc.rust-lang.org/stable/core/primitive.pointer.html#method.is_empty-1 )
- [`NonNull::<[T]>::is_empty`](https://doc.rust-lang.org/stable/core/ptr/struct.NonNull.html#method.is_empty )
- [`CStr::count_bytes`](https://doc.rust-lang.org/stable/core/ffi/c_str/struct.CStr.html#method.count_bytes )
- [`io::Error::downcast`](https://doc.rust-lang.org/stable/std/io/struct.Error.html#method.downcast )
- [`num::NonZero<T>`](https://doc.rust-lang.org/stable/core/num/struct.NonZero.html )
- [`path::absolute`](https://doc.rust-lang.org/stable/std/path/fn.absolute.html )
- [`proc_macro::Literal::byte_character`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.byte_character )
- [`proc_macro::Literal::c_string`](https://doc.rust-lang.org/stable/proc_macro/struct.Literal.html#method.c_string )
These APIs are now stable in const contexts:
- [`Atomic*::into_inner`](https://doc.rust-lang.org/stable/core/sync/atomic/struct.AtomicUsize.html#method.into_inner )
- [`io::Cursor::new`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.new )
- [`io::Cursor::get_ref`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.get_ref )
- [`io::Cursor::position`](https://doc.rust-lang.org/stable/std/io/struct.Cursor.html#method.position )
- [`io::empty`](https://doc.rust-lang.org/stable/std/io/fn.empty.html )
- [`io::repeat`](https://doc.rust-lang.org/stable/std/io/fn.repeat.html )
- [`io::sink`](https://doc.rust-lang.org/stable/std/io/fn.sink.html )
- [`panic::Location::caller`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.caller )
- [`panic::Location::file`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.file )
- [`panic::Location::line`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.line )
- [`panic::Location::column`](https://doc.rust-lang.org/stable/std/panic/struct.Location.html#method.column )
<a id="1.79.0-Cargo"></a>
## Cargo
- [Prevent dashes in `lib.name`, always normalizing to `_`.](https://togithub.com/rust-lang/cargo/pull/12783/ )
- [Stabilize MSRV-aware version requirement selection in `cargo add`.](https://togithub.com/rust-lang/cargo/pull/13608/ )
- [Switch to using `gitoxide` by default for listing files.](https://togithub.com/rust-lang/cargo/pull/13696/ )
- [Error on `[project]` in Edition 2024; `cargo fix --edition` will change it to `[package]`.](https://togithub.com/rust-lang/cargo/pull/13747/ )
<a id="1.79.0-Rustdoc"></a>
## Rustdoc
- [Always display stability version even if it's the same as the containing item.](https://togithub.com/rust-lang/rust/pull/118441/ )
- [Show a single search result for items with multiple paths.](https://togithub.com/rust-lang/rust/pull/119912/ )
- [Support typing `/` in docs to begin a search.](https://togithub.com/rust-lang/rust/pull/123355/ )
<a id="1.79.0-Misc"></a>
## Misc
<a id="1.79.0-Compatibility-Notes"></a>
## Compatibility Notes
- [Update the minimum external LLVM to 17.](https://togithub.com/rust-lang/rust/pull/122649/ )
- [`RustcEncodable` and `RustcDecodable` are soft-destabilized, to be removed
from the prelude in next edition.](https://togithub.com/rust-lang/rust/pull/116016/ )
- [The `wasm_c_abi` future-incompatibility lint will warn about use of the
non-spec-compliant C ABI.](https://togithub.com/rust-lang/rust/pull/117918/ )
Use `wasm-bindgen v0.2.88` to generate forward-compatible bindings.
- [Check return types of function types for well-formedness](https://togithub.com/rust-lang/rust/pull/115538 )
</details>
---
### Configuration
📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).
🚦 **Automerge**: Enabled.
♻ **Rebasing**: Whenever PR becomes conflicted, 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 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:eyJjcmVhdGVkSW5WZXIiOiIzNy4zOTMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjM5My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
2024-06-14 02:28:06 +00:00
Boshen
7f8dd24d6a
chore: fix cargo doc
2024-06-14 09:21:14 +08:00
Boshen
c522796ade
feat(coverage): TypeScript transpile runner prototype ( #3660 )
2024-06-13 22:16:22 +08:00
Boshen
30dc17ea92
refactor(coverage): align to typescript's test harness ( #3659 )
...
refactor(coverage): align to typescript's test harness
feat(coverage): transpile_runner prototype
2024-06-13 13:17:46 +00:00
Boshen
022e8e759a
refactor(coverage): move test runners to their own modules ( #3658 )
2024-06-13 11:16:18 +00:00
Boshen
b58d8eb88f
fix!(codegen): remove the unecessary 4th argument from Codegen::new ( #3640 )
2024-06-12 07:58:54 +00:00
Boshen
f6752b482f
feat!(ast): make Trivias clonable by adding Arc ( #3638 )
...
This makes `Trivias` cloneable and stops us from using `Rc::new` and
`Rc::clone` everywhere.
`Trivias` is rarely cloned so an `Arc` should suffice.
2024-06-12 13:16:10 +08:00
Boshen
9698be5479
chore(coverage): ignore eval related code in codegen runtime ( #3628 )
...
Properly misconfigured test setup for `eval`, but can't figure out where
2024-06-11 15:23:36 +00:00
Boshen
1959930ee7
fix(coverage): fix clippy
2024-06-11 17:01:52 +08:00
Boshen
f9c08d1e28
feat(coverage): add --debug option for finding crash scene ( #3622 )
...
The `--debug` options turns off rayon and prints the paths so we can
find the crashing file by looking at the last printed out file.
closes #3497
2024-06-11 07:10:02 +00:00
Dunqing
5793ff1986
refactor(transformer): replace &’a Trivias with Rc<Trivias> ( #3580 )
...
`Transformer` needs to borrow `Trivias`.
8be1cc8052 (r1630711060)
2024-06-11 13:23:41 +08:00
Dunqing
5c8e16c976
feat(coverage): second transformer build does not print typescript ( #3561 )
...
Currently, we lack a test to check if the TS AST has been completely deleted. I have thought of a way to test it. Let's have our idempotency test print the TypeScript code the first time and the second time print the JavaScript code only. If the two results do not match, it means that there are still undeleted TS ASTs or other bugs. Since ideally the TS ASTs are completely deleted, the two results should be the same.
2024-06-07 05:04:25 +00:00
Dunqing
0007ee47be
chore(coverage, transformer_conformance): print all AST whether or not they are Typecript AST ( #3556 )
...
We have a conclusion that codegen will print whatever is in the AST,
instead of having an option to enable printing TypeScript syntax. I plan
to remove codegen's `enable_typescript` option after we strip out all
typescript AST in the transformer typescript plugin.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-06-06 15:45:20 +08:00
Dunqing
646b9937ee
feat(coverage/transformer): handle @jsx option ( #3553 )
...
if has`@jsx: react`, configure transformer options to match `@jsx: react` behavior
2024-06-06 05:34:22 +00:00
Dunqing
3ba2a932d6
refactor(coverage): use code without meta options in TypeScriptSuite ( #3552 )
...
The `@jsx: react` is a typescript option. The `Babel` typescript plugin handles @jsx as well, but this is different. `@jsx` in babel is a [pragma](https://babeljs.io/docs/babel-plugin-transform-react-jsx#pragma ) option. So we should use code without these meta options to avoid Babel parsing `@jsx` incorrectly
2024-06-06 05:34:18 +00:00
Dunqing
d4588d7cac
chore(codegen): print typescript code for typescript files ( #3515 )
...
We should not print typescript code as javascript code. Forcing to print as JavaScript code may result in syntax errors. If we truly want javascript code, we can use the `oxc_transformer`.
2024-06-03 10:05:08 +00:00