Commit Graph

479 Commits

Author SHA1 Message Date
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/강동윤
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/강동윤
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/강동윤
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
magic-akari
f4b3cb714a
fix(es/resolver): Treat a switch statement as a block scope (#3275) 2022-01-15 17:20:17 +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/강동윤
978de5943e
chore(ci): Configure clippy (#3250) 2022-01-13 23:06:11 +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/강동윤
78720c4c91
fix(es/minifier): Fix handling of inlined call to a hoisted function (#3223) 2022-01-11 19:37:06 +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
Austaras
cdb46cfb91
fix(es/hygiene): Visit computed properties in usage analyzer (#3217) 2022-01-09 15:42:19 +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/강동윤
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
YuChao Liang
db51ce4461
fix(es/minifier): Fix comparison of objects, numbers and strings (#3172) 2022-01-03 11:31:49 +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/강동윤
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/강동윤
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/강동윤
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
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
黄伟
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/강동윤
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/강동윤
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