Commit Graph

58 Commits

Author SHA1 Message Date
Justin Ridgewell
990e48e0e8
fix(es/compat): Fix optional chaining (#7530)
**Description:**

This fixes a few bugs with optional chaining:

-
[`a?.c()`](https://play.swc.rs/?version=1.3.64&code=H4sIAAAAAAAAA9PXVwjOyC%2FNSVFISrXi0tdXSFSwtVXIK83JUbBXKM1LSU3LzEtNUbBSSNRL1tC05kq0h9AAouc%2F7DgAAAA%3D&config=H4sIAAAAAAAAA2VSu27DMAzc8xUC5wAZii7ZWnRJgXTKDxAKkyrQwyDpNEbgf69kxI4jexAk3olH3fm%2BMgYoXsFszT3vywchHQm2pa7cwXos28T0LRl4m0qnxJY%2BvD8wRsmHUGDllibGsYsYnN2FJrHWoCKfScudUbsv2LDARewEgI4CM24uezqj7b4oj4aauOpf5EdoT4pHVFxSmNDqS1tjNhvDbVQXKNuAraaA6iysC5DYWI8izs4uwIMOC%2F6cpL%2Bc%2FnanHwwkDVpaDJM5rdBn67y6WHv5eNCVfGpCzibDJ%2FQyw%2Fv1qtqAT0lqHWiQhfjVSumi4m2I3QYUy65RmNl0kdtS8OlvPWxfhTw0lnd45pv%2FstbTLOKuGeyzKYQULwIT08l%2B5BaJVf8PfP2zz7YCAAA%3D)
-
[`a?.b.c()`](https://play.swc.rs/?version=1.3.64&code=H4sIAAAAAAAAA9PXVwjOyC%2FNSVFISrXi0tdXSFSwtVXIK83JUbBXKM1LSU3LzEtNUbBSSNRL0kvW0LTmSrSHsQBsP8xLPAAAAA%3D%3D&config=H4sIAAAAAAAAA2VSu27DMAzc8xUC5wAZii7ZWnRJgXTKDxAKkyrQwyDpNEbgf69kxI4jexAk3olH3fm%2BMgYoXsFszT3vywchHQm2pa7cwXos28T0LRl4m0qnxJY%2BvD8wRsmHUGDllibGsYsYnN2FJrHWoCKfScudUbsv2LDARewEgI4CM24uezqj7b4oj4aauOpf5EdoT4pHVFxSmNDqS1tjNhvDbVQXKNuAraaA6iysC5DYWI8izs4uwIMOC%2F6cpL%2Bc%2FnanHw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8wRsmHUGDllibGsYsYnN2FJrHWoCKfScudUbsv2LDARewEgI4CM24uezqj7b4oj4aauOpf5EdoT4pHVFxSmNDqS1tjNhvDbVQXKNuAraaA6iysC5DYWI8izs4uwIMOC%2F6cpL%2Bc%2FnanHwwkDVpaDJM5rdBn67y6WHv5eNCVfGpCzibDJ%2FQyw%2Fv1qtqAT0lqHWiQhfjVSumi4m2I3QYUy65RmNl0kdtS8OlvPWxfhTw0lnd45pv%2FstbTLOKuGeyzKYQULwIT08l%2B5BaJVf8PfP2zz7YCAAA%3D)
-
[`a?.b[c?.d]`](https://play.swc.rs/?version=1.3.64&code=H4sIAAAAAAAAA9PXVwjOyC%2FNSVFISrXi0tdX0IhPVLBVSNRUsLVVyCvNyVGwVyjLz0xRMFCwUohP1EuK1ohPBipIxq4gWS8l1por0R6oLtkezAYAJs%2FWxmEAAAA%3D&config=H4sIAAAAAAAAA2VSu27DMAzc8xUC5wAZii7ZWnRJgXTKDxAKkyrQwyDpNEbgf69kxI4jexAk3olH3fm%2BMgYoXsFszT3vywchHQm2pa7cwXos28T0LRl4m0qnxJY%2BvD8wRsmHUGDllibGsYsYnN2FJrHWoCKfScudUbsv2LDARewEgI4CM24uezqj7b4oj4aauOpf5EdoT4pHVFxSmNDqS1tjNhvDbVQXKNuAraaA6iysC5DYWI8izs4uwIMOC%2F6cpL%2Bc%2FnanHwwkDVpaDJM5rdBn67y6WHv5eNCVfGpCzibDJ%2FQyw%2Fv1qtqAT0lqHWiQhfjVSumi4m2I3QYUy65RmNl0kdtS8OlvPWxfhTw0lnd45pv%2FstbTLOKuGeyzKYQULwIT08l%2B5BaJVf8PfP2zz7YCAAA%3D)
- [`delete
foo?.bar`](https://play.swc.rs/?version=1.3.64&code=H4sIAAAAAAAAA9PXVwjOyC%2FNSVFISrXi0tdXSMvPV7C1VcgrzclRsFcoKSpNVbBSSEnNSS1JBcnpJSUWcSG49iA%2BAGcLTstEAAAA&config=H4sIAAAAAAAAA1WPSw7CMAxE9zlF5DULYIEEd%2BAQVnCrVPkpTiWqqncnTZMAO3vG42evQkqYWMFDrrnMTcDIFHufFV5cwndWgJRFVlGHBKfmTrxbAxqmIm2HAwnjSKmk%2BHq%2B3GsCjPdMWU5xpipZ7fSw%2FCKVtyESc9vcaRbdaOgfKCoUrH%2FNxayvpCXQccANvkMN1heD5mdL7leJ7QOQNa2NFgEAAA%3D%3D)
- [`function foo(a, b = a?.b)
{}`](https://play.swc.rs/?version=1.3.64&code=H4sIAAAAAAAAA9PXVwjOyC%2FNSVFISrXi0tdXSCvNSy7JzM9TSMvP10jUUUhSsFXQ0NBUsLVTqFYoSyxSiE%2B0VnjUsEyhVlNDU1OhupYLm45Ee70kkCQAp8DQOl8AAAA%3D&config=H4sIAAAAAAAAA22Rz07DMAzG73uKyOdJAw5I7Ii4cBjvYKXuyJQ%2Fle3AqmnvTltIm63cHH%2B%2F%2BPtkXzbGwEks7M1lKIeHMkZpE4e5NbU9HdH2b2QToyYeROVM2wVoinQgxQYV1wgTWr0Za8xuZzhHdYH2BjBrCqjOwnYUEhvrUcTZ6gP84bDia0g%2FOX2%2Ftx8YSDq0tAozMFnoNTuvLsp%2FckNf5FMXKI6ZW%2FRS6ddSzgX4lOTeBzpkIb5dpfRR8TzmJxtQLLtOoVrTSc5rw2W%2F92GXBIp8JJ0Gy9PD48s0dJIhpCZ7qq7cd%2FQLPsMMOTkUrBhAcNG1fcmzuf4AkV7gUzECAAA%3D)

It also optimizes the AST for runtime evaluation. Before, we constructed
a leftwards conditional tree (`(_a_b = (_a = a) == null ? void 0 : _a.b)
== null ? void 0 : _a_b.c`) instead of a rightward tree (`(_a = a) ==
null ? void 0 : (_a_b = _a.b) == null ? void 0 : _a_b.c`), which
required multiple `== null` checks after the first nullish is found.

**Related issue:**

 - Closes #7531.
2023-06-19 12:00:11 +09:00
Donny/강동윤
e15adaf6ea
chore(es/preset-env): Update data (#7459) 2023-05-28 13:27:38 +00:00
OJ Kwon
bba1fad35c
feat(plugin): Add versioned wrapper struct (#7382) 2023-05-15 03:17:31 +00:00
Donny/강동윤
695ce060e9
test(es/plugin): Enable E2E test again (#7236) 2023-04-10 07:01:56 +00:00
Niklas Mischkulnig
e86d59882a
fix(bindings/node): Make peer dependency of helpers optional (#7216)
**Description:**

Mark the `@swc/helpers` dependency of `@swc/core` as optional.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/7212.
2023-04-06 14:28:08 +09:00
Donny/강동윤
9ae13a1d9e
chore: Publish v1.3.46 with fixed peerDependency (#7206) 2023-04-04 19:27:43 +09:00
magic-akari
3ca954b9f9
fix(es/helpers): Use snake_case for helpers (#7147)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/7144.
 - Closes https://github.com/swc-project/swc/issues/7118.
2023-03-31 15:15:21 +09:00
Donny/강동윤
a785f18740
test(es/plugin): Enable E2E plugin test (#7178) 2023-03-31 04:01:17 +00:00
Donny/강동윤
7e6e7b107e
chore(ci): Fix publish action (#6757)
Co-authored-by: LongYinan <lynweklm@gmail.com>
2023-01-06 08:43:32 +09:00
OJ Kwon
30dd65bb83
feat(bindings): Remove swcx from @swc/core (#6720) 2022-12-30 06:31:57 +00:00
LongYinan
e7849dbc6a
build(bindings): Crash in GraalVM (#6689) 2022-12-20 07:03:41 +00:00
Donny/강동윤
85875897f1
chore(ci): Fix CI (#6558) 2022-12-01 04:21:19 +00:00
Donny/강동윤
ae6322064d
feat(es/preset-env): Update data (#6538) 2022-11-30 04:27:59 +00:00
OJ Kwon
8ca3cc7875
chore(ci): Ensure to honor node package manager (#6437) 2022-11-15 00:52:44 +00:00
Donny/강동윤
13b4d317a5 chore(ci): Fix publish action 2022-11-03 12:04:13 +09:00
Vincent Ricard
205a317c4d
feat(css/minifier): Compute calc expressions (#5966) 2022-10-12 10:03:14 +00:00
Donny/강동윤
fee747de59 chore(ci): Fix publish action by reverting #5969 2022-10-06 16:36:01 +09:00
OJ Kwon
ca38a7027e
test(es/plugin): Reenable compat test (#5969) 2022-09-28 10:54:51 +09:00
Donny/강동윤
88e59ffcda
perf(css/minifier): Setup benchmark (#5800)
**Description:**

I created a simple benchmark for the css minifier. It's full benchmark, which also profiles parser and codegen
2022-09-10 13:39:55 +09:00
Donny/강동윤
32a73fbf22
fix(es/minifier): Fix calculation of character frequency (#5772) 2022-09-07 04:46:21 +00:00
OJ Kwon
81ab8a29e3
test(es/plugin): Add E2E test for the published plugins (#5771) 2022-09-07 02:05:42 +00:00
Donny/강동윤
60ce462215
feat(es/minifier): Align name mangler with terser (#5763) 2022-09-06 21:37:58 +09:00
Donny/강동윤
b378c06081
perf(es/minifier): Make name mangler faster (#5336) 2022-07-29 08:05:23 +00:00
OJ Kwon
add1b75f61
test(es): Update test cases (#5334) 2022-07-29 11:02:10 +09:00
Donny/강동윤
14894ed4c9
fix(atoms): Workaround a bug of rkyv (#5323) 2022-07-28 11:41:15 +09:00
OJ Kwon
27c6f2318a
test(swc): Update test cases (#5324) 2022-07-28 00:33:24 +00:00
Donny/강동윤
568aca4fed chore: Publish v1.2.219 2022-07-27 14:45:02 +09:00
Austaras
dd0a152f49
fix(es/preset-env): Realign with babel-polyfills (#5293) 2022-07-26 12:16:16 +00:00
OJ Kwon
b7c7e3afb0
test(es/plugin): Test plugins with different schema versions (#5255) 2022-07-20 04:08:48 +00:00
OJ Kwon
2fa51ecd78
test(plugin): Setup e2e fixture testing for plugins (#5192) 2022-07-13 06:39:08 +00:00
Donny/강동윤
364a34cd70
test(html): Remove files which are too large too verify (#4983) 2022-06-16 09:33:21 +00:00
LongYinan
52e23470e7
fix(ci): Fix android build issue caused by NDK 21 -> 23 (#4942) 2022-06-11 18:09:07 +09:00
Donny/강동윤
78d4c2c46a
fix(preset-env): Ignore unknown versions (#4809) 2022-05-26 15:32:06 +00:00
Donny/강동윤
b8d2fb8546
feat(es/helpers): Import only used helpers (#4767) 2022-05-24 04:09:59 +00:00
Donny/강동윤
c01476d9ae
feat(es/minifier): Enable conditionals by default (#4687) 2022-05-17 07:34:47 +00:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
LongYinan
3d5c0fa966
fix(node): Fix tls allocation issue (#4514) 2022-05-04 10:04:48 +00:00
Donny/강동윤
f30ffdf200
fix(es/decorators): Make legacy decorator identical to tsc (#4496) 2022-05-03 07:48:09 +00:00
Donny/강동윤
5c5337d342
feat(es/preset-env): Update data (#4497) 2022-05-02 06:43:36 +00:00
Donny/강동윤
0bc0bae90d
fix(es/async-generator): Fix yield* in async generators (#4452) 2022-04-28 04:14:17 +00:00
Donny/강동윤
0245e26af5
fix(es/codegen): Fix overflow of numeric literals (#4321) 2022-04-13 10:16:51 +00:00
Donny/강동윤
1d3763d96c
feat(es/minifier): Implement some unsafe evaluation rules (#4133) 2022-03-23 22:56:13 +00:00
LongYinan
db9b988845
feat(node-swc): Add libc field in Linux platform packages (#4046) 2022-03-16 18:58:24 +09:00
OJ Kwon
dab2002a2e
refactor(plugin/runner): Split modules and introduce feature flags (#4035) 2022-03-15 22:45:40 +00:00
LongYinan
1206c84e19
feat(*): Update dependencies (#3964) 2022-03-11 23:00:55 +09:00
Austaras
487273fc5b
fix(preset-env): Use core-js-compat and @babel/compat-data directly (#3968) 2022-03-11 12:49:53 +00:00
Donny/강동윤
12e52e171d chore: Publish v1.2.138 2022-02-09 02:10:54 +09:00
Donny/강동윤
8b7c38c80c
test(es): Update tsc test suite (#3448) 2022-02-04 17:08:38 +09:00
LongYinan
9608605772
build(node-swc): Fix GLIBC < 2.18 compatible issues and android arm binary loading issue (#3314) 2022-01-20 02:21:24 +00:00
LongYinan
206da128a1
feat(node): Upgrade napi to v2 (#2958) 2021-12-24 02:21:24 +00:00