Commit graph

346 commits

Author SHA1 Message Date
Boshen
4b719026bf
feat(transform_conformance): handle non-existent output.js (#1007) 2023-10-17 20:44:35 +08:00
Boshen
052661d75e
refactor(transform_conformance): improve report format 2023-10-17 17:41:34 +08:00
Boshen
3605f7c0fc
fix(transform_conformance): fix for codecov 2023-10-17 15:34:50 +08:00
Boshen
1b3b100475
feat(transformer_conformance): read plugins options from babel options.json (#1006)
This PR correctly handles babel `options.json` such as
https://github.com/babel/babel/blob/main/packages/babel-plugin-transform-nullish-coalescing-operator/test/fixtures/assumption-noDocumentAll/options.json
2023-10-17 14:52:51 +08:00
Boshen
678db1d955
feat(transformer): ES2020 Nullish Coalescing Operator (#1004)
The test runner needs an update for reading options.jon, which I'll work
on in the up coming PR.
2023-10-16 21:45:58 +08:00
Wenzhe Wang
0e9104477f
feat: adjust the order of print semicolon (#1003)
Add a number of semicolons to our minifier test cases.
2023-10-16 21:33:15 +08:00
Boshen
eaeb63072f
refactor(clippy): allow struct_excessive_bools 2023-10-16 15:18:07 +08:00
Boshen
c060621512
feat(transformer): add unit tests and test coverage (#1001) 2023-10-16 14:07:29 +08:00
Boshen
cc6c52e536
fix(benchmark): bench the whole transformation pipeline (#998) 2023-10-16 13:17:15 +08:00
Boshen
0f72066f2e
feat(transformer): finish 2016 exponentiation operator (#996) 2023-10-16 09:30:04 +08:00
Wenzhe Wang
6c18b3e8ec
feat(codegen): beauty class print (#995) 2023-10-15 16:37:01 +08:00
Boshen
1661385c1a
feat(semantic): check non-simple lhs expression of assignment expression (#994) 2023-10-14 23:40:10 +08:00
Boshen
801d78a3c6
refactor(minifier): make the minifier api only accept an ast (#990) 2023-10-14 00:51:29 +08:00
Boshen
f32bf27106
fix(codegen): fix some typescript codegen problems (#989) 2023-10-13 16:23:48 +08:00
Boshen
b9d0d57fa2
feat(transform_conformance): improve how snapshot is displayed 2023-10-13 13:44:45 +08:00
Boshen
a6ea901254
feat(coverage): add typescript to codegen tests (#988) 2023-10-13 13:42:54 +08:00
Boshen
e0ca09b1c9
feat(codegen): implement the basics of non-minifying codegen (#987) 2023-10-13 13:34:21 +08:00
Boshen
ce79bc12ab
feat(transform_conformance): move Formatter to codegen (#986) 2023-10-12 15:13:14 +08:00
Boshen
809f050a5f
feat(codegen): move minifying printer to codegen crate (#985) 2023-10-12 14:56:30 +08:00
Boshen
8c12dff8a3
perf: speed tasks run by using a global allocator 2023-10-11 20:30:30 +08:00
magic-akari
dc08c949a2
feat(transformer): RegexpFlags (#977)
Co-authored-by: Boshen <boshenc@gmail.com>
2023-10-11 07:15:19 -05:00
Boshen
eaa0c58e24
feat(linter): eslint-plugin-unicorn(filename-case) (#978) 2023-10-11 15:23:17 +08:00
Boshen
d5fb3d43ab
chore(coverage): remove regex-v-flag feature from parser tests (#975)
A regex parser is required to implement this.

Relates #385
2023-10-11 06:18:22 +08:00
Boshen
822f4e1468
chore: remove tasks/transform_conformance/README.md
use issue instead https://github.com/web-infra-dev/oxc/issues/974
2023-10-10 21:01:34 +08:00
Boshen
903854dac0
refactor(ast): fix the lifetime annotations around Vist and VisitMut (#973) 2023-10-10 17:05:48 +08:00
Boshen
c38a00b453
chore(minsize): disable the test as it is broken right now 2023-10-10 15:53:55 +08:00
Boshen
ef8aaa7bf1
feat(minifier): re-enable mangler (#972) 2023-10-10 14:32:58 +08:00
Wenzhe Wang
09df8e609a
feat(transform): sticky-regex (#968) 2023-10-09 19:12:14 +08:00
dependabot[bot]
4ce525c66d
chore(deps): bump the dependencies group with 4 updates (#970)
Bumps the dependencies group with 4 updates:
[num-traits](https://github.com/rust-num/num-traits),
[proc-macro2](https://github.com/dtolnay/proc-macro2),
[syn](https://github.com/dtolnay/syn) and
[similar](https://github.com/mitsuhiko/similar).

Updates `num-traits` from 0.2.16 to 0.2.17
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/rust-num/num-traits/blob/master/RELEASES.md">num-traits's
changelog</a>.</em></p>
<blockquote>
<h1>Release 0.2.17 (2023-10-07)</h1>
<ul>
<li><a
href="https://redirect.github.com/rust-num/num-traits/pull/286">Fix a
doc warning about custom classes with newer rustdoc.</a></li>
</ul>
<p><strong>Contributors</strong>: <a
href="https://github.com/robamu"><code>@​robamu</code></a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0a27d8c95a"><code>0a27d8c</code></a>
Merge <a
href="https://redirect.github.com/rust-num/num-traits/issues/289">#289</a></li>
<li><a
href="34e309a918"><code>34e309a</code></a>
Release 0.2.17</li>
<li><a
href="ef36d69f7c"><code>ef36d69</code></a>
Merge <a
href="https://redirect.github.com/rust-num/num-traits/issues/286">#286</a></li>
<li><a
href="d9d94f8a51"><code>d9d94f8</code></a>
Bugfix for text codeblock in documentation.</li>
<li>See full diff in <a
href="https://github.com/rust-num/num-traits/compare/num-traits-0.2.16...num-traits-0.2.17">compare
view</a></li>
</ul>
</details>
<br />

Updates `proc-macro2` from 1.0.67 to 1.0.69
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/proc-macro2/releases">proc-macro2's
releases</a>.</em></p>
<blockquote>
<h2>1.0.69</h2>
<ul>
<li>Fix Span::source_text() bug causing panics or incorrect source text
(<a
href="https://redirect.github.com/dtolnay/proc-macro2/issues/410">#410</a>)</li>
</ul>
<h2>1.0.68</h2>
<ul>
<li>Fix panic in Span::source_text() when source contains multibyte
characters (<a
href="https://redirect.github.com/dtolnay/proc-macro2/issues/408">#408</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="937bbcdcc1"><code>937bbcd</code></a>
Release 1.0.69</li>
<li><a
href="42dc36efce"><code>42dc36e</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/proc-macro2/issues/412">#412</a>
from dtolnay/sourcetext</li>
<li><a
href="6461c2dd60"><code>6461c2d</code></a>
Add out-of-order call to source_text test</li>
<li><a
href="c4c3251c57"><code>c4c3251</code></a>
Explain source_text implementation approach</li>
<li><a
href="31b14c30f2"><code>31b14c3</code></a>
Cache byte offsets computed from a char index</li>
<li><a
href="0e154618a1"><code>0e15461</code></a>
Make FileInfo mut in source_text to allow amortization of char
indices</li>
<li><a
href="90b8e1eb01"><code>90b8e1e</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/proc-macro2/issues/411">#411</a>
from dtolnay/sourcetext</li>
<li><a
href="137ae0a341"><code>137ae0a</code></a>
Fix source_text treating span.lo as byte offset not char index</li>
<li><a
href="4c0bd28a61"><code>4c0bd28</code></a>
Add regression test for issue 410</li>
<li><a
href="12eddc03a4"><code>12eddc0</code></a>
Reword explanation of SourceMap initial value</li>
<li>Additional commits viewable in <a
href="https://github.com/dtolnay/proc-macro2/compare/1.0.67...1.0.69">compare
view</a></li>
</ul>
</details>
<br />

Updates `syn` from 2.0.37 to 2.0.38
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/dtolnay/syn/releases">syn's
releases</a>.</em></p>
<blockquote>
<h2>2.0.38</h2>
<ul>
<li>Fix <em>&quot;method 'peek' has an incompatible type for
trait&quot;</em> error when defining <code>bool</code> as a custom
keyword (<a
href="https://redirect.github.com/dtolnay/syn/issues/1518">#1518</a>,
thanks <a
href="https://github.com/Vanille-N"><code>@​Vanille-N</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="43632bfb6c"><code>43632bf</code></a>
Release 2.0.38</li>
<li><a
href="abd2c214b4"><code>abd2c21</code></a>
Merge pull request <a
href="https://redirect.github.com/dtolnay/syn/issues/1518">#1518</a>
from Vanille-N/master</li>
<li><a
href="6701e6077e"><code>6701e60</code></a>
Absolute path to <code>bool</code> in
<code>custom_punctuation.rs</code></li>
<li><a
href="7313d24239"><code>7313d24</code></a>
Resolve single_match_else pedantic clippy lint in code generator</li>
<li><a
href="67ab64f3c0"><code>67ab64f</code></a>
Include unexpected token in the test failure message</li>
<li><a
href="137ae33486"><code>137ae33</code></a>
Check no remaining token after the first literal</li>
<li><a
href="258e9e8a11"><code>258e9e8</code></a>
Ignore single_match_else pedantic clippy lint in test</li>
<li><a
href="92fd50ee8c"><code>92fd50e</code></a>
Test docs.rs documentation build in CI</li>
<li>See full diff in <a
href="https://github.com/dtolnay/syn/compare/2.0.37...2.0.38">compare
view</a></li>
</ul>
</details>
<br />

Updates `similar` from 2.2.1 to 2.3.0
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/mitsuhiko/similar/blob/main/CHANGELOG.md">similar's
changelog</a>.</em></p>
<blockquote>
<h2>2.3.0</h2>
<ul>
<li>Added support for <code>Change::value_ref</code> and
<code>Change::value_mut</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="47f46257d4"><code>47f4625</code></a>
2.3.0</li>
<li><a
href="3319f77693"><code>3319f77</code></a>
Downgrade msrv lock file</li>
<li><a
href="d21e126057"><code>d21e126</code></a>
Use Cargo.lock.msrv</li>
<li><a
href="86f68a6394"><code>86f68a6</code></a>
Make clippy happy</li>
<li><a
href="e85ddb0d18"><code>e85ddb0</code></a>
Added value_ref and value_mut</li>
<li><a
href="de455873da"><code>de45587</code></a>
Spelling and grammar fixes (<a
href="https://redirect.github.com/mitsuhiko/similar/issues/49">#49</a>)</li>
<li><a
href="9f76d88c3d"><code>9f76d88</code></a>
fix some english things (<a
href="https://redirect.github.com/mitsuhiko/similar/issues/48">#48</a>)</li>
<li><a
href="e575b88ca1"><code>e575b88</code></a>
Update GitHub Actions CI (<a
href="https://redirect.github.com/mitsuhiko/similar/issues/47">#47</a>)</li>
<li><a
href="ae815d13ea"><code>ae815d1</code></a>
Remove mention of Hunt–McIlroy / Hunt–Szymanski</li>
<li>See full diff in <a
href="https://github.com/mitsuhiko/similar/compare/2.2.1...2.3.0">compare
view</a></li>
</ul>
</details>
<br />


Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore <dependency name> major version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's major version (unless you unignore this specific
dependency's major version or upgrade to it yourself)
- `@dependabot ignore <dependency name> minor version` will close this
group update PR and stop Dependabot creating any more for the specific
dependency's minor version (unless you unignore this specific
dependency's minor version or upgrade to it yourself)
- `@dependabot ignore <dependency name>` will close this group update PR
and stop Dependabot creating any more for the specific dependency
(unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore <dependency name>` will remove all of the ignore
conditions of the specified dependency
- `@dependabot unignore <dependency name> <ignore condition>` will
remove the ignore condition of the specified dependency and ignore
conditions


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-09 14:56:00 +08:00
Boshen
7e84369cad
refactor(resolver): move tests folder to fixtures (#964) 2023-10-08 13:29:02 +08:00
magic-akari
9ad2634091
feat(transformer): Class Static Block (#962) 2023-10-08 08:16:40 +08:00
magic-akari
21066a9ad7
feat(transformer): Shorthand Properties (#960) 2023-10-07 17:02:45 +08:00
Boshen
817f8c295e
ci: turn off doc tests because they are slow to compile and run (#961) 2023-10-07 17:01:23 +08:00
Boshen
b46f34e096
chore: bump submodules and snapshots 2023-10-06 16:15:35 +13:00
Cameron
5b1e1e5408
feat(parser): TypeScript 5.2 (#811)
- adds support for [Using
Declarations](https://devblogs.microsoft.com/typescript/announcing-typescript-5-2/#using-declarations-and-explicit-resource-management)

Closes #786
2023-10-05 12:52:14 +13:00
IWANABETHATGUY
266253c142
fix: ts parsing error (#940)
Fixed https://github.com/web-infra-dev/oxc/issues/932
2023-09-29 22:02:56 +13:00
Boshen
8553817bc9
chore(transform_conformance): update test cases and README regarding regex 2023-09-18 17:49:36 +08:00
Boshen
5973e5aede
feat(transformer): setup typescript and react transformers (#930) 2023-09-18 16:56:41 +08:00
Boshen
46d2623c1f
feat(transform_conformance): add jsx and ts tests 2023-09-18 15:35:02 +08:00
Boshen
4e036630ed
feat(transform_conformance): add all babel tests 2023-09-17 09:56:13 +08:00
Boshen
5863f8ffdb
feat(transformer): logical assignment operators (#923) 2023-09-16 23:54:53 +08:00
Boshen
1bb649243a
feat(transformer_conformance): group tests in the snapshot (#922) 2023-09-16 21:29:21 +08:00
Boshen
7172953fe9
feat(transformer_conformance): snapshot passed and failed tests (#921) 2023-09-16 20:58:31 +08:00
Boshen
8f59eb0960
chore(transformer): add feature list to README 2023-09-16 18:51:00 +08:00
Boshen
f4cea34534
feat(transformer): add babel conformance test suite (#920) 2023-09-16 18:50:51 +08:00
Boshen
540fa03ec0
feat(benchmark): add transformer benchmark (#919) 2023-09-16 17:09:27 +08:00
Boshen
ceeee5909b
Remove HIR (#917)
closes #273
closes #814

HIR is removed from this PR, with the minifier being commented out.

HIR is a wonderful idea for compiling to lower languages, but after
sitting on it for a few months I found that it only adds confusion and
uncertainties to both myself and future contributors.

It also adds too much burden to maintainers if we plan to support more
downstream tools.

1 AST is the only way.
2023-09-15 23:48:32 +08:00
Don Isaac
027a67d94c
feat(minifier): constant addition expression folding (#882)
Fold constant addition expressions. Handles string concatenation and
addition, both with implicit casting.

For example,
```ts
let x = 1 + 1
let y = "hello " + "world"
```
now becomes
```ts
let x = 2
let y = "hello world"
```

## Extra Goodies
- test(minifier): add `test_snapshot` helper to perform snapshot tests
with `insta`
- up(hir): implement `std::ops::Add` for `NumericValue`
- up(span): impl `TryFrom<Cow<'_, &str>>` for `Atom`
2023-09-11 10:38:35 +08:00
Boshen
a9d36f158f
chore(benchmark): turn on all lints (#892)
closes #888
2023-09-10 23:16:39 +08:00
Boshen
9ff12a9696
feat(linter): eslint-plugin-import/no-self-import (#878)
closes #440 #441
2023-09-10 00:12:26 +08:00