Commit Graph

52 Commits

Author SHA1 Message Date
강동윤
098e48b8f3
fix(es/codegen): Preserve more comments ()
swc_ecma_codgen:
 - Print more comments. ()
2021-06-26 02:07:11 +09:00
muji
8d8b2d10d4
fix(es/parser): Fix parsing of line terminators ()
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2021-06-15 00:39:03 +09:00
강동윤
57d1aaf80f
fix(es): Fix various bugs ()
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. ()

swc_ecma_transforms_typescript:
 - Skip `export {}` if it was not a module. ()
 - Skip `export {}` if the result is module without it. ()
2021-05-17 22:27:59 +09:00
강동윤
b0b0709e1a
fix(es): Fix various bugs. ()
swc_ecma_codegen:
 - Emit comments of `BytePos(0)`. ()

swc_ecma_transforms_compat:
 - `classes`: Optimize class expresssions. ()
2021-05-09 14:23:03 +09:00
강동윤
5ce4e1e927
fix(es/parser): Use correct position for comments ()
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
강동윤
bc07215d4d
fix(es/parser): Fix lexing of template literals. ()
swc_ecma_parser:
 - Fix lexing of template literals. ()
 - Ensure that  is not a bug of parser.
2021-03-03 17:46:36 +09:00
강동윤
8a8db58f1c
fix(ecmascript): Fix bugs related to string literals ()
swc_ecma_ast:
 - Add `Str.kind`.

swc_ecma_transforms:
 - Fix quotes in template literals. ()

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

swc:
 - Ensure that  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 ()
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
강동윤
faa1c5f4e5
Fix bugs ()
swc_ecma_codegen:
 - Print multiline string correctly. ()

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

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

swc_bundler:
 - Allow importing a module multiple time. ()
2020-11-30 18:21:34 +09:00
강동윤
6888c69bda
Fix codegen: preserve input ()
swc_ecma_codegen:
 - Preserve input. ()
2020-11-21 02:04:29 +09:00
강동윤
32b3bbd50b
Emit only ascii ()
swc_ecma_codegen:
 - Emit only ascii characters. (, )
2020-10-29 14:33:33 +09:00
강동윤
2fff66d985
codegen: Don't emit newline after a block comment () 2020-09-11 15:09:35 +09:00
Bartek Iwańczuk
9cb32cbb75
fix: readonly is not stripped from private prop ()
swc_ecma_codegen:
 - Fix printing logic of literals and template literals
 - Fix printing of hex

swc_ecma_parser:
 - Track raw string correctly

swc_ecma_transforms:
 - typescript: Handle class properties (readonly)
 - typescript: Handle enums inside function

Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-07-30 22:40:43 +09:00
강동윤
ca43112d2a
codegen: Preserve quotes () 2020-07-28 21:56:19 +09:00
강동윤
c0917839a5
Add empty to class member () 2020-07-05 20:10:33 +09:00
강동윤
38adc49e7e
Bugfixes ()
swc_common:
 - Fix new_source_file

swc_ecma_parser:
 - Fix parsing of paren expr in lhs of an assignment
2020-07-01 16:31:55 +09:00
강동윤
fcef201695
spack: super-fast bundler ()
Version is alpha as it's not complete
2020-06-13 23:09:45 +09:00
Vladimir Guguiev
ab7c9b1287
Implement codegen of export foo as Foo from foo; ()
Co-authored-by: 강동윤 <kdy1997.dev@gmail.com>
2020-06-03 11:05:29 +09:00
강동윤
65f2faa339
Reduce stack usage () 2020-05-17 18:50:52 +09:00
강동윤
e448a8910c
Fix bugs ()
- The parser now supports parsing optional patterns in .d.ts files (Closes )
 - The source map is handled properly (Closes , Closes )
2020-03-09 21:18:41 +09:00
강동윤
6e028696a5
Faster sourcemap generation for large files ()
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
강동윤
64f6e51b42
Unescape template literals before emitting. ()
Fixes .
Fixes .
2020-02-11 13:33:29 +09:00
강동윤
1bcfcb741a
Fix () 2020-01-03 12:19:39 +09:00
강동윤
916858ae81
Bugfixes ()
swc_ecma_ast:
 - fix TsExprWithTypeArgs (closes )

swc_ecma_codegen:
 - allow using default import with namespace import (closes )

swc_ecma_parser:
 - parse import.meta (closes )
2020-01-01 06:57:34 +09:00
David Sherret
708efebac9 Fix comment line's end to be on same line ()
- fix comment line's end to be on same line.
2019-12-30 11:09:45 +09:00
강동윤
702800e0d9
Attach comments to correct node () 2019-12-28 22:02:58 +09:00
강동윤
30af06bb70
Ast ()
swc_ecmascript:
 - add `ExprStmt`.
 - change type of regex.expression and regex.flags.
2019-12-16 18:08:21 +09:00
강동윤
b3a2ee8e9b
Fix bugs ()
swc_ecma_parser:
 - fix lexing of numbers like 9.09

swc_ecma_transforms:
 - jsx_text_to_str
 - use fxhash instead of ahash for exports
2019-12-02 20:19:15 +09:00
강동윤
a7a8a4a2e4
Plugin ()
swc_common:
 - apply patch from 

swc:
 - use &Options instead of Options
 - configures commons::CM
 - exposes `handler`
2019-11-29 23:46:06 +09:00
강동윤
3474c61a48
Fix codegen and parsing of template literal ()
- Fix codegen and parsing of template literal ()
2019-11-18 19:54:24 +09:00
강동윤
2bd4475c5d Fix codegen tests 2019-09-20 23:39:19 +09:00
강동윤
7715c2626b
Issues (, , ) ()
swc_ecma_transforms:
 - fix mis-referencing caused by destructuring ()
 - fix invalid code generated by comment on arrow functions ()
 - fix string concatation of template literal ()
 - hygiene: fix rewriting of object pattern
 - fix test module to prevent SIGILL
 - fix module import order (using IndexMap)
2019-09-18 14:40:22 +09:00
강동윤
1b28766c26
Improve comment api ()
swc_ecma_parser:
 - parser now take comments by reference
2019-02-26 13:56:58 +09:00
강동윤
b27829825e
Fix Bugs ()
swc_ecma_codegen:
 - escape characters ()

swc_ecma_parser:
 - fix parsing of `<!--`

swc_ecma_transforms:
 - promote VarCollector to crate-level utility
 - fix es3::member_expr_lits ()
 - fix es2015::duplicate_keys pass ()
 - improve fixer (paren for assignment) ()
 - improve fixer (arrow expression) ()
 - make typescript pass strip out type-only exports ()
2019-02-14 11:03:06 +09:00
강동윤
c647cf1bc0
Fix bugs ()
swc_ecma_parser:
 - fix lexer
 - better error reporting for jsx reference test

swc_ecma_codegen:
 - Update references
2019-02-13 16:03:38 +09:00
강동윤
fc661f24f0
Bugfixes ()
swc_ecma_ast:
 - rename ast to be consistent
2019-02-13 08:18:19 +09:00
강동윤
227423d5f6
Export default from & fix codegen of imports ()
swc_ecma_ast:
 - Support `export v from 'foo';`

swc_ecma_parser:
 - Support `export v from 'foo';`

swc_ecma_codegen:
 - Fix codegen of side-effect imports
2019-02-12 15:30:11 +09:00
강동윤
43d633b44d
Handle comments and improve codegen ()
swc_ecma_codegen:
 - Improve codegen
 - Handle comments

swc_ecma_parser:
 - Handle comments
2019-02-08 13:00:58 +09:00
강동윤
ba0c7c908c
Improve swc_ecma_trnasforms ()
# swc_ecma_ast
 - Add PrivateName to Expr

# swc_ecma_parser
 - Fix parsing of private name

# swc_ecma_transforms

## Hygiene
 - It correctly tracks `BindingIdentifer` / `IdentifierReference`
 - Preserve `IdentiferReference` if it conflicts with a `BindingIdentifier`

## Block scoping
 - It correctly tracks `BindingIdentifer` / `IdentifierReference`


## Fixer
 - It removes useless parens.
 - It removes useless `IdentiferReference`s in comma expressions.

## Classes properties
 - public prooperty
 - private property

## Class decorators
 - implemented
2019-01-29 23:56:16 +09:00
강동윤
ea610c6ded
Typescript & parser for decorators
swc_atoms:
 - add some atoms

swc_ecma_ast:
 - ast nodes for typescript
 - `ClassMethod` -> `Method`, `ClassMethodKind` -> `MethodKind`
 - private class method / class property
 - use separate type for tagged template literals
 - add `declare` field to `Decl`s
 - make function body optional

swc_ecma_parser:
 - rename Type to TokenContext
 - support decorators
 Note: error reporting for invalid decorator is not implemented yet
 - merge `Config` into `Syntax`
 - Use DiagnosticBuilder for error type
This is to make backtracking cheaper.

swc_ecma_transforms:
 - add `strip` pass
2019-01-07 19:43:47 +09:00
강동윤
4d4e4ce979
Implement object rest / spread ()
swc_ecma_parser:
 - improve parser's tests
It now shows the code failed to parse
 - allow rest pattern in catch clause
 - fix parsing of named export (semicolon)

swc_ecma_transforms:
 - implement array spread
 - add helper methods (objectWithoutProperties)
 - add some fast paths
 - make es2015::parameters handle catch clauses
 - don't show helpers when execution failed
 - export fixer
2018-12-26 17:09:48 +09:00
강동윤
4ff6d4ed4a
Performance & Node binding ()
swc_common:
 - update rustc-ap crates to v313

swc_ecma_ast:
 - use bool instead of Option<Span>


swc_ecma_parser:
 - remove LexerInput
 - use uncons_while
 - assert only on debug mode
 - use Visit instead of Fold while verifying
 - replace debug! with trace!
 - disable logging while benchmarking
 - drop slog

swc_ecma_transforms:
 - classes: fold Decl instead of Stmt

swc:
 - add nodejs binding
2018-12-21 16:54:36 +09:00
강동윤
ab7d46c5bc
Es2015 ()
swc_common:
 - implement VisitWith for &T and [T]

swc_ecma_ast:
 - fix codegen of `===`

swc_ecma_parser:
 - fix parsing of array pattern


swc_ecma_transforms:
 - implement es2015::destructuring
 - implement es2015::computed_properties
 - implement es2015::duplicate_keys
 - implement es2015::parameters
 - fix `InjectHelper` pass

Note that getters / setters in class are not supported yet

 - Run execution tests via jest
 - ignore es2016::exponentation tests
2018-11-28 12:24:08 +09:00
강동윤
33d296af31
block scoped function and tagged template literal ()
swc_ecma_transforms:
 - implement es2015::block_scoped_functions
 - implement tagged template literal without escape handling
 - hygiene: rename to different number
 - scope: handle pattern by folding children


swc_ecma_ast:
 - use Str instead of String for template literal

swc_ecma_parser:
 - fix lexer tests
 - handle template literal correctly
template literals now have cooked field


swc_ecma_codegen:
 - escape newline character and backslash ('\')
2018-11-25 11:31:48 +09:00
강동윤
7c58b89571
Scope analysis via ident hygiene ()
testing:
 - preserve context of the span in `::testing::DropSpan`

swc_ecma_codegen:
 - disable get_text_of_node to avoid deoptimization

swc_ecma_transforms:
 - allow using this inside arrow expression
 - implement es2015::block_scoping with hygiene ident
2018-11-23 19:22:07 +09:00
강동윤
4f1dc24e40
Update deps ()
* constructor codegen

* Update string_cache to 0.7

* make swc_common not depend on sourcemap

* Remove unused dependencies

* update either to 1.5.0

* update rustc-ap crates to 297

* remove unused dependency (fnv)
2018-11-16 11:56:04 +09:00
강동윤
7b56b0bc74
Improve codegen ()
* travis: make it faster

* better codegen

* Move enable_comments field to config
2018-11-15 21:43:04 +09:00
강동윤
5cf15cb40f
Fix tests by updating references () 2018-11-14 21:36:37 +09:00
강동윤
9a5de4beb6
More transcompilers ()
transforms:
 - implement String.length simplifier
 - implement more arithmetic operations
 - new Date() is side-effect free
 - implement left.rhs * right
 - optimize `SeqExpr` while creation
 
 - implement es3 - member expression literals pass
 - implement es2015 - classes pass

codegen: 
 - handle infinity correctly
 - disable comments for testing (it's buggy)

ast:
 - add methods about reserved words
2018-11-14 19:40:46 +09:00