Commit graph

113 commits

Author SHA1 Message Date
Dunqing
ba85b097e0
feat(transformer/decorators): support method decorator and is not static (#2238) 2024-02-01 11:36:22 +08:00
Dunqing
a79988d5e2
feat(transformer/decorators): support static member (#2235) 2024-01-31 19:11:27 +08:00
Dunqing
3b85e1813b
feat(transformer/decorators): ensure property key consistency (#2233) 2024-01-31 19:05:52 +08:00
Dunqing
e5719e9b4d
feat(transformer/decorators): support transform member decorators (#2171) 2024-01-26 10:14:19 +08:00
underfin
2794064eef
feat(transfrom): transform-json-strings (#2168)
The pr intends to implement the plugin
`babel-plugin-transform-json-strings`. But here is only mutate
`Directive`, the `StringLiteral` is not implement. It need to changed
the `StringLiteral` printer.

I'm intend to add the raw of `StringLiteral`, it will be mutate at
plugin, and using the `raw` to print `StringLiteral`. If you other
ideas, please let me know.

---------

Co-authored-by: Boshen <boshenc@gmail.com>
2024-01-25 10:39:02 +00:00
Dunqing
51cecbb3ea
refactor(transformer/decorators): align the implementation of all versions (#2159) 2024-01-25 13:11:24 +08:00
Dunqing
b261e86ea9
refactor(ast): improve simple_assignment_target_identifier and simple_assignment_target_member_expression method (#2153)
Based on current usage, I think returning AssignmentTarget is better.
2024-01-24 11:24:27 +08:00
Dunqing
7f89bfea0d
feat(transformer/decorators): support version 2023-05 (#2152) 2024-01-24 11:19:29 +08:00
Dunqing
04b401cbfd
feat(transformer/decorators): support transform the class decorators in export declaration (#2145) 2024-01-24 11:13:29 +08:00
Dunqing
9e598ff650
feat(transformer): add decorators plugin (#2139) 2024-01-24 11:09:19 +08:00
overlookmotel
777352e2ba
fix(transformer): always create valid identifiers (#2131)
I'm not familiar with the transformer, so not 100% sure what this
function does. But from the name `create_valid_identifier`, I'm guessing
that `-` is a mistake - it's not a valid character to have in
identifiers.

If I've misunderstood, please feel free to close this.
2024-01-23 12:35:41 +08:00
overlookmotel
ee949fc78d refactor(transformer): use is_identifier_part 2024-01-23 11:05:17 +08:00
overlookmotel
040ee192c4 refactor(transformer): use is_identifier_name from oxc_syntax 2024-01-23 11:05:17 +08:00
Dunqing
b5b2ef34af
feat(transformer/typescript): improve function parameters name (#2079) 2024-01-19 13:50:10 +08:00
Dunqing
7711f7abaf
feat(transformer/typescript): support only_remove_type_imports option (#2077) 2024-01-18 23:25:31 +08:00
Dunqing
f5bf5dece1
feat(transformer/typescript): support transform exported TSModuleBlock (#2076) 2024-01-18 23:20:26 +08:00
Dunqing
56ca8b6dfe
feat(transformer/typescript): support transform namespace (#2075) 2024-01-18 23:15:28 +08:00
Dunqing
2e78b918d1
refactor(transformer/typescript): move the ExportNamedDeclaration logic to its function (#2074) 2024-01-18 21:28:48 +08:00
Dunqing
b89e84cc2d
feat(transformer/typescript): keep imports if import specifiers is empty (#2058) 2024-01-17 16:14:31 +08:00
Dunqing
3413bb3884
feat(transformer/typescript): remove type-related exports (#2056) 2024-01-17 16:04:30 +08:00
Dunqing
95d741abd6
feat(transformer/typescript): remove type only imports/exports correctly (#2055) 2024-01-17 15:58:04 +08:00
Dunqing
6c7f983de5
feat(transformer/typescript): remove export specifier that import_kind is type (#2015) 2024-01-13 21:25:59 +08:00
Dunqing
ead4e8df1f
feat(transformer/typescript): remove import if only have type reference (#2001) 2024-01-13 08:52:14 +00:00
Boshen
61f37ea973
Publish crates v0.5.0 2024-01-12 23:33:47 +08:00
Dunqing
6a7e4be06c
feat(transformer): call enter_node/leave_node in visit_xxx (#1990) 2024-01-12 11:37:17 +08:00
Dunqing
afb2c501f5
feat(transformer): support for transform TSImportEqualsDeclaration (#1994) 2024-01-11 23:24:28 +08:00
underfin
78b427bc50
feat(transform): support es2015 new target (#1967)
Here implementing the es2015 new target transform, see detail at
https://babel.dev/docs/babel-plugin-transform-template-new-target.

Here has three kinds need to be distinguished.

- `NewTargetKind::Method`, it from `AstKind::ObjectMethod` or
`AstKind::MethodDefinitionKind::Get/Set/Method`. It will be transformed
to `void 0`.
- `NewTargetKind::Constructor`, is from `
AstKind::MethodDefinitionKind::Constructor`. It will be transformed to
`this.constructor`.
- `NewTargetKind::Function`, is from ` AstKind::Function`, here the
function is not the above function. It will be transformed to `this
instanceof _target ? this.constructor : void 0`, here `_target` comes
from the function name or is created by scope uid ident.
2024-01-10 23:59:56 +08:00
IWANABETHATGUY
4bbc977971
chore: upgrade rustc toolchain to stable 1.75.0 (#1853)
ref: 
https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html
2023-12-29 12:20:51 +08:00
秦宇航
ae27a8d1e6
feat(transformer): add partial support for babel-plugin-transform-instanceof (#1802) 2023-12-25 15:06:41 +08:00
magic-akari
a2858ed452
refactor(ast): introduce ThisParameter (#1728)
Most TypeScript types can be eliminated during the code generation phase
by not printing the corresponding AST nodes.
The changes in this PR enable applying a similar technique to the `this`
parameter.
2023-12-19 13:20:33 +08:00
Dunqing
f58b6279c8
feat(transformer): add arrow_functions plugin (#1663) 2023-12-13 20:46:28 +08:00
Dunqing
864176a051
feat(transformer/react-jsx): returns ThisExpression when identifier is this (#1661) 2023-12-13 13:47:54 +08:00
Ken-HH24
e331cc2677
feat(transformer): duplicate keys (#1649) 2023-12-10 18:07:32 +08:00
Boshen
8347e2225c
Release crates v0.4.0 2023-12-08 17:20:37 +08:00
Miles Johnson
c6ad6603a4
feat(semantic): support scope descendents starting from a certain scope. (#1629)
@Boshen 

The `ScopeTree.descendants` function would return all scopes starting
from the root, and wasn't truly descendants from a specific scope. To
improve this, I've renamed this function to `descendants_from_root` and
have introduced a new `descendants` function that does support from a
specific scope.

Furthermore, I've introduced helper functions to `SymbolTree` to make
reading symbols/scopes easier.

To verify this functionality, I enabled the `function_name` transformer
(and fixed it), and ran some example transforms. Here's the input:

```js
let fn;

fn = function (a, b, c) {
  const d = "";
};

const func = function (arg) {
  {
    const value = "";
  }
};

const f = function (f) {};
```

And the output using _the old implementation_. Note that all function
names are suffixed with a number, this is incorrect, since it was
inheriting far too many scopes.

```js
let fn;
fn = function fn1(a, b, c) {
	const d = '';
};
const func = function func1(arg) {
	{
		const value = '';
	}
};
const f = function f2(f) {
};
```

And here's the output with the new implementation. Note that only `f` is
suffixed with a number. That's because it has a shadowed argument of the
same name.

```js
let fn;
fn = function fn(a, b, c) {
	const d = '';
};
const func = function func(arg) {
	{
		const value = '';
	}
};
const f = function f1(f) {
};
```
2023-12-07 17:29:11 +08:00
Miles Johnson
6cbc5dd75b
feat(transformer): Start on function_name transform. (#1510)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-12-04 13:35:44 +08:00
IWANABETHATGUY
c034eee5c1
feat(transformer): handle invalid react jsx runtime (#1502) 2023-11-28 23:19:58 +08:00
magic-akari
92c1d9d527
feat(transform): TypeScript Enum (#1173) 2023-11-28 10:33:01 +08:00
IWANABETHATGUY
b6393f052f
feat(transformer/react): handle babel 8 breaking removed-options (#1489)
1. removed options react jsx
2. Passed 4 test cases.
2023-11-22 11:01:40 +08:00
IWANABETHATGUY
f66e4d8ac3
feat(transformer): add transform property-literal plugin (#1458)
1. Add `transform-property-literal-plugin`
2. Passing 2 testcases.

---------

Co-authored-by: Wenzhe Wang <mysteryven@gmail.com>
2023-11-21 23:07:43 +08:00
Boshen
1a576f60a8
refactor(rust): move to workspace lint table (#1444) 2023-11-20 14:38:10 +08:00
Dunqing
7f01d48df3
feat(transformer/react-jsx): set automatic to the default value for runtime (#1270)
Align babel8
2023-11-14 09:26:21 +08:00
Dunqing
d62631e239
refactor(transformer/react-jsx): use extend instead of for-in with push (#1236) 2023-11-12 19:26:15 +08:00
Dunqing
47ba874f4f
refactor(transformer/react-jsx): improve SpreadChildrenAreNotSupported error implementation (#1235) 2023-11-12 19:17:09 +08:00
Dunqing
1eef241788
feat(transformer/react-jsx): support for throwing SpreadChildrenAreNotSupported error (#1234) 2023-11-12 18:37:19 +08:00
Dunqing
39e608734f
feat(transformer/react-jsx): support for throwing ImportSourceCannotBeSet error (#1224) 2023-11-12 11:17:23 +08:00
Dunqing
b7e8feb7c1
feat(transformer/react-jsx): support throw valueless-key error (#1221) 2023-11-11 20:10:07 +08:00
Dunqing
a22ced78f1
feat(transformer/react-jsx): implement throwIfNamespace option (#1220) 2023-11-11 13:31:45 +08:00
Dunqing
48242367bb
fix(transformer/react-jsx): missing import jsxs in nested fragment (#1218) 2023-11-11 02:45:42 +00:00
Dunqing
a0f40cb058
fix(transformer/react-jsx): missing default options when plugin without config (#1219) 2023-11-11 10:38:28 +08:00