@swc/core 1.2.207 → 1.2.210
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +156 -0
- package/README.md +8 -0
- package/package.json +14 -14
- package/types.d.ts +90 -0
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,162 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(es/codegen)** Fix codegen of some non-ascii characters (#5108) ([b76b499](https://github.com/swc-project/swc/commit/b76b4999cce42fb2e41ca165bd68bbc8f6663bdc))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/fixer)** Preserve parens in opt calls (#5110) ([3e3c44a](https://github.com/swc-project/swc/commit/3e3c44a0b64c55b4d976a4dafbb999000612d14a))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/fixer)** Preserve parens in more opt calls (#5111) ([528d4c5](https://github.com/swc-project/swc/commit/528d4c5aa45f4a7445fcc7b50eb71302d3631190))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/lints)** Allow overload in typescript (#5116) ([bef8aeb](https://github.com/swc-project/swc/commit/bef8aebdeadb4d15b7417af88947bfc905f93628))
|
|
18
|
+
|
|
19
|
+
### Documentation
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(visit)** Generate rustdoc (#5107) ([8ea631c](https://github.com/swc-project/swc/commit/8ea631c7669356905fb7defd6aeb0fb0602ec458))
|
|
24
|
+
|
|
25
|
+
## [1.2.209] - 2022-07-05
|
|
26
|
+
|
|
27
|
+
### Bug Fixes
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- **(es/codegen)** Emit numeric value for Binary and Octal literals (#5083) ([8df6e04](https://github.com/swc-project/swc/commit/8df6e047cc523088a26a3363fe33f1bc224738b0))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- **(es/compat)** Preserve spans in `object_rest_spread` (#5082) ([de66b64](https://github.com/swc-project/swc/commit/de66b64aed13166803ebdfb91d1c421eec064c25))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- **(es/compat)** Preserve class names (#5104) ([adbb0bf](https://github.com/swc-project/swc/commit/adbb0bf8d8391aa4f15d64c72be701c03de98617))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
- **(es/lints)** Cover more `const-assign` cases (#5098) ([f7d857c](https://github.com/swc-project/swc/commit/f7d857c6b6c32ad228aa929d0301b22c9d34ff8b))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- **(es/modules)** Preserve orders of exports (#5081) ([2f2039c](https://github.com/swc-project/swc/commit/2f2039c693bd1e16b16dd1b1b32f3582fdadca4e))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
- **(es/modules)** Create an indirect call for a lazy require (#5089) ([0a7ca2f](https://github.com/swc-project/swc/commit/0a7ca2f4bbfaa2573b4da6b25127064cbcfd755f))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- **(es/modules)** Support lazy for `export from` (#5103) ([c531e67](https://github.com/swc-project/swc/commit/c531e67a3058bd6d567922d74fe51dc6e393761b))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
- **(es/react)** Don't panic on invalid react pragma (#5101) ([cc555ef](https://github.com/swc-project/swc/commit/cc555ef225e3299bc17b6e21d67b3a42619abd5a))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- **(es/resolver)** Fix handling of block scoped functions (#5092) ([9519e80](https://github.com/swc-project/swc/commit/9519e801ea3bd9a0d7cc4f145323d0a734c83669))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- **(html/minifier)** Small fix (#5079) ([5ac5ae2](https://github.com/swc-project/swc/commit/5ac5ae200c3c896f205e7c4567a5a6281d16015b))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
- **(html/minifier)** Fix bugs of the smart mode (#5093) ([5932a0a](https://github.com/swc-project/swc/commit/5932a0a2ef42ae67f1d2eceebe752b01160ca6fe))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
- **(node/types)** Add `simplify` (#5105) ([2a29b50](https://github.com/swc-project/swc/commit/2a29b50c5eb7e1441c2735fec9686771c6050053))
|
|
65
|
+
|
|
66
|
+
### Features
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
- **(es/modules)** Support `allowTopLevelThis` (#5086) ([9addef6](https://github.com/swc-project/swc/commit/9addef6fc8672854b52a1b71668795474a6f3fec))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
- **(es/modules)** Add pure annotations to interop functions (#5087) ([4d5783d](https://github.com/swc-project/swc/commit/4d5783d9cd1f91f5b7cdcc5efaa7d83f35ee4fef))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/modules)** Support AMD triple slash directives (#5091) ([ddb31d1](https://github.com/swc-project/swc/commit/ddb31d1fd79250b14cbb873424f02c750f9c6ef6))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(es/parser)** Support labelled function from annex B (#5078) ([b62fd3e](https://github.com/swc-project/swc/commit/b62fd3e6cc371ad4f8cb9055b3fed70f1954afa2))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
- **(html/minifier)** Remove empty metadata elements (#5085) ([cb845c9](https://github.com/swc-project/swc/commit/cb845c9bf903136b074af269b96a685027599284))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- **(visit)** Add path-aware variants (#5073) ([204d742](https://github.com/swc-project/swc/commit/204d742ed6ed5f91612245604b4e9037470bc97a))
|
|
86
|
+
|
|
87
|
+
### Testing
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- **(es/modules)** Add test for string-names (#5088) ([52bfb18](https://github.com/swc-project/swc/commit/52bfb18113895d20bc952e84302e8591c1fdf407))
|
|
92
|
+
|
|
93
|
+
## [1.2.208] - 2022-07-01
|
|
94
|
+
|
|
95
|
+
### Bug Fixes
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
- **(es/compat)** Preserve this in function with block scoped vars (#5056) ([18ea2b5](https://github.com/swc-project/swc/commit/18ea2b577011d610fbb06bb6728a86be8366703a))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
- **(es/modules)** Handle `this` in class methods (#5065) ([ef543b1](https://github.com/swc-project/swc/commit/ef543b1b22b9cf29add68984318fe19620240888))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
- **(es/modules)** Improve compatibility with cjs lexer (#5080) ([9e162dc](https://github.com/swc-project/swc/commit/9e162dcbae91a3dd4cef47ab0d80de14ada6d70d))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- **(html/minifier)** Fix smart mode (#5058) ([e9bad20](https://github.com/swc-project/swc/commit/e9bad20898df92f7d0dd898ab1924229d5113251))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
- **(html/minifier)** Minify `meta` element (#5075) ([214c60a](https://github.com/swc-project/swc/commit/214c60a313162218c9acb007b8747dbc8f39ac8a))
|
|
112
|
+
|
|
113
|
+
### Documentation
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
- **(contributing)** Add `--features memory_cache` to test steps (#5074) ([9d8beb0](https://github.com/swc-project/swc/commit/9d8beb02b7161a6af604cf187f2a53d91cd336ea))
|
|
118
|
+
|
|
119
|
+
### Features
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
- **(atoms)** Improve atoms (#5066) ([34f4f5a](https://github.com/swc-project/swc/commit/34f4f5a3bc7797e2b9b192671cf68b63ea0dd25c))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- **(es/modules)** Support node interop (#5069) ([1e33dba](https://github.com/swc-project/swc/commit/1e33dbab24a534477ed1046b57a0c9daeb84e3ca))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(es/parser)** Add `allow_return_outside_function` to options (#5046) ([37eb366](https://github.com/swc-project/swc/commit/37eb366a1f554668fd7011869ec8f58c67e9ce9f))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
- **(html/minifier)** Allow minifying custom script contents (#5043) ([d7a5f71](https://github.com/swc-project/swc/commit/d7a5f710730063c51deb91c9aa937f7d5a33e582))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(html/minifier)** Sort unordered values in attributes (#5035) ([26cfeff](https://github.com/swc-project/swc/commit/26cfeff79cbae9c7b998690ed6b59d2336cf2430))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
- **(html/minifier)** Improve `collapse_whitespaces` (#5070) ([144314d](https://github.com/swc-project/swc/commit/144314dcc2e98baba79502be6f82ea39aa71f560))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
- **(plugin)** Add versioned wrapper struct (#5062) ([e34a864](https://github.com/swc-project/swc/commit/e34a864390dc6a8a0d78cc60af458be37031e30f))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
- **(plugin)** Allow taking the inner data from versioned (#5071) ([e1aa937](https://github.com/swc-project/swc/commit/e1aa937183ca3c803be9665ec0a683b679bfc29f))
|
|
145
|
+
|
|
146
|
+
### Miscellaneous Tasks
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
- **(deps)** Update `rkyv` (#5057) ([374366d](https://github.com/swc-project/swc/commit/374366d56ca431dc892b390efaf090ee4d116100))- **general**: Workaround cargo mono bug ([60424db](https://github.com/swc-project/swc/commit/60424db67b3c9bc0d36012249e16ebaa2100f299))
|
|
151
|
+
|
|
152
|
+
### Performance
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
- **(atoms)** More groundwork for replacing `JsWord` with `Atom` (#5064) ([2e139f1](https://github.com/swc-project/swc/commit/2e139f144126636a5d44ae3866cf858426a1bb8e))
|
|
157
|
+
|
|
158
|
+
## [1.2.207] - 2022-06-28
|
|
159
|
+
|
|
160
|
+
### Bug Fixes
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
8
164
|
- **(es/compat)** Handle classes with accessors and a method with the same name (#5039) ([25bd520](https://github.com/swc-project/swc/commit/25bd5206205d76c1ff93e67b67b3aeca551113d6))
|
|
9
165
|
|
|
10
166
|
|
package/README.md
CHANGED
|
@@ -34,6 +34,14 @@
|
|
|
34
34
|
|
|
35
35
|
SWC (stands for `Speedy Web Compiler`) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a library for Rust and JavaScript at the same time. If you are using SWC from Rust, see [rustdoc](https://rustdoc.swc.rs/swc/) and for most users, your entry point for using the library will be [parser](https://rustdoc.swc.rs/swc_ecma_parser/).
|
|
36
36
|
|
|
37
|
+
Also, SWC tries to ensure that
|
|
38
|
+
|
|
39
|
+
> If you select the latest version of each crates, it will work
|
|
40
|
+
|
|
41
|
+
for rust users. Without such guarantee, using SWC would be too hard as SWC is a large, modular project and typically you have to use many modules.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
37
45
|
If you are using SWC from JavaScript, please refer to [docs on the website](https://swc.rs/docs/installation/).
|
|
38
46
|
|
|
39
47
|
# Documentation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.210",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -135,18 +135,18 @@
|
|
|
135
135
|
"url": "https://opencollective.com/swc"
|
|
136
136
|
},
|
|
137
137
|
"optionalDependencies": {
|
|
138
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
139
|
-
"@swc/core-darwin-x64": "1.2.
|
|
140
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
141
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
142
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
143
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
144
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
145
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
146
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
147
|
-
"@swc/core-android-arm64": "1.2.
|
|
148
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
149
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
150
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
138
|
+
"@swc/core-win32-x64-msvc": "1.2.210",
|
|
139
|
+
"@swc/core-darwin-x64": "1.2.210",
|
|
140
|
+
"@swc/core-linux-x64-gnu": "1.2.210",
|
|
141
|
+
"@swc/core-linux-x64-musl": "1.2.210",
|
|
142
|
+
"@swc/core-freebsd-x64": "1.2.210",
|
|
143
|
+
"@swc/core-win32-ia32-msvc": "1.2.210",
|
|
144
|
+
"@swc/core-linux-arm64-gnu": "1.2.210",
|
|
145
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.210",
|
|
146
|
+
"@swc/core-darwin-arm64": "1.2.210",
|
|
147
|
+
"@swc/core-android-arm64": "1.2.210",
|
|
148
|
+
"@swc/core-linux-arm64-musl": "1.2.210",
|
|
149
|
+
"@swc/core-win32-arm64-msvc": "1.2.210",
|
|
150
|
+
"@swc/core-android-arm-eabi": "1.2.210"
|
|
151
151
|
}
|
|
152
152
|
}
|
package/types.d.ts
CHANGED
|
@@ -642,6 +642,7 @@ export interface ConstModulesConfig {
|
|
|
642
642
|
};
|
|
643
643
|
}
|
|
644
644
|
export interface OptimizerConfig {
|
|
645
|
+
simplify?: boolean;
|
|
645
646
|
globals?: GlobalPassOption;
|
|
646
647
|
jsonify?: {
|
|
647
648
|
minCost: number;
|
|
@@ -721,6 +722,8 @@ export interface BaseModuleConfig {
|
|
|
721
722
|
*/
|
|
722
723
|
lazy?: boolean | string[];
|
|
723
724
|
/**
|
|
725
|
+
* @deprecated Use the `importInterop` option instead.
|
|
726
|
+
*
|
|
724
727
|
* By default, when using exports with swc a non-enumerable __esModule property is exported.
|
|
725
728
|
* This property is then used to determine if the import is the default export or if
|
|
726
729
|
* it contains the default export.
|
|
@@ -731,6 +734,93 @@ export interface BaseModuleConfig {
|
|
|
731
734
|
* Defaults to `false`.
|
|
732
735
|
*/
|
|
733
736
|
noInterop?: boolean;
|
|
737
|
+
/**
|
|
738
|
+
* Defaults to `swc`.
|
|
739
|
+
*
|
|
740
|
+
* CommonJS modules and ECMAScript modules are not fully compatible.
|
|
741
|
+
* However, compilers, bundlers and JavaScript runtimes developed different strategies
|
|
742
|
+
* to make them work together as well as possible.
|
|
743
|
+
*
|
|
744
|
+
* - `swc` (alias: `babel`)
|
|
745
|
+
*
|
|
746
|
+
* When using exports with `swc` a non-enumerable `__esModule` property is exported
|
|
747
|
+
* This property is then used to determine if the import is the default export
|
|
748
|
+
* or if it contains the default export.
|
|
749
|
+
*
|
|
750
|
+
* ```javascript
|
|
751
|
+
* import foo from "foo";
|
|
752
|
+
* import { bar } from "bar";
|
|
753
|
+
* foo;
|
|
754
|
+
* bar;
|
|
755
|
+
*
|
|
756
|
+
* // Is compiled to ...
|
|
757
|
+
*
|
|
758
|
+
* "use strict";
|
|
759
|
+
*
|
|
760
|
+
* function _interopRequireDefault(obj) {
|
|
761
|
+
* return obj && obj.__esModule ? obj : { default: obj };
|
|
762
|
+
* }
|
|
763
|
+
*
|
|
764
|
+
* var _foo = _interopRequireDefault(require("foo"));
|
|
765
|
+
* var _bar = require("bar");
|
|
766
|
+
*
|
|
767
|
+
* _foo.default;
|
|
768
|
+
* _bar.bar;
|
|
769
|
+
* ```
|
|
770
|
+
*
|
|
771
|
+
* When this import interop is used, if both the imported and the importer module are compiled
|
|
772
|
+
* with swc they behave as if none of them was compiled.
|
|
773
|
+
*
|
|
774
|
+
* This is the default behavior.
|
|
775
|
+
*
|
|
776
|
+
* - `node`
|
|
777
|
+
*
|
|
778
|
+
* When importing CommonJS files (either directly written in CommonJS, or generated with a compiler)
|
|
779
|
+
* Node.js always binds the `default` export to the value of `module.exports`.
|
|
780
|
+
*
|
|
781
|
+
* ```javascript
|
|
782
|
+
* import foo from "foo";
|
|
783
|
+
* import { bar } from "bar";
|
|
784
|
+
* foo;
|
|
785
|
+
* bar;
|
|
786
|
+
*
|
|
787
|
+
* // Is compiled to ...
|
|
788
|
+
*
|
|
789
|
+
* "use strict";
|
|
790
|
+
*
|
|
791
|
+
* var _foo = require("foo");
|
|
792
|
+
* var _bar = require("bar");
|
|
793
|
+
*
|
|
794
|
+
* _foo;
|
|
795
|
+
* _bar.bar;
|
|
796
|
+
* ```
|
|
797
|
+
* This is not exactly the same as what Node.js does since swc allows accessing any property of `module.exports`
|
|
798
|
+
* as a named export, while Node.js only allows importing statically analyzable properties of `module.exports`.
|
|
799
|
+
* However, any import working in Node.js will also work when compiled with swc using `importInterop: "node"`.
|
|
800
|
+
*
|
|
801
|
+
* - `none`
|
|
802
|
+
*
|
|
803
|
+
* If you know that the imported file has been transformed with a compiler that stores the `default` export on
|
|
804
|
+
* `exports.default` (such as swc or Babel), you can safely omit the `_interopRequireDefault` helper.
|
|
805
|
+
*
|
|
806
|
+
* ```javascript
|
|
807
|
+
* import foo from "foo";
|
|
808
|
+
* import { bar } from "bar";
|
|
809
|
+
* foo;
|
|
810
|
+
* bar;
|
|
811
|
+
*
|
|
812
|
+
* // Is compiled to ...
|
|
813
|
+
*
|
|
814
|
+
* "use strict";
|
|
815
|
+
*
|
|
816
|
+
* var _foo = require("foo");
|
|
817
|
+
* var _bar = require("bar");
|
|
818
|
+
*
|
|
819
|
+
* _foo.default;
|
|
820
|
+
* _bar.bar;
|
|
821
|
+
* ```
|
|
822
|
+
*/
|
|
823
|
+
importInterop?: "swc" | "babel" | "node" | "none";
|
|
734
824
|
/**
|
|
735
825
|
* If set to true, dynamic imports will be preserved.
|
|
736
826
|
*/
|