Commit Graph

20 Commits

Author SHA1 Message Date
강동윤
71080dbd26
feat(es/minifier): Implement more rules (#2039)
swc_ecma_minifier:
 - Remove useless `0` in sequence expressions.
 - `analyzer`: Don't treat fn decl as fn expr.
 - `sequences`: Use sequence expressions in front of `b`.
 - `if_return`: Drop else token within same pass. (#2044)
 - Fix counting logic for `pass`. (#2044)
 - `analyzer`: Fix `ref_count`.
 - `hygiene`: Implement `visit_prop_name`.
 - `ignore_return_value`: Property access to function parameters may have side effects.
 - `inline`: Treat `!0` as literal.
 - Remove some dead codes if `unused` is enabled.

swc_ecma_utils:
 - Fix `may_have_side_effects`.
2021-08-10 08:52:28 +00:00
강동윤
9793926cc8
fix(es/minifier): Fix bugs and implement more rules (#2032)
swc_ecma_minifier:
 - Fix an infinite loop. (#2028)
 - Don't remove span hygiene. (#2022)

swc_ecma_codegen:
 - Fix codegen of `return` with `async` arrow. (#2020)

swc:
 - Respect `minify = false`. (#2019)
2021-08-08 14:19:04 +00:00
Sosuke Suzuki
f4e0e91f64
feat(es/parser): Always enable features in ES spec (#2029) 2021-08-08 22:53:41 +09:00
강동윤
026c21ec68
feat(es/minifier): Make minifier parallel (#2009)
swc_ecma_minifier:
 - Introduce `bundle` mode, which can be used to parallelize processing of bundled files.
 - Add a function analyzer that checks if the function references something from the outer scope.
 - Split out parellsizable passes.
 - Split `optimzer` into pure / non-pure.
 - Run pure optimizations in parallel.
2021-08-07 08:27:52 +00:00
강동윤
48bc26d3c9
fix(es): Fix codegen & minifier (#2006)
swc_ecma_codegen:
 - Emit a semicolon before `!`.
 - Emit a semicolon before `[`. (#2007)

swc_ecma_minifier:
 - Disable buggy passes.
 - `iife`: Don't inline async functions. (#2007)
2021-08-04 10:27:17 +00:00
강동윤
68608db0b3
fix(es/minifier): Improve output of minifier (#2005)
swc_ecma_minifier:
 - Don't reorder import statements.
2021-08-04 07:20:02 +00:00
강동윤
f44e25c3af
fix(es/minifier): Improve output of minifier (#1990)
swc_common:
 - Add `Span.has_mark`.

swc_ecma_codegen:
 - Emit `1e3` for `1000`.
 - Optimize output. (#1986)

swc_ecma_minifier:
 - name mangler: Don't use keywords as an id.
 - `properties`: Optimize member expression with string properties.
 - `inline`: Inline some function expressions even if it's not fn-local.
 - `analyzer`: Track reassignment correctly.
 - `analyzer`: Track fn-local correctly.
 - `sequences`: Inject `void` if required.
 - `inline`: Inline function declarations correctly.
 - `sequences`: Merge expressions into test of if statements.
 - `sequences`: Reduce calls to an assigned variable.
 - Use `Marks` instead of `&dyn Comments`.


swc_ecma_transforms_optimization:
 - `expr_simplifier`: Fix infinite loops.

node/swc:
 - Ensure that `.transform` performs minification. (#1989)
2021-08-04 00:52:47 +09:00
강동윤
d1c481790c
feat(swc): Expose minifier api (#1978)
swc_ecma_codegen:
 - Fix codegen of imports when minification is enabled.

swc_ecma_minifier:
 - Mangle identifiers used by imports.

swc:
 - Support specifing `jsc.minify`. (#704, #1371)

swc/node:
 - Add `.minify()`.
 - Add `.minifySync()`.

swc/wasm:
 - Add `.minifySync()`.
2021-07-31 06:30:06 +00:00
강동윤
b02e189d07
feat(es/minifier): Implement more rules (#1871)
swc_ecma_codegen:
 - Fix codegen of `U+0028` and `U+0029`. 

swc_ecma_minifier:
 - Implement MVP.

swc_ecma_transforms_base:
 - `fixer`: Handle seq/await in rhs of for-of.
2021-07-30 10:11:27 +09:00
강동윤
4011703af5
fix(testing): Allow using it with stable rustc (#1974)
testing_macros:
 - Make `#[fixture]` relative to cargo manifest dir.
2021-07-29 14:18:21 +09:00
강동윤
ab161793a1
fix(es/transforms/optimization): Migrate to VisitMut (#1880)
swc_ecma_transforms_optimization:
 - Migrate `expr_simplifier` to `VisitMut`.
 - Migrate `dead_branch_remover` to `VisitMut`.
2021-07-02 12:20:24 +09:00
강동윤
33a43f85b1
feat(es/minifier): Implement more rules (#1766)
swc_ecma_minifier:
 - Implement more rules.

swc_ecma_transforms_base:
 - `resolver`: Fix syntax context of catch block.

swc_ecma_transforms_optimization:
 - `expr_simplifier`: Fix a bug related to `this` of call expressions.
 - `dead_branch_remover`: Don't reduce switch cases if test is now known.
 - `dead_branch_remover`: Don't break `&&`.
2021-06-29 16:11:22 +09:00
강동윤
03db7adc9f
fix(es/transforms/base): Wrap binary operands of unary expressions. (#1793)
swc_ecma_transforms_base:
 - `fixer`: Handle binary operands of unary expressions correctly. (#1789)
2021-06-05 12:58:50 +00:00
강동윤
0bd2a3a07e
fix(es/transforms): Fix bugs (#1783)
swc_ecma_transforms_base:
- `fixer`: Wrap operand of a unary expression if it's a binary expression. (#1781, #1789)

swc_ecma_transforms_module:
 - Allow multiple `export *` even if it has the same item. (#1780)
2021-06-05 11:13:42 +09:00
강동윤
99e738643a
feat(es/minifier): Implement rules and classify tests (#1750)
swc_ecma_minifier:
 - Classify tests so we can focus on MVP.
2021-05-28 19:44:03 +09:00
강동윤
ef6a745599
feat(es/minifier): Implement more rules (#1735)
swc_ecma_minifier:
 - Implement `evaluate` partially.
 - Store 'expected output' from terser along with our result.

swc_ecma_transforms_base:
 - `fixer`: Don't wrap `+ (a % b)`.

swc_ecma_transforms_optimization:
 - `expr_simplifier`: Preserve this in calls.
2021-05-25 16:39:07 +09:00
강동윤
5e2db21e47
feat(es/minifier): Implement more rules (#1731)
swc_ecma_codegen:
 - Don't panic while checking if 2 dots are required.

swc_ecma_minifier:
 - Implement some rules related to the option `evaluate`.
 - Implement some rules related to strings.
 - Implement some rules related to numbers.

swc_ecma_transforms_base:
 - `fixer`: Handle `- (1 / 0)`.
 - `fixer`: Handle `(void 0)(0)`.
2021-05-23 15:39:59 +09:00
강동윤
3522fc71e4
feat(es/minifier): Implement more rules (#1730)
swc_ecma_codegen:
 - Fix codegen of `-0.0`.

swc_ecma_transforms_base:
 - `fixer`: Handle tag of tagged template literals.


swc_ecma_minifier:
 - Implement more rules for strings.
 - Implement more rules for teplate literals.
 - Implement more rules for comparisons.
 - Implement more rules for destructuring bindings.
 - Implement more rules for switch statements.
 - Implement more rules for expressions.
2021-05-23 11:19:11 +09:00
강동윤
d20c1d3089
feat(es/minifier): Implement more rules (#1717)
swc_ecma_minifier:
 - Implement `global-defs` pass.
 - Implement `properties` pass partially.
2021-05-21 15:57:17 +09:00
강동윤
c6b22c57f8
feat(es/minifier): Implement minifier partially (#1302)
Co-authored-by: Fábio Santos <fabiosantosart@gmail.com>
2021-05-20 13:51:30 +09:00