Commit graph

29 commits

Author SHA1 Message Date
IWANABETHATGUY
f7d41dd6fb fix(oxc_transform): overlap replacement (#7621)
closed  https://github.com/oxc-project/oxc/issues/7594

### Reference
https://github.com/oxc-project/oxc/pull/7343/files
2024-12-06 15:26:54 +00:00
Kevin Deng 三咲智子
245d7d922c
fix(oxc_transformer): alias es2015 to es6 (#7673)
Supported in
[esbuild](https://esbuild.github.io/try/#dAAwLjI0LjAALS10YXJnZXQ9ZXM2ADEqKjI)
2024-12-05 16:26:05 +08:00
IWANABETHATGUY
64f92e9cb4
fix(oxc_transform): oxc dot define is postfix of some MemberExpr (#7640)
Closed https://github.com/oxc-project/oxc/issues/7598
2024-12-04 19:18:19 +08:00
翠 / green
71b3437a4c
test(oxc_transformer): define works differently with esbuild (#7593)
See https://github.com/oxc-project/oxc/issues/7594

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2024-12-03 15:23:40 +08:00
IWANABETHATGUY
a23ce152af
feat(oxc_transformer): replace_global_define for assignmentTarget (#7505)
related esbuild test:

d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L5430-L5497)
2024-11-28 10:33:44 +08:00
Boshen
45ef3eb2be chore(transformer): disable class properties transform from the target API (#7487) 2024-11-26 06:10:35 +00:00
Boshen
713e210012 chore(transformor): disable class properties transform (#7486)
The plugin is not ready.
2024-11-26 03:47:46 +00:00
overlookmotel
9778298fdb feat(transformer): class properties transform (#7011)
Add class properties transform.

Implementation is incomplete. Notable missing parts:

* Scopes are not updated where property initializers move from class body into class constructor / `_super` function.
* Does not handle binding shadowing problems when property initializers move from class body into class constructor.
* `this` and references to class name in static property initializers need to be transformed to point to a temp var.
* Not all usages of private properties are supported (see below).
* Code which is moved to outside of class body is not transformed by other transforms for class declarations (works OK for class expressions). This includes static property initializers, static blocks, and computed property/method keys.
* Only basic checks for whether computed property/method keys may have side effects.
* Numerous other small issues noted in TODO comments through the code.

### Private properties

Currently does not handle the following usages of private properties:

```js
class Class {
  #prop;
  static #static;

  method() {
    object?.#prop;
    object?.#prop();
    [object.#prop] = [1];
    ({x: object.#prop} = {x: 1});
    object.#prop`xyz`;

    object?.#static;
    object?.#static();
    [object.#static] = [1];
    ({x: object.#static} = {x: 1});
    object.#static`xyz`;
  }
}
```
2024-11-25 10:24:20 +00:00
IWANABETHATGUY
e9f9e8242a feat(oxc_transformer): replace_global_define ThisExpression (#7443)
Test from d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L5195-L5260),

esbuild snapshot:

d34e79e2a9/internal/bundler_tests/snapshots/snapshots_default.txt (L1081-L1108)
2024-11-25 04:13:52 +00:00
IWANABETHATGUY
87978499a3
feat(oxc_transformer): replace_global_define destructuring assignment optimization (#7449)
1. Closed #7382

Co-authored-by: Hiroshi Ogawa <hi.ogawa.zz@gmail.com>
2024-11-24 23:24:32 +08:00
Boshen
59e7e4674f feat(napi/transform): add TransformOptions::target API (#7426) 2024-11-23 15:46:33 +00:00
IWANABETHATGUY
4bb1dca673 feat(oxc_transformer): ReplaceGlobalDefines for ChainExpr (#7433) 2024-11-23 15:21:30 +00:00
IWANABETHATGUY
21614f23b6 feat(oxc_transformer): ReplaceGlobalDefinesPlugin for ComputedMemberExpr (#7431)
support replace `test['foo']` like `ComputedMemberExpr`, since they are static either,
e.g.:
https://hyrious.me/esbuild-repl/?version=0.23.0&b=e%00entry.js%00console.log%28a%5B%27b%27%5D.c%29&b=%00file.js%00&b=%00file2.js%00&o=%7B%0A++treeShaking%3A+true%2C%0A%0AglobalName%3A+%22global%22%2C%0A%22bundle%22%3A+false%2C%0Aformat%3A+%22esm%22%2C%0Adefine%3A+%7B%0A++%22a.b.c%22%3A+%22foo%22%0A%7D%0A%7D
2024-11-23 10:26:43 +00:00
Song Gao
cf3415b0e4
chore(doc): replace main/master to tag/commit to make the url always accessible (#7298) 2024-11-16 21:00:30 +08:00
Boshen
b57d00d6fb fix(tasks/compat_data): fix misplaced features (#7284)
closes #7279
2024-11-14 16:36:16 +00:00
Boshen
846711cf41 feat(transformer)!: change API to take a &TransformOptions instead of TransformOptions (#7213)
closes #7185

`TransformOption`s has an initialization cost, it should be initialized once and shared across files.
2024-11-09 06:01:13 +00:00
Boshen
a166a4abd7 feat(transformer): add esbuild comma separated target API --target=es2020,chrome58 (#7210) 2024-11-08 14:09:20 +00:00
Boshen
3a20b906f4 feat(transformer): add es target to engineTargets (#7193) 2024-11-08 03:25:21 +00:00
Boshen
22898c855a feat(transformer): warn BigInt when targeting < ES2020 (#7184)
closes #5822
2024-11-07 08:29:03 +00:00
Boshen
03a30856c4
chore(transformer): disable snapshot test in miri 2024-11-04 16:54:52 +08:00
Boshen
9f611a18cf
chore(transformer): fix typos s/browerslist/browserslist/ 2024-11-03 21:54:54 +08:00
Boshen
6133a502c6 test(transformer): use a single integration test for faster compilation (#7099) 2024-11-03 12:43:26 +00:00
Boshen
bfdbcf1c6a feat(transformer): add EnvOptions::from_browerslist_query API (#7098) 2024-11-03 12:43:25 +00:00
Boshen
21b8e4988f feat(transformer): add ESTarget (#7091)
closes #6982
2024-11-03 12:21:53 +00:00
Boshen
435a89c6e4 refactor(oxc): remove useless allocator.alloc(program) calls (#6571) 2024-10-15 02:21:20 +00:00
Boshen
2b7be08af4 feat(ast)! add source_text to Program (#6444) 2024-10-11 04:13:41 +00:00
Boshen
020bb80b65 refactor(codegen)!: change to CodegenReturn::code and CodegenReturn::map (#6310) 2024-10-06 05:05:47 +00:00
IWANABETHATGUY
9736aa0112 fix(oxc_transformer): define import.meta and import.meta.* (#6277)
1. related esbuild test
d34e79e2a9/internal/bundler_tests/bundler_default_test.go (L5077-L5119)
2024-10-04 14:22:56 +00:00
Boshen
82ab68984e feat(transformer,minifier)!: move define and inject plugin from minifier to transformer (#6199) 2024-10-01 03:59:24 +00:00