Dunqing
4aea2b158c
feat(isolated-declarations): improve inferring the type of accessor ( #3749 )
2024-06-19 14:06:02 +00:00
Dunqing
9ea30c41ff
feat(isolated-declarations): treat AssignmentPattern as optional ( #3748 )
2024-06-19 14:05:59 +00:00
rzvxa
887da40518
test(linter): enable no-fallthrough test with disable-next-line. ( #3766 )
...
I thought we didn't have this, But now that I've read the `LintContext` I have realized it wasn't true.
2024-06-19 13:24:21 +00:00
rzvxa
4d2b7f1227
refactor(linter): LintContext can now only be constructed with a cfg enabled semantic. ( #3761 )
...
It has the same spirit as #3747 but with a much simpler approach. I've used the fact that @Boshen mentioned about linter always using CFG so now we assert `semantic.cfg().is_some()` in the `LintContext::new` because of this assertion we can have a `LintContext::cfg` that unwraps unchecked.
Eliminates unnecessary checks in our hot paths.
It has the best of both worlds, No complicated typing yet we still get the CFG as a non-optional value without extra ASM or branching.
2024-06-19 13:01:33 +00:00
Boshen
4fb90eb009
feat(oxc): export isolated-declarations ( #3765 )
2024-06-19 12:54:02 +00:00
overlookmotel
22c56d73c3
refactor(transformer): move TSImportEqualsDeclaration transform code ( #3764 )
...
Pure refactor. Move all code related to `TSImportEqualsDeclaration` transform into `module.rs`.
2024-06-19 12:48:44 +00:00
overlookmotel
cd56aa9dd8
refactor(transformer): simplify TS export assignment transform ( #3762 )
...
Remove unnecessary jump through a `ModuleDeclaration` visitor, and visit as `TSExportAssignment` directly.
2024-06-19 12:31:02 +00:00
overlookmotel
512740d33d
refactor(transformer): move and simplify TS enum transform entry point ( #3760 )
...
Move logic for TS enum transform into `enum.rs`. Also simplify the logic, using `Statement` enum variants directly.
2024-06-19 12:16:30 +00:00
Boshen
bd534375a1
chore: update MAINTENANCE.md
2024-06-19 20:13:12 +08:00
Boshen
a11bdae1bb
chore(justfile): add a pre-commit hook
...
closes #3741
2024-06-19 20:09:42 +08:00
Boshen
3d0693f4d4
chore(linter): regenerate snapshot ( #3758 )
2024-06-19 09:33:04 +00:00
Boshen
45b0d1147e
chore(semantic): regenerate snapshot ( #3757 )
2024-06-19 09:28:31 +00:00
Boshen
8c02c1dac3
chore(isolated-declarations): add snapshot testing ( #3756 )
2024-06-19 09:20:17 +00:00
Boshen
b7f659ee47
chore(oxc-transform): update README
2024-06-19 14:30:15 +08:00
Boshen
36de684fd1
chore(benchmark): use a more complated file for codegen_sourcemap
2024-06-19 13:31:21 +08:00
rzvxa
49d28c0dd2
chore(benchmark): enable cfg for linter benchmarks. ( #3746 )
...
The benchmark result on this PR - if we filter out the unstable benchmarks - can also be used to show the total impact of CFG enable rules.
2024-06-19 05:12:58 +00:00
github-actions[bot]
1b3cd6c24d
Release crates v0.15.0 ( #3743 )
...
## [0.15.0] - 2024-06-18
- 0537d29 cfg: [**BREAKING**] Move control flow to its own crate.
(#3728 ) (rzvxa)
- 5c38a0f codegen: [**BREAKING**] New code gen API (#3740 ) (Boshen)
- 4bce59d semantic/cfg: [**BREAKING**] Re-export `petgraph` as
`control_flow::graph`. (#3722 ) (rzvxa)
- 534242a codegen: [**BREAKING**] Remove
`CodegenOptions::enable_typescript` (#3674 ) (Boshen)
- 0578ece ast: [**BREAKING**] Remove
`ExportDefaultDeclarationKind::TSEnumDeclaration` (#3666 ) (Dunqing)
### Features
- 5a99d30 codegen: Improve codegen formatting (#3735 ) (Boshen)
- bf9b38a codegen: Improve codegen formatting (#3731 ) (Boshen)
- 4a004e2 codegen: Print TSImport remaining fields (#3695 ) (Dunqing)
- a56cb1b codegen: Print accessibility for MethodDefinition (#3690 )
(Dunqing)
- 38a75e5 coverage: Improve codegen (#3729 ) (Boshen)
- 750a534 coverage: Transformer idempotency test (#3691 ) (Boshen)
- ee627c3 isolated-declarations: Create unique name for `_default`
(#3730 ) (Dunqing)
- 81e9526 isolated-declarations: Inferring set accessor parameter type
from get accessor return type (#3725 ) (Dunqing)
- 77d5533 isolated-declarations: Report errors that are consistent with
typescript. (#3720 ) (Dunqing)
- 8f5655d linter: Add eslint/no-useless-constructor (#3594 ) (Don Isaac)
- 046ff3f linter/eslint: Add `no_unreachable` rule. (#3238 ) (rzvxa)
- 0b8098a napi: Isolated-declaration (#3718 ) (Boshen)
- 527bfc8 npm/oxc-transform: Setup npm/oxc-transform and publish
(Boshen)
- d65c652 parser: Display jsx mismatch error, e.g. `<Foo></Bar>` (#3696 )
(Boshen)
- 9c31ed9 semantic/cfg: Propagate unreachable edges through subgraphs.
(#3648 ) (rzvxa)
- d9c5b33 semantic/cfg: Add `Condition` instruction. (#3567 ) (Ali
Rezvani)
- f2dfd66 semantic/cfg: Add iteration instructions. (#3566 ) (rzvxa)
- 910193e transformer-dts: Report error for super class (#3711 )
(Dunqing)
- 413d7be transformer-dts: Transform enum support (#3710 ) (Dunqing)
- 35c382e transformer-dts: Remove type annotation from private field
(#3689 ) (Dunqing)
- 0e6d3ce transformer-dts: Report error for async function and generator
(#3688 ) (Dunqing)
- b22b59a transformer-dts: Transform namespace support (#3683 ) (Dunqing)
- 4f2db46 transformer-dts: `--isolatedDeclarations` dts transform
(#3664 ) (Dunqing)
### Bug Fixes
- 2158268 ast: Incorrect visit order in function (#3681 ) (Dunqing)
- da1e2d0 codegen: Improve typescript codegen (#3708 ) (Boshen)
- f1b793f isolated-declarations: Function overloads reaching unreachable
(#3739 ) (Dunqing)
- 0fbecdc isolated-declarations: Should be added to references, not
bindings (#3726 ) (Dunqing)
- 8f64d99 minifier: Respect `join_vars: false` option (#3724 )
(mysteryven)
- 70fc69b semantic: Add Eq to CtxFlags (#3651 ) (Yuji Sugiura)
- 7a58fec semantic/cfg: Issue in unlabeled `Ctx`s. (#3678 ) (rzvxa)
- abd6ac8 semantic/cfg: Discrete finalization path after `NewFunction`s.
(#3671 ) (rzvxa)
- e148a32 semantic/cfg: Correct unreachability propagation in
try-finally. (#3667 ) (Ali Rezvani)
- 59666e0 transformer: Do not rename accessible identifier references
(#3623 ) (Dunqing)
- 90743e2 traverse: Change visit order for `Function` (#3685 )
(overlookmotel)
### Performance
- 2717a1a semantic/cfg: Lower the visits in
`neighbors_filtered_by_edge_weight`. (#3676 ) (rzvxa)
### Refactor
- fa7a6ba codegen: Add `gen` method to ast nodes (#3687 ) (Boshen)
- 09b92b6 codegen: Move `gen_ts` into `gen` to make searching things
easier (#3680 ) (Boshen)
- 3c59735 isolated-declarations: Remove `TransformDtsCtx` (#3719 )
(Boshen)
- 815260e isolated-declarations: Decouple codegen (#3715 ) (Boshen)
- 7ec44f8 semantic: Rename `cfg` macro to `control_flow`. (#3742 )
(rzvxa)
- d8ad321 semantic: Make control flow generation optional. (#3737 )
(rzvxa)
- a94a72d semantic: Expose 1 checker function instead of 2 (#3694 )
(Boshen)
- bd8d115 semantic/cfg: Remove unused types. (#3677 ) (rzvxa)
- f702fb9 semantic/cfg: Cleanup control flow and it's builder. (#3650 )
(rzvxa)
- 4f16664 transformer_dts: Create a `Program` for codegen (#3679 )
(Boshen)
Co-authored-by: Boshen <Boshen@users.noreply.github.com>
2024-06-19 01:15:55 +08:00
Boshen
9e14c75e2a
chore: oxc_cfg.publish = true
2024-06-19 01:09:47 +08:00
rzvxa
7ec44f84a5
refactor(semantic): rename cfg macro to control_flow. ( #3742 )
...
As requested here https://github.com/oxc-project/oxc/pull/3737#discussion_r1644713121
2024-06-18 17:01:49 +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
e592883bc1
chore: add oxc-transform to oxc_release.toml
2024-06-19 00:46:45 +08:00
Boshen
ce05671e90
Update README.md
2024-06-19 00:37:47 +08:00
Dunqing
f1b793fbba
fix(isolated-declarations): function overloads reaching unreachable ( #3739 )
2024-06-18 16:14:14 +00:00
rzvxa
256acc949b
chore(semantic)!: no longer generate CFG by default. ( #3738 )
...
related but won't close #3641
2024-06-19 00:13:29 +08:00
rzvxa
d8ad321687
refactor(semantic): make control flow generation optional. ( #3737 )
...
For maximum backward compatibility, we generate CFG by default.
Note: It can't be done with a simple method since lifetimes make it impossible(at least without unsafe trickery) I've tried to do it without a macro but it was just unintuitive.
2024-06-18 15:59:38 +00:00
rzvxa
0537d298db
refactor(cfg)!: move control flow to its own crate. ( #3728 )
2024-06-18 15:59:29 +00: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
527bfc82f5
feat(npm/oxc-transform): setup npm/oxc-transform and publish
2024-06-18 22:12:47 +08:00
Boshen
02cc14e90c
chore: remove npm/oxc package
2024-06-18 21:32:25 +08:00
Boshen
5a99d30eba
feat(codegen): improve codegen formatting ( #3735 )
2024-06-18 11:10:36 +00:00
Wang Wenzhe
4d462636cb
feat(playground): support modify compressor's options ( #3734 )
...

2024-06-18 18:49:16 +08:00
Boshen
bf9b38a197
feat(codegen): improve codegen formatting ( #3731 )
2024-06-18 04:14:10 +00:00
Dunqing
ee627c355c
feat(isolated-declarations): create unique name for _default ( #3730 )
2024-06-18 03:40:45 +00:00
Boshen
38a75e559b
feat(coverage): improve codegen ( #3729 )
2024-06-18 02:53:09 +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
Dunqing
0fbecdcd81
fix(isolated-declarations): should be added to references, not bindings ( #3726 )
2024-06-17 16:47:02 +00:00
mysteryven
8f64d9992f
fix(minifier): respect join_vars: false option ( #3724 )
...
fix : #3705
2024-06-17 15:52:21 +00:00
Dunqing
81e952632d
feat(isolated-declarations): inferring set accessor parameter type from get accessor return type ( #3725 )
2024-06-17 15:47:23 +00:00
rzvxa
4bce59df68
refactor(semantic/cfg)!: re-export petgraph as control_flow::graph. ( #3722 )
...
So we can replace or extend it easily.
2024-06-17 14:16:55 +00:00
Boshen
f42c325a06
refactor(napi): change "isolated declarations" to "transform" ( #3721 )
2024-06-17 14:09:18 +00:00
Dunqing
77d553364d
feat(isolated-declarations): report errors that are consistent with typescript. ( #3720 )
2024-06-17 13:53:19 +00:00
Boshen
3c597356e4
refactor(isolated-declarations): remove TransformDtsCtx ( #3719 )
2024-06-17 13:16:25 +00:00
Boshen
0b8098a442
feat(napi): isolated-declaration ( #3718 )
2024-06-17 13:06:00 +00:00
Boshen
1c7f19c868
chore(oxlint): remove unused code (format command) ( #3716 )
2024-06-17 12:16:21 +00:00
rzvxa
080ecbd88d
feat(linter): add no-fallthrough. ( #3673 )
...
[no-fallthrough](https://eslint.org/docs/latest/rules/no-fallthrough )
[oxlint-ecosystem-ci](https://github.com/rzvxa/oxlint-ecosystem-ci/actions/runs/9546510803 )
related to #633 and closes #597
also related to #3662
2024-06-17 11:50:24 +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