Commit Graph

529 Commits

Author SHA1 Message Date
Donny/강동윤
a6f6799811
feat(es/minifier): Evaluate trivial expressions (#4179) 2022-03-29 01:46:09 +00:00
SWC Bot
6125de9808 chore: Publish crates 2022-03-28 12:20:51 +00:00
SWC Bot
13e7b4f92a chore: Publish crates 2022-03-28 09:16:49 +00:00
Donny/강동윤
6f25e5774b
feat(es/minifier): Implement more rules for dropping unused assignemnts (#4171) 2022-03-28 09:14:16 +00:00
RiESAEX
ea0de90137
fix(es/codegen): Emit sourcemap of key-value properties correctly (#4166) 2022-03-27 14:26:53 +09:00
Donny/강동윤
32c2de1181 chore: Publish crates 2022-03-25 21:15:57 +09:00
SWC Bot
1a3ed8e625 chore: Publish crates 2022-03-25 12:10:43 +00:00
Donny/강동윤
b37dafbd27
feat(es/minifier): Implement rules for optimizing loops (#4157) 2022-03-25 12:08:14 +00:00
Donny/강동윤
97dfcb9ccb
chore(es/minifier): Add logging (#4156) 2022-03-25 06:44:07 +00:00
Donny/강동윤
e6088408bf chore: Publish crates 2022-03-24 12:05:47 +09:00
SWC Bot
4e07a29112 chore: Publish crates 2022-03-24 00:51:52 +00:00
Donny/강동윤
ee5c48c935
feat(es/minifier): Implement more rules for optimizing for-if-break (#4140) 2022-03-24 00:49:32 +00:00
SWC Bot
3c4c3a6087 chore: Publish crates 2022-03-23 22:58:33 +00:00
Donny/강동윤
1d3763d96c
feat(es/minifier): Implement some unsafe evaluation rules (#4133) 2022-03-23 22:56:13 +00:00
Alexander Akait
48f3dc8cc4
feat(es/codegen): Compress \t in string literals more (#4131) 2022-03-23 21:37:03 +00:00
magic-akari
bf1924d1a8
feat(es/typescript): Support optional variance annotations (#4008) 2022-03-23 14:36:37 +00:00
Alexander Akait
f5a5217506
fix(es/codegen): Fix codegen of template literals (#4124) 2022-03-23 12:39:47 +00:00
Donny/강동윤
13b2f38cdd
fix(es/typescript): Collect all bindings in strip (#4118) 2022-03-22 10:03:58 +00:00
SWC Bot
77722c4943 chore: Publish crates 2022-03-22 08:03:01 +00:00
Alexander Akait
634d732803
feat(es/ast): Add raw to Str (#4071) 2022-03-22 07:54:08 +00:00
SWC Bot
5b6b9c0a25 chore: Publish crates 2022-03-22 06:27:29 +00:00
Donny/강동윤
4a9817f003
fix(es/minifier): Consider side effects while lifting sequences (#4116) 2022-03-22 06:25:19 +00:00
SWC Bot
bba8e6be67 chore: Publish crates 2022-03-21 11:13:26 +00:00
Donny/강동윤
c6f8742669 feat(es/minifier): Implement more evaluation rules (#4030) 2022-03-21 20:07:59 +09:00
SWC Bot
e7d450c8af chore: Publish crates 2022-03-19 07:07:31 +00:00
SWC Bot
a74d4ca679 chore: Publish crates 2022-03-17 10:29:25 +00:00
SWC Bot
4d6d766cf8 chore: Publish crates 2022-03-17 05:36:01 +00:00
Alexander Akait
bd444c0ceb
fix(es/codegen): Fix codegen of string literals (#4037) 2022-03-16 14:25:26 +00:00
LongYinan
db9b988845
feat(node-swc): Add libc field in Linux platform packages (#4046) 2022-03-16 18:58:24 +09:00
SWC Bot
8eb9476cfb chore: Publish crates 2022-03-16 08:13:01 +00:00
SWC Bot
531762ae71 chore: Publish crates 2022-03-15 08:45:12 +00:00
Donny/강동윤
3173047f58
refactor(es/minifier): Cleanup (#4020)
**Description:**

 - `Optimizer.data`: `Option<ProgramData>` => `ProgramData`.
 - `Optimizer.done`: Remvoed.
 - `Optimzer.done_ctxt`: Removed.
 - `Pure`: Add `data: Option<&'a ProgramData>`.
2022-03-15 08:42:50 +00:00
Donny/강동윤
be09ea6991
feat(es/minifier): Drop noop calls (#4019) 2022-03-15 16:23:32 +09:00
Donny/강동윤
38c0c0faa6 chore: Publish crates 2022-03-14 04:11:07 +09:00
SWC Bot
386456f48a chore: Publish crates 2022-03-13 09:13:23 +00:00
Donny/강동윤
a23af2dea2
feat(es/minifier): Compress more comparisons (#3996) 2022-03-13 09:11:16 +00:00
SWC Bot
ad3115fa2f chore: Publish crates 2022-03-13 03:29:32 +00:00
Donny/강동윤
64ca5bae4d
feat(es/minifier): Implement more rules for arrows (#3992) 2022-03-13 03:27:15 +00:00
SWC Bot
d9db2faded chore: Publish crates 2022-03-13 02:59:56 +00:00
Donny/강동윤
f7b212bfc4
perf(es/minifier): Use Vec<u8> as a buffer for base54 (#3993)
Description:
We are only using ASCII characters so we can avoid utf8 logics by using `Vec<u8>` as a buffer and converting it into `String` at the end.
2022-03-13 02:57:47 +00:00
SWC Bot
2a6106f0b7 chore: Publish crates 2022-03-12 15:38:49 +00:00
magic-akari
04db7e2a9b
perf(es/minifier): Refactor base54 (#3989) 2022-03-12 15:36:42 +00:00
Donny/강동윤
1beecceead
perf(es/minifier): Merge hashmap for scoping before checking (#3988)
Currently, we check for child scopes by doing a recursive call, like 2ad0d801a2/crates/swc_ecma_minifier/src/pass/mangle_names/analyzer/scope.rs (L112-L114)

But this is slow because it results in an enormous amount of calls.

We can optimize this by merging information of child scopes beforehand.
2022-03-12 20:06:59 +09:00
SWC Bot
fb421b8cc3 chore: Publish crates 2022-03-12 06:47:29 +00:00
Donny/강동윤
67e615421f
perf(es/minifier): Use fxhash for integers (#3984)
Description:
 - `Id` is treated as integer, as `JsWord` and `SyntaxContext` are both integer.
2022-03-12 06:45:35 +00:00
SWC Bot
c6ddb5fcf5 chore: Publish crates 2022-03-12 06:17:50 +00:00
Donny/강동윤
107c91dd20
perf(es/minifier): Make mangler faster by merging hash sets into one (#3983) 2022-03-12 06:16:02 +00:00
Donny/강동윤
ddfa490899 chore: Publish crates 2022-03-12 10:00:23 +09:00
LongYinan
1206c84e19
feat(*): Update dependencies (#3964) 2022-03-11 23:00:55 +09:00
Donny/강동윤
76e646804a
fix(es/parser): Parse if-else chain iteratively (#3961) 2022-03-11 09:10:54 +00:00
SWC Bot
8bb74b6093 chore: Publish crates 2022-03-10 15:23:12 +00:00
underfin
91a302a672
fix(es/minifier): Preserve fuction parameters used for template literals in evaluate and reduce_vars (#3949) 2022-03-10 15:21:06 +00:00
SWC Bot
666f55e01c chore: Publish crates 2022-03-10 07:48:19 +00:00
SWC Bot
41573530c2 chore: Publish crates 2022-03-10 06:21:09 +00:00
underfin
cc564ff6c5
fix(es/minifier): Skip exported vars while collapsing vars (#3928) 2022-03-10 06:19:25 +00:00
SWC Bot
ce57482ac8 chore: Publish crates 2022-03-10 05:57:55 +00:00
Donny/강동윤
f1ec8620ac
perf(es/minifier): Make optimization of pure calls parallel (#3938) 2022-03-10 05:56:02 +00:00
OJ Kwon
86ea23785d
perf(*): Update tracing to improve performance of disabled spans (#3932) 2022-03-10 03:15:49 +00:00
SWC Bot
99f381cfa2 chore: Publish crates 2022-03-09 15:44:57 +00:00
Donny/강동윤
9e4dea6663
feat(es/minifier): Improve dropping of unused vars (#3923) 2022-03-09 15:43:01 +00:00
SWC Bot
56b646cc1a chore: Publish crates 2022-03-09 12:04:50 +00:00
Austaras
bd838ac5a9
feat(es/minifier): Remove pure calls (#3925) 2022-03-09 11:55:31 +00:00
Austaras
7cfa930a62
feat(es/fixer): Remove extra parens around IIFE in statements (#3918) 2022-03-08 14:35:18 +00:00
SWC Bot
4c8e747c5c chore: Publish crates 2022-03-08 10:06:14 +00:00
Donny/강동윤
8b3aa6d3aa
perf(es/minifier): Remove needless type parameter (#3897) 2022-03-08 10:04:14 +00:00
SWC Bot
c7d21da458 chore: Publish crates 2022-03-07 05:25:26 +00:00
Donny/강동윤
a47eed7241
perf(es/minifier): Add a fast-path to export merger (#3891) 2022-03-07 14:21:57 +09:00
Austaras
9dd0105c5b
feat(es/fixer): Remove extra parens around iife in expression position (#3887) 2022-03-07 03:51:57 +00:00
SWC Bot
04d77cab2f chore: Publish crates 2022-03-05 20:20:43 +00:00
Donny/강동윤
a2643608a7
feat(es/minifier): Implement pure_getters partially (#3872) 2022-03-05 20:18:52 +00:00
SWC Bot
fd453b9170 chore: Publish crates 2022-03-05 19:34:45 +00:00
SWC Bot
2fdc5f625d chore: Publish crates 2022-03-05 14:52:49 +00:00
Donny/강동윤
44262508c6
fix(es/parser): Use unicode id instead of xid (#3867) 2022-03-05 12:24:45 +00:00
SWC Bot
81b2e6153e chore: Publish crates 2022-03-05 10:03:49 +00:00
Donny/강동윤
e70c9d8f22
fix(es/minifier): Don't remove comments if compress is not configured (#3866) 2022-03-05 10:01:55 +00:00
SWC Bot
3de647a50a chore: Publish crates 2022-03-05 07:58:10 +00:00
SWC Bot
add86a7e6a chore: Publish crates 2022-03-05 06:48:00 +00:00
SWC Bot
db2a05fa55 chore: Publish crates 2022-03-04 02:11:24 +00:00
Donny/강동윤
260c2a885e
feat(es/minifier): Implement more rules (#3841)
swc_ecma_minifier:
 - `conditionals`: Preserve a conditional expression if test is not resolved.
 - `unsafe_arrows`: Optimize an anonymous function expression as an arrow expression.
 - `unsafe_methods`: Optimize a method property where the only statement is return to an arrow expression.
2022-03-04 02:09:15 +00:00
SWC Bot
8c5067f510 chore: Publish crates 2022-03-03 22:01:08 +00:00
Donny/강동윤
0fc819e2ef
fix(es/minifier): Support declaring multiple bindings with the same name (#3837) 2022-03-04 06:58:39 +09:00
SWC Bot
5f8f114b62 chore: Publish crates 2022-03-04 05:26:32 +09:00
SWC Bot
b9756596ae chore: Publish crates 2022-03-03 19:20:31 +00:00
Donny/강동윤
364532e9a7
feat(es/minifier): Improve sequential inlining (#3820) 2022-03-03 19:18:43 +00:00
SWC Bot
4a38e93efc chore: Publish crates 2022-03-03 16:37:49 +00:00
Donny/강동윤
efc67417a5
feat(config): Add a dedicated cached regex (#3832) 2022-03-03 16:35:41 +00:00
Donny/강동윤
351b814ed0
perf(es): Use Mutex from parking_lot (#3830) 2022-03-03 14:26:49 +00:00
Donny/강동윤
043fba274e
fix(es/hygiene): Fix renaming bugs (#3824) 2022-03-03 06:21:13 +00:00
Donny/강동윤
8a468f7544
fix(es/minifier): Don't reorder unnecessarily (#3817) 2022-03-02 08:57:50 +00:00
SWC Bot
6ba3c1bf3b chore: Publish crates 2022-03-02 07:15:46 +00:00
Donny/강동윤
89388e6ac3
fix(es/minifier): Preserve more variables (#3805) 2022-03-02 07:13:57 +00:00
SWC Bot
5667316f12 chore: Publish crates 2022-03-02 06:48:09 +00:00
Donny/강동윤
789eb7baa9
feat(es/minifier): Drop more function parameters in strict mode (#3814) 2022-03-02 06:41:11 +00:00
Austaras
e1b13eb21a
feat(es/codegen): Optimize output of new expressions without arguments (#3800) 2022-03-01 10:55:49 +00:00
SWC Bot
1a79eb984e chore: Publish crates 2022-03-01 09:58:04 +00:00
Donny/강동윤
8beaa202e2
fix(es/minifier): Fix optimizations of terminating expressions (#3794) 2022-03-01 09:55:45 +00:00
SWC Bot
bfc31c4bd1 chore: Publish crates 2022-02-28 16:33:26 +00:00
Donny/강동윤
73cab638a1
fix(es/minifier): Preserve unresolved references (#3780)
swc_ecma_minifier:
 - `pure`: Add an optional list of bindings.
 - `pure`: Drop identifier only if we have the complete list of bindings.
 - `pure`: Allow using `GLOBALS`.
 - `pure`: Drop some pure member expressions.
 - Move identifier dropping logic from the stateful optimizer to the pure optimizer.
 - `pure`: Drop more references to global declarations.
2022-02-28 16:31:13 +00:00
SWC Bot
a26edd2b0f chore: Publish crates 2022-02-28 13:53:22 +00:00
Donny/강동윤
86072b57f9
test(es/minifier): Prepare porting more rules from terser (#3779) 2022-02-28 13:49:10 +00:00
SWC Bot
1d0c5f600b chore: Publish crates 2022-02-28 13:01:51 +00:00
Donny/강동윤
714e05e553
feat(es/minifier): Consider arguments while dropping unused assignments (#3775)
swc_ecma_minifier:
 - `analyze`: Track usage of `arguments`.
2022-02-28 21:57:09 +09:00
SWC Bot
ca10ae1cd7 chore: Publish crates 2022-02-28 12:09:30 +00:00
Donny/강동윤
cfc036381a
fix(es/minifier): Fix inlining logic (#3776)
swc_ecma_minifier:
 - Make `inline_vars_in_node` use `MultiReplacer`.
2022-02-28 12:07:12 +00:00
SWC Bot
ba3fdad025 chore: Publish crates 2022-02-28 07:43:17 +00:00
Donny/강동윤
e7f7f69db4
fix(es/minifier): Disable some operations for asm.js codes (#3572) 2022-02-28 07:40:04 +00:00
Donny/강동윤
3798436201
chore: Update rustc (#3768) 2022-02-28 16:12:28 +09:00
SWC Bot
4fe874dd77 chore: Publish crates 2022-02-26 15:11:21 +00:00
Donny/강동윤
3d944656bf
refactor(es): Make compilation faster (#3749) 2022-02-26 06:41:14 +00:00
SWC Bot
2ab150c603 chore: Publish crates 2022-02-26 12:11:27 +09:00
Donny/강동윤
47ccff8a7c
feat(es/parser): Provide more api for reducing binary size (#3747) 2022-02-26 09:29:05 +09:00
SWC Bot
9a4e961b2b chore: Publish crates 2022-02-25 19:50:18 +00:00
SWC Bot
8f1aef47d4 chore: Publish crates 2022-02-25 06:10:45 +00:00
OJ Kwon
a454996314
feat(node-swc): Add experimental trace support in @swc/core (#3731) 2022-02-25 04:06:45 +00:00
SWC Bot
8c94ea9fc5 chore: Publish crates 2022-02-24 09:22:18 +00:00
Donny/강동윤
e35d73adf4
chore(clippy): Improve config (#3691) 2022-02-23 06:07:42 +00:00
SWC Bot
e4c674b9cb chore: Publish crates 2022-02-21 13:10:43 +00:00
SWC Bot
e08a2c2c17 chore: Publish crates 2022-02-21 07:15:09 +00:00
Austaras
2cb66ae075
refactor(es/ast): Change definition of optional chaining expressions (#3645) 2022-02-21 07:12:09 +00:00
SWC Bot
bea6810c08 chore: Publish crates 2022-02-21 05:36:52 +00:00
Donny/강동윤
da2c77d9af
perf(es/minifier): Parallelize join_vars (#3655) 2022-02-21 05:34:32 +00:00
SWC Bot
073ecb560c chore: Publish crates 2022-02-21 04:38:23 +00:00
Donny/강동윤
de6effc6e1
feat(es/minifier): Drop more unused vars (#3656) 2022-02-21 04:35:56 +00:00
SWC Bot
264f1cf8d6 chore: Publish crates 2022-02-20 15:53:48 +00:00
SWC Bot
4bd855274a chore: Publish crates 2022-02-20 12:10:24 +00:00
Donny/강동윤
e9fabd61e8
feat(es/minifier): Improve name mangler (#3638) 2022-02-20 12:08:26 +00:00
SWC Bot
18ae83d853 chore: Publish crates 2022-02-20 10:47:59 +00:00
Donny/강동윤
10adf1e548
feat(es/minifier): Merge exports (#3643) 2022-02-20 10:44:21 +00:00
SWC Bot
e668ff08a5 chore: Publish crates 2022-02-19 19:41:18 +09:00
Donny/강동윤
fd0e952aec
perf(es/minifier): Fix performance bug of the mangler (#3633)
swc_ecma_minifier:
 - Use a bi-directional hashmap instead of iterating all keys.
2022-02-19 10:31:54 +00:00
SWC Bot
144b2c9f9f chore: Publish crates 2022-02-19 08:42:02 +00:00
Donny/강동윤
d2c94416a8
feat(es/minifier): Treat !0 as a literal while inlining (#3631) 2022-02-19 17:33:36 +09:00
SWC Bot
a5b3dd815b chore: Publish crates 2022-02-15 16:30:56 +09:00
Donny/강동윤
bfc9897e34
fix(es/minifier): Disable name mangler if eval is used (#3526) 2022-02-15 07:29:45 +00:00
SWC Bot
7351ec2477 chore: Publish crates 2022-02-15 13:22:16 +09:00
OJ Kwon
ad6f24ad83
build(*): Dedupe once_cell (#3567) 2022-02-15 11:58:44 +09:00
SWC Bot
23544925e5 chore: Publish crates 2022-02-14 15:47:54 +09:00
Donny/강동윤
ac1d4058f2
fix(es/minifier): Fix analyzer (#3557)
swc_ecma_utils:
 - `collect_decls`: Support paramters of arrow expressions.

swc_ecma_minifier:
 - `analyzer`: Fix `has_property_mutation`.
2022-02-14 15:47:16 +09:00
Donny/강동윤
73e9185bba
test(es/minifier): Add snapshot testing for the analyzer (#3529) 2022-02-11 18:33:08 +09:00
SWC Bot
0780d892b3 chore: Publish crates 2022-02-11 17:46:34 +09:00
Donny/강동윤
a7f0e84bbf
feat(es/minifier): Drop useless assignments (#3528)
testing:
 - Allow skipping diff using an environment variable `DIFF`.

swc_ecma_minifier:
 - `pure`: Drop useless assignemnts.
2022-02-11 08:43:48 +00:00
SWC Bot
d065cb15bf chore: Publish crates 2022-02-10 21:27:43 +09:00
Donny/강동윤
8dab3d92b1
perf(es/minifier): Remove useless operations like eager call to .span() (#3512)
swc_ecma_minifier:
 - Merge variable for inlining.
 - Remove useless call to `.span()`.
2022-02-10 12:00:41 +00:00
SWC Bot
69181e822c chore: Publish crates 2022-02-10 13:55:12 +09:00
William Tetlow
5488159ba5
feat(es/minifier): Implement reserved mangle option (#3476) 2022-02-10 13:53:47 +09:00
Donny/강동윤
9b76783281
refactor(common): Cleanup & rustfmt (#3495)
swc_common:
 - Merge identical source codes.

swc_css_parser:
 - Deny `clippy::all`.
 - Fix lints.
2022-02-09 06:33:32 +00:00
Donny/강동윤
5e82640b42 chore: Publish crates 2022-02-09 13:57:21 +09:00
Donny/강동윤
8bf5cf4d03
chore(es): Fix clippy warnings (#3482) 2022-02-08 19:50:22 +09:00
Donny/강동윤
180bb86e8c chore: Publish crates 2022-02-08 19:10:54 +09:00
Donny/강동윤
292add7d26
fix(es/minifier): Make sequences less aggressive (#3480)
swc_ecma_minifier:
 - `sequences`: Abort on RHS contains the left id.
2022-02-08 19:10:22 +09:00
Donny/강동윤
0ff58d83c6 chore: Publish crates 2022-02-07 13:43:30 +09:00
Donny/강동윤
0371c41b7c
fix(es/minifier): Fix mapbox (#3463)
swc_ecma_minifier:
 - `mangler`: Handle the identifiers of class expressions correctly.
2022-02-07 13:43:00 +09:00
Donny/강동윤
f1f9c1ce4d chore: Publish crates 2022-02-07 11:12:21 +09:00
Donny/강동윤
5812c3c10f
fix(es/minifier): Fix codemirror (#3462)
swc_ecma_minifier:
 - Mark for in/of loops as executed multiple times.
 - Check captured identifiers while invoking IIFE.
2022-02-07 11:11:53 +09:00
Donny/강동윤
19e7c70bd7 chore: Publish crates 2022-02-04 13:21:41 +09:00
Alexander Akait
e8b64a9871
feat(es/codegen): Improve compression of numbers (#3425) 2022-02-03 13:04:32 +09:00
Donny
0e7d525352 chore: Publish crates 2022-01-28 16:09:16 +09:00
Donny/강동윤
91d78000ea
feat(es/minifier): Implement drop_console (#3392)
swc_ecma_minifier:
 - Merge `drop_console` into pure optimizer.
 - Implement `drop_console`. (Closes #2321)
2022-01-28 16:08:41 +09:00
Donny
6690354f79 chore: Publish crates 2022-01-28 13:43:58 +09:00
Donny/강동윤
38c2499358
fix(es/minifier): Fix evaluator (#3391) 2022-01-28 13:43:29 +09:00
Donny/강동윤
7ef3bfa5b6
refactor(es/minifier): Merge execution tests into a file to make git faster (#3377) 2022-01-27 17:41:43 +09:00
Donny
6b2f3bb8a0 chore: Publish crates 2022-01-27 15:36:55 +09:00
Donny/강동윤
68e9017376
fix(es/minifier): Improve minifier (#3350)
swc_ecma_transforms_optimization:
 - `expr_simplifier`: Track more changes.

swc_ecma_minifier:
 - Analyze after applying the pure optimizer.
 - Preserve access to a variable not in scope.
 - `compress`: Remove string literal if it was not a directive.
 - `pure/collapse_vars`: Merge vars declared in the first statement into one with initializers if `collapse_vars` and `join_vars` are enabled.
 - `unused`: Use `usage_count` instead of `ref_count`.
 - `unused`: Fix dropping rule for member expressions.
 - `unused`: Fix dropping rule for declarations.
 - `hoist_props`: Preserve exported items.
2022-01-27 15:36:22 +09:00
Donny
ac2bb9b7bd chore: Publish crates 2022-01-26 13:12:02 +09:00
Donny/강동윤
703972dc29
fix(es/minifier): Prepend/append correctly (#3367)
swc_ecma_minifier:
 - Add some assertions for injections.
 - Fix prepend/append logic of statements.
2022-01-26 13:11:26 +09:00
Donny
ad860c9a1c chore: Publish crates 2022-01-25 06:22:21 +09:00
Donny
b7c2e13237 chore: Publish crates 2022-01-24 21:11:03 +09:00
Donny/강동윤
8007b2dc93
feat(es/minifier): Handle array literals in sequences (#3348)
swc_ecma_minifier:
 - `sequences`: Implement more rules for array literals.
2022-01-24 21:10:20 +09:00
Donny
efdbda5808 chore: Publish crates 2022-01-24 00:19:56 +09:00
Donny/강동윤
6921ffbbda
fix(es/minifier): Respect block scoping while negating if statements (#3344)
swc_ecma_minifier:
 - Don't negate a if statement if it has `let`/`const` binding.
2022-01-24 00:19:33 +09:00
Donny
4ee4672e4d chore: Publish crates 2022-01-21 14:01:51 +09:00
Donny/강동윤
d52a1f3899
fix(es/minifier): Don't inline a var if the initializer is reassigned (#3333)
swc_ecma_minifier:
 - Consider reassignment to initializer while inlining a variable.
2022-01-21 14:01:20 +09:00
Donny
846a91e14c chore: Publish crates 2022-01-21 10:25:41 +09:00
Donny/강동윤
4f23d651d1
fix(es/minifier): Consider capturing while inlining (#3322)
swc_ecma_minifier:
 - Don't inline functions if it captures the environment.
2022-01-21 10:24:41 +09:00
Donny
f62e6312d5 chore: Publish crates 2022-01-20 16:07:42 +09:00
Donny/강동윤
57204e39cd
fix(es/minifier): Don't inline functions used as arguments (#3320)
swc_ecma_minifier:
 - Preserve a variable initialized with a function expression if it's used as an argument.
2022-01-20 16:06:23 +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
Donny
11aac9b89f chore: Publish crates 2022-01-19 23:17:46 +09:00
Donny/강동윤
b4d21bf077
fix(es/minifier): Prevent infinite loop due to negation (#3310)
swc_ecma_minifier:
 - Don't mark as modified while negating.
2022-01-19 23:17:17 +09:00
Austaras
9e636c7e58
refactor(es): Add visit_obj_and_computed macro (#3304) 2022-01-19 23:11:52 +09:00
Donny
b4f268fa23 chore: Publish crates 2022-01-19 17:39:58 +09:00
Donny/강동윤
1aa494b1c0
fix(es/minifier): Fix logic for checking arguments (#3313)
swc_ecma_minifier:
 - Don't mark `arguments` in nested scope as a inline blocker.
2022-01-19 17:39:24 +09:00
Donny
4966af8273 chore: Publish crates 2022-01-19 16:38:33 +09:00
Donny/강동윤
289122009b
refactor(es/minifier): Fix clippy warnings (#3312) 2022-01-19 16:37:55 +09:00
Donny
dca1c919c2 chore: Publish crates 2022-01-18 20:52:56 +09:00
Donny/강동윤
8e796cdc0a
fix(es/minifier): Don't emit invalid code (#3302)
swc_ecma_minifier:
 - Add lots of debug assertions for invalid codes.
 - Remove all invalid AST nodes eagerly.
 - `pure`: Normalize `PatOrExpr`.
 - `analyzer`: Handle `PatOrExpr` correctly.
2022-01-18 20:52:21 +09:00
Donny
1e4bf76c2b chore: Publish crates 2022-01-18 16:46:13 +09:00
Donny/강동윤
210ecf83bb
feat(es/minifier): Drop more expressions from parallel optimizer (#3303)
swc_ecma_minifier:
 - `pure`: Implement more rule for dropping useless expressions.
2022-01-18 16:45:47 +09:00
Donny
cea7d21ca4 chore: Publish crates 2022-01-18 12:52:37 +09:00
Donny/강동윤
18a11d7c8f
fix(es/minifier): Remove more side-effect-free expressions. (#3301)
swc_ecam_minifier:
- `pure`: Drop more binary expressions.
- `pure`: Drop more literals.
2022-01-18 12:51:31 +09:00
Donny
a424ac30ed chore: Publish crates 2022-01-17 15:17:30 +09:00
Donny/강동윤
fa5c063144
fix(es/minifier): Inline into interpolations in tagged template literals (#3287)
swc_ecma_minifier:
 - Inline into tagged template literals. (Closes #2923)
2022-01-17 15:17:01 +09:00
Donny
023fc956ae chore: Publish crates 2022-01-17 14:30:25 +09:00
Donny/강동윤
b55ae4b312
fix(es/minifier): Fix analysis of unary expressions (#3286)
swc_ecma_minifier:
 - Mark update as usage and assignment. (Closes #3265)
2022-01-17 14:28:35 +09:00
Donny
681de03e4b chore: Publish crates 2022-01-17 13:36:00 +09:00
Donny
0955c3646b chore: Publish crates 2022-01-16 23:32:02 +09:00
Niklas Mischkulnig
162c1fe047
fix(es/transforms): Remove unsafe new String("...") optimization (#3284) 2022-01-16 23:31:08 +09:00
Donny/강동윤
e8670b3383
refactor(es): More fix for clippy (#3280) 2022-01-16 14:33:06 +09:00
magic-akari
f4b3cb714a
fix(es/resolver): Treat a switch statement as a block scope (#3275) 2022-01-15 17:20:17 +09:00
Donny
235a849485 chore: Publish crates 2022-01-14 16:38:01 +09:00
Donny/강동윤
efd86715c9
fix(es/minifier): Preserve side effects in correct position (#3263)
swc_ecma_minifier:
 - Add `fake_block` mark.
 - Inject statements for side effects from `visit_mut_stmt` instead of `visit_mut_stmt_likes`. (Closes #2926)
2022-01-14 16:36:48 +09:00
Donny/강동윤
15b604b6d6
refactor(*): Fix some clippy warnings (#3257) 2022-01-14 07:20:45 +09:00
Donny/강동윤
978de5943e
chore(ci): Configure clippy (#3250) 2022-01-13 23:06:11 +09:00
Donny
c13bba8401 chore: Publish crates 2022-01-12 18:39:56 +09:00
Donny
db952ecf01 chore: Publish crates 2022-01-12 16:58:23 +09:00
Donny/강동윤
74fd353053
fix(es/minifier): Fix bugs (#3238)
swc_ecma_minifier:
 - `collapse_vars`: Respect `mutated`. (Closes #2679)
 - Add a test for https://github.com/vercel/next.js/issues/31084.
2022-01-12 16:57:54 +09:00
Donny
dc99778808 chore: Publish crates 2022-01-12 08:28:25 +09:00
Donny/강동윤
12dd0a6c1f
fix(es/minifier): Fix optimization of assignment expressions (#3231)
swc_ecma_minifier:
 - Check if the operator is `=` before optimizing assignment with a binary expression.
2022-01-12 08:26:56 +09:00
Donny
acfce35d77 chore: Publish crates 2022-01-11 19:37:43 +09:00
Donny/강동윤
78720c4c91
fix(es/minifier): Fix handling of inlined call to a hoisted function (#3223) 2022-01-11 19:37:06 +09:00
Donny
9a62ef21b7 chore: Publish crates 2022-01-11 16:48:26 +09:00
Donny
d51904b93e chore: Publish crates 2022-01-11 14:42:17 +09:00
Donny/강동윤
1edbf1a37a
feat(es/ast): Update is-macro (#3226)
swc_ecma_ast:
 - Add `as_*` for ast enums.
2022-01-11 14:41:34 +09:00
Donny
852ec783f3 chore: Publish crates 2022-01-10 22:57:17 +09:00
Austaras
f58b50bea7
refactor(es/ast): Change types of member-like expressions (#3178)
swc_ecma_ast:
 - Split `MemberExpr` into `MemberExpr` and `SuperPropExpr`.
 - Use `Box<Expr>` for `MemberExpr.obj`.
 - Use ad-hoc type for `MemberExpr.prop`.
 - Use ad-hoc type for `SuperPropExpr.prop`.
 - Use `Callee` instead of  `ExprOrSpread` for `CallExpr`.
 - Simplify types for meta property expressions.
2022-01-10 13:54:42 +00:00
Donny/강동윤
057fca4196
chore(es/minifier): Add scripts to extract tests automatically (#3212) 2022-01-10 16:59:21 +09:00
Donny
0d4b671052 chore: Publish crates 2022-01-10 15:05:26 +09:00
Austaras
cdb46cfb91
fix(es/hygiene): Visit computed properties in usage analyzer (#3217) 2022-01-09 15:42:19 +09:00
Donny
fa212be6ae chore: Publish crates 2022-01-07 14:49:46 +09:00
Donny/강동윤
54353a6fb5
fix(es/helpers): Don't transpile _typeof helper (#3208)
swc_ecma_transforms_base:
 - Add a directive to `_typeof` helper.

swc_ecma_transforms_compat:
 - Don't transpile `_typeof` helper. (Closes #3201)

swc_ecma_minifier:
 - Drop swc/babel directives.
2022-01-07 14:48:08 +09:00
Donny
80bf7f25ff chore: Publish crates 2022-01-06 21:25:35 +09:00
Donny/강동윤
0105939426
fix(es/minifier): Drop unreachable statements eagerly (#3204)
swc_ecma_minifier:
 - `pure`: Drop unreachable statements. (Closes #3173)
2022-01-06 21:25:06 +09:00
Donny
7c59765b2f chore: Publish crates 2022-01-06 20:51:06 +09:00
Donny/강동윤
69b5f799f3
fix(es/minifier): Disable inlining of expressions from collapse_vars (#3200)
swc_ecma_minifier:
 - `collapse_vars`: Disable for member expressions. (Closes #2614)
 - `sequences`: Respect `inline_prevented`.
2022-01-06 20:49:10 +09:00
Donny
6892f27ad7 chore: Publish crates 2022-01-06 20:19:36 +09:00
Donny
1b8b062621 chore: Publish crates 2022-01-05 05:13:24 +09:00
Donny/강동윤
1c1c9f0eae
fix(es/minifier): Fix bugs (#2955)
swc_ecma_minifier:
 - Improve the script for extracting inputs from next.js app.
 - Ensure the name is removed on inlining.
 - Respect `inline_prevented`.
2022-01-05 05:12:52 +09:00
Donny
781aa79b82 chore: Publish crates 2022-01-04 19:29:50 +09:00
Donny
1ef435e1ce chore: Publish crates 2022-01-03 20:35:10 +09:00
YuChao Liang
db51ce4461
fix(es/minifier): Fix comparison of objects, numbers and strings (#3172) 2022-01-03 11:31:49 +00:00
Donny
1e5bc88cd3 chore: Publish crates 2022-01-03 17:45:09 +09:00
Sosuke Suzuki
07c0489575
feat(es/ast): Add ModuleExportName (#3048)
swc_ecma_ast:
 - Allow using string as import/export specifiers.
2022-01-03 08:44:11 +00:00
magic-akari
52961804d1
feat(es/codegen): Make the output for empty objects and empty statements pretty (#3171) 2022-01-03 05:54:58 +09:00
Donny
e14aa9dab4 chore: Publish crates 2022-01-03 00:08:39 +09:00
Donny/강동윤
790c50631b
fix(es/minifier): Fix for modules (#3170)
swc_ecma_minifier:
 - Handle exported declarations correctly.

swc:
 - Change default of `compress.toplevel` and `mangle.top_level` to true for modules. (Closes #3169)
2022-01-03 00:07:42 +09:00
Donny/강동윤
194b3e9b67
refactor(*): Use 2021 edition (#3151) 2021-12-30 18:59:18 +09:00
Donny
0cf8265f02 chore: Publish crates 2021-12-29 21:04:30 +09:00
OJ Kwon
72c963662d
refactor(*): Drop unused dependencies (#3138) 2021-12-29 15:27:51 +09:00
Donny
737b6108d4 chore: Publish crates 2021-12-29 13:46:45 +09:00
Donny/강동윤
43c8cda31a
fix(es/renamer): Fix renamer (#3139)
swc_ecma_transforms_base:
 - `resolver`: Ignore named export with source.
 - `hygiene`: Ignore named export with source. (Closes #2924, Closes #3114)

swc_ecma_minifier:
 - Handle `export default` declarations as declaration instead of expressions. (Closes #2717)
 - Don't override already-processed identifiers. (Closes #2988)

swc_bundler:
 - Adjust the syntax context for named re-exports.
2021-12-29 13:44:48 +09:00
Donny/강동윤
a81661c74a
perf(es/hygiene): Fix performance bug (#3090)
swc_ecma_transforms_base:
 - `hygiene`: Skip checking a symbol if we are sure that it will be discarded.

swc_ecma_laoder:
 - Optimize `NodeModulesResolver` by trying `.js` first.
2021-12-21 23:52:13 +09:00
Donny
e33248cbcc chore: Publish crates 2021-12-21 18:21:48 +09:00
Donny/강동윤
0e4dce694d
refactor(es/minifier): Use swc_timer (#3087)
swc_bundler:
 - Add `Config.disable_fixer`.
 - Add `Config.disable_hygiene`.

swc_ecma_minifier:
 - Use `swc_timer`.
2021-12-21 18:19:33 +09:00
Donny/강동윤
d482d61b9f
chore(scripts): Use cargo profile instruments instead of cargo instruments (#3086) 2021-12-21 16:09:19 +09:00
Donny
9b36abbe75 chore: Publish crates 2021-12-15 16:22:00 +09:00
Austaras
38955c0c8d
refactor(es/ast): Change type or the key of ClassProp to PropName (#3038) 2021-12-15 16:21:30 +09:00
Donny
f86c077a37 chore: Publish crates 2021-12-13 06:46:14 +09:00
Donny
bf69cd554b chore: Publish crates 2021-12-07 18:03:14 +09:00
Donny/강동윤
4a7937d56e
fix(es/minifier): Don't create top level variables (#2985)
swc_ecma_minifier:
 - Add `module` to `TerserCompressorOptions`.
 - Don't create top level variables while inlining if `module` is false.
 - Drop more unused parameters.
2021-12-07 18:02:43 +09:00
Donny
82ece9d0ca chore: Publish crates 2021-12-07 15:15:08 +09:00
Donny
b1a47ee971 chore: Publish crates 2021-12-07 14:34:44 +09:00
Donny/강동윤
e48263b2f3
refactor(visit): Remove &dyn Node from Visit (#2984)
swc_visit_macros:
 - Remove `&dyn Node` from `Visit`.
 - Implement `VisitWith<V>` for `[T]`.
2021-12-07 14:34:16 +09:00
Donny/강동윤
694d3c5072
feat(es/minifier): Print more informantion on infinite loops (#2976)
swc_ecma_minifier:
 - Remove `OptimizerState`.
 - Dump source code if pass is over 200.
2021-12-06 19:47:02 +09:00
Donny
acc45e7c36 chore: Publish crates 2021-12-05 17:34:04 +09:00
Donny
529f980693 chore: Publish crates 2021-12-05 15:44:50 +09:00
Donny
42a93dd8ef chore: Publish crates 2021-12-04 11:53:14 +09:00
David Sherret
67280b6fb0
fix(es/typescript): Run resolver before typescript::strip (#2951)
swc_ecma_transforms_base:
 - `resolver`: Handle some typescript nodes.

swc_ecma_transforms_typescript:
 - `strip`: Use identifier span hygiene information for stripping types.
2021-12-04 02:35:16 +00:00
David Sherret
beb2c73c2c
fix(swc/hygiene): Prefer not renaming top level variables (#2940)
swc_ecma_transforms_base:
 - `hygiene`: Use concept of depth to prevent renaming top level nodes.
2021-12-04 01:55:27 +09:00
David Sherret
4d993c26b6
fix(es/hygiene): Reduce renaming (#2938)
swc_ecma_transforms_base:
 - `hygiene`: Treat class methods and constructors as a scope.
2021-12-02 07:28:09 +00:00
RiESAEX
d8c8641e59 fix(es/parser, es/compat): transform tagged template with invalid escape sequence (#2939)
swc_ecma_parser:
 - Preserve more data for invalid escapes in template literals.

swc_ecma_transforms_compat:
 - Fix handling of template literals. (Closes #2674)
2021-12-02 15:49:45 +09:00
Donny
67dc0d3b94 chore: Publish crates 2021-12-02 10:08:22 +09:00
Donny
86d2cebd37 chore: Publish v1.2.115 2021-12-01 14:20:52 +09:00
Donny/강동윤
28850eef5c
chore: Allow using #[doc(cfg)] (#2871) 2021-11-25 14:16:18 +09:00
Donny
770da5ae9e chore: Publish crates 2021-11-24 15:05:46 +09:00
RiESAEX
cf777c5ba1
fix(es/lexer): Fix lexing of hexadecimal escape sequences (#2838) 2021-11-24 05:26:38 +00:00
Donny
d4ffce13b5 chore: Publish crates 2021-11-24 10:08:01 +09:00
Donny/강동윤
6b96a3d8ed
feat: Enable logging of timings (#2833)
swc_timer:
 - Add `Timer`.
 - Add `timer!()`.

node:
 - Enable logging.
2021-11-22 21:01:08 +09:00
Donny
7ec522f165 chore: Publish crates 2021-11-22 17:55:07 +09:00
黄伟
c5768d7672
feat(es/minifier): Improve drop_console (#2830)
swc_ecma_minifier:
 - Implement more rules for `drop_console`. (Closes #2807)
2021-11-22 17:54:36 +09:00
Donny
cdf7f5f5a0 chore: Publish crates 2021-11-20 17:06:40 +09:00
Donny/강동윤
fa342a0067
fix(es/minifier): Fix bugs (#2779)
swc_ecma_minifier:
 - Don't optimize `1 / t == -1 / 0` as `!1`.
 - Don't optimize `e === -1 / 0` as false.
 - Don't inline string literals in arguments, if it's used multiple time. (https://github.com/vercel/next.js/issues/31291)
2021-11-20 17:06:18 +09:00
Donny/강동윤
e1b76654f5
chore(es/minifier): Add a script to copy tests from a next.js app (#2778) 2021-11-17 16:18:34 +09:00
Donny
2cd565bfc0 chore: Publish crates 2021-11-15 14:31:44 +09:00
Donny/강동윤
f2c67b8caf
fix(es/minifier): Don't inline string literals if it's used multiple time (#2748)
swc_ecma_minifier:
 - Don't inline strings because it's simple.
 - Inline short strings.
2021-11-15 14:03:03 +09:00
Tim Neutkens
3ebc5c6b69
chore: Update markdown files to use "SWC" instead of "swc" (#2744) 2021-11-15 04:26:04 +00:00
Donny/강동윤
665c8e05fc
fix(es): Move TargetEnv to loader from ast (#2719)
swc_ecma_ast:
 - Move `TargetEnv` to `swc_ecma_loader`.

swc_ecma_loader:
 - Drop unused dependencies.
2021-11-11 20:00:46 +09:00
Donny
3adeb6bf30 chore: Publish crates 2021-11-10 20:57:43 +09:00
Donny/강동윤
df635c9e6d
fix(es/minifier): Fix minifier (#2711)
swc_ecma_minifier:
 - Respect `inline_prevented`.
 - Mark the LHS of an assignment pattern property as a pattern. (https://github.com/vercel/next.js/issues/30498)
2021-11-10 20:56:50 +09:00
Donny/강동윤
2b2f6955f2
refactor: Flatten ecmascript (#2708) 2021-11-10 19:00:54 +09:00