Commit Graph

6572 Commits

Author SHA1 Message Date
Donny/강동윤
631dd7872b
feat(es/renamer): Support safari10 from the name mangler (#6801) 2023-01-13 05:00:13 +00:00
SWC Bot
75bf8397ba chore: Publish crates 2023-01-12 11:42:47 +00:00
Donny/강동윤
224eff91eb
feat(es/quote): Allow using Str as a var (#6797) 2023-01-12 11:40:26 +00:00
SWC Bot
be0af3ff13 chore: Publish crates 2023-01-12 11:04:17 +00:00
Donny/강동윤
b29aa5b5a0
test(es/preset-env): Add a test for a wrong issue (#6794)
**Related issue:**
 
 - Closes https://github.com/swc-project/swc/issues/6460.
2023-01-12 11:01:25 +00:00
SWC Bot
ba910306ad chore: Publish crates 2023-01-12 09:22:29 +00:00
Donny/강동윤
07676d5515
fix(es/compat): Ignore this in nested scopes in classes pass (#6796)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6506.
2023-01-12 09:19:40 +00:00
SWC Bot
2efcbdd2b4 chore: Publish crates 2023-01-12 07:31:36 +00:00
Donny/강동윤
c14540905f
fix(es/transform): Apply hygiene and resolver if minify is specified (#6793)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6791.
2023-01-12 07:29:28 +00:00
SWC Bot
06e7db9f06 chore: Publish crates 2023-01-12 06:56:43 +00:00
Donny/강동윤
7dc5ccb0fc
test(es/compat): Add a test to verify parameters passs (#6792)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6790.
2023-01-12 15:54:36 +09:00
Donny/강동윤
288ec1d6e0 chore: Publish v1.3.26 2023-01-11 18:37:35 +09:00
Donny/강동윤
5496379454 chore: Publish crates 2023-01-11 18:36:16 +09:00
SWC Bot
d9b22b8bf7 chore: Publish crates 2023-01-11 08:43:06 +00:00
Donny/강동윤
1c6fe35313
chore: Publish v1.3.26 (#6787) 2023-01-11 08:40:40 +00:00
SWC Bot
1431c735a9 chore: Publish crates 2023-01-11 07:44:21 +00:00
Donny/강동윤
bbfa97a475
fix(es/decorator): Fix type detection for template literal types (#6786)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6682.
2023-01-11 07:42:09 +00:00
SWC Bot
eddf8fd1bb chore: Publish crates 2023-01-11 07:06:58 +00:00
Donny/강동윤
06770cff04
fix(es/minifier): Make AST compressor respect toplevel (#6775)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/4386.
2023-01-11 07:04:20 +00:00
SWC Bot
267d256b5b chore: Publish crates 2023-01-11 06:04:36 +00:00
Donny/강동윤
336b1d8b4d
fix(es/minifier): Don't inline conditionally initialized vars (#6751)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6750.
 - Closes https://github.com/swc-project/swc/issues/6780.
2023-01-11 06:01:56 +00:00
SWC Bot
c695249b2a chore: Publish crates 2023-01-11 05:09:17 +00:00
Donny/강동윤
0ef84e1c00
test(es/module): Add a test for invalid issue (#6785)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6779.
2023-01-11 05:06:45 +00:00
SWC Bot
cd06479a43 chore: Publish crates 2023-01-11 03:00:59 +00:00
HeYunfei
ff8facef64
fix(es/parser): Allow parsing import.meta as an expression (#6783) 2023-01-11 02:58:25 +00:00
SWC Bot
70c3126771 chore: Publish crates 2023-01-10 10:21:15 +00:00
Donny/강동윤
ae3cfa7d2d
fix(es): Remove useless context (#6777) 2023-01-10 10:19:01 +00:00
SWC Bot
6f1e08fa3c chore: Publish crates 2023-01-10 06:45:17 +00:00
Donny/강동윤
ec7e913815
fix(es/minifier): Make name mangler respect toplevel (#6774)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6418.
2023-01-10 06:42:49 +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
b102504eb9 chore: Publish crates 2023-01-10 03:30:52 +00:00
Donny/강동윤
6d365de9e2
chore(ci): Fix CI action (#6772) 2023-01-10 03:28:07 +00:00
SWC Bot
ca64ab0906 chore: Publish crates 2023-01-09 11:00:40 +00:00
magic-akari
1d147602c0
fix(es/helpers): Make _classPrivateFieldLooseBase return receiver (#6770) 2023-01-09 10:58:29 +00:00
SWC Bot
a145bb5776 chore: Publish crates 2023-01-09 06:27:08 +00:00
Donny/강동윤
6c126da1d4
test(es): Add a test for a fixed source map issue (#6768)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6244.
2023-01-09 06:25:03 +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/#ODEzAC8qKgogKiBmb28KICogQHBhcmFtIGRhdGEgZm9vCiAqIEByZXR1cm5zIGZvbwogKi8gZXhwb3J0IGNvbnN0IGZpeHVwUmlza0NvbmZpZ0RhdGEgPSAoZGF0YSk9PnsKICAgIGlmICh4KSB7CiAgICAgICAgcmV0dXJuIDEyMzsKICAgIH0gZWxzZSB7CiAgICAgICAgcmV0dXJuIDQ1NjsKICAgIH0KfTsKCi8vIyBzb3VyY2VNYXBwaW5nVVJMPWRhdGE6YXBwbGljYXRpb24vanNvbj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z0lIMGdaV3h6WlNCN1hISmNiaUFnSUNCeVpYUjFjbTRnTkRVMk8xeHlYRzRnSUgxY2NseHVmVHNpWFN3aWJtRnRaWE1pT2xzaVptbDRkWEJTYVhOclEyOXVabWxuUkdGMFlTSXNJbVJoZEdFaUxDSjRJbDBzSW0xaGNIQnBibWR6SWpvaVFVRkJRVHM3T3p0RFFVbERMRWRCUTBRc1QwRkJUeXhKUVVGTlFTeHpRa0ZCYzBJc1UwRkJRME1zVFVGQmIwTTdTVUZEZEVVc1NVRkJTVU1zUjBGQlJ6dFJRVU5NTEU5QlFVODdTVUZEVkN4UFFVRlBPMUZCUTB3c1QwRkJUenRKUVVOVUxFTkJRVU03UVVGRFNDeEZRVUZGSW4wPTQ0NgB7InZlcnNpb24iOjMsInNvdXJjZXMiOlsiLi9hcHAuanMiXSwic291cmNlc0NvbnRlbnQiOlsiLyoqXHJcbiAqIGZvb1xyXG4gKiBAcGFyYW0gZGF0YSBmb29cclxuICogQHJldHVybnMgZm9vXHJcbiAqL1xyXG5leHBvcnQgY29uc3QgZml4dXBSaXNrQ29uZmlnRGF0YSA9IChkYXRhOiBhbnkpOiB0eXBlcy5SaXNrQ29uZmlnVHlwZSA9PiB7XHJcbiAgaWYgKHgpIHtcclxuICAgIHJldHVybiAxMjM7XHJcbiAgfSBlbHNlIHtcclxuICAgIHJldHVybiA0NTY7XHJcbiAgfVxyXG59OyJdLCJuYW1lcyI6WyJmaXh1cFJpc2tDb25maWdEYXRhIiwiZGF0YSIsIngiXSwibWFwcGluZ3MiOiJBQUFBOzs7O0NBSUMsR0FDRCxPQUFPLElBQU1BLHNCQUFzQixTQUFDQyxNQUFvQztJQUN0RSxJQUFJQyxHQUFHO1FBQ0wsT0FBTztJQUNULE9BQU87UUFDTCxPQUFPO0lBQ1QsQ0FBQztBQUNILEVBQUUifQ==)


**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6694.
2023-01-08 13:57:26 +09:00
SWC Bot
fb6770f649 chore: Publish crates 2023-01-06 08:17:26 +00:00
HeYunfei
8a6a1cbcf1
feat(es/minifier): Handle boolean in Evaluator (#6756)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5953.
2023-01-06 08:15:07 +00:00
Donny/강동윤
48902b60d3 chore: Publish crates 2023-01-06 16:41:16 +09:00
SWC Bot
1161360d54 chore: Publish crates 2023-01-06 03:49:20 +00:00
Donny/강동윤
26a0c13589
fix(common): Mark \r as a line ending (#6752)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/6694.
2023-01-06 03:47:16 +00:00
SWC Bot
ec8497b42c chore: Publish crates 2023-01-06 03:16:51 +00:00
HeYunfei
a1ccc8afdf
feat(es/minifier): Make name mangler understand block scoping (#6670)
**Related issue:**

 - Closes https://github.com/swc-project/swc/issues/5090.
 - Closes https://github.com/swc-project/swc/issues/5766.
2023-01-06 03:14:10 +00:00
Donny/강동윤
e9f99c4fe7 chore: Publish crates 2023-01-06 10:41:41 +09:00
SWC Bot
e5ea18b62b chore: Publish crates 2023-01-05 23:46:00 +00:00