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
Dunqing
f59e87f9c4
refactor(semantic): checking label in ContinueStatement based on LabelBuilder ( #2202 )
2024-01-29 18:24:42 +08:00
Dunqing
56adfb1a86
refactor(semantic): use LabelBuilder instead of UnusedLabeled ( #2184 )
...
I think `UnusedLabeled` can do more than that.
1. Collect unused label
2. Support check duplication label
3. Support check label in `BreakStatement`
4. Support check label in `ContinueStatement` (Not yet)
But then the `UnusedLabeled` name wouldn't fit, so I renamed it
`LabelBuilder` and moved it to `label.rs`
2024-01-29 15:15:07 +08:00
Dunqing
ea8cc98c34
fix(ast): AcessorProperty is missing decorators ( #2176 )
2024-01-26 15:43:05 +08:00
underfin
989ab88bc6
fix(codegen): print Directive original string ( #2157 )
...
> A Use Strict Directive may not contain an EscapeSequence or
LineContinuation.
It is `Use Strict Directive` spec, but the `expression` of `Directive`
isn't original string value, it has error if using it to codegen, so
here using `directive` of `Directive` to codegen and not to escape it.
Here is crashed test cases.
``` js
'use str\
ict';
```
The babel will print the original string, I follow it and avoid using
`print_str` because it will escape string.
I also changed some code using the `expression` of `Directive` to check
`Use Strict Directive` .
2024-01-25 15:24:05 +08:00
Boshen
ad133ba647
chore: update snapshots
2024-01-22 19:16:09 +08:00
Boshen
26571c72de
chore(just): change sync command to sync-submodules
...
This should avoid accidentally running the command
2024-01-22 17:45:13 +08:00
Boshen
2f5afff9bd
fix(parser): fix crash on TSTemplateLiteralType in function return position ( #2089 )
...
```
interface Helpers {
inspect(): `~~~~\n${string}\n~~~~`;
}
```
2024-01-19 23:14:05 +08:00
Boshen
b0f4715df1
ci: disable codegen runtime tests for now
...
It seems to be unstable across node.js versions
2024-01-15 21:24:07 +08:00
Boshen
a69b76ab77
chore: update snapshots
2024-01-15 21:13:05 +08:00
Valerii Smirnov
c60c31521e
feat(linter): eslint-plugin-import no-named-as-default-member rule ( #1988 )
...
- Docs:
https://github.com/import-js/eslint-plugin-import/blob/main/docs/rules/no-named-as-default-member.md
- Code:
https://github.com/import-js/eslint-plugin-import/blob/main/src/rules/no-named-as-default-member.js
- Tests:
https://github.com/import-js/eslint-plugin-import/blob/main/tests/src/rules/no-named-as-default-member.js
2024-01-15 11:03:04 +00:00
dependabot[bot]
21909fa962
chore(deps): bump the dependencies group with 3 updates ( #2033 )
2024-01-15 15:31:32 +08:00
Dunqing
0a086860da
feat(ast): visit TSModuleReference ( #1998 )
...
### Failed cases:
* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elision-qualifiedname/input.ts
* 7c29fbc4db/packages/babel-plugin-transform-typescript/test/fixtures/imports/elide-react/input.ts
We need to distinguish whether a reference is a type or a js variable
2024-01-11 23:29:29 +08:00