Commit Graph

1054 Commits

Author SHA1 Message Date
David Sherret
534c0b19c8
fix(es/parser): Make comments in empty file be in leading comments (#1879) 2021-07-03 12:19:30 +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
Austaras
1a01d0f2c5
fix(es/transform/react): Handle TypeScript declare module (#1875)
swc_ecma_transforms_module:
 - Handle typescirpt declare module. (#1865)
2021-07-02 10:07:34 +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
Iron Lu
f8a3df8cc3
fix(es/transforms/module): Fix for duplicate export (#1846) 2021-06-29 15:12:18 +09:00
강동윤
eaaf32d806
feat(es/loader): Add more logics to tsconfig.paths handler (#1860) 2021-06-27 07:19:05 +00:00
Vladimir Guguiev
7488950f90
fix(es/parser): Fix span of ExportDefaultDeclaration (#1818) 2021-06-27 11:02:45 +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
Moti Zilberman
5345c90989
fix(es/transforms/base): Fix fixer for the call in callee position (#1857) 2021-06-26 13:12:26 +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
강동윤
737ce63b78
chore(es/ast): Bump version (#1853) 2021-06-25 08:19:15 +00:00
Maxime Guerreiro
c5f1c6b8ba
chore(es/ast): Upgrade arbitrary crate to v1 (#1844)
swc_ecma_ast:
 - Upgrade arbitrary crate.
2021-06-25 14:40:51 +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
Andrew Bradley
a31ca40dbb
fix(es/transforms/module): Share usage data between passes (#1829)
swc_ecma_transforms_module:
 - Share scope data between import analyzer and module passes.
2021-06-24 13:37:30 +09:00
강동윤
6ad3f7b90e
feat(es/visit): Groundwork to use VisitMut instead of Fold (#1842)
swc_ecma_transforms:
 - Expose `VisitMut` if possible.

swc_ecma_visit:
 - Implement `VisitMut` for` Folder<V>`.
 - Implement `VisitMut` for `AndThen<A, B>`.
2021-06-23 04:18:41 +00:00
강동윤
6c492796d0
fix(es/parser): Fix parsing of abstract class over multiple lines (#1837)
swc_ecma_parser:
 - Don't allow `abstract` and `class` to be on different lines.
2021-06-20 14:17:40 +00:00
Austaras
11f75dfdcd
fix(es/utils): Fix detection of used variables (#1835) 2021-06-20 14:33:19 +09: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
Andrew Bradley
9ae8c47d9b
fix(es/transforms/module): Allow importing same module with multiple names (#1830) 2021-06-18 12:25:05 +09:00
강동윤
f9bdc7b227
fix(es/parser): Fix panic on debug mode (#1828)
swc_ecma_parser:
 - Handle undefined unicode code point gracefully. (#1813)
2021-06-16 15:55:20 +09:00
강동윤
b5a7a3f577
fix(es/transforms/optimization): Fix dead_branch_remover (#1827)
swc_ecma_transforms_optimization:
 - Preserve side effects of a while statement even if it's a infinite loop. (#1825)
2021-06-16 14:30:33 +09:00
강동윤
4c8d68bfe2
fix(es): Improve handling of typescript (#1824)
swc_ecma_codegen:
 - Implement more code generator for typescript ast nodes.

swc_ecma_transforms_base:
 - Mark LHS of typescript import equals as a variable instead of a type.
2021-06-15 01:13:06 +09:00
muji
8d8b2d10d4
fix(es/parser): Fix parsing of line terminators (#1755)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-06-15 00:39:03 +09:00
강동윤
7fa4e1bea5
fix(es): Fix bugs for the type checker (#1823)
swc_ecma_codegen:
 - Fix codegen of constructor signatures.

swc_ecma_parser:
 - Fix lexing of long numeric literals.
2021-06-13 12:24:30 +09:00
강동윤
001af8637d
fix(es/parser): Fix lexing of numbers (#1821)
swc_ecma_parser:
 - Fix lexing of long numeric literals.
2021-06-12 08:47:13 +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
강동윤
3c3fb359ee
fix(es): Remove UB (#1815)
swc_ecma_parser:
 - Remove UB.

swc_ecma_codegen:
 - Remove codes related to the UB of the parser. (#1782)
2021-06-12 05:17:09 +00: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
강동윤
c56115793c
fix(es/parser): Fix parser (#1808)
swc_ecma_parser:
 - Allow large numeric literals. (#1803)
 - Allow long numeric literals. (#1806)
2021-06-09 23:02:13 +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
강동윤
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
강동윤
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
Shinobu Hayashi
5d219b8cd1
fix(es/codegen): Fix codegen of classes with minify enabled (#1767) 2021-05-30 15:05:14 +09:00
Shinobu Hayashi
65ffd87771
fix(es/parser): Report error for wrong declare keywords (#1760)
swc_ecma_parser:
 - Report `TS1031`.
2021-05-29 16:51:52 +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
강동윤
9fa878c1a6
fix(es/transforms/base): Fix ts_resolver (#1761)
swc_ecma_transforms_base:
 - `ts_resolver`: Handle type-only imports properly. (denoland/deno_lint#705)
2021-05-28 14:04:00 +09:00
강동윤
c79db252dc
fix(swc): Fix bugs (#1753)
swc_ecma_parser:
 - Allow class members to be declared. (#1751)

node-swc:
 - Fix typescript type definitions. (#1746)
2021-05-27 11:59:04 +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
강동윤
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
강동윤
d60c3242af
fix(swc): Fix bugs (#1739)
swc_bundler:
 - Fix cycle detection for complex circular imports. (denoland/deno#10752)

swc_ecma_transforms_typescript:
 - Allow using large values for an enum variant.
2021-05-25 14:30:17 +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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
8a2909bc51
fix(es/preset-env): Update core js compat data (#1719)
swc_ecma_preset_env:
 - Update `core-js-compat`. (https://github.com/swc-project/swc/issues/1712#issuecomment-844959483)
2021-05-20 20:46:03 +09:00
강동윤
470c8f4745
fix(es/minifier): Publish (#1716) 2021-05-20 15:09:30 +09:00
강동윤
ded8f2b5e5
fix(es/minifier): Use log instead of stderr (#1715) 2021-05-20 14:23:01 +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
강동윤
b6589af92b
fix(swc): Fix bugs (#1712)
swc_ecma_preset_env:
 - Update compat data. (#1704)
 - Support `export-namespace-from`.

swc_ecma_transforms_compat:
 - Use proper argument for private field accesses in a private method. (#1711)
2021-05-19 00:55:01 +09:00
강동윤
a0241c88b2
fix(es/transforms/base): Fix resolver (#1710)
swc_ecma_transforms_base:
 - `ts_resolver`: Treat the type parameter of a mapped type as a binding.
2021-05-18 17:47:43 +09:00
강동윤
dee82904f8
fix(es): Fix bugs (#1709)
swc_ecma_transforms_base:
 - `fixer`: Fix regression related to `??` and `||`. (denoland/deno#10668)
2021-05-18 15:34:44 +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
강동윤
8a36435ee1
fix(es/transforsm/compat): Transform private field access in private methods (#1703)
swc_ecma_transforms_compat:
 - `class_properties`: Handle private field accesses in private methods. (#1702)
2021-05-16 16:11:35 +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
Pig Fang
1dbc3644a5
feat(es): Support type-only import equals declaration (#1695)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-15 14:26:24 +09:00
강동윤
f0d7a3d064
fix(es/transforms): Fix bugs (#1691)
swc_ecma_transforms_optimization:
 - Don't optimize optional chaining expressions. (#1688)

swc_ecma_transforms_react:
 - Don't panic. (#1683)
2021-05-14 00:11:27 +09:00
강동윤
24bd5ea4a4
fix(es): Fix various bugs (#1680)
swc_ecma_parser:
 - Allow a class member named `declare`. (#1671)

swc_ecma_transforms_optimization:
 - Preserve side effects while inlining array index operations. (#1674)

wasm/web: 
 - Fix ci script. (#1675)
2021-05-11 16:29:29 +00:00
강동윤
2ad0af9e91
fix(es/transforms/compat): Improve performance (#1673)
swc_ecma_transforms_compat:
 - `classes`: Fast-path.
 - `destructuring`: Fast-path.
 - `sticky_regex`: Fast-path.
 - `spread`: Fast-path.
 - `shorthand`: Fast-path.
 - `typeof_symbol`: Fast-path.
 - `block_scoped_functions`: Fast path.
 - `duplicate_keys`: Use fxhash.
 - `instance_of`: Fast path.
 - `reserved_words`: Make string comparison efficient.
2021-05-11 04:53:36 +00:00
강동윤
9381d0dbc2
fix(es/transforms/base): Fix resolver (#1672)
swc_ecma_transforms_base:
 - `resolver`: Handle variables in for in/of loop body correctly.
2021-05-10 20:39:07 +09:00
Pig Fang
b713972493
feat(es/parser): Enforce orders of override and async (#1670)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-10 08:55:22 +00:00
강동윤
de15804b89 Bump version 2021-05-10 17:23:51 +09:00
Pig Fang
50f8048f2a
feat(es/parser): Enforce order of abstract and override (#1668)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-10 17:09:51 +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
Pig Fang
1548f6d799
feat(es/parser): Allow override in parameter properties (#1667)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-05-09 22:17:58 +09:00
Pig Fang
4aed9423de
fix(es/parser): Allow using override with static (#1663) 2021-05-09 21:04:42 +09:00
강동윤
9585500476
fix(es/transforms/base): Fix resolver (#1666)
swc_ecma_transforms_base:
 - `resolver`: Handle function declarations in arrow body.
2021-05-09 09:52:29 +00:00
강동윤
aea08fb8c9
fix(es/tranforms/base): resolver: Handle function declarations in ts modules (#1665)
swc_ecma_transforms_base:
 - `resolver`: Handle function names in ts modules correctly.
2021-05-09 16:03:59 +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
강동윤
f368c5f81c fix(es/transforms/react): Bump version 2021-05-07 22:21:56 +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
강동윤
abc24c9256
fix(es/transforms/resolver): Fix setter properties (#1647)
swc_ecma_transorms_base:
 - Handle parameters of a setter property correctly.
2021-05-06 13:56:42 +09:00
강동윤
deec1f67a3
fix(es/transforms/resolver): Fix setter properties (#1645)
swc_ecma_transorms_base:
 - Handle parameters of a setter property correctly.
2021-05-06 03:09:03 +09:00
Niklas Mischkulnig
fe107a1223
fix(es/transforms/react): Change order of passes (#1639) 2021-05-05 14:13:06 +09:00
강동윤
27a1c30fef
fix(es/transforms/fixer): Handle binary expressions in super class expr (#1636)
swc_ecma_transforms_base:
 - Handle binary expressions in super class expressions. (denoland/deno#10487)
2021-05-04 12:11:40 +09:00
강동윤
2724cefe2c
fix(es/transforms/react): Expose RefreshOptions (#1635)
swc_ecma_transforms_react:
 - Expose `RefreshOptions`. (#1634)
 - Expose `Runtime`.
2021-05-03 19:31:04 +09:00
Niklas Mischkulnig
b6ff4d6f71
fix(es/transforms/optimization): Preserve x instanceof Object (#1630) 2021-05-03 18:12:15 +09:00
강동윤
d10671bbda
fix(swc): Fix various bugs. (#1632)
swc_ecma_transforms_typescript:
 - Fix import analyzer. (denoland/deno#10462)
2021-05-03 13:34:13 +09: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 `&nbsp;`. (#1446)

swc:
 - Upgrade dashmap. (#1616)
2021-04-28 14:49:21 +09:00
Will Binns-Smith
f943021de0
feat(es/transforms/optimization): simplify: Preserve do-while loops with conditional stoppers (#1618) 2021-04-28 10:14:13 +09:00
Will Binns-Smith
a24266d986
feat(es/preset-env): Make android targets fall back to chrome (#1597) 2021-04-27 12:46:04 +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
Devon Govett
1c4fa63bdc
fix(es/transforms/compat): Handle references to arguments inside arrow functions and block scoped loops (#1585)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-04-19 15:50:44 +00: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
강동윤
4db24fb7f6
fix(swc): Fix various bugs (#1588)
swc_ecma_transforms_module:
 - Change the order of functions exported as default. (#1568)
 - Handle mixed imports correctly. (#1525)

swc:
 - Ensure that #1581 is fixed. (#1581)
2021-04-18 20:58:30 +00:00
Devon Govett
d7ea5ae00c
fix(es/transforms/compat): Fix syntax context of super classes (#1586) 2021-04-18 15:40:06 +00:00
강동윤
46c3d62ebd
fix(swc): Fix bugs (#1560)
spack:
 - Ensure that #1533 is fixed. (#1533) 

swc_ecma_parser:
 - Support `async override` in classes. (#1558)

swc_ecma_transforms_compat:
 - `async_to_generator`: Preserve this in async object methods. (#1575)
 - `nullish_coaelscing`: Fix assignments. (#1570)
 - `export_namespace_from`: Preserve order of statements. (#1457)

swc:
 - Disable aes. (#1583)
2021-04-17 06:00:14 +00:00
강동윤
1178686a4c
fix(bundler): Fix bundler (#1576)
swc_bundler:
 - Fix remapping of exports. (denoland/deno#9350)
2021-04-16 18:09:38 +00:00
Devon Govett
efa7a9af78
fix(es/transforms/compat): Fix regenerator pass for yield* expressions (#1580)
swc_ecma_transforms_compat:
 - `regenerator`: Fix delegating yield expressions.
2021-04-16 15:44:36 +00:00
grimly
60ad0df3f5
@swc/helpers exports typeOf instead of typeof (#1578)
swc_ecma_transforms_base:
 - Fix helper names.
2021-04-16 13:48:37 +09:00
Devon Govett
00461f3a76
fix(es/transforms/base): Fix precedence of yield expression inside ternary (#1577) 2021-04-15 05:50:43 +00:00
강동윤
246bdd5088
fix(bundler): Fix bugs (#1572)
swc_bundler:
 - Ensure that denoland/deno#10141 is fixed. 
 - Run deno tests on ci.
 - Support nested `export *`. (denoland/deno#10153, denoland/deno#10174)

swc_ecma_codegen:
 - Remove `,` after rest elements. (#1573, denoland/deno#10167)

swc_ecma_transforms_optimization:
 - Don't drop items used by the discriminant of a switch.

swc_ecma_transforms_typescript:
 - Remove constructors without a body.
2021-04-14 14:00:33 +00:00
Devon Govett
d8a18dfd9e
fix(es/transforms/compat): Fix block scoping of class declarations (#1569) 2021-04-14 17:42:07 +09:00
Austaras
df2a926e9d
fix(es/transforms/module): Use correct this (#1561)
swc_ecma_transforms_module:
 - Preserve semantics of `this` in imported functions. (#1556)
2021-04-14 00:18:24 +09:00
Devon Govett
92bbde3b53
fix(es/transforms/base): Fix nested function scopes (#1559)
swc_ecma_transforms_base:
 - `resolver`: Handle nested function scopes correctly.
2021-04-13 16:23:04 +09:00
Niklas Mischkulnig
e43de77ec6
fix(es/transforms/optimization): Preserve missing object members (#1567)
swc_ecma_transforms_optimization:
 - Don't replace missing object members with undefined
2021-04-12 11:18:17 +00:00
Devon Govett
14edb69826
fix(es/transforms/base/fixer): Fix parens of sequence expressions (#1566)
swc_ecma_transforms_base:
 - Fix parens of sequence expressions in callee and function parameters.
2021-04-12 06:14:55 +00:00
Devon Govett
8f5daa3bbb
feat(es/transforms/react): Add pure annotation comments (#1564)
swc_ecma_transforms_react:
 - Add pure annotations for react.
2021-04-11 15:09:27 +09:00
강동윤
5ef3c43522
fix(es): Fix bugs. (#1565)
swc_ecma_parser:
 - Don't panic for `try` statements without handler and finalizer. (denoland/deno#10112)

swc_ecma_transforms_base:
 - Fix `typeof`s used with `externalHelpers: true`. (#1458, #1557)
2021-04-10 20:55:17 +00:00
강동윤
2211a9908a
fix(swc): Fix various bugs (#1550)
swc:
 - Improve error message for invalid configs. (#1532)

swc_common:
 - Handle input source map correctly. (#1404)

swc_ecma_parser:
 - Fix parsing of generics type declarations when tsx is enabled. (#1526)

swc_ecma_transforms_compat:
 - Allow using carriage return. (#1549)
2021-04-08 12:55:02 +00:00
Devon Govett
ee641bab63
fix(es/transforms/optimization): Fix function hoisting with early return branch simplification (#1539)
swc_ecam_transforms_optimization:
 - Fix function hoisting.
2021-04-08 05:15:59 +00:00
Pig Fang
f002b73d82
fix(es/parser): Fix error message (#1551)
swc_ecma_parser:
 - Use correct error code for implements preceding extends.
2021-04-07 17:13:54 +00:00
Pig Fang
39e1e54ee4
fix(es/parser): Disallow override in non-subclass (#1552)
swc_ecma_parser:
 - Disallow `override` in classes without super class.
2021-04-07 15:38:24 +00:00
Pig Fang
3d0ad22ace
feat(es): Support override syntax in class for TS 4.3 (#1541)
swc_atoms:
 - Add `override`.

swc_ecma_ast:
 - Add `is_override` to class members.

swc_ecma_parser:
 - Support override syntax of typescript 4.3.
2021-04-06 17:06:18 +00:00
강동윤
62d0cbcabb
fix(es): Fix sourcemap (#1548)
swc_ecma_codegen:
 - Consider indentions while calculating starting point of source map entries. (denoland/deno#10014)
2021-04-06 11:26:51 +00:00
Devon Govett
beeb1f9067
fix(es/transforms/base): Fix named function expression handling in resolver (#1540) 2021-04-06 13:31:11 +09:00
David Sherret
f1792708b4 fix(es/ast): Remove TsSignatureDecl (#1531) 2021-04-04 20:12:17 +09:00
Devon Govett
0d79ca617d
fix(es/transforms/optimization): Fix inlining nested block statements in branch simplifier (#1536)
swc_ecma_transforms_optimization:
 - Fix branch remover.
2021-04-04 17:24:49 +09:00
Austaras
6cad184dfd
feat(es/transforms/react): Fast refresh config (#1538)
swc_ecma_transforms_react:
 - Add a config for fast refresh.
2021-04-04 16:18:17 +09:00
Pig Fang
65122163cf
feat(es): Support TS 4.3 static index signature in class (#1537) 2021-04-04 11:43:13 +09:00
강동윤
252804d2e3
fix(swc): Fix bugs (#1529)
swc_ecma_parser:
 - Fix comment positions. (#1530)

swc_ecam_transforms_compat:
 - Handle default in destructuring binding patterns. (#1477, #1449)
 - `async_to_generator`: Handle `this` correctly for async function in key-value properties. (#1455)

swc_ecam_transforms_typescript:
 - Handle import defaults. (#1448)
2021-04-02 18:47:05 +09:00
Devon Govett
b9f5a50d18
fix(es/transforms/typescript): Fix TS import elision with shadowed declarations (#1521) 2021-04-01 11:46:57 +09:00
강동윤
4ab7a91fe3
fix(es): Fix for the type checker (#1528)
swc_ecma_codegen:
 - Fix codegen of type assertions.


swc_ecma_transforms_base:
 - `resolver`: Handle getter properties.
 - •resolver`: Handle setter properties.
2021-04-01 03:01:44 +09:00
Austaras
0fabc2cfc9
feat(es/transforms/react): Support fast refresh (#1524)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-31 22:14:47 +09:00
강동윤
5ce4e1e927
fix(es/parser): Use correct position for comments (#1527)
swc_ecma_parser:
 - Use correct position for comments in

```ts
function Bar() {
  const [foo, setFoo] = useState(0);
  React.useEffect(() => {
    // @refresh reset
  });
  return <h1>{foo}</h1>;
}
```
2021-03-31 19:30:05 +09:00
강동윤
13a9d12c84
chore(ci): Configure github actions for rustdoc (#1523) 2021-03-31 13:09:10 +09:00
강동윤
51d0cef287
fix: Fix bugs (#1516)
swc_ecma_ast:
 - Support TypeScript 4.3. (#1517)

swc_ecma_parser:
 - Support new syntaxes from typescript 4.3. (#1517) 

swc_ecma_transforms_compat:
 - Fix '\\`' in template literals. (#1488)
 - `classes`: Fix super calls. (#1490)

swc_ecma_transforms_module:
 - Respect `esModuleInterop` for dynamic imports. (#1480)

swc_ecma_transforms_typescript:
 - `strip`: Remove `declare`-d namespaces. (#1508)
2021-03-30 16:47:12 +09:00
Nayeem Rahman
8b1f8dde4b
fix(strip): Expand class expressions as sequences
swc_ecma_transforms_typescript:
 - `strip`: Expand class expressions as sequences.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-30 12:09:11 +09:00
Devon Govett
393808a8f6
fix(es/codegen): Fix sourcemaps of multi line block comments (#1511)
swc_ecma_codegen:
 - Fix sourcemaps of multiline block comments.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-29 23:41:05 +09:00
강동윤
99f4f0f280
fix(swc): Fix bugs for v1.2.52 (#1506)
swc_ecma_parser:
 - Support `private declare`. (#1503)
 - Recover `backtracking` state while doing some nested backtracking. (#1505)
 - Allow using `readonly` as the name of class properties. (#1514)

swc_ecma_transforms_base:
 - `hygiene`: Keep the name of class expressions. (#1507)

swc_ecma_transforms_typescript:
 - Allow a namespace and a class to have the same name. (#1515)

swc:
 - Disable `tsx` if the ext of a file is ts.
2021-03-29 20:48:48 +09:00
강동윤
3ddf229c18
fix(es/parser): Fix assert after imports (#1513)
swc_ecma_parser:
 - Check for newline while parsing import assertions. (#1512)
2021-03-29 11:30:00 +09:00
Nayeem Rahman
8eae00900f
fix(es/transforms/typescript): Precompute class field keys (#1498)
swc_ecma_transforms_typescript:
 - `strip`: Precompute keys.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-28 12:14:59 +09:00
강동윤
232cfc5f4f
fix(es/transforms/react): Handle jsx entities in attributes correctly (#1501)
swc_ecma_transforms_react:
 - Fix jsx entities in attribute values. (#1479)
2021-03-27 21:06:47 +09:00
강동윤
b7eb1f9154
fix(es/transforms/base): Fix fixer (#1496)
swc_ecma_transforms_base:
 - Fix `('a' ?? 'b') || c`.
2021-03-27 00:45:51 +09:00
Nayeem Rahman
fa3d65cd58
fix(strip): Transform static class fields to assignments (#1487)
swc_ecam_transforms_compat:
 - Deprecate `typescript_class_properties`.

swc_ecma_tranforms_typescript:
 - Merge `typescript_class_properties` into `strip`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-26 13:48:55 +09:00
David Sherret
da62c73239
refactor(es/ast): Change TaggedTpl to have a Tpl (#1114)
swc_ecma_ast:
 - Make `TaggedTpl` have `Tpl`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-25 20:09:36 +09:00
강동윤
df3f3106df
fix(es/transforms/fixer): Fix await expressions. (#1475)
swc_ecma_transforms_base:
 - Handle assign expressions in `await` correctly. (denoland/deno#9810)
2021-03-24 19:25:04 +09:00
강동윤
fec189f2f3
fix(bundler): Fix stack overflow on Windows (#1464)
bundler:
 - Prevent stack overflow. (denoland/deno#9752)

testing:
 - Bump version
 - Fix handling of paths on windows.

testing_macros:
 - Bump version
 - Correctly ignore files.
2021-03-22 19:42:42 +09:00
Nayeem Rahman
9bc074ed46
fix(strip): Combine typescript_class_properties() into strip() (#1478)
swc_ecma_utils:
 - Use `&mut` for inject_after_super.

swc_ecma_transforms_typescript:
 - Merge `typescript_class_properties` into `strip`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-21 22:31:35 +09:00
강동윤
9445c109f9
fix(es/codegen): Fix codegen of arrow expressions. (#1452)
swc_ecma_codegen:
 - Fix codegen of arrow functions.  (#1451)
2021-03-20 15:30:54 +09:00
강동윤
dcdac2db6f
fix(swc): Fix bugs (#1453)
swc_ecma_transforms_typescript:
  - Add option to use define propert for `strip` pass. (#1472)

node-swc:
  - Fix `keepClassNames`. (Brooooooklyn/swc-node#335)
2021-03-17 15:24:35 +09:00
Alexander van Ratingen
06cb4b89cb
fix(es/codegen): Fix SX spread props (#1463) 2021-03-11 11:24:31 +09:00
강동윤
97269a37b9
fix(swc): Fix bugs for v1.2.50 (#1444)
swc:
 - Respect `react` config.

swc_ecma_transforms_compat:
 - `export-namespace-from`: Preserve `use strict`. (#1423)

swc_ecma_transforms_module:
 - Inject `use strict` before imports. (#1423)

swc_ecma_transforms_proposal:
 - Emit metadata for literal types. (#1421)
2021-03-03 20:39:02 +09:00
강동윤
bc07215d4d
fix(es/parser): Fix lexing of template literals. (#1450)
swc_ecma_parser:
 - Fix lexing of template literals. (denoland/deno#9620)
 - Ensure that denoland/deno#9650 is not a bug of parser.
2021-03-03 17:46:36 +09:00
Devon Govett
eec65f25bb
feat(es/transforms): Port @babel/preset-modules (#1439)
swc_ecma_preset_env:
 - Add options to enable bugfix transforms.

swc_ecma_transforms_compat:
 - Add bugfix transform for async arrows in a class.
 - Add bugfix transform for default parameters.
 - Add bugfix transform for templit literal caching.

swc_ecma_transforms_react:
 - Respect `use_spread`.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-03-02 16:03:22 +09:00
Giorgi Rostomashvili
73b8826a2f
fix(es/parser): Recover from type annotations after = (#1445) 2021-03-02 15:50:13 +09:00
강동윤
a3105428ba
fix(swc): Fix various bugs (#1440)
swc:
 - Use `hygiene_with_config` instead. (#1279)
 - Allow enabling source map with `.swcrc`. (#1309)

swc_ecma_transforms_base:
 - `hygiene`: Add an option to preserve class names. (#1279)

swc_ecma_transforms_compat:
 - `block_scoping`: Allow using `break` in switch cases. (#1415)
2021-03-01 17:19:37 +09:00
marieell
24dac8605b
chore: Typo (#1442) 2021-03-01 13:44:44 +09:00
강동윤
a4d408dc6e
fix(es/transforms/base): Fix span hygiene of type elements (#1436)
swc_ecma_transforms_base:
 - `ts_resolver`: Fix span hygiene of type elements.
2021-02-28 15:55:20 +09:00
강동윤
c047e0e54d
fix(bundler): Fix bundler (#1427)
swc_bundler:
 - Create variables for export while preparing a module. (denoland/deno#9560)
 - Fix order of statements.
 - Invoke dce multiple time if required. (denoland/deno#9546)

swc_ecma_transforms_optimization:
 - dce: Track modifications correctly.
2021-02-26 18:21:42 +09:00
Jakub Koralewski
59bd00d841
fix: Fix tests on windows (#1419)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-02-23 00:33:11 +09:00
강동윤
7f5bfdcc00
fix(bundler): Fix bugs (#1382)
swc_bundler:
 - Improve performance
 - Use `Vec<AHashSet<usize>>` instead of `AHashSet<(usize, usize)>`.
 - Fix statement orderings. (denoland/deno#9464) 
 - Fix wrapped esm mixed with circular imports. (denoland/deno#8224)
 - Store content of wrapped esm at top level. (denoland/deno#8224)
2021-02-22 17:27:40 +09:00
David Sherret
adcca03cfa
fix(es/ast): Remove TsTypeCastExpr it's not used (#1420) 2021-02-22 17:05:51 +09:00
Yehuda Katz
db85d123b7
Fix a number of typos (#1412)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-02-20 15:18:09 +09:00
강동윤
eecdca4e86
fix(es/transforms/base): Fix resolver (#1414)
swc_ecma_transforms_base:
 - `resolver`: Handle private class methods. (denoland/deno_lint#615)
2021-02-19 19:51:50 +09:00
강동윤
27aad87798
fix(es/transforms/base): Fix hygiene of catch clause (#1413)
swc_ecma_transforms_base:
 - `hygiene`: Apply ops in catch clauses. (#1402)
2021-02-19 16:52:02 +09:00
강동윤
eaeffabf74
fix(es): Improve performance (#1411)
swc_ecma_ast:
 - Add `BindingIdent`.
 - Reduce size of `Ident`.
2021-02-19 15:34:22 +09:00
강동윤
0be20ff0ae
feat(es/transforms/react): New jsx transform (#1408)
swc_ecma_transforms_react:
  - Implement new jsx transform. (#1103, denoland/deno#7993)
2021-02-19 14:32:53 +09:00
강동윤
8fb0b4c303
fix(es/transforms/react): Use VisitMut instead of Fold (#1409)
swc_ecma_transforms_base:
 - Implement `MapWithMut` for more types.

swc_ecma_transforms_react:
 - Migrate to `VisitMut`.
2021-02-17 14:40:03 +09:00
강동윤
5ad57b02f2
fix(es/parser): Fix bugs (#1405)
swc_ecma_parser:
 - Parse generics in class methods with special name properly.
2021-02-17 01:47:00 +09:00
강동윤
fc2a8cb073
fix(es): Fix docs.rs (#1399) 2021-02-15 02:45:50 +09:00
강동윤
9dabf00200
fix(es): Fix bugs (#1395)
swc_ecma_codegen:
 - Implement `emit_ts_type_assertion`.
 - Implement `emit_ts_type_cast_expr`. 
 - Implement `emit_ts_ns_export_decl`.
 - Implement `emit_ts_signature_decl`.

swc_ecma_parser:
 - Ensure that we report an error for invalid input. (#1391)

swc_ecma_transforms_base:
 - fixer: Handle `await (await foo)()`. (#1397)
2021-02-14 22:18:05 +09:00
David Sherret
313f51fab1
feat(es/parser): Allow to look at the kind of an error (#1396)
swc_ecma_parser:
 - Add a method to look at the kind of an error without destructuring it.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-02-14 16:49:28 +09:00
Bartek Iwańczuk
8ef78a9e08
feat: add import assertion to dep analyzer (#1387)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-02-10 21:49:44 +09:00
강동윤
bf445a75c4
fix(swc): Fix bugs (#1372)
swc_ecma_ast:
 - Support import assertions for exports.

swc_ecma_parser:
 - Support import assertions for exports.

swc_ecma_transform_typescript:
 - Strip `declare globals` correctly. (#1383)

spack:
 - Re-enable multi-entry tests.
2021-02-10 17:25:28 +09:00
강동윤
686c98116d
fix(es): Fix for the type checker (#1381)
swc_ecma_codegen:
 - Fix codegen of `TsCallSignatureDecl`.

swc_ecma_transforms_base:
 - Handle `TsCallSignatureDecl`.
2021-02-08 01:39:05 +09:00
Michael Nicholls
bd119e6634
feat(es/preset-env): Custom config path (#1374)
swc_ecma_preset_env:
 - Support custom path.

Co-authored-by: 강동윤 <kdy1@dudy.kr>
2021-02-03 13:27:11 +09:00
강동윤
0d130f8103
fix(bundler): Prevent hanging (#1369)
swc_bundler:
 - Prevent infinite loop.
2021-01-30 13:35:07 +09:00
강동윤
af25a88902
fix(swc): Fix bugs for v1.2.47 (#1368)
swc_ecma_parser:
 - Fix generic parsing issue in jsx context. (#1299)

swc_ecma_transforms_module:
 - Allow importing a module multiple time. (#1232)
 - Handle imports in the constructor of an exported class decl. (#1213)

swc:
 - Respect `sourceMappingURL`. (#1236)
 - Resolve `sourceMappingURL` relative from file. (#1255)
 - Respect `isModule: false` (#1258)

spack:
 - Support loading json files. (#1225)
2021-01-29 22:19:04 +09:00
David Sherret
4155822283
Fix span of arrow expression with type params (#1365)
swc_ecma_parser:
 - Fix span of arrow expression with type params.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-01-28 20:55:43 +09:00
강동윤
78e79a7ace
feat(es/transforms/typescript): Strip out type-only namespaces (#1361)
swc_ecma_transforms_typescript:
 - Strip out type-only namespaces.
2021-01-27 16:20:10 +09:00
강동윤
93a19140a8
fix(es): Fixes for type checker (#1359)
swc_ecma_codegen:
 - Print type parameters of a class method.

swc_ecam_transforms_base:
 - `ts_resolver`: Handle type parameter constraints correctly.
2021-01-26 22:05:30 +09:00
강동윤
947161b43b
fix(bundler): Fix bugs (#1349)
swc_bundler:
 - Fix deglobbing of imports. (denoland/deno#8985)
 - Use correct syntax context while deglobbing imports. (denoland/deno#9212)
 - Allow reexporting from wrapped esms. (denoland/deno#8959, denoland/deno#9200)
 - Fix statement orderings. (denoland/deno#9250)
 - Emit injected items as early as possible. (denoland/deno#9250)
 - Respect `external_modules`. (#1338)
 - Fix cjs suppport. (#1328)

swc_ecma_transforms_base:
 - hygiene: Fix for hoisting. (denoland/deno#9212)
2021-01-25 21:15:42 +09:00
강동윤
947f9c5641
fix(es/ast): Fix EqIgnoreSpan (#1360)
swc_ecma_ast:
 - Make `EqIgnoreSpan`  impl of` StrKind` always return true.
2021-01-25 18:14:34 +09:00
강동윤
2921b903d7
fix(es/ast): Compilation (#1357)
swc_ecma_ast:
 - Fix compilation.
2021-01-25 11:32:09 +09:00
강동윤
b7ae896bbd
fix(es): Fix bugs (#1353)
swc_ecma_transforms_compat:
 - Handle all accesses to private class properties. (#1333)
 - block_scoping: Inject variable correctly. (#1231)
 - Handle async arrow function correctly. (#1341)
2021-01-23 20:52:53 +09:00
강동윤
d4df2cece8
fix(es): Fix bugs (#1347)
swc_ecma_parser:
 - Do not emit strict mode error while backtracking. (#1252)

swc_ecma_transforms_proposal:
 - Handle decorator on methods with computed key.
2021-01-23 15:46:42 +09:00
강동윤
6a1c3da326
fix(bundler): Fix bugs (#1346)
swc_bundler:
 - Fix keywords pass.

swc_ecma_transforms_optimization:
 - Remove `dbg!`.
 - `constant_propagation`: Inline only injected variables.
2021-01-22 18:39:57 +09:00
강동윤
0469e3a33e
fix(es): Move and rename JscTarget (#1343)
swc_ecma_ast:
 - Add `EsVersion`.

swc_ecma_parser:
 - Remove `JscTarget`.
 - Reexport `EsVersion` as `JscTarget`.
2021-01-20 19:43:56 +09:00
강동윤
17f17e82e6
fix(bundler): Fix bugs (#1342)
swc_bundler:
 - Add a testing system for constant inliner.

swc_ecma_transforms_optimization:
 - const_propagation: Handle export specifiers.
 - const_propagation: Handle inlining of variables whose initializer is inlined.
 - dce: Allow dropping identifiers used in `exported` part of export specifiers.
2021-01-20 16:10:12 +09:00
강동윤
ddc9492aed
fix(es/transforms): Handle enum in namespaces (#1340)
swc_ecma_transforms_typescript:
 - Handle enums in namespaces. (#1329)

swc:
 - Exclude files based on .swcrc.
2021-01-18 23:00:53 +09:00
강동윤
613a5a45dd
fix(es): Fixes for the type checker (#1331)
swc_ecma_codegen:
 - Fix codegen of typescript interfaces.

swc_ecma_transforms_base:
 - ts_resolver: Handle ts module declarations.
2021-01-15 21:12:16 +09:00
강동윤
3faefb5836
feat(es): TypeScript 4.2 (#1330)
swc_ecma_ast:
 - Add `is_abstract` to constructor types.

swc_ecma_codegen:
 - Fix codegen of `Bool`.
 - Implement codegen for abstract constructors.

swc_ecma_parser:
- Inline tsc parser test suite.
- Implement parsing of abstract constructor types.
2021-01-15 19:30:44 +09:00
강동윤
a9bf9bb9e1
fix(swc): Fix bugs (#1300)
swc_ecma_codegen:
 - Handle unicode escape sequences when target is es5. (#1227, #1326)

swc_ecma_transforms_compat:
 - Handle template literals correctly. (#1314)
 - Handle private class properties correctly. (#1306)

swc:
 - Don't panic on `export * as foo from 'foo'`. (#1307)
2021-01-14 21:56:25 +09:00
강동윤
6984217200
feat(ES/transform/typescript): Support namespace (#1325)
swc_common:
 - Update `serde`.

swc_ecma_transforms_typescript:
 - Add support for namespace.
2021-01-12 21:59:42 +09:00
강동윤
23aebacade
fix(bundler): Fix bundler (#1318)
swc_bundler:
 - Use two-context system properly.
 - Remove old logic.
 - keywords: Handle assignment pattern property.
 - keywords: Handle shorthand property.
 - keywords: Handle identifiers in declarations.

swc_ecma_transforms_typescript:
 - Do not remove import if there's non-type usage. (Related to denoland/deno#8978)

swc_ecma_transforms_optimization:
 - dce: Handle new expression correctly.
2021-01-11 19:38:20 +09:00
강동윤
dc0d226684 Update cargo.toml 2021-01-05 21:55:00 +09:00
강동윤
c83d19eb2f
feat(ecmascript): Remove macros (#1319)
swc_ecma_ast:
 - Drop dependency on `enum_kind`.

swc_ecma_parser:
 - Remove `swc_ecma_parser_macros`.
2021-01-05 21:39:24 +09:00
강동윤
842b6f953c
fix(ecmascript/transforms): Fix dce (#1301)
swc_bunder:
 - Fix `keywords` pass.

swc_ecma_codegen:
 - Ensure that the code generator handles unicode characters properly. (denoland/deno#8925)

swc_ecma_parser:
 - Ensure that the parser handles unicode characters properly. (denoland/deno#8925)

swc_ecma_transforms:
 - Fix dce.
2021-01-05 18:45:26 +09:00
강동윤
5d515d9ced Fix deps 2021-01-05 14:59:53 +09:00
강동윤
76d9e2a9df
feat(ecmascript/transforms): Split into multiple crates. (#1311) 2021-01-05 14:29:52 +09:00
강동윤
682661d9a9 Fix 2021-01-01 13:38:44 +09:00
강동윤
35cac79f48
Publish swc crate (#1308) 2021-01-01 13:30:35 +09:00
Boris
d638fc32cc
Add tests to cover comments in regex pattern (#1303) 2020-12-30 23:13:26 +09:00
강동윤
254efc4d54 Bump version 2020-12-29 13:04:20 +09:00
Maxime Guerreiro
9063908528
feat(ecmascript/codegen): fix and use omit_trailing_semi (#1298)
swc_ecma_codegen:
- Use omit_trailing_semi in 'assert_min' tests, to identify bugs. Before this,
  no code was using this method - and it had some serious bugs.
- Omit semicolons when writing punctuation, as it's permitted to do so.
- Use two macros ('semi', 'formatting_semi') to distinguish between required
  semicolons, as used in for(...), and optional ones that are used between
  statements.

This commit does not enforce the use of omit_trailing_semi when cfg.minify is
used (except in tests using assert_min), and as such should not modify the
behavior of existing apps. This is confirmed by the Test262 suite passing
without changes.

Co-authored-by: 강동윤 <kdy1@dudy.kr>
2020-12-29 11:56:38 +09:00
강동윤
ba13db54db
fix(bundler): Fix remaining bugs (#1296)
swc_bundler:
 -  Allow `export *` and `import` from same source. (denoland/deno#8828, denoland/deno#8725)
 -  Handle contextual keywords. (denoland/deno#8680)
 -  Prevent duplicated identifiers. (denoland/deno#8725)

swc_ecma_transforms:
 - dce: Preserve tags in tagged template literals. (denoland/deno#8746)
 - dce: Handle throw statement correctly. (denoland/deno#8736)
2020-12-28 19:53:40 +09:00
강동윤
b66ee58ee3
fix(bundler): Fix statement ordering issue (#1264)
swc_bundler:
 - Reduce binary size by reducing usage of visitor / folders.
 - Handle `export *` and `export { default }` from same source. (denoland/deno#8530, denoland/deno#8679)
 - Fix ordering of statements. (denoland/deno#8545)
 - Sort statements in wrapped modules. (https://github.com/denoland/deno/issues/8211#issuecomment-741070299)
 - Exclude default export while handling `export *`.
 - Exclude `export { default }` and `export { foo as default }` while handling `export *`.
 - Make statements from same module to be injected together. (denoland/deno#8620)

swc_ecma_transforms:
 - fixer: Handle assignments in the callee of `new`  correctly.
 - fixer: Handle seqence expression in the callee of `new`  correctly.
2020-12-27 19:02:41 +09:00
강동윤
6941f29943
fix(swc): Fixes for typescript type checker (#1146)
swc_ecma_codegen:
 - Fix codegen of `TsConstructorSignature`.
 - Fix codegen of `TsIndexSignature`.
 - Fix codegen of type parameters in arrow expressions.
 - No panic on dummy span.

swc_ecma_parser:
 - Parse optoinal method correctly.

swc_ecma_transforms:
 - resolver: Handle type parameters in arrow expressions.
2020-12-27 18:18:30 +09:00
강동윤
08c5d83d20 Bump version 2020-12-27 13:22:02 +09:00
강동윤
34249bbf47
feat(ecmascript/ast): Add EqIgnoreSpan and TypeEq (#1295) 2020-12-27 13:11:44 +09:00
Boris
c2a99944cf
feat(ecmascript/parser): Add tests for binding patterns (#1289) 2020-12-22 14:12:33 +09:00
강동윤
8a8db58f1c
fix(ecmascript): Fix bugs related to string literals (#1287)
swc_ecma_ast:
 - Add `Str.kind`.

swc_ecma_transforms:
 - Fix quotes in template literals. (#1280)

swc_ecma_codegen:
 - Fix escape of single quotes. (#1259)
 - Fix codegen of wrong escapes. (#1276)

swc:
 - Ensure that #1271 is about napi's deserialization.
2020-12-22 04:27:18 +09:00
Liam Murphy
576fb6a532
fix(ecmascript/lexer): Normalize \r\n and \r to \n in template literals (#1286)
swc_ecma_parser:
 - Normalize \r\n and \r to \n in template literals.

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-12-21 17:56:17 +09:00
Liam Murphy
b760c7c9c7
fix(ecmascript/codegen): TsQualifiedName has trailing dot (#1268)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-12-20 22:27:31 +09:00
강동윤
0ead8dc403
fix(ci): Fix ci (OOM & library api change) (#1284) 2020-12-20 21:31:00 +09:00
강동윤
bf69b47791
fix(ecmascript/parser): Fix span of declare decls. (#1282)
swc_ecma_parser:
 - Include `declare` span. (#843)
2020-12-19 23:48:13 +09:00
강동윤
25856f230c
feat(parser): Don't hang on unexpected inputs (#1274)
swc_ecma_parser:
 - Don't hang on unexpected inputs. (#1272, denoland/deno#8719)
2020-12-14 16:37:11 +09:00
강동윤
ccf4c2b12c
feat(fixer): Handle ?? properly (#1270)
swc_ecma_transforms:
 -  Handle `??` properly. (denoland/deno#8722)
2020-12-12 17:45:54 +09:00
David Sherret
7a46c8844e
Implement Spanned for TokenAndSpan (#1269)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-12-12 12:45:22 +09:00
강동윤
03f9b93f58
Fix bundler (#1247)
swc_bundler:
 - Handle indirect wrapped es modules. (denoland/deno#8597, denoland/deno#8625)
 - Respect `export { foo }`. (denoland/deno#8626)

swc_ecma_parser:
- Allow `??=`, `||=`, `??=` in non-ts modules. (denoland/deno#8627)

swc_ecma_transforms:
 - Make `hygiene` check if a variable with expanded name exists. (denoland/deno#8620)
 - Handle `??=` correctly.
2020-12-09 14:23:44 +09:00
Luca Casonato
8ba2ae959d
feat: specifier position in DependencyDescriptor (#1260)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-12-09 11:27:09 +09:00
강동윤
2e29d78281
fix: Decorator metadata (#1248)
swc_ecma_transforms:
 - Emit proper typename for `design:type` used with enum. (#1160)
2020-12-04 05:03:26 +09:00
강동윤
faa1c5f4e5
Fix bugs (#1241)
swc_ecma_codegen:
 - Print multiline string correctly. (#1233)

swc_ecma_transforms:
 - `optional_chaining`: Ensure that #1149 is fixed. (#1149)
 - `async_to_generator`: Remove method parameters. (#1215, #1235)
 - `regenerator`: Don't emit useless expressions. (#1125)
 - `regenerator`: Track `finally` properly. (#1125)

spack:
 - LRU cache for resolver.
2020-11-30 19:20:21 +09:00
강동윤
ea6beaa06d
Fix bundler (#1242)
swc_ecma_codegen:
 - Fix codegen of unicode escapes. (denoland/deno#8541)

swc_bundler:
 - Allow importing a module multiple time. (denoland/deno#8530)
2020-11-30 18:21:34 +09:00
강동윤
f8a1fb878d
fix(regenerator): Handle ternary correctly (#1228)
swc_ecma_transforms:
 - Fix interaction between ternary and await. (#1216)

testing_macors:
 - Fix for `--lib` tests.
2020-11-24 02:54:18 +09:00
강동윤
25f2ff1a45 Bump version 2020-11-22 18:17:55 +09:00
강동윤
6888c69bda
Fix codegen: preserve input (#1221)
swc_ecma_codegen:
 - Preserve input. (#1204)
2020-11-21 02:04:29 +09:00
강동윤
4294b5e7ba
bundler: Fix issues (#1212)
swc_bundler:
 - Bundler rework. (denoland/deno#6802)
 - Reexports are not transitive. (denoland/deno#8246)
 - Dependencies of module with circular dependency. (denoland/deno#8302)
 - Order of injection between import vs export. (denoland/deno#8302)
 - `export *` in wrapped modules. (denoland/deno#8308, denoland/deno#8399)
 - `export { a as b }` in wrapped modules.
 - Fix denoland/deno#8314.
 - Fix denoland/deno#8325.
 - Fix denoland/deno#8344.
 - Make deno test verify exported names. 
 - Handle `export * from './foo'`.

swc_ecma_parser:
 - Don't panic on private name in interface (Closes #1211)

swc_ecma_transforms:
 -  dce: Prevent infinite loop
 -  Faster constant propagation pass.
2020-11-19 20:42:56 +09:00
Brad Dunbar
4327d91fe3
BigInt literal keys (#1192) 2020-11-15 01:22:35 +09:00
강동윤
af0b0a9ab1
Fix fixer (#1207)
swc_ecma_transforms:
 - fixer: Don't unwrap paren if there's a comment for inner node.
2020-11-08 10:59:36 +09:00
강동윤
0a5e23f97c
bundler: Handle swc helpers (#1199)
swc_bundler:
 - Handle helpers from `swc_ecma_transforms`.

swc_ecma_transforms:
 - dce: Remove unused self-referential functions.
2020-11-05 09:53:18 +09:00
강동윤
f21a28844d
resolver: handle class declarations (#1200)
swc_ecma_transforms:
 - resolver: Handle class declarations (denoland/deno_lint#463)
2020-11-03 01:30:21 +09:00
강동윤
bae0eda8bd
Fix bundler (#1194)
swc_bundler:
 - Remove wrong assertion. (denoland/deno#8148)
 - Remove wrong variables created on reexports. (denoland/deno#8188)

swc_ecma_transforms:
 - inlining: Treat usage as an argument as writes. (denoland/deno#8180)
 - inlining: Visit rhs of `||` and `&&`. (denoland/deno#8189)
2020-10-30 14:49:02 +09:00
Pig Fang
11dbc1406c
TypeScript 4.1: intrinsic keyword (#1193)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-29 18:37:22 +09:00
Pig Fang
5ef993d9b2
TypeScript 4.1: template literal type (#1190)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-29 17:27:35 +09:00
강동윤
a368f66e77 Bump version 2020-10-29 15:44:12 +09:00
강동윤
32b3bbd50b
Emit only ascii (#1191)
swc_ecma_codegen:
 - Emit only ascii characters. (#1187, #1188)
2020-10-29 14:33:33 +09:00
강동윤
b2aec35eb6
Fix issues (#1189)
swc_bundler:
 - Support emitting iife. (Closes #1184)

swc_ecma_parser:
 - Auto-detect script / module (Closes #1164)
 - lexer: Error recovery for strict mode and module mode.
 - More error recovery logic for strict mode violation.
 - Fix panic on invalid input. (Closes #1170)
2020-10-28 21:20:11 +09:00
Brad Dunbar
667a8c72c0
Single argument arrow functions (#1186)
swc_ecma_codegen:
 - Remove parens from arrow functions when possible.
 - Remove space after prop keys when minifying.
 - Remove line break after expressions when minifying.
 - Remove space after generator `*` when minifying.
2020-10-27 15:08:05 +09:00
Brad Dunbar
6e9d06e95a
codegen: Preserve space for postfix unary operators (#1185)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-25 17:38:27 +09:00
Frederik Wessberg
6b03c659ca
transforms: fix _typeof helper 2020-10-24 23:26:13 +09:00
강동윤
6ba64ed359 Bump version of swc_ecmascript 2020-10-20 22:17:28 +09:00
강동윤
cf01ec8277 Bump version 2020-10-20 22:09:52 +09:00
Brad Dunbar
26c530b133
Invalid template escape in ES2018+ (#1175)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-20 00:17:20 +09:00
Brad Dunbar
fd760fbf09
parser: Remove unnecessary question mark (#1174) 2020-10-19 11:19:56 +09:00
강동윤
626c881c98
bundler: Fix ordering (#1171) 2020-10-16 22:26:18 +09:00
강동윤
11d137ac11
ast: Add support for fuzzing (#1167)
swc_common:
 - Add support for fuzzing.

swc_ecma_ast:
 - Add support for fuzzing.
2020-10-15 14:58:11 +09:00
강동윤
a5e6242601 Bump version 2020-10-14 14:39:51 +09:00
Pig Fang
aded151b8f
[typescript] 4.1 mapped type 'as' clause (#1151)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-13 16:44:05 +09:00
강동윤
5a91ab994c
bundler: Fix dead code elimination (#1157)
swc_bundler:
 - Fix dce bug. (#1156)

swc_ecma_transforms:
 - resolver: Ignore non-computed class properties.
 - dce: Handle usages in class property initializers.
2020-10-12 00:36:44 +09:00
강동윤
f0ea70cb25
bundler: Allow importing and exporting from same module (#1152)
swc_bundler:
 - Allow importing and exporting from same module. (#1150)
2020-10-09 19:10:25 +09:00
강동윤
75a6211e2d
Fix hygiene and bundler (#1144)
swc_bundler:
 - Change order of execution of modules with circular imports. (#1139)

swc_ecma_transforms:
 - hygiene: Fix handling of default in object patterns. (#1138)
2020-10-07 14:55:02 +09:00
강동윤
0586c733e3
Fix bugs (#1143)
swc_ecma_transforms:
 - fixer: Fix conditional expression in await expressions. (#1133)
 - optional_chaining: Fix call expression. (#1136)
 - hygiene: Fix codegen of computed keys. (#1140)
2020-10-06 23:27:23 +09:00
강동윤
e4ddfcc899
export * as ns is part of ES2020 (#1142)
swc_bundler:
 - Add direct support for `export * as ns from 'foo';`. (#1137)

swc_ecma_transforms:
 - Split `export` pass to `export_namespace_from` and `export_default_from`.

swc:
 - Enable `export * as ns` for targets lower than es2020.
2020-10-06 20:48:29 +09:00
강동윤
aa9555865b
Fix bugs (#1132)
swc_ecma_transforms:
 - Handle typescript class properties correctly. (#1122)
 - Handle optional chaining properly. (#1130)
 - Inject variables for nullisn coalescing in correct scope. (#1123)
2020-10-04 21:59:19 +09:00
강동윤
205ce4ebe2
bundler: fix extra bugs (#1127)
swc_bundler:
 - Prevent invalid output like `export * as helpers`
 - Prevent stack overflow which occurs while bundling `https://deno.land/x/oak@v6.2.0/mod.ts`

swc_ecma_transforms:
 - Migrate inlining pass to VisitMut
2020-10-04 00:19:35 +09:00
Nayeem Rahman
e4b8a0cc1e
fix(strip): Don't treat type-only exports as concrete references (#1126)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-03 17:43:09 +09:00
Juho Vepsäläinen
ea091337d8
fix(jsx): Drop extra spaces around jsx attributes (#1121)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-10-02 17:06:02 +09:00
강동윤
9879fa59c8
bundler: fix bugs (#1105)
swc_bundler:
 - Correct lca for circular dependencies.
 - Handle namespaced imports. (#1109)
 - Handle namespaced reexports. (#1110)
 - Handle shorthand properly. (#1111)
 - Implement `import.meta` (#1115)
 - Handle reexport mixed with imports correctly. (#1116)
 - Handle export default decls in computed-key modules. 
 - Remove all export * from. output. (#1118)
 - Handle export of class or function declaration in a computed module properly. (#1119)


swc_ecma_transforms:
 - Do not rename class members. (#1117)
2020-10-02 11:07:40 +09:00
강동윤
1f00d9ba26
Fix jest extension (#1106) 2020-09-24 19:49:12 +09:00
강동윤
ab8df21797
Fix optional chaining in argument position (#1104) 2020-09-24 15:14:30 +09:00
Nayeem Rahman
a9c3072b65
fix(strip): Fix Config::import_not_used_as_values (#1101)
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-09-23 22:52:47 +09:00
강동윤
73671ecd90
chores: Bump version of wasm (#1102) 2020-09-23 21:44:51 +09:00