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
Danil Karpenko
1721feea0e
feat(prettier/ts): better conformance ( #2721 )
...
I know 5% isn't much, but it's small steps like this that move us toward
our goal.
2024-03-20 18:59:49 +08:00
renovate[bot]
1e9c0bc484
chore(deps): update rust crates ( #2747 )
2024-03-17 16:40:42 +00:00
Boshen
798a1fde09
fix(parser): fix failed to parse JSXChild after JSXEmptyExpression ( #2726 )
...
fixes #2723
2024-03-15 13:39:20 +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
9609c34e6d
fix(codegen): CallExpression sourcemap ( #2717 )
2024-03-14 07:53:22 +00:00
Boshen
0f86333437
refactor(ast): refactor Trivias API - have less noise around it ( #2692 )
2024-03-12 20:16:36 +08:00
Boshen
86ee074678
fix(parser): remove all duplicated comments in trivia builder ( #2689 )
2024-03-12 17:51:22 +08:00
Boshen
977c20b677
feat(coverage): add a duplicate comment check ( #2688 )
2024-03-12 16:52:34 +08:00
Boshen
cda9c93436
fix(parser): improve lexing of jsx identifier to fix duplicated comments after jsx name ( #2687 )
2024-03-12 15:51:51 +08:00
Boshen
6c6adb46d1
fix(ast): parse rest parameter with the correct optional and type annotation syntax ( #2686 )
...
closes #2653
2024-03-12 15:47:22 +08:00
Boshen
8a73d18fcf
chore(parser): make sure all span.end >= span.start ( #2681 )
...
closes #2679
2024-03-11 19:49:51 +08:00
Boshen
265b2fb640
feat: miette v7 ( #2465 )
2024-03-08 15:50:00 +08:00
magic-akari
17bc711bf0
fix(prettier): print bare import ( #2633 )
2024-03-07 14:03:20 +08:00
Boshen
240ff19675
refactor(parser): improve parsing of BindingPattern in TypeScript ( #2624 )
...
closes #2622
2024-03-06 16:16:03 +08:00
Arnaud Barré
97aa9cfd54
fix(parser): fix span end for TSEmptyBodyFunctionExpression ( #2606 )
...
https://oxc-project.github.io/oxc/playground/?code=3YCAAICXgICAgICAgICxG4jI43W9aqTWr3WzyAs1pNu4fnf%2FXXEB3Yt%2FfiBIgA%3D%3D
The conformance test are going back to initial state. I think the `.asi`
should be smarter, i can rethink that later
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-05 12:45:11 +08:00
Boshen
e2d2ce3369
feat(parser): parse decorators properly ( #2603 )
...
closes #2562
2024-03-04 19:30:41 +08:00
Boshen
ef932a3c27
refactor(codegen): clean up API around building sourcemaps ( #2602 )
...
closes #2564
2024-03-04 16:03:33 +08:00
Boshen
9cc960e591
fix(parser): fix duplicated comments during parser rewind ( #2600 )
...
closes #2592
2024-03-04 14:07:33 +08:00
Arnaud Barré
d9cc429d4a
fix(parser): parse empty method declaration as TSEmptyBodyFunctionExpression ( #2574 )
...
That a tricky one, because it's time to decide what does ESTree
compliant means in the TS world (re #2463 )
This code:
```ts
export declare class ByteBuffer {
clear(): void;
// ^^
}
```
- Is parsed by
[Babel](d38530204e )
as `FunctionExpression` with an empty body
- By
[TS-ESLint](4ea4e2feb5 )
as
[TSEmptyBodyFunctionExpression](https://github.com/typescript-eslint/typescript-eslint/pull/1289 )
- By
[OXC](https://oxc-project.github.io/oxc/playground/?code=3YCAAIC1gICAgICAgICyHorESipoTXPdvBaE9wxzlOraoWs19SUxDvdcwSVU0kbBO2b7ppX3x2P5IhQlpGHOYEHNCEfLf38HUICA )
as `TSDeclareFunction`
I'm going the easy way to fix this to the Babel way, but I think
following TS-ESLint would make sense. There is an [open babel
issue](https://github.com/babel/babel/issues/13878 ) about that.
Edit: Ok that not so easy and require updating some logic.
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-03-03 13:59:17 +00:00
Boshen
8bb1084863
feat(codegen): add sourcemap ( #2565 )
...
Co-authored-by: underfin <2218301630@qq.com>
2024-03-03 14:44:49 +08:00
Boshen
3efbbb2e1f
feat(ast): add "abstract" type to MethodDefinition and PropertyDefinition ( #2536 )
...
closes #2532
```
pub enum PropertyDefinitionType {
PropertyDefinition,
TSAbstractPropertyDefinition,
}
pub enum MethodDefinitionType {
MethodDefinition,
TSAbstractMethodDefinition,
}
```
2024-02-28 17:33:11 +08:00
renovate[bot]
29b213eac7
chore(deps): update rust crates ( #2503 )
2024-02-26 10:38:11 +08:00
Andrew McClenaghan
6b3b260dcc
feat(Codegen): Improve codegen ( #2460 )
...
This gets all the new TS types working to the same level TS output was
before and fixes a bunch of other codegen
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-21 14:41:57 +08:00
Dunqing
197fa16613
feat(semantic): add check for duplicate class elements in checker ( #2455 )
...
1. Remove the check implementation of the parser
2. Implement it to semantic checker
3. Support typescript's check for duplicate class elements
Support checking for duplicate class elements in semantic checker is
easier to support typescript checking rules.
2024-02-21 14:10:19 +08:00
Andrew McClenaghan
e6d536cb9b
feat(codegen): configurable typescript codegen ( #2443 )
...
- Adds option to `CodegenOptions` - `enable_typescript` to enable output
of TS.
- Stops skipping output that is TS when `enable_typescript` is enabled
- Adds TS support to
- Function
- FormalParameter
- BindingPattern
- Adds basic tests for TS generation
---------
Co-authored-by: Boshen <boshenc@gmail.com>
2024-02-20 12:09:28 +08:00
Dunqing
60db720fa6
feat(parser): parse import attributes in TSImportType ( #2436 )
...
close : #2394
64d2eeea7b/src/compiler/types.ts (L2177-L2185)
The corresponding test cases were skipped, so I manually added some
cases to misc
f5db48237f/tasks/coverage/src/typescript.rs (L118-L121)
2024-02-19 12:26:42 +08:00
Dunqing
b5deb9a708
fix(codegen): when async is on the left-hand side of a for-of, wrap it in parentheses ( #2407 )
...
Refer to
55e1127a49/internal/js_printer/js_printer.go (L3097-L3104)
2024-02-13 22:42:23 +08:00
Boshen
1cbd7539fb
feat(coverage): add prettier idempotency test ( #2402 )
...
closes #1329
2024-02-12 15:30:16 +08:00
Boshen
70a0076eed
refactor: remove global allocator from non-user facing apps ( #2401 )
...
The runtime performance gains does not out weight the compilation speed from
building the custom allocators, which takes about a minute to build on
slower machines.
2024-02-12 14:09:05 +08:00
Dunqing
73e116e8a1
fix(parser): incorrect parsing of class accessor property name ( #2386 )
2024-02-11 22:57:13 +08:00
Dunqing
0df7e296f9
feat(tasks/codegen): check node version >= 20 ( #2385 )
...
This syntax only works on node >= 20
`import value from './json-value-array_FIXTURE.json' with { type: 'json'
};`
2024-02-11 19:23:11 +08:00
Boshen
ef336cb66b
feat(parser): recover from async x [newline] => x ( #2375 )
...
```javascript
async x
=> x
```
Babel recovers and displays "No line break is allowed before '=>'
2024-02-10 11:19:08 +08:00
Dunqing
2eb489e996
fix(codegen): format new expession + import expression with the correct parentheses ( #2346 )
...
Similar to #2330
2024-02-09 20:51:50 +08:00
Dunqing
55011e2793
feat(codegen): avoid printing comma in ArrayAssignmentTarget if the elements is empty ( #2331 )
2024-02-06 22:45:19 +08:00
Boshen
43a9cb5522
chore: update snapshot
2024-02-06 22:17:59 +08:00
Dunqing
a3570d41f0
feat(semantic): report parameter related errors for setter/getter ( #2316 )
2024-02-05 17:38:43 +08:00
Dunqing
9ca13d040d
feat(semantic): report type parameter list cannot be empty ( #2315 )
2024-02-05 16:05:51 +08:00
Dunqing
d6d931cd80
fix(tasks/coverage): when providing filter, do not run just submodules ( #2310 )
2024-02-05 15:06:37 +08:00
Dunqing
f53c54ced9
feat(semantic): report unexpected type annotation in ArrayPattern ( #2309 )
2024-02-05 13:45:52 +08:00
underfin
2f97b332bd
chore: codegen test skip v8 failed test ( #2283 )
...
Because v8 isn't pass some test262 tests, we also need to skip them, you
can find it at
https://chromium.googlesource.com/v8/v8/+/refs/heads/main/test/test262/test262.status .
2024-02-04 14:02:39 +08:00
Boshen
d2f7ea2923
chore: manually clone git modules instead of using submodules ( #2274 )
...
closes #2231
Submodules are a blocker for beginners, we should make it clone on
demand.
It is also a blocker for people who wants to target this repo as a crate
for testing purposes, cargo will do a full clone if you specify
oxc_parser = { git = "this repo" } in Cargo.toml
2024-02-02 11:56:18 +00:00
Boshen
28daf83b19
feat(semantic): report no class name error ( #2273 )
...
closes #2144
2024-02-02 19:05:00 +08:00
Boshen
650f6c942f
refactor: use our forked version of miette::Reporter for tests ( #2266 )
2024-02-02 16:15:31 +08:00
Dunqing
da2ffdf7a0
feat(semantic): check parameters property ( #2264 )
2024-02-02 15:58:32 +08:00
Dunqing
d71175e712
feat(semantic): check optional parameters ( #2263 )
2024-02-02 15:54:04 +08:00
Boshen
8d99a15ac9
feat(semantic): report error on optional variable declaration in TypeScript ( #2261 )
...
closes #2253
closes #2255
2024-02-02 14:13:10 +08:00
Tzvi Melamed
73ccf8a4da
fix(oxc_semantic): proper traversal of try statements ( #2250 )
...
Closes #2227
2024-02-01 20:46:38 +08:00
Wenzhe Wang
5fb5d8a01e
chore(tasks): update codegen runtime snapshot ( #2223 )
2024-01-31 12:25:28 +08:00
renovate[bot]
d7a9bcf191
chore(deps): update rust crates ( #2199 )
2024-01-30 15:30:22 +08:00