Commit Graph

42 Commits

Author SHA1 Message Date
강동윤
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