Commit Graph

379 Commits

Author SHA1 Message Date
westhide
e9fdac216c
fix(es/codegen): Skip space if jsx attrs is empty (#6823) 2023-01-16 15:23:28 +00:00
SWC Bot
a5707ae7c1 chore: Publish crates 2023-01-15 06:45:26 +00:00
SWC Bot
cd06479a43 chore: Publish crates 2023-01-11 03:00:59 +00:00
SWC Bot
52dada97ff chore: Publish crates 2023-01-10 06:03:34 +00:00
Donny/강동윤
3f0f664c48
fix(es/codegen): Skip lo of a program if body is not empty (#6773)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6767.
2023-01-10 06:01:14 +00:00
SWC Bot
478b1fe458 chore: Publish crates 2023-01-10 05:10:48 +00:00
magic-akari
019cf37199
feat(es/typescript): Support const modifier on type parameters (#6672)
**Related issue:**

 - https://github.com/microsoft/TypeScript/pull/51865.
2023-01-10 05:08:29 +00:00
SWC Bot
a225efe363 chore: Publish crates 2023-01-08 04:59:27 +00:00
Justin Ridgewell
2b503c16d5
fix(es/codegen): Fix LineCol calculation of printed files (#6763)
**Description:**

There were several issues with the way we updated the current `LineCol` position during the printing of the generated file:

- We used `chars` and `char_indices` (UTF-32) instead of `encode_utf16` (UTF-16) chars.
- JS uses UCS-2 (basically UTF-16) for its strings, and source maps default to that implicitly.
- `\r` was incorrectly handled
  - it didn't add a `line_start`; only `\n` did
- `\r\n` was incorrectly handled
- It was trying to let the `\n` path handle the `line_start`, but it called
`chars.next()` which ate the `\n` char.

I also took the opportunity to avoid the `Vec` allocations and reduced some code duplication.

See the
[before](https://evanw.github.io/source-map-visualization/#ODEzAC8qKgogKiBmb28KICogQHBhcmFtIGRhdGEgZm9vCiAqIEByZXR1cm5zIGZvbwogKi8gZXhwb3J0IGNvbnN0IGZpeHVwUmlza0NvbmZpZ0RhdGEgPSAoZGF0YSk9PnsKICAgIGlmICh4KSB7CiAgICAgICAgcmV0dXJuIDEyMzsKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuIDQ1NjsKICAgIH0KfTsKCi8vIyBzb3V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2023-01-08 13:57:26 +09:00
SWC Bot
1161360d54 chore: Publish crates 2023-01-06 03:49:20 +00:00
SWC Bot
790c478a7a chore: Publish crates 2023-01-04 07:29:33 +00:00
SWC Bot
61245739ea chore: Publish crates 2022-12-21 03:03:05 +00:00
SWC Bot
913230d02a chore: Publish crates 2022-12-20 06:11:34 +00:00
SWC Bot
fa1b02bbd2 chore: Publish crates 2022-12-14 09:23:16 +00:00
SWC Bot
30692bc26c chore: Publish crates 2022-12-13 15:48:32 +00:00
SWC Bot
292c3388b5 chore: Publish crates 2022-12-13 07:31:37 +00:00
SWC Bot
581d9ce769 chore: Publish crates 2022-12-13 03:38:21 +00:00
SWC Bot
4d4406d5b3 chore: Publish crates 2022-12-12 02:40:19 +00:00
SWC Bot
2e50dd54e8 chore: Publish crates 2022-12-12 02:01:40 +00:00
Kevin Barabash
5c53a74f55
fix(es/codegen): Fix codegen of TypeScript mapped types (#6621) 2022-12-12 01:58:08 +00:00
SWC Bot
3d80fa4c25 chore: Publish crates 2022-12-10 00:55:14 +00:00
Alexander Akait
68d76afe5d
fix(es/codegen): Don't print trailing coma for a rest argument (#6610)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6589.
2022-12-10 00:51:11 +00:00
SWC Bot
fc21895bce chore: Publish crates 2022-12-10 00:09:46 +00:00
SWC Bot
9d0247a394 chore: Publish crates 2022-12-06 00:54:17 +00:00
SWC Bot
2379fc1fd9 chore: Publish crates 2022-12-04 05:55:52 +00:00
SWC Bot
cffa11122b chore: Publish crates 2022-12-03 00:26:38 +00:00
SWC Bot
ab2e19b601 chore: Publish crates 2022-12-02 08:01:39 +00:00
SWC Bot
912743aadb chore: Publish crates 2022-11-30 17:13:08 +00:00
SWC Bot
171733e8bb chore: Publish crates 2022-11-30 07:50:13 +00:00
SWC Bot
6ca36c198b chore: Publish crates 2022-11-29 06:00:22 +00:00
SWC Bot
5a9aab2392 chore: Publish crates 2022-11-28 16:00:01 +00:00
SWC Bot
96a1f93e91 chore: Publish crates 2022-11-28 07:54:59 +00:00
SWC Bot
553ba9c382 chore: Publish crates 2022-11-21 00:11:04 +00:00
magic-akari
1ca281a6cf
fix(es/codegen): Preserve parens for new in optional chaining (#6484) 2022-11-21 00:07:16 +00:00
SWC Bot
66b4966d60 chore: Publish crates 2022-11-20 23:40:48 +00:00
SWC Bot
40ad709523 chore: Publish crates 2022-11-20 10:06:27 +00:00
Alexander Akait
08a9e21b36
feat(es/codegen): Skip whitespaces for comments in minify mode (#6465)
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com>
2022-11-20 10:03:26 +00:00
SWC Bot
59954370cb chore: Publish crates 2022-11-20 00:30:30 +00:00
SWC Bot
e45c66535c chore: Publish crates 2022-11-18 07:19:26 +00:00
SWC Bot
2088dd4a84 chore: Publish crates 2022-11-11 22:50:50 +00:00
Donny/강동윤
6b876c4c4f
fix(es/resolver): Resolve interfaces correctly (#6387)
**Related issue:**

 - https://github.com/dudykr/stc/pull/245.
2022-11-09 06:28:58 +00:00
SWC Bot
9f685796c3 chore: Publish crates 2022-11-07 03:59:24 +00:00
Daiki Nishikawa
f6faeb3bad
fix(es/parser): Fix parsing of TS satisfies expressions (#6354) 2022-11-07 03:56:15 +00:00
SWC Bot
4293463bb6 chore: Publish crates 2022-11-03 04:55:30 +00:00
Donny/강동윤
0967e8f06d
chore(ci): Enforce clippy for all targets (#6299) 2022-10-31 16:59:29 +09:00
SWC Bot
a4546a4d22 chore: Publish crates 2022-10-28 01:27:37 +00:00
SWC Bot
09b296164c chore: Publish crates 2022-10-27 03:05:43 +00:00
Donny/강동윤
c3184463f1
fix(es/codegen): Preserve more parens (#6268)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6266.
2022-10-27 03:02:56 +00:00
SWC Bot
fd4b66ea8c chore: Publish crates 2022-10-27 01:25:04 +00:00
SWC Bot
51132f0636 chore: Publish crates 2022-10-27 00:19:24 +00:00
SWC Bot
2f05c3fd32 chore: Publish crates 2022-10-24 03:58:37 +00:00
SWC Bot
e2c1fcffd4 chore: Publish crates 2022-10-21 23:50:56 +00:00
SWC Bot
b79997ba02 chore: Publish crates 2022-10-21 09:11:29 +00:00
SWC Bot
3f648bdf0f chore: Publish crates 2022-10-20 08:59:26 +00:00
SWC Bot
0c23592d14 chore: Publish crates 2022-10-20 01:50:04 +00:00
SWC Bot
b48ec880fd chore: Publish crates 2022-10-19 04:00:51 +00:00
SWC Bot
a049ef058b chore: Publish crates 2022-10-18 14:51:39 +00:00
SWC Bot
fed888f822 chore: Publish crates 2022-10-17 08:33:49 +00:00
SWC Bot
c3ba51f48e chore: Publish crates 2022-10-15 23:59:27 +00:00
Kevin Barabash
083924c0e1
fix(es/codegen): Emit readonly for TsIndexSignature (#6172) 2022-10-16 08:56:56 +09:00
SWC Bot
1affcfe8e8 chore: Publish crates 2022-10-13 06:12:56 +00:00
SWC Bot
56da9981bb chore: Publish crates 2022-10-12 10:06:01 +00:00
SWC Bot
e37ced5bf4 chore: Publish crates 2022-10-12 01:55:47 +00:00
SWC Bot
dcb3a4371d chore: Publish crates 2022-10-11 23:55:24 +00:00
SWC Bot
5bf306565f chore: Publish crates 2022-10-11 11:23:16 +00:00
SWC Bot
018ca946e7 chore: Publish crates 2022-10-10 13:09:51 +00:00
SWC Bot
3171718e07 chore: Publish crates 2022-10-07 07:48:18 +00:00
IWANABETHATGUY
8003dc8563
feat(es/codegen): Remove the trailing comma of binding patterns (#6078) 2022-10-07 16:45:20 +09:00
SWC Bot
5f49ac012e chore: Publish crates 2022-10-06 11:38:55 +00:00
SWC Bot
d620ce60ff chore: Publish crates 2022-10-02 15:36:08 +00:00
Donny/강동윤
10fb645552
chore(ci): Merge CI scripts (#5999)
**Description:**

This PR merges CI scripts, and make integration tests use patched crates.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5540.
2022-09-30 16:57:15 +09:00
SWC Bot
2f626e95eb chore: Publish crates 2022-09-30 07:16:28 +00:00
Donny/강동윤
8b31b65059
fix(es/codegen): Improve performance of debug build (#6003) 2022-09-30 16:12:56 +09:00
OJ Kwon
af64217f19
build(cargo): Introduce workspace deps (#5997) 2022-09-30 13:43:32 +09:00
SWC Bot
c499e2054d chore: Publish crates 2022-09-28 22:57:51 +00:00
SWC Bot
1c9870a744 chore: Publish crates 2022-09-28 13:44:08 +00:00
Donny/강동윤
bc2c0f4133
fix(es/codegen): Fix codegen of a negative number (#5980)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5912.
2022-09-28 13:40:07 +00:00
SWC Bot
d75addbdec chore: Publish crates 2022-09-28 10:37:40 +00:00
SWC Bot
e001226674 chore: Publish crates 2022-09-26 09:21:39 +00:00
Donny/강동윤
2ba88154fc
fix(es/codegen): Align sourcemap with terser (#5657) 2022-09-26 18:12:42 +09:00
SWC Bot
e1f421b6af chore: Publish crates 2022-09-25 01:36:48 +00:00
SWC Bot
e5ba9636ac chore: Publish crates 2022-09-24 03:36:47 +00:00
SWC Bot
8a5ed1e0ba chore: Publish crates 2022-09-23 07:50:26 +00:00
Donny/강동윤
5cddb4c734
feat(es/typescript): Support TS 4.9 (#5938)
**Description:**

This PR adds satisfaction expression to the AST and parser.
2022-09-23 16:41:56 +09:00
SWC Bot
4c3813dbcc chore: Publish crates 2022-09-22 03:16:22 +00:00
SWC Bot
5c2b1bb15d chore: Publish crates 2022-09-20 03:51:28 +00:00
Donny/강동윤
1a182ef8d9
perf(es): Optimize memory layout of AST (#5829) 2022-09-20 12:47:21 +09:00
IWANABETHATGUY
7d6d04b421
fix(es/codegen): Drop the last comma in an array literal (#5877)
**Description:**

Drop the last comma in an array literal.

**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5692.
2022-09-16 15:48:28 +09:00
Donny/강동윤
f0ca487848 chore: Publish crates 2022-09-16 15:46:25 +09:00
SWC Bot
1d633e8ba7 chore: Publish crates 2022-09-15 06:08:07 +00:00
SWC Bot
ec8bb432b9 chore: Publish crates 2022-09-15 05:23:46 +00:00
Donny/강동윤
dfb01bde71
refactor: Refactor code using clippy (#5863)
**Description:**

I temporarily updated rustc to use newer version of `cargo clippy`.
2022-09-14 15:05:59 +00:00
SWC Bot
d35792f424 chore: Publish crates 2022-09-14 07:56:20 +00:00
SWC Bot
8432c0a1ad chore: Publish crates 2022-09-14 07:19:24 +00:00
SWC Bot
0a56a2d5ab chore: Publish crates 2022-09-14 06:10:39 +00:00
magic-akari
2b2464271a
fix(es/codegen): Remove redundant ; after export default decl (#5851) 2022-09-14 06:07:15 +00:00
SWC Bot
d16fb9a8cf chore: Publish crates 2022-09-13 05:04:36 +00:00
SWC Bot
b2c0fbd7ba chore: Publish crates 2022-09-13 02:19:15 +00:00
SWC Bot
2df19176fb chore: Publish crates 2022-09-12 05:16:53 +00:00
SWC Bot
9f28c246dc chore: Publish crates 2022-09-12 04:34:08 +00:00