Commit Graph

258 Commits

Author SHA1 Message Date
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
강동윤
ff440d47a4
chore: Organize project (#1849) 2021-06-24 17:01:21 +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
강동윤
f4249574da
feat(ci): Track binary size and performance (#1840) 2021-06-23 10:50:27 +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
강동윤
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
강동윤
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
강동윤
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
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
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
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
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
강동윤
6888c69bda
Fix codegen: preserve input (#1221)
swc_ecma_codegen:
 - Preserve input. (#1204)
2020-11-21 02:04:29 +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
강동윤
6c6f1aaaa3
Fixs bugs (#1095)
spack:
 - fix resolver. (#1076)

swc_common:
 - preserve original sourcemap. (#1091)

swc_ecma_transforms:
 - optional chaining: `a?.b.c.d.e`. (#1092)
 - fixer: preserve parenthesis in `(a || b)()`. (#1093)
 - compat::es2015: Change order of passes (#1036)
2020-09-22 16:39:00 +09:00
강동윤
2fff66d985
codegen: Don't emit newline after a block comment (#1062) 2020-09-11 15:09:35 +09:00
강동윤
3a26d3d34d
Do not rename keywords in meta properties (#1053) 2020-09-09 15:16:44 +09:00
강동윤
0ac55ae68b
Improve ux for rust users (#909)
testing:
 - Remove dependency on relative_path

swc_common:
 - Span's byte positions are now self-contained and `GLOBALS` is not required while parsing.
 - Changed `Comments` into a trait.
 - Provide single-threaded implementation of `Comments`
 - Cargo feature `tty-emiiter` (To remove tty related stuffs )
 - Cargo feature `sourcemap` (To remove sourcemap for web assets)
 - Removed dependency on dashmap

swc_ecma_parser:
 - No duplicated comments.
 - Removed dependency on once_cell and regex
 - Add a test suite to visualize and test span of nodes.

swc_ecma_utils:
 - Removed dependency on parser

swc:
 - Remove dependency on derive_more and path-clean
 - Add multi-threaded implementation of `Comments`

swc_ecmascript:
 - A new crate contains `ast`, `codegen`, `parser`, `utils`, `visit`.
2020-07-31 18:49:07 +09:00
강동윤
ca43112d2a
codegen: Preserve quotes (#911) 2020-07-28 21:56:19 +09:00
강동윤
ecd7b4decc
Implement more methods for codegen (#902)
swc_ecma_codegen:
 - implement emit_private_property (Closes #903)
2020-07-27 22:58:42 +09:00
강동윤
ea885df521
Fix bugs (#901)
swc_ecma_parser:
 - Accept `export type * from '../typings'` (#896)

swc_ecma_transforms:
 - Ensure that swc does not duplicate classes (#879)
2020-07-27 20:21:52 +09:00
강동윤
a1d33d023a
Improve ux using swc as a rust library (#893)
swc_ecma_parser:
 - Improve parser's error reporting story
 - Replace `Session`, `Handler`, `Emitter` with Parser.take_errors()
 - Expose `Error`
 - Remove useless lifetime parameters
2020-07-25 20:26:04 +09:00
강동윤
a2369be5b2
Fix random panic (#876) 2020-07-02 13:10:44 +09:00
강동윤
fcef201695
spack: super-fast bundler (#825)
Version is alpha as it's not complete
2020-06-13 23:09:45 +09:00
강동윤
28456d0b49
Default value for options.jsc.parser.syntax (#840) 2020-06-13 02:05:49 +09:00
강동윤
fce0917016
Fix bigint literals (#837) 2020-06-11 17:49:40 +09:00
강동윤
283825c91a
Fix typescript_strip and handle reserved word (#802) 2020-05-28 12:00:34 +09:00
강동윤
f1900da246
Fix .swcrc (env and error message) (#784)
FIx preset-env and better error message for invalid config
2020-05-19 20:24:00 +09:00
강동윤
71ea61e6c4
Make require of regenerator use global mark (#780) 2020-05-18 23:25:41 +09:00
강동윤
ddc5ace570
dce: Separate phase for dropping imports (#764) 2020-05-09 12:22:45 +09:00
강동윤
432d7993a3
Handle input source map (#734) 2020-03-27 14:40:01 +09:00
강동윤
c7b12cd408
Fix bugs (#718)
- Handle inline source map (Closes #706)
 - Fix parsing of conditional expression starting with async (Closes #706)
2020-03-13 23:34:36 +09:00
강동윤
6e028696a5
Faster sourcemap generation for large files (#697)
We buffer operations related to source map and make it fast using an assumption that the byte positions always increment while emitting a file.
2020-03-02 20:49:08 +09:00
강동윤
e709da9d55
Fix SourceMap (#672)
Previously, `SourceMap` (taken from rustc) has a bug which reuses start position when new_source_file is invoked concurrently.
2020-02-17 15:56:41 +09:00
강동윤
64ed0bd801
Validate sourcemap (#669) 2020-02-16 16:51:42 +09:00
강동윤
348052b017
Improve optimizer (#660)
Although it's quite naive at the moment, I added two optimization passes.

 - dead code elimination (Closes #607)
 - inlining
2020-02-13 11:45:14 +09:00
kdy1
82e73b1121 Fix bugs (#659)
- Strip out const assertions (Closes #656)
 - Fix exclude of the file matcher (Closes #658) 
 - Automatic typescript detection (Closes #655)
2020-02-12 15:07:45 +00:00
kdy1
add63826bd Allow await expression at other than expression statement (#636)
Fixes #635
2020-02-08 01:49:00 +00:00
dsherret
55c0258017 Remove empty expression in expression statement with top level await (#630)
Eats the semi-colon.

This doesn't compile (edit: doesn't compile the code in the tests) though because the target of that folder is ES2015. Also, this is kind of strange for me to put the tests in the "typescript" folder. Should we create something more general?

You can take over this PR if you'd like!
2020-02-07 05:33:26 +00:00
kdy1
0ebda3c33e hygiene / block scoping improvement (#608)
`hygiene` pass had a bug related to globally defined variables like `Object` or `undefined`. This pr make hygiene to utilize use-bind conflict to resolve global objects correctly.
Closes #605.

block_scoping pass had a bug with closure in for statement with let or const. This pr fixes it by extracting a loop body as a variable.
Closes #604.
2020-01-24 05:54:52 +00:00
kdy1
9be9ea2c43 hygiene: fix handling of special identifiers (#603)
The identifiers are `arguments`, `undefined`, `NaN`.

Closes #602.
2020-01-23 14:23:24 +00:00
강동윤
702800e0d9
Attach comments to correct node (#541) 2019-12-28 22:02:58 +09:00
강동윤
6fa85b646f
preset-env (#537)
swc_ecma_preset_env:
 - can inject polyfills automatically
 - can apply transforms automatically

swc:
 - added env config to .swcrc
2019-12-28 11:25:54 +09:00
강동윤
b1e4122b02
Nullish coalescing / optional chaining / comments (#529)
swc_ecma_ast:
 - rename `TsOptChain` to `OptChainExpr` (Fixes #525)
 - add `BinOp::NullishCoalescing`

swc_ecma_parser:
 - parse `??` (Fixes #526)

swc_ecma_transforms:
 - remap comments from fixer (Fixes #528)
2019-12-24 17:01:32 +09:00
강동윤
332061f44d
Parser: respect jsc.target (#507)
swc:
 - make parser respect `jsc.target`.
2019-12-14 18:51:08 +09:00
kdy1
3ec395ba75 Improve performance & update rustfmt (#504) 2019-12-13 06:21:25 +00:00
kdy1
0df908fdb4 ast & parser improvement (#502)
Parser can now parse typescript source code and rxjs.

Closes #468.
2019-12-11 14:28:35 +00:00
kdy1
fa98c470d6 Program instead of Module (#499)
This pr adds an option to parse file as script, not module.


Related: https://github.com/swc-project/swc/issues/491
2019-12-11 06:07:21 +00:00
강동윤
ae6de87abb
Add more tests (#489) 2019-12-09 21:02:51 +09:00
강동윤
153cf36168
Jsonify large pure object literals (#477)
swc_ecma_transforms:
 - add `jsonify` transform
2019-12-01 17:32:44 +09:00
강동윤
51558c6c36
Final groundwork for plugin (#474)
swc:
 - add serialization tests

ast_node:
 - handle `*` tag properly

swc_ecma_ast:
 - update serialization of ExprOrSpread
2019-11-30 11:12:34 +09:00
강동윤
a7a8a4a2e4
Plugin (#473)
swc_common:
 - apply patch from rust-lang/rust#59693

swc:
 - use &Options instead of Options
 - configures commons::CM
 - exposes `handler`
2019-11-29 23:46:06 +09:00
강동윤
747a07f566 Update submodules 2019-11-26 20:42:41 +09:00
강동윤
8c7005d7ab
More testing (#469)
swc:
 - Move tests from node-swc to swc
 - Add integration tests (webpack, rxjs, angular-core)
 - Support `exclude`
 
swc_ecma_transforms:
 - More span validation
 - classes:
    - Strip `TsIndexSignature`

swc_ecma_parser:
 - Fix span of member expression
 - Fix span of binary expression
 - Fix span of unary expression
2019-11-26 10:08:48 +09:00