Commit Graph

5659 Commits

Author SHA1 Message Date
SWC Bot
366d9eb514 chore: Publish crates 2023-10-20 21:35:19 +00:00
Donny/강동윤
5be8e74ee0
chore(es/module): Remove serde(deny_unknown_fields) (#8163)
**Related issue:**

 - Closes #7979
2023-10-20 21:32:34 +00:00
SWC Bot
6f9c6424d7 chore: Publish crates 2023-10-20 13:33:17 +00:00
Donny/강동윤
826386f49a
fix(es/parser): Skip this parameters in setter (#8158)
**Description:**

This is not a proper fix, but let's wait for the conf.

**Related issue:**

 - Closes #8156
2023-10-20 13:30:40 +00:00
SWC Bot
b806f925f1 chore: Publish crates 2023-10-20 06:09:49 +00:00
Donny/강동윤
08cf1f786d
fix(es/utils): Fix regression of RefRewriter (#8153)
**Related issue:**

- Found while investigating https://github.com/swc-project/swc-ecosystem-ci/actions/runs/6581045465/job/17880208108
2023-10-20 06:07:17 +00:00
SWC Bot
4a1a233db8 chore: Publish crates 2023-10-19 21:08:38 +00:00
Donny/강동윤
8a461b8957
feat(es/minifier): Drop empty static blocks (#8152)
**Related issue:**

 - Closes #8136
2023-10-19 21:06:12 +00:00
SWC Bot
64bddc110e chore: Publish crates 2023-10-19 20:24:12 +00:00
Donny/강동윤
35601e4dcb
fix(es/minifier): Abort function inliner if keep_fnames is true (#8145)
**Related issue:**

 - https://github.com/vercel/next.js/issues/56408
2023-10-19 20:20:54 +00:00
SWC Bot
9e71134b3c chore: Publish crates 2023-10-19 19:40:19 +00:00
Austaras
13106e0d2e
refactor(es/minifier): Decouple assign_count from reassigned (#8137) 2023-10-19 19:37:37 +00:00
SWC Bot
a18ffc107f chore: Publish crates 2023-10-19 17:13:59 +00:00
pshu
8d7894c71f
fix(css/ast): Make .hash() of Token not recursive (#8151) 2023-10-19 17:10:48 +00:00
SWC Bot
0b6f2b4fe9 chore: Publish crates 2023-10-18 18:00:42 +00:00
magic-akari
e186b80ddc
feat(es/compat): Skip empty class static blocks (#8138)
**Description:**

And update the `static_block_private_id` generate rules to be consistent with Babel.

**Related issue:**

 - #8136
2023-10-18 17:58:02 +00:00
SWC Bot
34b01672ad chore: Publish crates 2023-10-18 04:24:27 +00:00
David Sherret
bffe33a270
feat(es/parser): Implement AsRef<str> for IdentLike (#8133) 2023-10-18 04:22:03 +00:00
SWC Bot
5bb63aa2a2 chore: Publish crates 2023-10-18 03:47:26 +00:00
Donny/강동윤
111de264b0
fix(es/minifier): Abort seq inliner if b can short-circuit (#8128)
**Related issue:**

 - Closes #8119
2023-10-18 03:44:36 +00:00
SWC Bot
736831cb68 chore: Publish crates 2023-10-18 03:10:04 +00:00
Austaras
4f67794223
feat(es/minifier): Inline into the arguments of new using seq inliner (#8127) 2023-10-18 03:07:14 +00:00
SWC Bot
dc337d59f1 chore: Publish crates 2023-10-16 22:11:45 +00:00
SWC Bot
9b27a41b76 chore: Publish crates 2023-10-16 20:41:20 +00:00
Alessandro Chitolina
9c029ef095
feat(es/compat): Implement decorator metadata proposal (#8097)
**Description:**

This PR implements the [decorator
metadata](https://github.com/tc39/proposal-decorator-metadata) proposal,
that is now at Stage 3.

As the decorator metadata proposal is a small extension of the decorator
proposal and is not possible to compile the metadata without transpiling
decorators, I opted to implement it into the existing decorator
transformer (and helper)

**Related issue:**

 - Closes #7957
2023-10-16 20:38:53 +00:00
SWC Bot
f81ca2c795 chore: Publish crates 2023-10-15 10:27:05 +00:00
magic-akari
fb81a36adc
fix(es/utils): Skip var declarator name in RefRewriter (#8125)
**Related issue:**

 - Closes #8124
2023-10-15 10:24:40 +00:00
SWC Bot
3bca931560 chore: Publish crates 2023-10-15 08:25:08 +00:00
David Sherret
57b171dcbe
feat(es/typescript): Add ts_enum_is_mutable to disable enum inlining (#8115)
**Related issue:**

 - Closes #8114.
2023-10-15 08:22:47 +00:00
SWC Bot
06a2b44499 chore: Publish crates 2023-10-13 06:10:04 +00:00
magic-akari
7da3f52485
feat(es/minifier): Evaluate more toFixed expressions (#8109) 2023-10-13 15:07:00 +09:00
강동윤 (Donny)
787a465d8d chore: Publish crates 2023-10-13 12:28:41 +09:00
SWC Bot
a1d7ea7899 chore: Publish crates 2023-10-13 02:52:46 +00:00
Donny/강동윤
affb6fb5e3
refactor(es/compat): Split swc_ecma_transforms_compat (#8110)
**Description:**

- New: `cargo build --release 478.59s user 19.16s system 814% cpu 1:01.09 total`
- Prev: `cargo build --release 495.60s user 18.89s system 742% cpu 1:09.26 total`
2023-10-12 10:08:00 +00:00
SWC Bot
04932acc02 chore: Publish crates 2023-10-12 04:06:44 +00:00
Donny/강동윤
95eb147742
refactor(es/preset-env): Rename parameter to avoid confusion (#8106)
**Related issue:**

 - Closes #8103
2023-10-12 04:04:10 +00:00
SWC Bot
1bb2491368 chore: Publish crates 2023-10-12 03:28:23 +00:00
Donny/강동윤
fe0bf5746f
chore(ci): Fix CI action (#8107) 2023-10-12 03:26:04 +00:00
SWC Bot
1364c568e1 chore: Publish crates 2023-10-12 00:42:04 +00:00
Donny/강동윤
94bb42e294
fix(es/minifier): Don't inline functions if keep_fnames is enabled (#8093)
**Related issue:**

 - https://github.com/vercel/next.js/issues/56550
2023-10-12 00:39:19 +00:00
SWC Bot
6828fdbee5 chore: Publish crates 2023-10-11 22:50:49 +00:00
SWC Bot
a25fff5c46 chore: Publish crates 2023-10-11 18:35:43 +00:00
Donny/강동윤
cb4361f293
fix(es/decorators): Fix a regression about class expressions (#8102)
**Related issue:**

 - Closes #8095
2023-10-11 16:45:21 +00:00
SWC Bot
1183c32e3c chore: Publish crates 2023-10-11 14:05:36 +00:00
Donny/강동윤
e1043fae77
fix(es/parser): Fix parsing of await using (#8101)
**Related issue:**

 - Closes #8096
2023-10-11 14:03:08 +00:00
SWC Bot
17fe7b29c5 chore: Publish crates 2023-10-11 12:44:18 +00:00
Donny/강동윤
226b17fa86
chore(ci): Remove unused concurrency tests (#8100) 2023-10-11 21:40:49 +09:00
SWC Bot
8a07681f78 chore: Publish crates 2023-10-11 12:26:14 +00:00
magic-akari
bf523f5351
fix(es/compat): Handle export default decorator only if not empty (#8099)
**Related issue:**

 - Closes: #8098
2023-10-11 12:24:22 +00:00
SWC Bot
3dc761ab47 chore: Publish crates 2023-10-11 05:23:36 +00:00
SWC Bot
77d34014c7 chore: Publish crates 2023-10-10 14:21:09 +00:00
Donny/강동윤
a2d077958f
chore(es/minifier): Fix script for extracting test cases from next.js app (#8092) 2023-10-10 23:18:39 +09:00
SWC Bot
7e4b2490e8 chore: Publish crates 2023-10-10 11:44:33 +00:00
Donny/강동윤
d1097ccb59
feat(css/parser): Store lexed comments (#8091)
**Description:**

For now, we leave every comment as a leading comment. As logic for determining leading vs trailing is quite complex, I'll do it with another PR.
2023-10-10 11:42:20 +00:00
SWC Bot
4453d1b0a8 chore: Publish crates 2023-10-10 06:49:24 +00:00
SWC Bot
f44205bd57 chore: Publish crates 2023-10-10 04:10:33 +00:00
magic-akari
a912937cea
fix(es/compat): Handle __proto__ edge case in shorthand pass (#8077)
**Related issue:**

 - https://github.com/babel/babel/pull/12664
2023-10-10 04:08:45 +00:00
SWC Bot
ed648337f1 chore: Publish crates 2023-10-08 02:05:49 +00:00
SWC Bot
34e03c4661 chore: Publish crates 2023-10-08 00:41:50 +00:00
Donny/강동윤
84cec8766d
refactor(atoms): Remove usage of js_word! to drop string-cache (#7976)
**Description:**

This PR is to prepare removal of `string-cache`. Actually, this PR does not remove it. Instead, this PR only removes direct usages of `js_word!`s, especially in patterns.



**Related issue:**

 - #4946.
2023-10-08 00:39:51 +00:00
SWC Bot
d716dc823b chore: Publish crates 2023-10-07 14:22:43 +00:00
magic-akari
1346528477
fix(es/helpers): Override mistake in _interop_require_wildcard (#8076)
**Related issue:**

 - https://github.com/babel/babel/issues/15995
2023-10-07 14:20:39 +00:00
SWC Bot
4843266545 chore: Publish crates 2023-10-06 14:46:52 +00:00
Donny/강동윤
a5621bb30a
chore(xtask): Migrate scripts to xtask (#8072)
This PR adds

 - `xtask clean`
 - `xtask bench`
2023-10-06 14:44:53 +00:00
SWC Bot
5c6c82bc6a chore: Publish crates 2023-10-06 12:41:57 +00:00
Edward Faulkner
6f45b4693e
fix(es/codegen): Fix codegen of type-only imports (#8070) 2023-10-06 12:39:56 +00:00
SWC Bot
a6527bf9ab chore: Publish crates 2023-10-06 00:12:18 +00:00
Donny/강동윤
9b9bc51c28
refactor(es/parser): Introduce TokenKind along with Token (#8071)
**Description:**

This is extracted from https://github.com/swc-project/swc/pull/7790 because this PR is extremely large PR. I'll switch to `TokenKind` gradually.
2023-10-06 00:09:48 +00:00
SWC Bot
da9bee9776 chore: Publish crates 2023-10-05 09:17:21 +00:00
magic-akari
3e5b062cd2
refactor(es/module): Reimplement some functions of module/typescript (#8063) 2023-10-05 09:15:27 +00:00
SWC Bot
70ec648a63 chore: Publish crates 2023-10-05 08:36:48 +00:00
강동윤 (Donny)
a35fed015f chore: Publish crates 2023-10-05 16:29:43 +09:00
SWC Bot
0edd36842b chore: Publish crates 2023-10-03 16:49:03 +00:00
SWC Bot
89676946e6 chore: Publish crates 2023-10-03 06:04:32 +00:00
Donny/강동윤
8318ea82c2
fix(es/compat): Use async and await correctly in block-scoping pass (#8056)
**Related issue:**

 - Closes #7989
2023-10-03 06:02:42 +00:00
SWC Bot
4abfbaacc4 chore: Publish crates 2023-10-03 03:35:46 +00:00
SWC Bot
b3a59613ab chore: Publish crates 2023-10-02 17:32:00 +00:00
Alessandro Chitolina
a751f1cfaf
fix(es/compat): Transform default-exported class decorators correctly (#8050)
**Description:**

Process decorators on the class expression on `export default` declaration and ensure to execute tests for the feature.

**Related issue:**

 - Closes #8049
2023-10-02 17:30:13 +00:00
SWC Bot
c53a655154 chore: Publish crates 2023-10-02 16:45:51 +00:00
magic-akari
4d8e1013bb
fix(es/module): Handle directives (#8048)
**Related issue:**

 - Closes: #8047
2023-10-02 16:44:05 +00:00
SWC Bot
92c6be7681 chore: Publish crates 2023-10-02 15:48:04 +00:00
Donny/강동윤
f717cf21cc
refactor(cli): Make CLI testable/managable with swc-bump (#8045)
**Description:**

It was hard to maintain CLI because actual logic was in `./bindings`.
2023-10-02 15:46:14 +00:00
SWC Bot
2bf935c68b chore: Publish crates 2023-10-02 06:18:14 +00:00
Donny/강동윤
96a7a4d045
fix(es/compat): Fix scoping of explicit-resource-management (#8044)
**Related issue:**

 - Closes #8020
2023-10-02 06:16:08 +00:00
Donny/강동윤
f2bc6a3fcc
chore(ci): Prepare multi-package repository (#8043) 2023-10-02 04:41:21 +00:00
강동윤 (Donny)
13161c45cd chore: Publish crates 2023-10-01 20:52:47 +09:00
SWC Bot
203b2297c3 chore: Publish crates 2023-09-30 11:42:29 +00:00
Austaras
01391e3c13
fix(es/minifier): Check if object shorthand is skippable for seq inliner (#8036)
**Related issue:**

 - Closes #7984
2023-09-30 11:40:46 +00:00
SWC Bot
3fd6f64e60 chore: Publish crates 2023-09-29 21:35:08 +00:00
Austaras
06b6eb9999
fix(es/compat): Generate OptCall for OptCall for private fields (#8031)
**Related issue:**

 - Closes #8003
2023-09-29 21:32:48 +00:00
SWC Bot
8f445f49c9 chore: Publish crates 2023-09-29 20:54:50 +00:00
SWC Bot
5283e5bf82 chore: Publish crates 2023-09-29 20:36:29 +00:00
magic-akari
cf96171a53
fix(es/typescript): Preserve default value of an exported binding in a namespace (#8029)
**Related issue:**

 - Closes: #8025
2023-09-29 20:34:24 +00:00
SWC Bot
d35de6444e chore: Publish crates 2023-09-29 19:53:01 +00:00
SWC Bot
537932b581 chore: Publish crates 2023-09-29 19:48:02 +00:00
SWC Bot
90387bb340 chore: Publish crates 2023-09-29 14:50:45 +00:00
Donny/강동윤
a13f5cbe03
refactor(es): Extract parser/codegen code for swc::Compiler (#8030) 2023-09-29 14:48:31 +00:00
SWC Bot
920362685b chore: Publish crates 2023-09-29 11:01:28 +00:00
Donny/강동윤
725f7f5bda
refactor(es/minifier): Move JS options to swc_ecma_minifier (#8028)
**Description:**

This is not a public API, though.
2023-09-29 10:59:43 +00:00
SWC Bot
2153c05c66 chore: Publish crates 2023-09-29 10:27:04 +00:00
magic-akari
990ca06aca
fix(es/module): Sort the exported ESM bindings (#8024)
**Related issue:**

 - Closes: #8023
2023-09-29 10:25:22 +00:00
SWC Bot
83f77ddfce chore: Publish crates 2023-09-29 08:49:57 +00:00
SWC Bot
632a63a46e chore: Publish crates 2023-09-27 23:30:11 +00:00
jrandolf
38bc71006e
fix(es/compat): Use return statements for method and setter decorator (#8017)
**Description:**

This aligns with other implementations such as TypeScript's and correctly implements the currently proposed behavior.

**Related issue:**

 - Closes #8015.
2023-09-27 23:27:57 +00:00
SWC Bot
0871d4e0f0 chore: Publish crates 2023-09-27 14:36:52 +00:00
magic-akari
58172689ce
fix(es/typescript): Rename wrong unresolved_mark (#8018)
**Related issue:**

 - Closes: #8016
2023-09-27 14:34:59 +00:00
강동윤 (Donny)
8231f874e7 chore: Publish crates 2023-09-27 10:13:08 +09:00
SWC Bot
0e24dc9c74 chore: Publish crates 2023-09-27 00:57:21 +00:00
magic-akari
2f01aba978
fix(es/typescript): Handle qualified access in assign pat (#8012)
**Related issue:**

 - Closes #8011
 - https://github.com/swc-project/swc/discussions/5186
2023-09-27 00:55:22 +00:00
SWC Bot
7c227870c8 chore: Publish crates 2023-09-26 23:39:31 +00:00
magic-akari
9d08b8a614
fix(es/typescript): Handle DeclareCollect correctly (#8008)
**Related issue:**

 - Closes #8007
2023-09-26 23:37:28 +00:00
SWC Bot
78e12595a4 chore: Publish crates 2023-09-26 03:59:50 +00:00
Donny/강동윤
f07bb482e6
fix(es/codegen): Fix codegen of optional chaining expr with a comment (#8005)
**Related issue:**

 - Closes #8004
2023-09-26 03:58:02 +00:00
SWC Bot
b74a9f4357 chore: Publish crates 2023-09-25 23:38:00 +00:00
Donny/강동윤
39c680d814
fix(es/codegen): Fix codegen of unicode surrogates (#7985)
**Description:**


x-ref: https://vercel.slack.com/archives/C02HY34AKME/p1695334071194139


Reproduction: https://github.com/kdy1/repro-test-mdx-korean



Regression of next.js: `v13.4.11`(swc_core@v0.79.13) => `v13.5.2`
(swc_core@v0.83.12)


 - `next@v13.4.19` works (swc_core@v0.79.59)
 - `next@v13.4.20-canary.3` works (swc_core@v0.79.70)
 -  **`next@v13.4.20-canary.32` fails** (swc_core@v0.83.12)

Commit range:
662f236aa5...e67bf05f9d

- `swc_core@v0.79.70`:
662f236aa5
- `swc_core@v0.83.12`:
e67bf05f9d

Diff: https://gist.github.com/kdy1/047e7e5537c34180d446cb3d5b95fce8

---

I did more investigation by monkey-patching the `next` package.
`.minify()` resolved without an exception.
It means that `.minify()` is producing an invalid ES code.

So... candidates are

 - https://github.com/swc-project/swc/pull/7890
 - https://github.com/swc-project/swc/pull/7876
 - https://github.com/swc-project/swc/pull/7858
 - https://github.com/swc-project/swc/pull/7856
 - https://github.com/swc-project/swc/pull/7853
 - https://github.com/swc-project/swc/pull/7832
2023-09-25 23:36:05 +00:00
강동윤 (Donny)
243d68d8dc chore: Publish crates 2023-09-25 22:24:43 +09:00
SWC Bot
5a94ff1083 chore: Publish crates 2023-09-25 04:04:09 +00:00
magic-akari
d91a554033
fix(es/compat): Skip function scope in block-scoped-fns pass (#7975)
**Related issue:**

 - Closes: #2793
2023-09-25 04:02:09 +00:00
SWC Bot
e146ff7d8e chore: Publish crates 2023-09-25 01:42:53 +00:00
magic-akari
9c9a538f23
refactor(es/typescript): Reimplement TypeScript pass (#7202)
**Description:**

## Bugfixes
- Exported `let`/`var` declarations in TypeScript namespaces should be mutable.
- Fix missing declaration of complex exported patterns in TypeScript namespaces.
- Preserve concrete TS namespaces.

## New Features
- Introducing [Verbatim Module Syntax](https://www.typescriptlang.org/tsconfig#verbatimModuleSyntax).
- Enum value will now be inlined whenever possible within a single module, optimizing runtime performance.
- Constant enums will be automatically eliminated when feasible, This can reduce bundle size.
- Added support for cross-referencing enum values.

## Deprecated
`TsEnumConfig` is deprecated
  - The `treat_const_enum_as_enum` transform option is deprecated.
  - The `ts_enum_is_readonly` assumption option is deprecated.

**BREAKING CHANGE:**

TypeScript Config is changed.


**Related issue:**

 - Closes #5197
 - Closes #5259 
 - Closes #7177
 - Closes #7453
 - Closes #7676 
 - Closes #7681
 - Closes #7791 
 - Closes #7961
2023-09-25 01:41:00 +00:00
SWC Bot
bea10ef5f5 chore: Publish crates 2023-09-24 23:41:11 +00:00
Donny/강동윤
f374ad903a
fix(es): Enable resolver if jsc.baseUrl is specified (#7998)
**Related issue:**

 - Closes #7990
2023-09-24 23:39:12 +00:00
강동윤 (Donny)
489797f1cf chore: Publish crates 2023-09-24 13:59:06 +09:00
SWC Bot
36de9de600 chore: Publish crates 2023-09-23 15:49:46 +00:00
Donny/강동윤
4d777ee270
feat(es/config): Accept jsc.experimental.keepImportAssertions (#7995)
**Related issue:**

 - Closes #7923.
2023-09-23 15:47:30 +00:00
SWC Bot
3eb23eba7b chore: Publish crates 2023-09-22 23:50:22 +00:00
강동윤 (Donny)
276be28ae1 chore: Publish crates 2023-09-22 11:15:56 +09:00
SWC Bot
ee6260d53b chore: Publish crates 2023-09-21 05:18:49 +00:00
magic-akari
5050f5820a
fix(es/compat): Handle nullish in fn expr scope (#7980)
**Related issue:**

  - Closes: #7977
2023-09-21 05:16:43 +00:00
SWC Bot
95285e8a4a chore: Publish crates 2023-09-20 06:58:46 +00:00
Donny/강동윤
b3d3a7bc73
fix(es/minifier): Do not inline into a template literal with sequential inliner (#7971)
**Related issue:**

 - Closes #7969.
2023-09-20 06:57:03 +00:00
SWC Bot
0229bad76c chore: Publish crates 2023-09-19 02:59:38 +00:00
강동윤 (Donny)
2dac39304d chore: Publish crates 2023-09-19 07:09:26 +09:00
강동윤 (Donny)
76b7a747ad chore: Publish crates 2023-09-19 07:05:57 +09:00
강동윤 (Donny)
199a13847a chore: Publish crates 2023-09-19 06:38:30 +09:00
SWC Bot
f66da77220 chore: Publish crates 2023-09-18 14:42:07 +00:00
magic-akari
f7b5e16aef
refactor(es/lint): Remove usage of box_patterns (#7966)
**Related issue:**
 
 - Closes #7964
2023-09-18 14:39:53 +00:00
SWC Bot
1079daab4c chore: Publish crates 2023-09-18 14:04:53 +00:00
SWC Bot
f2baa7ab63 chore: Publish crates 2023-09-18 13:22:16 +00:00
Donny/강동윤
005ddc573e
chore(es/preset-env): Ignore tp in the version of a browser version (#7968) 2023-09-18 13:20:23 +00:00
SWC Bot
e749328312 chore: Publish crates 2023-09-16 09:19:13 +00:00
magic-akari
06ca1fe0a0
fix(es/minifier): Handle ModuleDecl when transform const modules (#7959)
**Related issue:**

 - Closes #7747
2023-09-16 09:17:26 +00:00
SWC Bot
fc90ead01d chore: Publish crates 2023-09-16 04:33:48 +00:00
magic-akari
28318f09ed
fix(es/compat): Handle PrivateName in logical_assignments (#7958)
**Related issue:**

 - Closes #7956
2023-09-16 04:32:07 +00:00
SWC Bot
e67bf05f9d chore: Publish crates 2023-09-15 12:38:09 +00:00
Donny/강동윤
be5b02a8cf
fix(es/module): Preserve import specifier if resolving fails (#7955)
**Related issue:**

 - https://github.com/vercel/next.js/pull/55216

This PR fixes a regression caught by the PR above.
2023-09-15 12:36:25 +00:00
SWC Bot
88b009cee2 chore: Publish crates 2023-09-15 08:25:18 +00:00
Gábor Szabó
ca22359dbd
chore(es/preset-env): Add the repository url to Cargo.toml (#7941) 2023-09-15 08:23:23 +00:00
강동윤 (Donny)
01fefd32f7 chore: Publish crates 2023-09-15 15:11:50 +09:00
강동윤 (Donny)
67e30819bd chore: Publish crates 2023-09-15 15:07:28 +09:00
SWC Bot
16ad8ec4d1 chore: Publish crates 2023-09-14 07:19:55 +00:00
Donny/강동윤
7e8d72d03b
feat(es/module): Add an option to make resolver fully resolve index.js (#7945)
**Description:**

 - `jsc.module.resolveFully` is added to support resolving as `.js`.

**Related issue:**

 - Closes #7861
 - Closes #7898
2023-09-14 07:17:23 +00:00
SWC Bot
9f8d454e00 chore: Publish crates 2023-09-14 02:49:44 +00:00
magic-akari
a80aec47ef
fix(es/compat): Handle single expression case in static block (#7944)
**Related issue:**

 - Closes #7922
2023-09-14 02:47:44 +00:00
SWC Bot
47388a047e chore: Publish crates 2023-09-14 02:17:21 +00:00
Brandon Dail
05ca19b844
fix(css/modules): Support composes when using multiple subclass selectors (#7949) 2023-09-14 02:14:58 +00:00
SWC Bot
418a2e3016 chore: Publish crates 2023-09-13 05:57:44 +00:00
Anders Kaseorg
b87ac646f8
fix(es/minifier): Parse a file as a module only if opts.module is true (#7943)
**Description:**

Previously it was impossible to minify non-strict code (e.g. `delete identifier;`) because `minify()` unconditionally parsed the input as a module regardless of the `module` setting.

**BREAKING CHANGE:**

`minify()` now respects the `module` parameter instead of ignoring it, so users who had been processing modules with `minify()` without passing `{ module: true }` will now need to pass it.

**Related issue**

 - Closes #6130.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2023-09-13 05:55:34 +00:00
SWC Bot
858a4f4a22 chore: Publish crates 2023-09-13 02:05:35 +00:00
Austaras
c091c5e295
feat(es/compat): Support pure_getters for optional_chaining (#7933)
**Related issue:**

 - Closes #7921
2023-09-13 02:03:41 +00:00
Donny/강동윤
26b01bd01b chore: Publish crates 2023-09-11 23:26:44 +09:00
SWC Bot
0d0f04689c chore: Publish crates 2023-09-11 08:33:49 +00:00
Donny/강동윤
dac8888829
fix(es/codegen): Use emitAssertForImportAttributes (#7936)
**Description:**

 - Add `format.emitAssertForImportAttributes` to `minify()`
 - Use `jsc.experimental. emitAssertForImportAttributes`.

**Related issue (if exists):**

 - Closes #7926
 - Closes #7928
2023-09-11 08:31:46 +00:00
SWC Bot
5431010c75 chore: Publish crates 2023-09-10 07:00:21 +00:00
magic-akari
2da58959c2
fix(es/codegen): Emit leading comments for ExprStmt (#7916) 2023-09-10 06:58:26 +00:00
SWC Bot
3210556c7e chore: Publish crates 2023-09-10 06:29:19 +00:00
Austaras
97068e12d1
fix(es/compat): Visit assign expr in generator (#7932)
**Related issue:**
 - Closes #7809
2023-09-10 06:27:30 +00:00
Donny/강동윤
8bb2925e23 chore: Publish crates 2023-09-07 10:23:00 +09:00
SWC Bot
8bb911269c chore: Publish crates 2023-09-06 17:31:41 +00:00
Donny/강동윤
a86e9f3bb5
fix(es/module): Fix jsc.paths for projects using pnpm (#7918)
**Related issue:**

- x-ref: https://vercel.slack.com/archives/C04DUD7EB1B/p1693911653100299?thread_ts=1693819683.070959&cid=C04DUD7EB1B
2023-09-06 17:29:47 +00:00
SWC Bot
5c005256d6 chore: Publish crates 2023-09-06 10:26:13 +00:00
Kei Sakamoto
0db25a252c
fix(css/modules): Aggregate class names when composes is chained. (#7917)
**Description:**

aggregate class names when composes is chained.

**Related issue:**

 - Closes #7737
 - https://github.com/web-infra-dev/rspack/issues/3875
2023-09-06 19:24:26 +09:00
SWC Bot
4623b3e07f chore: Publish crates 2023-09-05 12:26:15 +00:00
Donny/강동윤
ee7575695d
feat(es/codegen): Add an option to print assert for import attributes (#7914)
**Description:**

- `jsc.experimental.keepImportAssertions` is renamed to `jsc.experimental.keepImportAttributes`.
 - `jsc.experimental.emitAssertForImportAttributes` is added.

**Related issue:**

 - Closes #7908
2023-09-05 21:24:25 +09:00
SWC Bot
92d08c38e2 chore: Publish crates 2023-09-01 05:26:46 +00:00
Donny/강동윤
85d6e9be07
fix(es/module): Revert #7901 (#7906)
**Description:**

I'm reverting #7901 because it caused a regression in next.js CI.
https://github.com/vercel/next.js/pull/54653


**Related issue:**

 - Reverts #7901.
2023-09-01 14:24:50 +09:00
Donny/강동윤
fd1c0cfdae chore: Publish crates 2023-09-01 11:36:14 +09:00
SWC Bot
d1ec49e3e5 chore: Publish crates 2023-08-31 13:25:10 +00:00
Donny/강동윤
aa6495519b
fix(common): Fix logic for excluding FileName from source maps (#7900)
**Description:**

This PR also modifies React transform to use `FileName::Internal` and makes `SourceMapGenConfig` skips `FileName::Internal`.

**Related issue:**

 - Closes #5272
2023-08-31 13:23:11 +00:00
SWC Bot
e5f7a9dab0 chore: Publish crates 2023-08-31 07:26:53 +00:00
Donny/강동윤
c714dd20de
fix(es/module): Make jsc.paths fully resolve TypeScript files (#7901)
**Related issue:**

 - Closes #7861
 - Closes #7898
2023-08-31 07:24:12 +00:00
SWC Bot
482306086d chore: Publish crates 2023-08-31 05:56:04 +00:00
Austaras
2db10e9fd1
fix(es/resolver): Correctly resolve global value (#7893)
**Related issue:**

 - Closes #7685
2023-08-31 05:54:18 +00:00
Donny/강동윤
15d3900f60 chore: Publish crates 2023-08-30 21:08:25 +09:00
SWC Bot
3127ad9515 chore: Publish crates 2023-08-30 10:15:47 +00:00
Donny/강동윤
5fbc251db1
fix(es/module): Don't create absolute paths for jsc.paths on Windows (#7892)
**Related issue:**

 - Closes #7806
2023-08-30 10:11:34 +00:00
SWC Bot
766d3e8896 chore: Publish crates 2023-08-30 03:03:30 +00:00
Austaras
8db968a25d
refactor(es/minifier): Remove mutated and mutation_by_call_count (#7890)
**Description:**

`mutated` can be seen as a combination of `reassigned` and `has_property_mutation`, and `mutation_by_call_count` is simply useless.
2023-08-30 03:01:29 +00:00
SWC Bot
853b4803ad chore: Publish crates 2023-08-30 02:26:08 +00:00
Donny/강동윤
01cbd6edbd
chore(deps): Update memchr (#7891) 2023-08-30 02:23:57 +00:00
SWC Bot
aa8ad10ad8 chore: Publish crates 2023-08-29 10:23:30 +00:00
Austaras
87a47bfb2c
fix(es/minifier): Report is_fn_local even if var is hoisted (#7876)
**Related issue:**
 - Closes #7847
2023-08-29 10:21:14 +00:00
SWC Bot
c31f05a675 chore: Publish crates 2023-08-29 05:47:51 +00:00
Donny/강동윤
4b33d41fab
fix(es/compat): Make SwitchCase handler of block-scoping stateless (#7888)
**Related issue:**

 - Closes #7885
2023-08-29 05:45:13 +00:00
SWC Bot
4a2c24bbec chore: Publish crates 2023-08-29 05:06:03 +00:00
Donny/강동윤
a50501255d
perf(es/transforms): Remove wrong parallelism (#7889) 2023-08-29 05:04:11 +00:00
SWC Bot
3e41468a3a chore: Publish crates 2023-08-29 01:41:18 +00:00
David Sherret
057bd5f3ef
fix(es/dep-graph): Analyze import type children (#7883)
**Description:**

It was not analyzing children of a dynamic imports.
2023-08-29 01:39:05 +00:00
SWC Bot
44de87f481 chore: Publish crates 2023-08-28 01:12:12 +00:00
Donny/강동윤
a97d8b42b1
feat(es/preset-env): Update data (#7882) 2023-08-28 01:09:38 +00:00
SWC Bot
562f5e1eb3 chore: Publish crates 2023-08-28 00:31:39 +00:00
Donny/강동윤
4d3fcb86e4
feat(es/ast): Support import attributes proposal (#7868)
**Related issue:**

 - Closes #7179
2023-08-28 00:29:45 +00:00
SWC Bot
5d25307a1a chore: Publish crates 2023-08-27 23:38:50 +00:00
Lewis Liu
122d14c0d3
fix(es/codegen): Fix placing of comments of yield arguments (#7858)
**Description:**

Looks like the bug I ran into had nothing to do with the changes in
#7856, since it's reproducible without it. Looks like it might have only
surfaced now because https://github.com/swc-project/swc/pull/7853
changed the default value of `jsc.minify.format.comments`? Added a
minimal test case here with the expected result.

Here's the actual output:

```js
 export var padding = '';
 export function exec2({ commands }) {
     return __awaiter(this, void 0, void 0, function*() {
         for(let i2 = 0; i2 < commands.length; i2++){
             let command = commands[i2];
             yield // some-comment
             function({ command }) {
                 command();
             }({
                 command,
                 handleError
             });
         }
     });
 }
```

The comment ends up getting added after the yield, which makes the
output invalid.

Going to see if I can figure out a fix tomorrow, but let me know if you
have any ideas on where to start looking in the meantime!
2023-08-27 23:36:50 +00:00
SWC Bot
2be46c920c chore: Publish crates 2023-08-27 18:25:51 +00:00
Donny/강동윤
3180e68bf2
fix(es/compat): Apply transforms for explicit resource management (#7881)
**Related issue:**

 - Closes #7879
2023-08-27 18:23:32 +00:00
SWC Bot
84737cdcd8 chore: Publish crates 2023-08-26 01:14:53 +00:00
Donny/강동윤
71d01ec127
feat(es): Add an option to disable builtin transforms (#7873) 2023-08-26 01:12:36 +00:00
SWC Bot
606b57c101 chore: Publish crates 2023-08-25 22:13:55 +00:00
Donny/강동윤
7911973020 chore: Publish crates 2023-08-25 22:55:28 +09:00
SWC Bot
5c96b8545d chore: Publish crates 2023-08-25 13:48:47 +00:00
Donny/강동윤
11ebae1bdd
fix(es/module): Don't resolve as node_modules from TscResolver (#7866)
**Related issue:**

 - Closes #7863
2023-08-25 22:46:53 +09:00
SWC Bot
7986566128 chore: Publish crates 2023-08-25 07:25:19 +00:00
Donny/강동윤
52a1ee78da
fix(es/module): Fix logic for exact matches in jsc.paths (#7860)
**Related issue:**

 - Closes #7829
2023-08-25 07:23:19 +00:00
Donny/강동윤
c18051fb0b chore: Publish crates 2023-08-25 15:21:54 +09:00
SWC Bot
9c69caf665 chore: Publish crates 2023-08-25 06:07:50 +00:00
Donny/강동윤
d33a97303c
fix(es/module): Make jsc.paths work for a nest.js app (#7852) 2023-08-25 15:05:43 +09:00
SWC Bot
f79ca54584 chore: Publish crates 2023-08-25 04:49:30 +00:00
Lewis Liu
ae8cd9430d
fix(es/minifier): Don't remove exports (#7856) 2023-08-25 13:47:42 +09:00
SWC Bot
5ae2e810d8 chore: Publish crates 2023-08-25 03:34:55 +00:00
SWC Bot
e3b4cfbbf9 chore: Publish crates 2023-08-24 18:52:19 +00:00
Donny/강동윤
64e51d3a28
fix(es): Fix default value of jsc.minify.format.comments (#7853)
**Related issue:**

 - Closes #7842
2023-08-24 18:50:21 +00:00
SWC Bot
7b5cb902a5 chore: Publish crates 2023-08-24 12:58:41 +00:00
Donny/강동윤
c65732496e
refactor(common): Mark some methods of Input unsafe (#7848)
**Related issue:**

 - Closes #7709
2023-08-24 12:56:38 +00:00
SWC Bot
a9a6928a4e chore: Publish crates 2023-08-24 08:20:56 +00:00
Jason
a34f3592b3
feat(css/ast): Support @scope at-rule (#7837)
> ### Describe the feature
> [Chrome 118 is shipping
soon](https://chromium-review.googlesource.com/c/chromium/src/+/4790561),
which is expected to be one of the more popular CSS features, giving new
hope for style isolation of components.
> 
> * Explainer https://css.oddbird.net/scope/explainer
> * Specification https://drafts.csswg.org/css-cascade-6/#scope-atrule
> 

Closed: #7836
2023-08-24 08:18:35 +00:00
SWC Bot
da5bc1084d chore: Publish crates 2023-08-24 07:37:21 +00:00
Austaras
65db1badff
refactor(es/minifier): Pre-calculate reassigned (#7832) 2023-08-24 07:35:26 +00:00
SWC Bot
662f236aa5 chore: Publish crates 2023-08-22 02:06:20 +00:00
Donny/강동윤
7fe01e64dd
fix(es/minifier): Don't inline properties if the var is not fn-local (#7839)
**Related issue:**

 - https://github.com/vercel/next.js/issues/54192.
2023-08-22 11:04:15 +09:00
SWC Bot
6a8ea89f4b chore: Publish crates 2023-08-18 06:26:59 +00:00
SWC Bot
f87581f67d chore: Publish crates 2023-08-18 04:27:30 +00:00
Donny/강동윤
1ab406cd7a
refactor(es/helpers): Move packages for monorepo (#7833) 2023-08-18 04:25:37 +00:00
Donny/강동윤
6e37fd2932 chore: Publish crates 2023-08-18 04:30:40 +09:00
SWC Bot
becea47a2d chore: Publish crates 2023-08-17 18:11:16 +00:00
Donny/강동윤
31de19ece2
fix(es/minifier): Preserve more analysis data upon inlining (#7823)
**Related issue:**

 - Closes #7821.
2023-08-17 18:09:02 +00:00
SWC Bot
9dbfadb48d chore: Publish crates 2023-08-17 14:38:07 +00:00
Donny/강동윤
9099883175
feat(es/module): Improve error message about relative jsc.baseUrl (#7827) 2023-08-17 14:35:39 +00:00
SWC Bot
ebbc9292e3 chore: Publish crates 2023-08-17 05:18:03 +00:00
Austaras
f8ca366cc1
fix(es/minifier): Abort seq inliner if var is not fn_local or reassigned (#7804)
**Description:**

It turns out that the original implementation of `infect`is incomplete
because it cannot cover function param, and the new implementation
introduced in #7772 is redundant because what
[terser](https://github.com/terser/terser/blob/master/lib/compress/tighten-body.js#L909C18-L909C28)
do is basically checking `fn_local`


**Related issue:**

 - Closes #7784
2023-08-17 05:15:59 +00:00
SWC Bot
a6a5ec30cd chore: Publish crates 2023-08-17 04:37:14 +00:00
Donny/강동윤
05990a98fd
fix(es/minifier): Preserve cooked while compressing template literals (#7773)
**Related issue:**

 - Closes #7770
2023-08-17 04:35:07 +00:00
SWC Bot
05200ad352 chore: Publish crates 2023-08-17 04:03:33 +00:00
Donny/강동윤
3766a7c776
fix(es/compat): Remove wrong logic for object patterns in object_rest (#7788)
**Related issue:**

 - Closes #7776
2023-08-17 04:01:30 +00:00
SWC Bot
0d036b4915 chore: Publish crates 2023-08-16 19:11:18 +00:00
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