Commit Graph

81 Commits

Author SHA1 Message Date
강동윤
6896a83d54
fix(es/codegen): Fix codegen of ~ (#2104)
swc_ecma_codegen:
 - Emit pending semi on `~`. (#2091)
2021-08-19 17:21:08 +09:00
강동윤
879a0f39a8
feat(swc): Implement format.comments of terser (#2095)
swc:
 - `minify`: Support `format.comments`.
 - `process_js`: Support `jsc.minify.format.comments`.
2021-08-17 14:34:37 +00:00
강동윤
a309b36236
fix(es/transforms): Fix bugs (#2089)
swc_ecma_minifier:
 - Expose hygiene optimizer.
 - `mangle_names`: Handle private names in member expressions. (#2086)

swc_visit:
 - Make `Optional::new` const function.

swc:
 - Make `es3` optional via cargo feature.
 - Ensure that #1554 is already fixed. (#1554)
2021-08-16 10:33:18 +00:00
Iron Lu
ddb2dc7380
test(es/ext/jest): Add tests for jest (#2082) 2021-08-15 18:36:23 +09:00
강동윤
949a4d9716
fix(es): Fix simple bugs (#2077)
swc_ecma_visit:
 - Ensure that #1967 is wrong. (#1967)

swc:
 - Add a test for #1107. (#1107)

node:
 - Make optional fields optional. (#1947)
2021-08-14 18:34:14 +00:00
강동윤
1b9584cfc0
fix(swc): Fix bugs (#2067)
swc_ecma_transforms_compat:
 - Fix optional chaining. (#2063)

node/swc:
 - Fix definition of `ImportDeclaration`. (#2059)

testing:
 - Allow using `testing` with stable `rustc`.

testing_macros:
 - Add `#[inline(never)]`.
2021-08-13 10:57:25 +00:00
강동윤
72c9f4373a
fix(es): Fix bugs (#2055)
swc_ecma_parser:
 - Fix panic from span assertion. (#2040)

swc_ecma_transforms_compat:
 - Fix handling of `await for`. (#1918)

swc_ecma_transforms_base:
 - Allow using decorator metadata even if `reflect-metadata` is not imported. (#1362)
2021-08-12 12:28:58 +00:00
강동윤
a7cb2aba9d
fix(es/minifier): Fix bugs of the minifier (#2052)
swc_ecma_minifier:
 - Test mangler using execution test suite.
 - `mangler`: Preserve `arguments`.
 - `mangler`: Handle shorthand. (#2051)
 - `mangler`: Handle object pattern properties.
 - `precompress`: Don't drop function declarations if the variable with same name is in different scope. (#2011)
2021-08-11 07:24:52 +00:00
강동윤
2c52021ed4
fix(es/transforms/module): Fix paths bug. (#2043)
swc_ecma_preset_env:
 - Update compat data.

swc_ecma_transforms_module:
 - Fix `paths`. (#1934, #1935)
2021-08-09 19:21:24 +00:00
강동윤
53b031b019
fix(swc): Fix bugs (#2034)
swc_ecma_transforms_base:
 - `resolver`: Handle constructor properties correctly. (#2021)

swc_ecma_transforms_compat:
 - `block_scoping`: Handle arrows in loops. (#2027)
 - `block_scoping`: Handle nested for loops with function between them. (#2027)
 - `regenerator`: Handle rhs of `||` correctly. (#2024)

swc:
 - Add a test for #1734. (#1734)
2021-08-09 07:38:46 +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
강동윤
81abfe55d6
fix(es): Fix bugs (#2004)
swc_ecma_codegen:
 - Fix codegen of regexp where `minify` = `true`. (#2000)

swc_ecma_transforms_react:
 - Respect `@jsxImportSource` in `classic` mode. (#1933)

swc:
 - Upgrade `base64`.
2021-08-04 04:58:10 +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
강동윤
6285f20cfa
fix(es): Ensure that #1681 is fixed (#1970)
swc:
 - Ensure #1681 is fixed. (#1681)
2021-08-02 14:18:50 +00: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
nuintun
ef4bb314b9
fix(es/codegen): Remove extra space of import decl (#1975)
swc_ecma_codegen:
 - Remove extra space from import declarations. (#1690)
2021-07-29 18:56:59 +09:00
강동윤
204a71ca94
fix(es/transforms): Fix bugs (#1950)
swc_ecma_trasnsforms_base:
 - `fixer`: Don't de-optimize `++foo || bar`.

swc_ecma_trasnsforms_typescript:
 - Allow using properties from a decorated class. (#1869)

swc_ecma_transforms_optimization:
 - Fix infinite loop. (#1901, #1946)
2021-07-22 07:33:00 +00:00
강동윤
ebdd04d7c7
fix(es/transforms/typescript): Fix typescript stripper (#1945)
swc_ecma_transforms_typescript:
 - Fix usage detection logic. (denoland/deno#10684)
2021-07-21 14:24:57 +00:00
OJ Kwon
de24ff275d
fix(es/transforms/module): Allow namespace import with default import (#1940)
swc_ecma_transforms_module:
 - Allow using a namespace import specifier with a default import specifier. (#1938)
2021-07-20 18:00:27 +09:00
강동윤
39ee7b962d
fix(es/codegen): Fix codegen of template literals (#1936)
swc_ecma_codegen:
 - Fix codegen of template literals. (Closes #1791)
2021-07-20 14:11:33 +09:00
Iron Lu
4a9b31df3e
fix(swc): Fix order of passes (#1931)
swc:
 - Run `import_analyzer` after  `regenerator`.
2021-07-17 13:12:30 +09:00
강동윤
104be9837b
fix(es/transforms): Fix transforms (#1909)
swc_ecma_transforms_compat:
 - `regenerator`: Use es6 import while folding module. (#1641)
 - `typeof_symbol`: Handle `undefined` specially. (#1843)
 - `regenerator`: Do not create useless codes. (#1687)
 - `typeof_symbol`: Migrate to `VisitMut`.

swc_ecma_transforms_module:
 - Add `import_hoister`.
 - Improve import analyzer. (#1682)
 - Allow overriding `export *` wth named exports. (#1714)

swc_ecma_transforms_testing:
 - Add a hack for `regenerator-runtime`.

swc:
 - Run import analyzer ahead of time. (#1682)

misc:
 - Downgrade rustc to the version rust-analyzer supports.
2021-07-10 11:18:28 +00:00
강동윤
03be315921
fix(es/transforms): Fix decorator bugs (#1905)
swc_ecma_transforms_proposal:
 - Initialze decorators lazily. (#1278)
2021-07-08 20:48:07 +09:00
강동윤
19bcb06f73
fix(swc): Fix source path of a source map file (#1902)
swc:
 - Use `output_path` to make sourcemap path relative to the `.map` file. (#1255)
2021-07-08 07:32:06 +00:00
강동윤
69186eb74d
fix(es/transforms): Fix transforms (#1900)
node-swc:
 - Use proper field name in `ObjectPattern`. (#1886)

swc_ecma_codegen:
 - Fix codegen of private properties. (#1898)

swc_ecma_transforms_compat:
 - Fix optional chaining expressions in a single-line arrow expression. (#1836)
 - `regenerator`: Preserve `ExportDefaultDecl`. (#1799)

swc_ecma_transforms_module:
 - Fix `export default function`. (#1799)
2021-07-08 04:54:57 +00:00
Iron Lu
f8a3df8cc3
fix(es/transforms/module): Fix for duplicate export (#1846) 2021-06-29 15:12:18 +09:00
강동윤
33f2ab2d79
fix(es/transforms): Fix transforms (#1861)
swc_ecma_transforms_compat:
 - Organize logical assignment pass correctly.

swc_ecma_transforms_optimization:
 - `dead_branch_remover`: Handle nullish coalescing operator correctly. (#1851)
2021-06-26 16:02:15 +09:00
강동윤
098e48b8f3
fix(es/codegen): Preserve more comments (#1856)
swc_ecma_codgen:
 - Print more comments. (#1165)
2021-06-26 02:07:11 +09:00
강동윤
4cd43375a5
feat(swc): Add import resolvers (#1834)
swc_ecma_loader:
 - Add `Resolve`. 
 - Add `TsConfigResolver`. 

swc_ecma_transforms_module:
 - Use `Resolve` for remapping import paths.
 - Add `ImportResolver`.
 - Add `NodeImprortResolver`.

swc:
 - Add `paths` to `.swcrc`.
 - Use `paths`. (#379, #702)
 - Canonicalize file names.
2021-06-24 06:32:09 +00:00
강동윤
5a6c4fd5a0
fix(swc): Fix sourcemap (#1832)
swc_common:
 - `SourceMap`: Don't panic for dummy spans.

swc_ecma_codegen:
 - Use span for `throw`. (#1685)
 - Use span for `var` / `let` / `const`.
 - Use span for `new`.
 - Use span for `if`.
 - Add spans to braces of a block statement. (#1796)

swc_ecma_transforms_compat:
 - `parameters`: Don't drop the span of block statements. (#1796)

swc:
 - Allow specifying input source map in `.swcrc`.
 - Ensure that the inline source map works properly. (#1713)
2021-06-18 11:34:17 +00:00
강동윤
d3944f5203
fix(swc): Fix bugs (#1820)
swc_ecma_preset_env:
 - [x] Rename directory to be consistant.
 - [x] Add es2020::operators. (#1812)

swc_ecma_transforms_react:
 - [x] Don't escpae unicodes. (#1782)
2021-06-12 15:39:39 +09:00
강동윤
97ef7c0553
fix(swc): Fix bugs (#1811)
swc_ecma_ast:
 - Add `es2021`. 

swc_ecma_transforms_compat:
 - Handle `||=`. (#1788)
2021-06-11 16:55:34 +09:00
강동윤
7730a6ea5a
fix(es/transforms): Fix bugs (#1795)
swc_ecma_transforms_compat:
 - `async_to_generator`: Handle await in async generators correctly. (#1752)

swc_ecma_transforms_module:
 - Don't panic on double import from one module. (#1757)
2021-06-06 22:16:59 +09:00
강동윤
ad55711e45
fix(es/transforms): Fix bugs (#1769)
swc_ecma_transforms_optimization:
 - `dce`: Mark references from decorator as usage. (denoland/deno#10789)

swc_ecma_transforms_proposal:
 - Allow using `super` in decorated class methods. (#846)
2021-05-30 19:52:51 +09:00
강동윤
8726c9caf2
fix(swc): Fix bugs (#1745)
swc_ecma_codegen:
 - Don't escape unicode characters for old targets. (#1744)

swc_ecma_transforms_compat:
 - `class_properties`: Preserve `this` for tagged template literals. (#1742)
2021-05-26 01:24:58 +09:00
강동윤
a795de7f43
fix(swc): Fix bugs (#1732)
swc_ecma_transforms_react:
 - Escape some characters. (#1661)

swc_ecma_transforms_compat:
 - `regenerator`: Handle `||` properly. (#1684)
2021-05-24 09:41:22 +00:00
강동윤
a518c83485
fix(es): Fix bugs (#1728)
swc_ecma_transforms_compat:
 - `block_scoping`: Ensure that #1462 is fixed. (#1462)
 - `regenerator`: Inject variables at proper level. (#1718)

swc_ecam_transforms_typescript:
 - `strip`: Handle class expressions in arrow expressions correctly. (#1729)
2021-05-22 12:14:00 +09:00
강동윤
a1341dcdc6
fix(es/transforms/compat): Fix async_to_generator pass. (#1724)
swc_ecma_transforms_compat:
 - `async_to_generator`: Fix async iife. (#1722)
 - `async_to_generator`: Don't apply iife optimization to named function expressions.
 - `async_to_generator`: Remove duplicated works.
 - `async_to_generator`: Support `await for`. (#1721)
 - `async_to_generator`: Support async generators.
2021-05-21 13:13:22 +09:00
강동윤
57d1aaf80f
fix(es): Fix various bugs (#1707)
swc_ecma_codegen:
 - Fix codegen of `\r\n` in template literals when targeting `es2020`. (denoland/deno#10282)

swc_ecma_parser:
 - Support non-identifier getters in typescript. (#1708)

swc_ecma_transforms_typescript:
 - Skip `export {}` if it was not a module. (#1706)
 - Skip `export {}` if the result is module without it. (#1706)
2021-05-17 22:27:59 +09:00
강동윤
b044d2c6dd
fix(es/transforms/compat): Support private methods (#1700)
swc_ecma_transforms_base:
 - Add some helpers.

swc_ecma_transforms_compat:
 - `class_properties`: Support private methods. (Closes #1694)
2021-05-15 20:35:24 +09:00
강동윤
b4aa1d48e3
fix(es/transform): Fix bugs (#1699)
swc_ecma_transforms_base:
 - Fix bug of `ts_resolver`.

swc_ecma_transforms_typescript:
 - `strip`: Emit `export {}` for type-only modules. (#1698)
 - `strip`: Support scripts.
2021-05-15 16:07:24 +09:00
강동윤
2b918b0c3d
fix(es/transforms/compat): Don't create unnecessary IIFE. (#1669)
swc_ecma_transforms_compat:
 - `class_properties`: Do not create iife if possible. (#1660)
2021-05-10 16:18:31 +09:00
강동윤
b0b0709e1a
fix(es): Fix various bugs. (#1664)
swc_ecma_codegen:
 - Emit comments of `BytePos(0)`. (#1657)

swc_ecma_transforms_compat:
 - `classes`: Optimize class expresssions. (#1660)
2021-05-09 14:23:03 +09:00
강동윤
c3bf517dc9
fix(es/transforms/compat): Fix span for comments in classes transform. (#1658)
swc_ecma_transforms_compat:
 - classes: Fix span for `PURE` comments. (#1657)
2021-05-09 02:26:45 +09:00
Niklas Mischkulnig
f4d0e46cbb
feat(es/transforms/compat): Add pure comment to classes (#1646)
swc_ecma_transforms_compat:
 - Add pure annotations while tranpiling classes.
2021-05-08 15:47:20 +09:00
강동윤
1b1c46b492
fix(es/transforms/compat): Allow keywords in method names. (#1651)
swc_ecma_transforsm_compat:
 - Allow using a keyword as a method name.
2021-05-07 11:27:25 +00:00
강동윤
28bb61fb8d
fix(swc): Fix bugs (#1624)
spack:
 - Add ability to exclude module from the bundle. (#1385)

swc_ecma_ast:
 - Make `Param.decorators` optional. (#1603).

swc_ecma_transforms_compat:
 - Fix super calls in seq exprs in a class. (#1617)

swc_ecma_transforms_module:
- `common_js`: Fix dynamic imports. (#1614)

swc_ecma_transforms_typescript:
 - Fix common js imports. (#1593)
2021-04-30 06:25:24 +00:00
강동윤
5a0bacb5b8
fix(swc): Fix various bugs (#1613)
swc_ecma_codegen:
 - Fix codegen of `\x00`. (#1619)

swc_ecma_preset_env:
 - Fix order of core-js imports. (#1605)

swc_ecma_transforms_react:
 - Preserve ` `. (#1446)

swc:
 - Upgrade dashmap. (#1616)
2021-04-28 14:49:21 +09:00
강동윤
dbec753ca1
fix(swc): Fix bugs (#1591)
swc_ecma_parser:
 - Support optional async class methods. (#1454)

swc_ecma_transforms_compat:
 - Hoist import statements. (#1457)
2021-04-21 09:26:07 +09:00
강동윤
c765c7e06e
fix: Fix bugs (#1590)
swc_ecma_transforms_proposal:
 - Detect decorators in typescript parameter properties. (#1456)

swc:
 - Add tests for #1362. (#1362)
2021-04-19 10:16:10 +00:00