Commit Graph

507 Commits

Author SHA1 Message Date
Donny/강동윤
b0efd00f38
test(es/minifier): Ignore difference of parens (#4546) 2022-05-07 06:08:23 +00:00
Kristján Oddsson
3d5d234047
fix(es/minifier): Respect keepClassNames for class expressions (#4536)
Co-authored-by: Keith Cirkel <keithamus@users.noreply.github.com>
2022-05-06 05:17:45 +00:00
Donny/강동윤
3d3e3bb1d2
test(es/minifier): Categorize more tests (#4538) 2022-05-06 13:54:32 +09:00
Donny/강동윤
a6d404a8c2
chore(repo): Configure prettier (#4523) 2022-05-04 14:25:28 +00:00
Donny/강동윤
09ba3c0e68
feat(es/minifier): Add pristine_globals (#4480) 2022-04-29 08:40:16 +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/강동윤
effc85df57
fix(es/minifier): Disable some passes for hoist_props (#4468) 2022-04-28 08:32:03 +00:00
Donny/강동윤
0bc0bae90d
fix(es/async-generator): Fix yield* in async generators (#4452) 2022-04-28 04:14:17 +00:00
Austaras
ec7dfb9209
chore(es/minifier): Don't run tests with infinite loops (#4448) 2022-04-27 02:21:39 +00:00
Donny/강동윤
53610fdafc
feat(es/resolver): Use different syntax context for unresolved refs (#4436)
- We don't need a list of bindings to check if an identifier is unresolved.
 - Checking if an identifier is unresolved is now one CPU instruction.
   - Previously it was one hashmap operation.
 - This PR also improves performance, by removing the hashmaps mentioned above.
2022-04-26 07:38:50 +00:00
Donny/강동윤
8048597c9e
feat(es/optimization): Accept top level mark from simplifiers (#4434) 2022-04-25 15:31:59 +00:00
Donny/강동윤
8118569045
fix(es/minifier): Remove wrong logic for optimizing deletes (#4429) 2022-04-25 12:32:02 +00:00
Donny/강동윤
9733917cc7
fix(es/minifier): Fix analysis of update expressions (#4428) 2022-04-25 12:07:27 +00:00
Donny/강동윤
8ab12fd97b
fix(es/minifier): Preserve more side effects (#4420) 2022-04-25 06:56:19 +00:00
Donny/강동윤
aa19b65f9c
fix(es/minifier): Don't drop arguments to an IIFE without body (#4419) 2022-04-24 15:27:51 +00:00
Donny/강동윤
9b34ecfd2e
test(es/minifier): Categorize tests (#4410) 2022-04-24 12:11:02 +00:00
Donny/강동윤
f787f8c819
test(es/minifier): Execute terser tests if possible (#4418) 2022-04-24 11:40:39 +00:00
Austaras
83244add33
fix(es/minifier): Remove the last break in the last BlockStmt (#4413) 2022-04-24 03:26:49 +00:00
Donny/강동윤
4e113037e5
test(es/minifier): Use _ instead of - for terser tests (#4411) 2022-04-23 18:34:00 +00:00
Donny/강동윤
ab88637937
test(es/minifier): Split tests into improvement and stabilization (#4409) 2022-04-23 13:40:28 +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/강동윤
87859e373d
fix(es/minifier): Preserve more labels (#4380) 2022-04-21 07:23:50 +00:00
Donny/강동윤
922299a490
fix(es/minifier): Don't drop labels if required (#4370) 2022-04-20 13:34:21 +00:00
Donny/강동윤
4a8b1dad1d
test(es/minifier): Organize tests (#4375) 2022-04-20 15:52:03 +09:00
Donny/강동윤
a8eb00cc54
perf(es/minifier): Change default value of passes to 3 (#4373) 2022-04-19 22:02:33 +00:00
Donny/강동윤
a8ed5ba357
fix(es/minifier): Apply name mangler as much as we can (#4365) 2022-04-19 17:20:12 +09:00
Donny/강동윤
128175c329
fix(es/minifier): Fix default values of toplevel (#4366) 2022-04-19 07:31:48 +00:00
Donny/강동윤
e60ae2a486
feat(es/minifier): Implement all template literal evaluation rules (#4360)
- We now handle nested template literals.
 - We now drop expressions in template literals if it's ignored.
2022-04-18 02:43:55 +00:00
Donny/강동윤
2e095face5
feat(es/minifier): Improve evaluation of template literals (#4359) 2022-04-18 08:43:54 +09:00
Donny/강동윤
e13b8625f2
feat(es/minifier): Implement more evaluation rules (#4356)
- We now handle `array.join` in parallel optimizer.
 - We now handle `[].join` of template literals.
 - We now optimize a template literal as a string addition, in unsafe mode.
2022-04-17 22:16:21 +00:00
Donny/강동윤
b3b95acc75
feat(es/minifier): const => let (#3654) 2022-04-17 15:52:29 +00:00
Austaras
5a5e41aaaa
fix(es/minifier): Preserve vars in dead branches (#4345) 2022-04-17 08:15:14 +00:00
Donny/강동윤
4110fcb961
fix(es/minifier): Inline before cloning (#4338) 2022-04-15 11:01:29 +00:00
Donny/강동윤
f92242dcb1
feat(es/minifier): Improve sequential inliner (#4335)
- We now skip more expressions.
2022-04-15 08:25:31 +00:00
Donny/강동윤
8886a4b572
fix(es/minifier): Respect dead_code (#4328) 2022-04-14 06:00:43 +00:00
Donny/강동윤
2002554fa2
refactor(es/minifier): Clean up logging (#4322) 2022-04-13 23:23:07 +09:00
Donny/강동윤
0245e26af5
fix(es/codegen): Fix overflow of numeric literals (#4321) 2022-04-13 10:16:51 +00:00
Alexander Akait
81370d16cb
fix(css/parser): Parse legacy calcs (#4320) 2022-04-13 07:02:31 +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
那里好脏不可以
37a8c90750
chore(*): Typo + fomatting (#4304) 2022-04-11 18:45:58 +00:00
Austaras
df0d572b4f
chore(es/minifier): Update terser test references (#4297) 2022-04-10 06:50:52 +00:00
Donny/강동윤
c961371c31
fix(es/minifier): Fix handling of eval (#4273) 2022-04-08 08:56:28 +00:00
Donny/강동윤
434dcf4af7
refactor(es/minifier): Merge code for multi-replacer (#4269) 2022-04-07 08:08:42 +00:00
Donny/강동윤
1f5cac4d41
feat(es/minifier): Implement more rules for hoist_props (#4262) 2022-04-06 11:01:45 +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/강동윤
350a19587e
fix(es/minifier): Fix infinite loops (#4250)
- We now don't mark changes due to `negate_cost` as a change.
2022-04-05 07:29:10 +00:00
Donny/강동윤
4701da576f
feat(es/minifier): Improve inliner and evaluator (#4216) 2022-04-05 06:25:23 +00:00
magic-akari
6a51d0471a
fix(es/minifier): Handle empty RegExp (#4235) 2022-04-04 03:46:07 +00:00
Donny/강동윤
fe358ad0b9
feat(es/minifier): Improve sequential inlining (#4231) 2022-04-03 13:13:15 +00:00
Donny/강동윤
55b98fc874
fix(es/minifier): Remap variables on IIFE evaluation (#4230)
- We now check if there's pending inlining before remapping variables.
 - We now use ad-hoc type for remapping.
 - We now inline before remapping to prevent interference with inlining.
2022-04-03 11:39:05 +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/강동윤
11fe5fabd8
feat(es/minifier): Evaluate more iifes (#4200) 2022-03-30 23:35:30 +00:00
Donny/강동윤
9a9a4f37d8
fix(es/minifier): Fix react-ace (#4183) 2022-03-29 10:13:30 +00:00
Donny/강동윤
6d3ea17aa6
feat(es/minifier): Optimize switches more correctly (#4180) 2022-03-29 04:25:15 +00:00
Donny/강동윤
a6f6799811
feat(es/minifier): Evaluate trivial expressions (#4179) 2022-03-29 01:46:09 +00:00
Donny/강동윤
6f25e5774b
feat(es/minifier): Implement more rules for dropping unused assignemnts (#4171) 2022-03-28 09:14:16 +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/강동윤
ee5c48c935
feat(es/minifier): Implement more rules for optimizing for-if-break (#4140) 2022-03-24 00:49:32 +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
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/강동윤
be09ea6991
feat(es/minifier): Drop noop calls (#4019) 2022-03-15 16:23:32 +09:00
Donny/강동윤
a23af2dea2
feat(es/minifier): Compress more comparisons (#3996) 2022-03-13 09:11:16 +00:00
Donny/강동윤
64ca5bae4d
feat(es/minifier): Implement more rules for arrows (#3992) 2022-03-13 03:27:15 +00:00
magic-akari
04db7e2a9b
perf(es/minifier): Refactor base54 (#3989) 2022-03-12 15:36:42 +00:00
Donny/강동윤
76e646804a
fix(es/parser): Parse if-else chain iteratively (#3961) 2022-03-11 09:10:54 +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
underfin
cc564ff6c5
fix(es/minifier): Skip exported vars while collapsing vars (#3928) 2022-03-10 06:19:25 +00:00
Donny/강동윤
9e4dea6663
feat(es/minifier): Improve dropping of unused vars (#3923) 2022-03-09 15:43:01 +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
Austaras
9dd0105c5b
feat(es/fixer): Remove extra parens around iife in expression position (#3887) 2022-03-07 03:51:57 +00:00
Donny/강동윤
a2643608a7
feat(es/minifier): Implement pure_getters partially (#3872) 2022-03-05 20:18:52 +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
Donny/강동윤
0fc819e2ef
fix(es/minifier): Support declaring multiple bindings with the same name (#3837) 2022-03-04 06:58:39 +09: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/강동윤
8a468f7544
fix(es/minifier): Don't reorder unnecessarily (#3817) 2022-03-02 08:57:50 +00:00
Donny/강동윤
89388e6ac3
fix(es/minifier): Preserve more variables (#3805) 2022-03-02 07:13:57 +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
Donny/강동윤
8beaa202e2
fix(es/minifier): Fix optimizations of terminating expressions (#3794) 2022-03-01 09:55:45 +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/강동윤
86072b57f9
test(es/minifier): Prepare porting more rules from terser (#3779) 2022-02-28 13:49:10 +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
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/강동윤
e7f7f69db4
fix(es/minifier): Disable some operations for asm.js codes (#3572) 2022-02-28 07:40:04 +00:00
Donny/강동윤
3d944656bf
refactor(es): Make compilation faster (#3749) 2022-02-26 06:41:14 +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/강동윤
e9fabd61e8
feat(es/minifier): Improve name mangler (#3638) 2022-02-20 12:08:26 +00:00
Donny/강동윤
10adf1e548
feat(es/minifier): Merge exports (#3643) 2022-02-20 10:44:21 +00:00
Donny/강동윤
d2c94416a8
feat(es/minifier): Treat !0 as a literal while inlining (#3631) 2022-02-19 17:33:36 +09:00
Donny/강동윤
bfc9897e34
fix(es/minifier): Disable name mangler if eval is used (#3526) 2022-02-15 07:29:45 +00: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
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
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/강동윤
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/강동윤
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/강동윤
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
Alexander Akait
e8b64a9871
feat(es/codegen): Improve compression of numbers (#3425) 2022-02-03 13:04:32 +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/강동윤
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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/강동윤
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
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/강동윤
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