Commit graph

4009 commits

Author SHA1 Message Date
Boshen
1af5ed3d89 refactor(ast)!: replace Modifiers with declare and const on EnumDeclaration (#3845) 2024-06-23 10:34:55 +00:00
Boshen
0673677317 refactor(ast)!: replace Modifiers with declare on Function (#3844) 2024-06-23 10:34:54 +00:00
Boshen
ee6ec4ee57 refactor(ast)!: replace Modifiers with declare and abstract on Class (#3841) 2024-06-23 10:34:53 +00:00
Boshen
9b38119ec9 refactor(ast)!: replace Modifiers with declare on VariableDeclaration (#3839)
part of #2958
2024-06-23 10:34:52 +00:00
rzvxa
f029273b04 chore(ast): move the rest of ast implementations to ast_impl (#3840) 2024-06-23 09:56:35 +00:00
overlookmotel
d76f34b130 fix(transformer): TODO comments for missing scopes (#3837)
Where we create new block statements, need to generate scopes for them. Just adding TODO comments for this at present - we need an API to make this easy.
2024-06-23 08:45:28 +00:00
overlookmotel
d9f268dd55 refactor(transformer): shorten TS transform code (#3836)
Shorten code in TS transform. Remove a pointless reallocation of a `Box` in `transform_simple_assignment_target`.
2024-06-23 08:45:27 +00:00
overlookmotel
e4707315c0 fix(transformer): TS transform handle when type exports first (#3833)
Fix 2 bugs in TS transform:

1. Handle where export declaration precedes its import/definition. e.g. `export { X }; import { type X } from "x";`
2. Don't insert `export {}` statement if any other `export` statements remain.

Also refactor to simplify logic for removing imports/exports.
2024-06-23 08:45:25 +00:00
overlookmotel
d774e54f8e fix(transformer): TS transform generate do not copy statements (#3832)
Remove an unsound usage of `ast.copy` from TS transform. Previously the same statements were inserted into the AST multiple times. Instead generate these statements on demand.

Also use a `std::vec::Vec` for temporary values, rather than allocating them into arena, where they take up space to no purpose.
2024-06-23 08:45:24 +00:00
Don Isaac
d5f6aeb1ca
feat(semantic): check for illegal symbol modifiers (#3838) 2024-06-23 12:36:09 +08:00
overlookmotel
a6487482bc
refactor(ast): shorten code in AST builder (#3835)
Shorten code in AST builder. `MemberExpression` can be converted
directly to `AssignmentTarget`.
2024-06-23 10:47:15 +08:00
overlookmotel
120696741c
refactor(ast): reduce allocations in AST builder (#3834)
No need to unbox and then box again.
2024-06-23 10:46:54 +08:00
overlookmotel
ff1da27278 fix(transformer): correct comment in example (#3831)
Correct instructions for transformer example.
2024-06-22 19:08:01 +00:00
Boshen
cfcef241db feat(ast)!: add directives field to TSModuleBlock (#3830)
closes #3564
2024-06-22 18:14:08 +00:00
Boshen
445603444f feat(ast)!: add IdentifierReference to ExportSpecifier (#3820)
closes #3795
closes #3796
2024-06-22 11:43:41 +00:00
Boshen
99a40ce6ac fix(semantic): export default foo should have ExportLocalName::Default(NameSpan) entry (#3823) 2024-06-22 11:09:23 +00:00
Boshen
7302429b2b refactor(linter/prefer_number_properties): remove the unused IdentifierName check (#3822) 2024-06-22 09:40:02 +00:00
Boshen
a1b2d83ea9
chore(ast): move ast implementations to ast_impl (#3821)
Co-authored-by: Boshen <1430279+Boshen@users.noreply.github.com>
2024-06-22 16:58:24 +08:00
rzvxa
567334834b chore(ci): now we mark both ts alias and eslint rules. (#3813)
Fixes the unmarked implemented rules in #479.
2024-06-22 04:55:34 +00:00
overlookmotel
4f7ff7e3ad perf: do not pass &Atom to functions (#3818)
`Atom` is just a wrapper around `&str`, so better not to pass `&Atom` to functions, as that's a double-reference. Prefer `Atom` or `&str` instead to avoid indirection.
2024-06-22 04:48:00 +00:00
overlookmotel
aaa944d66b improve(transformer): avoid reallocating strings (#3817)
Re-use existing `Atom`s rather than allocating duplicate strings in TS transforms.
2024-06-22 04:47:58 +00:00
overlookmotel
6dcc3f4002 fix(transformer): fix TS annotation transform scopes (#3816)
Create symbol references for `IdentifierReferences` created in TS annotations transform.
2024-06-22 04:47:57 +00:00
Dunqing
2cdb34f6df feat(isolated-declarations): support for class function overloads (#3811) 2024-06-21 14:37:10 +00:00
Boshen
dd540c8f0f feat(minifier): add skeleton for ReplaceGlobalDefines ast pass (#3803) 2024-06-21 13:53:59 +00:00
Dunqing
58e54f4aea fix(isolated-declarations): report an error for parameters if they are ObjectPattern or ArrayPattern without an explicit type (#3810) 2024-06-21 10:20:28 +00:00
Dunqing
231b8f0946 feat(isolated-declarations): support for export default function overloads (#3809) 2024-06-21 10:20:25 +00:00
Dunqing
eadf495e85 chore(isolated-declarations): add tests from Deno (#3808) 2024-06-21 10:20:21 +00:00
Dunqing
cb8a272392 fix(isolated-declarations): cannot infer nested as const (#3807) 2024-06-21 10:20:17 +00:00
Dunqing
d8ecce5b3c fix(isolated-declarations): infer BigInt number as bigint type (#3806) 2024-06-21 10:20:13 +00:00
Dunqing
4e241fcda8 fix(isolated-declarations): missing const after transformed const enum (#3805) 2024-06-21 10:20:10 +00:00
Dunqing
683c7b0dd1 fix(isolated-declarations): shouldn’t add declare in declaration with export default (#3804)
Added tests in #3808
2024-06-21 10:20:06 +00:00
Boshen
f3c3970131 feat(minifier): add skeleton for RemoveDeadCode ast pass (#3802) 2024-06-21 07:18:14 +00:00
Boshen
8027b1e894 refactor(minifier): change prepass to ast_passes::remove_parens (#3801) 2024-06-21 07:18:08 +00:00
Boshen
49fab9d6be
Release npm/oxc-transform v0.15.1 2024-06-20 23:41:31 +08:00
Boshen
f8fe583a0b
ci: run cargo check first 2024-06-20 23:38:21 +08:00
Boshen
0511a1b014
chore(justfile): run cargo shear in just ready 2024-06-20 23:27:46 +08:00
Boshen
4f2f96e716
chore(napi/transform): remove unused dependencies 2024-06-20 23:26:57 +08:00
Boshen
05e97b615d
chore: fix clippy warning 2024-06-20 23:22:01 +08:00
Boshen
25b607cde1
ci: fix 2024-06-20 23:18:42 +08:00
Boshen
fe38a20715
refactor(napi/transform): output normal error messages 2024-06-20 23:14:17 +08:00
Boshen
152195b67b
ci: try fix graphite optimize ci 2024-06-20 23:14:17 +08:00
Dunqing
a37138f1ec feat(isolated-declarations): improve the inference template literal (#3797) 2024-06-20 15:02:45 +00:00
Dunqing
b0d7355c98 feat(isolated-declarations): transform const expression correctly (#3793) 2024-06-20 15:02:41 +00:00
Boshen
2a16ce0624 feat(traverse): disable syntax check and disable build module record (#3794)
These can be skipped because :
 * semantic errors are not passed to the caller
 * module record is not used
2024-06-20 13:05:35 +00:00
Dunqing
01da2f78c1 feat(codegen): print TSThisParameter for TSCallSignatureDeclaration and TSMethodSignature (#3792) 2024-06-20 10:13:58 +00:00
Dunqing
2821e0e307 feat(codegen): print readonly keyword for TSIndexSignature (#3791) 2024-06-20 10:13:51 +00:00
Dunqing
7d47fc3fcc fix(isolated-declarations): should stripe async and generator keyword after transformed (#3790) 2024-06-20 10:13:44 +00:00
Dunqing
dc8e2b8dc0 feat(coverage/transpile): compare error message (#3789) 2024-06-20 10:13:36 +00:00
Boshen
ebb6eb8c67
chore(coverage): add a prepass benchmark 2024-06-20 15:07:17 +08:00
Alexander S
a5e0f2274a
fix(docs): detect typescript alias rules and mark them as supported (#3779)
Some tpyescript rules are extensions of the core eslint rules.  

Now we mark them as supported :) 

Maybe add a info for the user about this behavior?

Some discord discussion:

https://discord.com/channels/1079625926024900739/1080712072012238858/1226407188650659845

## Current State

Found Aliases:
- default-param-last
- max-params
- no-array-constructor
- require-await
- no-dupe-class-members
- no-empty-function
- no-loss-of-precision
- no-redeclare
- no-useless-constructor

Todo: why im getting following output:
```
👀 typescript/require-await is implemented but not found in their rules
👀 tree-shaking/no-side-effects-in-initialization is implemented but not found in their rules
```
2024-06-20 14:56:31 +08:00