Austaras
8567a38c4a
feat(es/minifier): Extend inlining of identifiers to multi-usage ( #5832 )
2022-09-13 03:52:47 +00:00
Austaras
ee26337a25
feat(es/minifier): Inline lazily initialized variables ( #5737 )
...
Safety:
For a function-local variable, an expression with side-effects would be a call, including an indirect one with a member expression.
- If the call is function-local, it will be analyzed by the analyzer and inliner will not work.
- If the call is not a function-local one, it cannot modify the local variable.
2022-09-08 08:07:43 +00:00
Austaras
90852f5aa6
fix(es/minifier): Fix analysis of assignments and classes ( #5770 )
2022-09-07 03:51:42 +00:00
Donny/강동윤
6ba6da62d7
perf(es/minifier): Make dead branch remover parallel ( #5734 )
2022-09-04 07:33:26 +00:00
Austaras
5b2d024788
feat(es/minifier): Relax requirement for IIFE invokation ( #5721 )
2022-09-03 07:33:31 +00:00
Donny/강동윤
8827c38faf
feat(es/minifier): Make DCE single-pass ( #5699 )
2022-09-01 16:30:21 +00:00
Austaras
4ef99f346b
feat(es/minifier): Relax function inline requirement ( #5607 )
2022-09-01 19:36:16 +09:00
Donny/강동윤
217f519940
feat(es/minifier): Ignore closure in initializer from sequential inliner ( #5702 )
2022-08-31 10:33:22 +00:00
Donny/강동윤
d43334eb92
feat(es/minifier): Remove redundant check ( #5664 )
2022-08-30 12:22:18 +09:00
Donny/강동윤
a06e6e9ce5
fix(es/minifier): Fix alias analyzer ( #5639 )
2022-08-26 10:06:25 +00:00
Donny/강동윤
d44bbffa02
fix(es/minifier): Revert alias analyzer work ( #5634 )
2022-08-26 08:45:49 +00:00
Donny/강동윤
00e635b9ea
fix(es/minifier): Improve alias analyzer ( #5500 )
2022-08-26 07:56:40 +00:00
Austaras
d2f3e29bb0
feat(es/minifier): Ignore recursive usage for function calls and pure calls ( #5526 )
2022-08-17 23:24:10 +00:00
Austaras
5aa96e00d8
fix(es/minifier): Remove recklessly inline ( #5528 )
2022-08-17 13:06:01 +00:00
Austaras
ca21fd0c4d
fix(es/minifier): Inline vars declared in conditional paths ( #5392 )
2022-08-05 13:25:28 +00:00
Austaras
77497e4fbe
fix(es/fixer): Don't insert extra paren when left of BinExpr
is UpdateExpr
( #5376 )
2022-08-03 08:41:40 +00:00
Austaras
b221f90117
fix(es/minifier): Optimize inlining function calls with a literal in arguments ( #5365 )
2022-08-02 11:37:40 +00:00
Austaras
11f495ad37
fix(es/minifier): Check if an inlined value is mutated ( #5318 )
2022-07-29 04:49:09 +00:00
Austaras
6573324d9c
feat(es/minifier): Calculate correct size ( #5253 )
2022-07-20 08:25:26 +00:00
Donny/강동윤
0e4a03ccc6
fix(es/minifier): Don't inline a callable expression if it's used as a reference ( #5118 )
2022-07-06 03:53:11 +00:00
Donny/강동윤
b76b4999cc
fix(es/codegen): Fix codegen of some non-ascii characters ( #5108 )
2022-07-05 10:22:25 +00:00
Donny/강동윤
36d960c7e9
perf(es/hygiene): Make hygiene
faster ( #4952 )
2022-06-15 14:36:57 +00:00
magic-akari
594089488b
feat(es/minifier): Drop new
token if possible ( #4932 )
2022-06-11 05:27:13 +00:00
Austaras
83ae6a1f1f
feat(es/minifier): Remove extra parens in BinExpr
( #4878 )
2022-06-05 05:52:22 +00:00
Donny/강동윤
49b3c2715c
refactor(es/minifier): Make rust-analyzer
fast, really ( #4746 )
2022-05-23 16:16:05 +09:00
Donny/강동윤
47e6cc5190
refactor(es/minifier): Make rust-analyzer
faster ( #4744 )
...
- We now use a separate crate for testing the minifier. This makes IDE much faster.
2022-05-23 15:53:01 +09:00
Donny/강동윤
dc67911f61
feat(es/minifier): Implement more skipping rules for sequences
( #4716 )
2022-05-20 16:01:27 +09:00
Donny/강동윤
1358f452e7
fix(es/minifier): Consider more side effects while inlining ( #4715 )
2022-05-20 04:57:38 +00:00
Donny/강동윤
183e884cbf
fix(es/minifier): Don't hoist functions with dead_code
( #4695 )
2022-05-18 07:25:25 +00:00
Donny/강동윤
c01476d9ae
feat(es/minifier): Enable conditionals
by default ( #4687 )
2022-05-17 07:34:47 +00:00
Donny/강동윤
8a40b583a5
feat(es/minifier): Implement directives
( #4668 )
2022-05-15 10:02:55 +00:00
Donny/강동윤
2ab7594b4a
fix(es/minifier): Fix switches ( #4595 )
2022-05-09 21:36:09 +00:00
Donny/강동윤
3521ce09e7
fix(es/minifier): Consider more aliases in sequences pass ( #4583 )
2022-05-09 16:36:40 +00:00
Donny/강동윤
7e80c10cba
fix(es/minifier): Don't create an invalid labeled statement ( #4581 )
2022-05-09 09:15:12 +00:00
Austaras
b3b6fd448c
feat(es/minifier): Remove duplicate control flow in nested blocks ( #4569 )
2022-05-08 13:07:58 +09:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier
( #4523 )
2022-05-04 14:25:28 +00:00
Donny/강동윤
918c9c8a21
feat(es/minifier): Drop pure new
calls ( #4478 )
2022-04-29 07:22:13 +00:00
Donny/강동윤
7a584d755a
feat(es/minifier): Consider cost of functions for inlining ( #4470 )
2022-04-29 05:58:59 +00:00
Donny/강동윤
273954640a
feat(es/minifier): Drop more returns ( #4471 )
2022-04-28 13:28:33 +00:00
Donny/강동윤
233c4d5b86
fix(es/minifier): Fix skipping logic of sequential inliner ( #4469 )
2022-04-28 11:41:41 +00:00
Donny/강동윤
375cc5975a
fix(es/minifier): Disable conditionals
by default ( #4391 )
2022-04-22 10:44:53 +09:00
Austaras
8cf3ddda6c
feat(es/minifier): Improve handling of switches ( #4260 )
2022-04-21 10:00:25 +00:00
Donny/강동윤
922299a490
fix(es/minifier): Don't drop labels if required ( #4370 )
2022-04-20 13:34:21 +00:00
Donny/강동윤
74a5087989
feat(es/minifier): Enable dead_code
by default ( #4309 )
2022-04-12 03:40:10 +00:00
Donny/강동윤
7e8f613272
feat(es/minifier): Enable conditionals
by default ( #4301 )
2022-04-12 02:12:10 +00:00
Donny/강동윤
ab1f440103
feat(es/minifier): Exclude local bindings from aliases ( #4261 )
...
- We now exclude bindings created by the initializer while analyzing aliases.
2022-04-06 06:28:49 +00:00
Alexander Akait
f39d3aca4d
feat(es/ast): Add raw
to Num
( #4245 )
2022-04-05 12:46:35 +00:00
Donny/강동윤
4701da576f
feat(es/minifier): Improve inliner and evaluator ( #4216 )
2022-04-05 06:25:23 +00:00
Donny/강동윤
fe358ad0b9
feat(es/minifier): Improve sequential inlining ( #4231 )
2022-04-03 13:13:15 +00:00
Donny/강동윤
10718547e0
fix(es/minifier): Fix evaluation of IIFEs ( #4207 )
...
- We now remap parameters using a new syntax context. This is required because we may copy functions, and it can result in duplicated variables with respect to the span hygiene.
- We now visit the sequence expression generated by inlining. This is to improve performance in some cases.
- We now remove variables from variable statements if it's identical to a parameter declared in the function.
- IIFE evaluation is now aware of `this` being different for member expressions.
- We now have more logic for detecting simple functions.
2022-03-31 09:11:54 +00:00
Donny/강동윤
9a9a4f37d8
fix(es/minifier): Fix react-ace
( #4183 )
2022-03-29 10:13:30 +00:00
Donny/강동윤
ee5c48c935
feat(es/minifier): Implement more rules for optimizing for-if-break ( #4140 )
2022-03-24 00:49:32 +00:00
Alexander Akait
634d732803
feat(es/ast): Add raw
to Str
( #4071 )
2022-03-22 07:54:08 +00:00
Donny/강동윤
4a9817f003
fix(es/minifier): Consider side effects while lifting sequences ( #4116 )
2022-03-22 06:25:19 +00:00
Donny/강동윤
c6f8742669
feat(es/minifier): Implement more evaluation rules ( #4030 )
2022-03-21 20:07:59 +09:00
Alexander Akait
bd444c0ceb
fix(es/codegen): Fix codegen of string literals ( #4037 )
2022-03-16 14:25:26 +00:00
Donny/강동윤
9e4dea6663
feat(es/minifier): Improve dropping of unused vars ( #3923 )
2022-03-09 15:43:01 +00:00
Austaras
7cfa930a62
feat(es/fixer): Remove extra parens around IIFE in statements ( #3918 )
2022-03-08 14:35:18 +00:00
Austaras
9dd0105c5b
feat(es/fixer): Remove extra parens around iife in expression position ( #3887 )
2022-03-07 03:51:57 +00:00
Donny/강동윤
364532e9a7
feat(es/minifier): Improve sequential inlining ( #3820 )
2022-03-03 19:18:43 +00:00
Donny/강동윤
043fba274e
fix(es/hygiene): Fix renaming bugs ( #3824 )
2022-03-03 06:21:13 +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
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
Donny/강동윤
da2c77d9af
perf(es/minifier): Parallelize join_vars
( #3655 )
2022-02-21 05:34:32 +00:00
Donny/강동윤
de6effc6e1
feat(es/minifier): Drop more unused vars ( #3656 )
2022-02-21 04:35:56 +00:00
Donny/강동윤
d2c94416a8
feat(es/minifier): Treat !0
as a literal while inlining ( #3631 )
2022-02-19 17:33:36 +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/강동윤
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
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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
Austaras
cdb46cfb91
fix(es/hygiene): Visit computed properties in usage analyzer ( #3217 )
2022-01-09 15:42:19 +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/강동윤
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
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/강동윤
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
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
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/강동윤
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
Donny/강동윤
2b2f6955f2
refactor: Flatten ecmascript
( #2708 )
2021-11-10 19:00:54 +09:00