Commit graph

181 commits

Author SHA1 Message Date
Boshen
f32bf27106
fix(codegen): fix some typescript codegen problems (#989) 2023-10-13 16:23:48 +08:00
Boshen
e0ca09b1c9
feat(codegen): implement the basics of non-minifying codegen (#987) 2023-10-13 13:34:21 +08:00
Boshen
903854dac0
refactor(ast): fix the lifetime annotations around Vist and VisitMut (#973) 2023-10-10 17:05:48 +08:00
Boshen
ef8aaa7bf1
feat(minifier): re-enable mangler (#972) 2023-10-10 14:32:58 +08:00
Boshen
0fcad27515 use enter / leave scope from ast visit in SemanticBuilder 2023-10-09 09:59:14 +08:00
Boshen
dd875402e7 swap enter leave scope order with enter / leave node 2023-10-09 09:59:14 +08:00
Don Isaac
6c1388df55 feat(ast): enter/leave scopes in Visit 2023-10-09 09:59:14 +08:00
Boshen
55b2f031df
feat(minifier): partially re-enable minifier (#963)
closes #949
closes #950
closes #951

All minifier tests are disable from this PR.

We are going to fix the compilation errors first, then the behavioral
errors.
2023-10-08 11:06:42 +08:00
magic-akari
9ad2634091
feat(transformer): Class Static Block (#962) 2023-10-08 08:16:40 +08:00
magic-akari
21066a9ad7
feat(transformer): Shorthand Properties (#960) 2023-10-07 17:02:45 +08:00
Boshen
817f8c295e
ci: turn off doc tests because they are slow to compile and run (#961) 2023-10-07 17:01:23 +08:00
Cameron
5b1e1e5408
feat(parser): TypeScript 5.2 (#811)
- adds support for [Using
Declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management)

Closes #786
2023-10-05 12:52:14 +13:00
IWANABETHATGUY
266253c142
fix: ts parsing error (#940)
Fixed https://github.com/web-infra-dev/oxc/issues/932
2023-09-29 22:02:56 +13:00
Boshen
5863f8ffdb
feat(transformer): logical assignment operators (#923) 2023-09-16 23:54:53 +08:00
Boshen
70189f9758
refactor(ast): change the arguments order for some new functions 2023-09-16 16:07:52 +08:00
Boshen
419d5aa6ee
feat(transformer): transformer prototype (#918)
This PR introduces the oxc transformer.

The code is purposely arranged without any Rust trickery such as traits
and macros.
I intend to keep the code style this way until something blows up.

The next steps are:
* unit tests
* conformance tests with TypeScript and Babel
* benchmarks
2023-09-16 16:05:35 +08:00
Boshen
ceeee5909b
Remove HIR (#917)
closes #273
closes #814

HIR is removed from this PR, with the minifier being commented out.

HIR is a wonderful idea for compiling to lower languages, but after
sitting on it for a few months I found that it only adds confusion and
uncertainties to both myself and future contributors.

It also adds too much burden to maintainers if we plan to support more
downstream tools.

1 AST is the only way.
2023-09-15 23:48:32 +08:00
Boshen
38bbc96fb0
Release oxc v0.2.0 2023-09-14 23:41:44 +08:00
Boshen
babbc47d61
perf(parser): lazily build trivia map instead of build in-place (#903)
closes #898
2023-09-12 23:23:56 +08:00
Boshen
93adc9b9c2
Release oxc v0.1.3 2023-09-03 12:22:05 +08:00
Boshen
37bf4c4421
Release oxc v0.1.2 2023-09-03 11:30:44 +08:00
EliLichtblau
6a9d57061c
TSTypeName change identifer name to identifier reference (#804)
When initially written types were not in the symbol table. Now that
types are in the symbol table it makes sense given
```ts
type A = 1
type B = A
```
that you can get to the symbol id for for A from type B = A.

Please correct me if I'm wrong about how I implemented this. I also
verified that occurrence (I believe this is the correct word) behaves
how I would expect.

```ts
type RecursiveType = string | {[x: string]: RecursiveType}
```
Does populate a reference.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2023-08-28 11:42:21 +08:00
Boshen
1f27426570
Release crates as v0.1.1 2023-08-26 17:53:11 +08:00
u9g
741aa8df1f
feat(ast): Add to ChainExpression and ExpressionArrayElement to ASTKind (#785) 2023-08-25 03:03:53 +00:00
Boshen
5152b39b17
chore: clean up Cargo.toml with cargo machete (#767) 2023-08-20 15:29:09 +08:00
Yunfei He
e7c2313817
feat(ast): add SymbolId and ReferenceId (#755)
Closes #510
2023-08-19 18:09:47 +08:00
Boshen
fdf288c685
refactor: improve code coverage in various places (#721) 2023-08-11 15:17:49 +08:00
Boshen
89b49bdb07
doc(ast): document why Directive.directive is a raw string 2023-08-09 14:06:25 +08:00
Yunfei He
35167599bc
refactor(ast): use atom for Directive and Hashbang (#701)
The main reason is using Atom to remove the lifetime for convenience.

And after removing the lifetime of these nodes, the `Program<'a>`
doesn't rely on `&'a source` anymore, which allows us to [specify more
accurate
lifetimes](https://github.com/web-infra-dev/oxc/discussions/700).
2023-08-09 13:52:56 +08:00
EliLichtblau
5e54bd0537
Adding types to the symbol table - consistent export type sample rule implemented (#667)
Fixes 11 TS conformance tests and 18 babel tests.

Adds types to the symbol table functionally conformant to TS behavior
but symbol flags implemented slightly differently.

Symbol redeclaration check is also not entirely conformant but fixing
this seems like a separate PR.

For testing purposes - consistent-export-type was also implemented
(WIP).
2023-07-31 12:33:47 +08:00
Don Isaac
47541339a9
feat(ast): AstKind::debug_name() (#665)
Adds `AstKind::debug_name()`, which returns the name of an AstKind
struct with a few minor details as applicable. I intentionally did not
make `AstKind` implement `Display`, as this method returns minimal
information. Additionally, this method only exists in debug builds. I've
hidden it behind a `#[cfg(debug_assertions)]`, so it won't affect
release builds.

This code was extracted from #642, where it as created while debugging
iteration over ancestor nodes. I figured it belonged in its own PR and
may be useful to other devs.
2023-07-31 10:04:52 +08:00
Don Isaac
6628fc8d9c
perf(linter): reduce mallocs (#654)
Reduces mallocs via `clones()` (particularly of `Atom`s), and vec
allocations.

Affects the following rules:
- [x] eslint/no-dupe-keys
- [x] eslint/no-global-assign
- [x] eslint/no-loss-of-precision _(only partially optimized, needs more
work later)_
~- [ ] typescript-eslint/ajacent-overload-signatures~ (_will be
addressed in following pr_)
2023-07-29 12:02:53 +08:00
Boshen
1012d8300c
chore: release crates as v0.1.0 2023-07-27 13:54:17 +08:00
Boshen
d587065436
chore(rust): update crate info, add minimal rust-version, add categories 2023-07-27 13:33:18 +08:00
Boshen
b34ef4f07a chore: reformat 2023-07-27 13:11:46 +08:00
Matthew "strager" Glazar
ad00720d75 refactor: avoid unstable let_chains
The let_chains Rust feature is unstable, preventing Oxc from using a
stable Rust compiler. Refactor the code to avoid let_chains.
2023-07-27 09:44:57 +08:00
Boshen
38e11956be
chore(rust): rust version 1.71.0 nightly 2023-07-13 23:10:10 +08:00
阿良仔
976059d418
feat: implement GetSpan for ForStatementLeft (#540) 2023-07-11 22:11:07 +08:00
Don Isaac
0346adb1eb
feat(linter): add eslint/no-control-regex (#516) 2023-07-10 10:20:57 +08:00
u9g
6614b46f26
Visit jsx_element in ast visitor and add to astkind (#524) 2023-07-07 12:36:52 +08:00
Boshen
2e32140450
publish: bump all crates to v0.0.7 2023-07-06 14:27:13 +08:00
Boshen
8aba8bcbb5
feat(oxc): a single oxc crate (#522) 2023-07-06 13:35:25 +08:00
u9g
974dfa027f
Implement GetSpan for JSXExpression 2023-07-06 00:27:57 -04:00
u9g
ed9f67d263
Add examples to JSXElementName (#515) 2023-07-05 00:13:53 +08:00
u9g
4d71784b94
Implement GetSpan for JSXAttributeItem (#514) 2023-07-05 00:13:36 +08:00
Boshen
e25f6e2dd4
chore(rust): rust cargo fmt and fix clippy warnings 2023-07-04 15:41:30 +08:00
Boshen
17a73b1eef
refactor(ast): move ModuleRecord to oxc_syntax 2023-07-03 22:54:27 +08:00
Boshen
1aa112917a
feat(linter): implement no-inner-declarations 2023-07-01 13:58:50 +08:00
Boshen
072abcc2a6
fix(linter): fix no_empty_pattern broken on rest elements 2023-06-28 18:40:45 +08:00
u9g
a2d90d94d6
Add comments to BindingPatternKind (#489) 2023-06-28 14:47:22 +08:00