Commit Graph

7478 Commits

Author SHA1 Message Date
Donny/강동윤
04921f301a
fix(es/codegen): Add quotes to property names when ascii_only is true (#7820)
**Related issue:**

 - Closes #7805.
2023-08-16 19:09:27 +00:00
SWC Bot
e9dfe879d9 chore: Publish crates 2023-08-16 18:04:14 +00:00
David Sherret
981d7b152b
refactor(common): Make ahash optional (#7816)
**Description:**

This adds the ability to not include `ahash` with swc_common, which
caused some issues for me compiling dprint-plugin-typescript to Wasm
because of:

```
   Compiling ahash v0.8.3
   Compiling getrandom v0.2.10
error: the wasm*-unknown-unknown targets are not supported by default, you may need to enable the "js" feature. For more information see: https://docs.rs/getrandom/#webassembly-support
   --> C:\Users\david\.cargo\registry\src\index.crates.io-6f17d22bba15001f\getrandom-0.2.10\src\lib.rs:285:9
    |
285 | /         compile_error!("the wasm*-unknown-unknown targets are not supported by \
286 | |                         default, you may need to enable the \"js\" feature. \
287 | |                         For more information see: \
288 | |                         https://docs.rs/getrandom/#webassembly-support");
    | |________________________________________________________________________^
``` 

(I can't enable the JS feature because it's running the wasm file in
Wasmer and also I don't support Wasi in dprint plugins)

**BREAKING CHANGE:**

This removes swc_common's "perf" feature and makes it the default, then
adds an `ahash` feature instead. An alternative would be to make the
`ahash` dep optional and part of the default features, then do
`default-features = false` in the downstream crates (I think, but I'm
not sure), but I figure most people will be using the perf default
anyway? I'm not sure what's preferable.

**Related issue:**

 - Closes #7729.
2023-08-16 18:02:05 +00:00
SWC Bot
d5495eeb9a chore: Publish crates 2023-08-16 14:18:56 +00:00
David Sherret
b43e38d3f9
refactor: Use ahash from swc_common in more places (#7815)
**Description:**

Uses ahash from swc_common in more places. This allows for more easily
swapping out ahash with rustc_hash.
2023-08-16 23:16:52 +09:00
SWC Bot
2dc88ef147 chore: Publish crates 2023-08-16 13:26:52 +00:00
Donny/강동윤
8b809dbe23
refactor(es/parser): Remove needless unsafe (#7818)
**Related issue:**

 - Closes #7797
2023-08-16 13:24:35 +00:00
Donny/강동윤
6f2773a744 chore: Publish crates 2023-08-16 11:26:52 +09:00
Donny/강동윤
677e25026d
chore: Publish v1.3.77 with swc_core v0.79.59 (#7817) 2023-08-16 11:23:54 +09:00
SWC Bot
a671afa0aa chore: Publish crates 2023-08-16 02:12:39 +00:00
Johnil Quezada
478fa4736f
feat(es/ast): Expose Archived types (#7811)
**Description:**

For crates using both `rkyv` and `swc`, where ast nodes from
`swc_ecma_ast` are included in data that's serialized with `rkyv`, it's
difficult to access the archived data from the archived ast nodes since
the types are private.

More context in the issue.

**Related issue:**

 - Closes #7810.
2023-08-16 02:10:51 +00:00
SWC Bot
023042dfb9 chore: Publish crates 2023-08-15 15:29:35 +00:00
Donny/강동윤
42dec557ed
fix(es/compat): Revert #7610 (#7813)
**Related issue:**

 - Reverts #7610.
 - Closes #7798.
 - Closes #7789.
 - Opens #7561.
2023-08-15 15:27:38 +00:00
SWC Bot
47350a8ac6 chore: Publish crates 2023-08-14 16:35:22 +00:00
Donny/강동윤
fe1ca26218
fix(es): Resolve jsc.baseUrl for .swcrc specified by --config-file (#7801)
**Related issue:**

 - Closes #7800
2023-08-14 16:33:17 +00:00
SWC Bot
0f66ee315a chore: Publish crates 2023-08-14 15:47:58 +00:00
David Sherret
e527c12a82
fix(es/parser): Revert lexer fix for << (#7807)
This temporarily reverts commit 68503726a7
until https://github.com/swc-project/swc/issues/7621 can be fixed.

Re-opens #7187.
2023-08-14 15:45:51 +00:00
SWC Bot
74d446f759 chore: Publish crates 2023-08-14 01:35:45 +00:00
Manish Goregaokar
5e7834aa2e
refactor(es/parser): Don't attempt to handle shebangs in read_token_number_sign (#7803)
bump() has a safety invariant that there must be input in the buffer to
read (See https://github.com/swc-project/swc/issues/7709).

This function as currently written calls `bump()` after calling
`read_token_interpreter()`, which *may* have exhausted the buffer
already in the specific case that it is handling a shebang. (The input
string `#!/bin/js` with no newline is sufficient to cause UB here)

Fortunately, shebangs never reach this function, due to `read_shebang`!
Hurray!

It's cleaner to not attempt to handle shebangs here when this code path
will never be reached, and use a debug assertion to ensure that we're
not dealing with shebangs.
2023-08-14 01:33:50 +00:00
Donny/강동윤
7fac0270c4 chore: Publish crates 2023-08-10 17:13:03 +09:00
Donny/강동윤
7aea2bdd97
chore: Publish v1.3.76 with swc_core v0.79.55 (#7794) 2023-08-10 17:12:04 +09:00
SWC Bot
b5dcce03c1 chore: Publish crates 2023-08-10 08:01:19 +00:00
Donny/강동윤
13bedc084e
fix(es/ast): Bump version (#7793) 2023-08-10 16:57:07 +09:00
Donny/강동윤
54f38cb47e chore: Publish crates 2023-08-10 12:05:44 +09:00
Donny/강동윤
9079050232
chore: Publish v1.3.76 with swc_core v0.79.54 (#7792) 2023-08-10 12:04:11 +09:00
SWC Bot
be58d36c42 chore: Publish crates 2023-08-10 02:50:53 +00:00
Donny/강동윤
552d9aa344
fix(es/minifier): Do not drop properties used via this (#7785)
**Related issue:**

 - Closes #7783.
2023-08-10 02:48:35 +00:00
SWC Bot
e90b555790 chore: Publish crates 2023-08-09 20:44:26 +00:00
Donny/강동윤
eff0caca2b
feat(es/minifier): Support mangle.eval (#7777)
**Related issue:**

 - Closes #7754
2023-08-09 20:42:12 +00:00
SWC Bot
0edc4207f4 chore: Publish crates 2023-08-09 20:04:15 +00:00
Austaras
ef8d12154d
fix(es/minifier): Abort seq inliner if a same var is defined in outer scope (#7772)
**Description:**

The algorithm here is directly copied from terser, I don't if it's correct or can be improved, but it does fix the issue.


**Related issue:**

 - Closes #7749
2023-08-09 20:01:59 +00:00
SWC Bot
c04ca528b8 chore: Publish crates 2023-08-09 09:19:00 +00:00
Donny/강동윤
76c6258d15
perf(es/compat): Improve time complexity of class_properties (#7786)
**Related issue:**

 - Closes #7780
2023-08-09 09:17:14 +00:00
SWC Bot
fd2d6747be chore: Publish crates 2023-08-09 08:37:37 +00:00
Donny/강동윤
ab39f1c3c8
chore(ci): Cleanup CI (#7787)
**Description**:
 - Disable `crev` action.
 - Cleanup compilation check matrix.
 - Update `cargo-hack`.
2023-08-09 08:35:36 +00:00
SWC Bot
1c2eb88a60 chore: Publish crates 2023-08-09 05:00:38 +00:00
Donny/강동윤
5c4bfa61f9
fix(es/module): Use jsc.baseUrl while resolving absolute paths (#7775)
**Related issue:**

 - Closes #7761
2023-08-09 13:58:45 +09:00
Donny/강동윤
000f817bcc chore: Publish crates 2023-08-08 14:05:39 +09:00
Donny/강동윤
41692f91db
chore: Publish v1.3.75 with swc_core v0.79.49 (#7778) 2023-08-08 14:03:36 +09:00
SWC Bot
83983f49c8 chore: Publish crates 2023-08-07 22:56:50 +00:00
Donny/강동윤
f7afe7edec
refactor(es/minifier): Support stable rustc (#7734) 2023-08-07 22:55:00 +00:00
SWC Bot
14906e279f chore: Publish crates 2023-08-07 22:20:08 +00:00
Donny/강동윤
b45649b8d6
fix(es/codegen): Don't strip necessary escape characters (#7687)
**Related issue:**

 - Closes #7678.
2023-08-07 22:17:59 +00:00
SWC Bot
0219eebeb9 chore: Publish crates 2023-08-07 21:31:50 +00:00
Fy
5f97f8656f
refactor(es/parser): Do not validate top-level await with target (#7774) 2023-08-07 21:30:04 +00:00
SWC Bot
1323c25ed6 chore: Publish crates 2023-08-07 20:38:40 +00:00
Donny/강동윤
36ccbec061
fix(es/minifier): Abort on Array.slice with start >= end (#7745)
**Related issue:**

 - Closes #7742.
2023-08-07 20:36:15 +00:00
SWC Bot
1e6ade8cfa chore: Publish crates 2023-08-07 20:01:21 +00:00
Manish Goregaokar
2258274233
refactor(es/ast): Avoid transmute in impl of Hash for Number (#7771)
**Description:**

[`f64::to_bits()`](https://doc.rust-lang.org/stable/std/primitive.f64.html#method.to_bits) does the same thing.
2023-08-08 04:59:15 +09:00
SWC Bot
76c78f8794 chore: Publish crates 2023-08-07 08:17:54 +00:00