@swc/core 1.2.218 → 1.2.222
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 +242 -25
- package/index.d.ts +2 -1
- package/index.js +52 -30
- package/package.json +18 -16
- package/postinstall.js +5 -1
- package/spack.js +5 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,115 +5,311 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
- **(
|
|
8
|
+
- **(css/ast)** Support list of component values (#5321) ([8f81104](https://github.com/swc-project/swc/commit/8f811043809a8cc51bb717b678906576bb6eccc3))
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
- **(
|
|
11
|
+
- **(css/prefixer)** Generate prefixes for selectors using env (#5307) ([b18172d](https://github.com/swc-project/swc/commit/b18172d7613c2ecee85f559b9b317aeb2f9bfda7))
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
- **(es/
|
|
14
|
+
- **(es/codegen)** Emit type parameters of class super expression (#5338) ([42d8ad2](https://github.com/swc-project/swc/commit/42d8ad26ce5b56d9c26d342e8b6af8844b85bd17))
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
- **(es/minifier)**
|
|
17
|
+
- **(es/minifier)** Change default es version to `es5` (#5333) ([64a9946](https://github.com/swc-project/swc/commit/64a99461ecc24b074e9b674c98c1cec12b687159))
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
- **(es/
|
|
20
|
+
- **(es/minifier)** Check if an inlined value is mutated (#5318) ([11f495a](https://github.com/swc-project/swc/commit/11f495ad37cbaf56359174a206e97f0874cc0d15))
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
- **(
|
|
23
|
+
- **(es/minifier)** Ignore member expression without side-effects in assign position (#5344) ([8611161](https://github.com/swc-project/swc/commit/8611161c02223f6b1fb8734e648392794f2b1d81))
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
- **(
|
|
26
|
+
- **(es/minifier)** Allow single-thread mode (#5353) ([fbdc9af](https://github.com/swc-project/swc/commit/fbdc9af5ca51e7e2a0ba42997dd9ffd14d5059f4))
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
- **(
|
|
29
|
+
- **(es/utils)** Fix `contains_top_level_await` (#5335) ([1d10c3e](https://github.com/swc-project/swc/commit/1d10c3e83725276fa466393fb7a3139f07fa66c7))
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
### Features
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(css/prefixer)** Prefix more properties (#5340) ([8e12e52](https://github.com/swc-project/swc/commit/8e12e52a5735dafe1336d0bdc83e91dd7cca9d7d))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
- **(css/prefixer)** Avoid prefixing general functions (#5319) ([07732d6](https://github.com/swc-project/swc/commit/07732d6a0a3684697ebfd263749b12a083029db9))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- **(wasm)** Add interfaces for wasm bindings (#5341) ([c16b6b7](https://github.com/swc-project/swc/commit/c16b6b72300a4e4952398c136ef834b8ca2f4b41))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(wasm)** Enable string interning (#5351) ([b0cb35a](https://github.com/swc-project/swc/commit/b0cb35abaad7ca2a2e58462285548959d3e2c0fc))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(wasm)** Expose async facade interfaces (#5352) ([281bdd9](https://github.com/swc-project/swc/commit/281bdd9e9741ec7375497b390058a86a4f199029))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
- **(xml)** Add xml crates (#5329) ([83e5023](https://github.com/swc-project/swc/commit/83e502367b5224be8e147d2e255e1ea3b7be4faa))
|
|
51
|
+
|
|
52
|
+
### Miscellaneous Tasks
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
- **(ci)** Set MSRV to `1.60` (#5354) ([d3ecfd3](https://github.com/swc-project/swc/commit/d3ecfd36cd79e25334f36119da3233be53fa7e10))
|
|
57
|
+
|
|
58
|
+
### Performance
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- **(es/minifier)** Make name mangler faster (#5336) ([b378c06](https://github.com/swc-project/swc/commit/b378c060816411dd1990a1dae4977703d3c80748))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
- **(html/parser)** Apply small memory optimizations (#5345) ([2a499de](https://github.com/swc-project/swc/commit/2a499de61decdb836a4a51bc0fa5631568b77015))
|
|
66
|
+
|
|
67
|
+
### Refactor
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
- **(wasm)** Use async interfaces for fallback bindings (#5356) ([74e7486](https://github.com/swc-project/swc/commit/74e748617e288b98b80e4b71aee15ed6fda1c48d))
|
|
72
|
+
|
|
73
|
+
### Testing
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- **(es)** Support tsc multi-file unit tests (#5316) ([81ac366](https://github.com/swc-project/swc/commit/81ac36604edda1d38329cf10fc65720eedf48cb9))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
- **(es)** Update test cases (#5334) ([add1b75](https://github.com/swc-project/swc/commit/add1b75f61683f129b148fa14942e10a6514a0f3))
|
|
81
|
+
|
|
82
|
+
### Build
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
- **(cargo)** Update packages (#5331) ([5c9ea16](https://github.com/swc-project/swc/commit/5c9ea16b2a5e003a5fa0198f3101e93efceab3b0))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
- **(node)** Include fallback binding as a dependency (#5322) ([0782d25](https://github.com/swc-project/swc/commit/0782d250746eae97426ce7db9a24308efddcccf0))
|
|
90
|
+
|
|
91
|
+
## [1.2.220] - 2022-07-28
|
|
92
|
+
|
|
93
|
+
### Bug Fixes
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
- **(atoms)** Workaround a bug of `rkyv` (#5323) ([14894ed](https://github.com/swc-project/swc/commit/14894ed4c970b7d283e36acd6001339e7d0d04fd))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- **(css/prefixer)** Avoid prefixes for media features (#5308) ([925b16a](https://github.com/swc-project/swc/commit/925b16a563227a43fc52c107a8d2ead577137aa3))
|
|
32
101
|
|
|
33
102
|
### Features
|
|
34
103
|
|
|
35
104
|
|
|
36
105
|
|
|
37
|
-
- **(
|
|
106
|
+
- **(html/minifier)** Compress title (#5320) ([6ad5b3c](https://github.com/swc-project/swc/commit/6ad5b3ce5fc1ebb1ab37d03039065af682369610))
|
|
38
107
|
|
|
108
|
+
### Testing
|
|
39
109
|
|
|
40
|
-
- **(es/lints)** Support `ignoreReadBeforeAssign` for `prefer-const` (#4933) ([d035648](https://github.com/swc-project/swc/commit/d0356489cb1dfae8e6ced8dd239643bf6f5b029d))
|
|
41
110
|
|
|
42
111
|
|
|
43
|
-
- **(
|
|
112
|
+
- **(swc)** Update test cases (#5324) ([27c6f23](https://github.com/swc-project/swc/commit/27c6f2318af03aaafa4288ff96840977972fa7a7))
|
|
44
113
|
|
|
114
|
+
## [1.2.219] - 2022-07-27
|
|
45
115
|
|
|
46
|
-
|
|
116
|
+
### Bug Fixes
|
|
47
117
|
|
|
48
118
|
|
|
49
|
-
- **(html/minifier)** Compress more default attributes (#5182) ([625fc18](https://github.com/swc-project/swc/commit/625fc18da01643d81af535eefd4c636e5a632af0))
|
|
50
119
|
|
|
120
|
+
- **(css)** Fix parsing of `layer` (#5290) ([83651c2](https://github.com/swc-project/swc/commit/83651c297d4e6b03809b96a87ce1c59f158e28ff))
|
|
51
121
|
|
|
52
|
-
- **(html/minifier)** Improve minifier (#5227) ([1da6016](https://github.com/swc-project/swc/commit/1da6016da7db783a4207cfff480b057ea911006c))
|
|
53
122
|
|
|
123
|
+
- **(css/prefixer)** Generate at-rules based on preset-env (#5294) ([94b4e0a](https://github.com/swc-project/swc/commit/94b4e0a3213e7cd0982eebe2d1b65ac5f10af2f2))
|
|
54
124
|
|
|
55
|
-
- **(node)** Use wasm as a fallback (#5233) ([1cebf62](https://github.com/swc-project/swc/commit/1cebf626e66b52f0fe325f679443d8243ab9eba3))
|
|
56
125
|
|
|
126
|
+
- **(es/codegen)** Add `;` for a generator function (#5292) ([daac26b](https://github.com/swc-project/swc/commit/daac26bcfbc48a732d4b1b831a0f54518401f63b))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(es/codegen)** Fix sourcemap of multiline comments (#5299) ([3100bf8](https://github.com/swc-project/swc/commit/3100bf8c6220640006c3238e69f0f5fbd8fce738))
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
- **(es/compat)** Preserve orders of `import`s and `export`s (#5249) ([2010409](https://github.com/swc-project/swc/commit/2010409bac0f73c5f4d04f6735db6142f621701a))
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(es/compat)** Fix capturing of block scoping pass (#5279) ([b423d6f](https://github.com/swc-project/swc/commit/b423d6f936eb1bdc66b2223fe9189a7dcc8ae1d8))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
- **(es/decorators)** Use decorated consturctors (#5263) ([d9877e3](https://github.com/swc-project/swc/commit/d9877e305a3989e88b696135cb7cf16fc63e940f))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
- **(es/fixer)** Wrap `await` and `yield` in callee (#5314) ([b3269fd](https://github.com/swc-project/swc/commit/b3269fda8e8614cc7faaebae0edc2bbb05b7fb0e))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
- **(es/minifier)** Preserve order of side-effects in sequences pass (#5283) ([ee84842](https://github.com/swc-project/swc/commit/ee84842d226df4905fd7edae41bfa8f7d4b48bfb))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
- **(es/modules)** Use a private context for `export from` (#5262) ([c0ace4c](https://github.com/swc-project/swc/commit/c0ace4cb2c63b81dc08e35d6a59f9a9bcd961985))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
- **(es/preset-env)** Realign with `babel-polyfills` (#5293) ([dd0a152](https://github.com/swc-project/swc/commit/dd0a152f49da3acab06dece8eb7982c56e4c23b0))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
- **(es/preset-env)** Don't add instance properties when there's a static property (#5305) ([06677c2](https://github.com/swc-project/swc/commit/06677c26eed5a2320541522b3587e0b81e7ef0e9))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
- **(es/visit)** Disable `serde` by default (#5273) ([a0007e1](https://github.com/swc-project/swc/commit/a0007e11c393dd72bd5a056e7261422a96adc106))
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
- **(html/minifier)** Don't break unknown attributes (#5256) ([4f55459](https://github.com/swc-project/swc/commit/4f55459b013eeee8374ee9587e7d7c71d16262ec))
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **(html/parser)** Fix span (#5312) ([c80b9e1](https://github.com/swc-project/swc/commit/c80b9e106a432a858e40817069862b9a8f235ad3))
|
|
163
|
+
|
|
164
|
+
### Documentation
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
- **(ast_node)** Remove an unnecessary comment (#5304) ([8896dd9](https://github.com/swc-project/swc/commit/8896dd9a66686ddb84a444480f395dcd75a92cba))
|
|
169
|
+
|
|
170
|
+
### Features
|
|
57
171
|
|
|
58
|
-
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
- **(css/minifier)** Remove duplicate selectors (#5257) ([ce34746](https://github.com/swc-project/swc/commit/ce347461ee4cb14ef0f099abb6a8831c929f958a))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
- **(css/prefixer)** Implement `preset-env` (#5247) ([e78d23d](https://github.com/swc-project/swc/commit/e78d23d193585bb088f71602a33340d0a1ed1601))
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
- **(es/codegen)** Optimize number and bigint literal (#5223) ([3f0856d](https://github.com/swc-project/swc/commit/3f0856db2ef7dde001cd482088a094f49de7ddac))
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
- **(es/codegen)** Remove extra space before a private method (#5295) ([0f254d5](https://github.com/swc-project/swc/commit/0f254d5ce5c23fa3ec06c074aa1b8acc5d1dbddf))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
- **(es/minifier)** Calculate correct size (#5253) ([6573324](https://github.com/swc-project/swc/commit/6573324d9c59000c81ae35ad615b0b7428bc75f9))
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
- **(es/plugin)** Add experimental metadata field (#5254) ([bd1c2cc](https://github.com/swc-project/swc/commit/bd1c2cc7e6dcc04c3d8b59f34b4b88be29ec1ccb))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
- **(es/plugin)** Pass experimental metadata from host (#5261) ([43eeeb3](https://github.com/swc-project/swc/commit/43eeeb35a5ec2a368c3cd215abaff1e1f7fa5a1d))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
- **(node)** Coerce fallback bindings (#5250) ([7e6ffff](https://github.com/swc-project/swc/commit/7e6ffffbd3834f220e940d447bf1632f70f3b9a7))
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
- **(plugin)** Make metadata api lazy (#5310) ([5a164bd](https://github.com/swc-project/swc/commit/5a164bd13741d3871170cefe4778b615640d169d))
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
- **(testing/macros)** Generalize test names with regex (#5242) ([ecbf9d6](https://github.com/swc-project/swc/commit/ecbf9d6c36b4f86945a66deb8a7d90d7ae01dc3d))
|
|
59
202
|
|
|
60
203
|
### Miscellaneous Tasks
|
|
61
204
|
|
|
62
205
|
|
|
63
206
|
|
|
64
|
-
- **(ci)**
|
|
207
|
+
- **(ci)** Update macos runner (#5284) ([e8473eb](https://github.com/swc-project/swc/commit/e8473eb8a8d3bebea157d0e06a56d95b2350872c))
|
|
65
208
|
|
|
66
209
|
|
|
67
|
-
- **(
|
|
210
|
+
- **(ci)** Fix build for Android platforms (#5317) ([18d4029](https://github.com/swc-project/swc/commit/18d4029b337a94881ea173886271a54b5f385998))
|
|
68
211
|
|
|
69
|
-
### Testing
|
|
70
212
|
|
|
213
|
+
- **(deps)** Update `bytecheck` (#5296) ([35b1e78](https://github.com/swc-project/swc/commit/35b1e7817974b0e1d7a5af1f9314444fe4070585))- **general**: Fix CI (#5251) ([d229917](https://github.com/swc-project/swc/commit/d229917588a7bfda8bf4023c42c4190552a3b0c6))- **general**: Fix CI ([3421064](https://github.com/swc-project/swc/commit/34210648b06c4e4e4bd7d368a1b9d203535bbc30))
|
|
71
214
|
|
|
215
|
+
### Performance
|
|
72
216
|
|
|
73
|
-
- **(css/parser)** Add a test (#5228) ([8e5efb6](https://github.com/swc-project/swc/commit/8e5efb65d55706883663a25a0e281a4ef013001b))
|
|
74
217
|
|
|
75
218
|
|
|
76
|
-
- **(es/
|
|
219
|
+
- **(es/ast)** Use `Atom` in some places (#5271) ([037a53d](https://github.com/swc-project/swc/commit/037a53d5d1ff19514e6f5941fef1ed4b7fe57c31))
|
|
77
220
|
|
|
221
|
+
### Testing
|
|
78
222
|
|
|
79
|
-
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
- **(es/plugin)** Test plugins with different schema versions (#5255) ([b7c7e3a](https://github.com/swc-project/swc/commit/b7c7e3afb069da6804aafc67f5207da11ad36c17))
|
|
80
226
|
|
|
81
227
|
### Build
|
|
82
228
|
|
|
83
229
|
|
|
84
230
|
|
|
85
|
-
- **(
|
|
231
|
+
- **(cargo)** Align dependency versions (#5248) ([0d91741](https://github.com/swc-project/swc/commit/0d91741eb9dc9e2d3ae23f555e3b35c9c448cfc6))
|
|
86
232
|
|
|
87
|
-
## [1.2.
|
|
233
|
+
## [1.2.218] - 2022-07-18
|
|
88
234
|
|
|
89
235
|
### Bug Fixes
|
|
90
236
|
|
|
91
237
|
|
|
92
238
|
|
|
239
|
+
- **(cli)** Emit sourcemap with file inputs (#5213) ([3e3be80](https://github.com/swc-project/swc/commit/3e3be80efda09ae494f8962947562b4411874061))
|
|
240
|
+
|
|
241
|
+
|
|
93
242
|
- **(es)** Check the syntax context of `arguments` (#5174) ([375774d](https://github.com/swc-project/swc/commit/375774d31e690142faeb8422fed4cc996bf1de16))
|
|
94
243
|
|
|
95
244
|
|
|
245
|
+
- **(es)** Fix resolving of symlinks (#5222) ([27cc45d](https://github.com/swc-project/swc/commit/27cc45d50fa035fbb7bbab307752ec55c8d5ed0c))
|
|
246
|
+
|
|
247
|
+
|
|
96
248
|
- **(es/codegen)** Mark bigint as an item starting with number (#5207) ([387d5e4](https://github.com/swc-project/swc/commit/387d5e41db260893297b65d0fd9084f60c71443a))
|
|
97
249
|
|
|
98
250
|
|
|
99
251
|
- **(es/fixer)** Handle invalid numeric literals (#5201) ([436f620](https://github.com/swc-project/swc/commit/436f6200bc05d1d88c9b3fb991f793ed308f607b))
|
|
100
252
|
|
|
101
253
|
|
|
254
|
+
- **(es/lints)** Disallow duplicate export functions (#5234) ([c68d484](https://github.com/swc-project/swc/commit/c68d484305d3dfac3e14e45682c9d5ec10b49a45))
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
- **(es/minifier)** Fix size calculation of numbers (#5232) ([2e9c9be](https://github.com/swc-project/swc/commit/2e9c9bea1ad5c95a1e4867eba2f9bbe53c466fc7))
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
- **(es/modules)** Preserve order for ts import equals (#5215) ([6b1ce09](https://github.com/swc-project/swc/commit/6b1ce09b6f59e53a750a71e447a148aedcef8468))
|
|
261
|
+
|
|
262
|
+
|
|
102
263
|
- **(es/parser)** Fix parsing of export specifiers (#5190) ([ec93783](https://github.com/swc-project/swc/commit/ec9378370dd870c304143219afed04624075141f))
|
|
103
264
|
|
|
265
|
+
|
|
266
|
+
- **(html/parser)** Fix span (#5209) ([b4daa30](https://github.com/swc-project/swc/commit/b4daa3005803be23676bec666bb8f8791f2472b3))
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
- **(html/parser)** Improve span (#5230) ([0f7646c](https://github.com/swc-project/swc/commit/0f7646cc4763f2d79d0b3cb4529a0c7ec7df94e8))
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
- **(testing)** Allow space in file names (#5237) ([de76868](https://github.com/swc-project/swc/commit/de76868cad88b9afe103a60331c1456a3f02e37e))- **general**: Fix(es/lints: Handle ts export import equals (#5225)
|
|
273
|
+
|
|
274
|
+
([04de455](https://github.com/swc-project/swc/commit/04de455a9a34dbcbb193bffc9ab504c0e30e8706))
|
|
275
|
+
|
|
104
276
|
### Features
|
|
105
277
|
|
|
106
278
|
|
|
107
279
|
|
|
280
|
+
- **(css/ast)** Make `raw` optional (#5211) ([b65a16c](https://github.com/swc-project/swc/commit/b65a16c7aa58bca57ad861ca015867f89fb80a79))
|
|
281
|
+
|
|
282
|
+
|
|
108
283
|
- **(es)** Add quote to `swc_ecmascript` (#5199) ([fbfa59b](https://github.com/swc-project/swc/commit/fbfa59b5b78ed76350be246eecba86f8fe8b4234))
|
|
109
284
|
|
|
110
285
|
|
|
286
|
+
- **(es/lints)** Support `ignoreReadBeforeAssign` for `prefer-const` (#4933) ([d035648](https://github.com/swc-project/swc/commit/d0356489cb1dfae8e6ced8dd239643bf6f5b029d))
|
|
287
|
+
|
|
288
|
+
|
|
111
289
|
- **(es/plugin)** Print filename on failure (#5200) ([f69dee7](https://github.com/swc-project/swc/commit/f69dee75f208a6385b64fa79147eef57bd24944e))
|
|
112
290
|
|
|
113
291
|
|
|
292
|
+
- **(html/ast)** Add `raw` to attributes (#5208) ([64237fa](https://github.com/swc-project/swc/commit/64237fa7fb9c95030f92892143f476c2573bed75))
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
- **(html/ast)** Add `raw` to doctype (#5198) ([945510a](https://github.com/swc-project/swc/commit/945510a6954db87f78dcffa888f49b630f4eb74d))
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
- **(html/minifier)** Compress more default attributes (#5182) ([625fc18](https://github.com/swc-project/swc/commit/625fc18da01643d81af535eefd4c636e5a632af0))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
- **(html/minifier)** Improve minifier (#5227) ([1da6016](https://github.com/swc-project/swc/commit/1da6016da7db783a4207cfff480b057ea911006c))
|
|
302
|
+
|
|
303
|
+
|
|
114
304
|
- **(html/parser)** Add `raw` to comments (#5196) ([dead719](https://github.com/swc-project/swc/commit/dead719550b1ac3024e07f77905ce7b064f102c4))
|
|
115
305
|
|
|
116
306
|
|
|
307
|
+
- **(node)** Use wasm as a fallback (#5233) ([1cebf62](https://github.com/swc-project/swc/commit/1cebf626e66b52f0fe325f679443d8243ab9eba3))
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
- **(plugin)** Pass `unresolved_mark` to plugins (#5212) ([92c0153](https://github.com/swc-project/swc/commit/92c0153cb56a6b3b7d6503216a14d5ed78df71dc))
|
|
311
|
+
|
|
312
|
+
|
|
117
313
|
- **(quote)** Support different types for variables (#5194) ([c91abb2](https://github.com/swc-project/swc/commit/c91abb2ca75ff98e8fad7a4740b6feccec62cd54))
|
|
118
314
|
|
|
119
315
|
### Miscellaneous Tasks
|
|
@@ -128,6 +324,12 @@
|
|
|
128
324
|
|
|
129
325
|
- **(ci)** Disable some tests ([ff949b0](https://github.com/swc-project/swc/commit/ff949b0bc7df790a6d1df11f2129d589b0dd46b8))
|
|
130
326
|
|
|
327
|
+
|
|
328
|
+
- **(ci)** Fix publish script (#5241) ([66550d6](https://github.com/swc-project/swc/commit/66550d6e87582bb3cb34d18c0dffd8f33814d81d))
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
- **(visit)** Specify version of `swc_macros_common` (#5231) ([1aa0223](https://github.com/swc-project/swc/commit/1aa022361e7918f4077eacae6e51899eac007be5))- **general**: Typo (#5239) ([17f1cee](https://github.com/swc-project/swc/commit/17f1cee0a8132c79712c742f645e098df9309999))- **general**: Typo (#5238) ([df426d7](https://github.com/swc-project/swc/commit/df426d7b1d2ca74505051bfe78aa78a2a315e0ab))
|
|
332
|
+
|
|
131
333
|
### Testing
|
|
132
334
|
|
|
133
335
|
|
|
@@ -135,8 +337,23 @@
|
|
|
135
337
|
- **(css/codegen)** Add tests (#5195) ([fa4c2de](https://github.com/swc-project/swc/commit/fa4c2de7064a213eb70cc7712b50d4a41d2bfdfe))
|
|
136
338
|
|
|
137
339
|
|
|
340
|
+
- **(css/parser)** Add a test (#5228) ([8e5efb6](https://github.com/swc-project/swc/commit/8e5efb65d55706883663a25a0e281a4ef013001b))
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
- **(es/plugin)** Build plugins for e2e testing (#5210) ([cd94f0a](https://github.com/swc-project/swc/commit/cd94f0a2e9a7331073d20638031ae86d3308760e))
|
|
344
|
+
|
|
345
|
+
|
|
138
346
|
- **(plugin)** Setup e2e fixture testing for plugins (#5192) ([2fa51ec](https://github.com/swc-project/swc/commit/2fa51ecd7819b460837467d2a9093730671dd3fc))
|
|
139
347
|
|
|
348
|
+
|
|
349
|
+
- **(plugin)** Fix e2e tests on windows (#5216) ([f1ba332](https://github.com/swc-project/swc/commit/f1ba3327cfcc37534484362293cfac19587110da))
|
|
350
|
+
|
|
351
|
+
### Build
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
- **(node)** Use explicit list for package files (#5229) ([b01b6cf](https://github.com/swc-project/swc/commit/b01b6cf57ee2dcd33886ba9196f364bcb9273afe))
|
|
356
|
+
|
|
140
357
|
## [1.2.213] - 2022-07-13
|
|
141
358
|
|
|
142
359
|
### Bug Fixes
|
package/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { BundleInput } from "./spack";
|
|
|
7
7
|
export declare const version: any;
|
|
8
8
|
export declare function plugins(ps: Plugin[]): Plugin;
|
|
9
9
|
export declare class Compiler {
|
|
10
|
+
private fallbackBindingsPluginWarningDisplayed;
|
|
10
11
|
minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
|
|
11
12
|
minifySync(src: string, opts?: JsMinifyOptions): Output;
|
|
12
13
|
parse(src: string, options: ParseOptions & {
|
|
@@ -101,6 +102,6 @@ export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
|
|
|
101
102
|
* as internal representation may change anytime. Use it with caution.
|
|
102
103
|
*/
|
|
103
104
|
export declare function getBinaryMetadata(): {
|
|
104
|
-
target:
|
|
105
|
+
target: string | undefined;
|
|
105
106
|
};
|
|
106
107
|
export declare const DEFAULT_EXTENSIONS: readonly string[];
|
package/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -49,6 +53,7 @@ const spack_1 = require("./spack");
|
|
|
49
53
|
const assert = __importStar(require("assert"));
|
|
50
54
|
// Allow overrides to the location of the .node binding file
|
|
51
55
|
const bindingsOverride = process.env["SWC_BINARY_PATH"];
|
|
56
|
+
// `@swc/core` includes d.ts for the `@swc/wasm` to provide typed fallback bindings
|
|
52
57
|
let fallbackBindings;
|
|
53
58
|
const bindings = (() => {
|
|
54
59
|
let binding;
|
|
@@ -82,15 +87,18 @@ function plugins(ps) {
|
|
|
82
87
|
}
|
|
83
88
|
exports.plugins = plugins;
|
|
84
89
|
class Compiler {
|
|
90
|
+
constructor() {
|
|
91
|
+
this.fallbackBindingsPluginWarningDisplayed = false;
|
|
92
|
+
}
|
|
85
93
|
minify(src, opts) {
|
|
86
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
-
if (
|
|
88
|
-
|
|
95
|
+
if (bindings) {
|
|
96
|
+
return bindings.minify(toBuffer(src), toBuffer(opts !== null && opts !== void 0 ? opts : {}));
|
|
89
97
|
}
|
|
90
|
-
else if (
|
|
91
|
-
|
|
98
|
+
else if (fallbackBindings) {
|
|
99
|
+
return fallbackBindings.minify(src, opts);
|
|
92
100
|
}
|
|
93
|
-
|
|
101
|
+
throw new Error('Bindings not found.');
|
|
94
102
|
});
|
|
95
103
|
}
|
|
96
104
|
minifySync(src, opts) {
|
|
@@ -112,8 +120,14 @@ class Compiler {
|
|
|
112
120
|
else if (!bindings) {
|
|
113
121
|
throw new Error('Bindings not found.');
|
|
114
122
|
}
|
|
115
|
-
|
|
116
|
-
|
|
123
|
+
if (bindings) {
|
|
124
|
+
const res = yield bindings.parse(src, toBuffer(options), filename);
|
|
125
|
+
return JSON.parse(res);
|
|
126
|
+
}
|
|
127
|
+
else if (fallbackBindings) {
|
|
128
|
+
return fallbackBindings.parse(src, options);
|
|
129
|
+
}
|
|
130
|
+
throw new Error('Bindings not found.');
|
|
117
131
|
});
|
|
118
132
|
}
|
|
119
133
|
parseSync(src, options, filename) {
|
|
@@ -123,7 +137,7 @@ class Compiler {
|
|
|
123
137
|
return JSON.parse(bindings.parseSync(src, toBuffer(options), filename));
|
|
124
138
|
}
|
|
125
139
|
else if (fallbackBindings) {
|
|
126
|
-
return
|
|
140
|
+
return fallbackBindings.parseSync(src, options);
|
|
127
141
|
}
|
|
128
142
|
throw new Error('Bindings not found.');
|
|
129
143
|
}
|
|
@@ -159,13 +173,13 @@ class Compiler {
|
|
|
159
173
|
print(m, options) {
|
|
160
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
161
175
|
options = options || {};
|
|
162
|
-
if (
|
|
163
|
-
|
|
176
|
+
if (bindings) {
|
|
177
|
+
return bindings.print(JSON.stringify(m), toBuffer(options));
|
|
164
178
|
}
|
|
165
|
-
else if (
|
|
166
|
-
|
|
179
|
+
else if (fallbackBindings) {
|
|
180
|
+
return fallbackBindings.print(m, options);
|
|
167
181
|
}
|
|
168
|
-
|
|
182
|
+
throw new Error('Bindings not found.');
|
|
169
183
|
});
|
|
170
184
|
}
|
|
171
185
|
/**
|
|
@@ -178,32 +192,36 @@ class Compiler {
|
|
|
178
192
|
return bindings.printSync(JSON.stringify(m), toBuffer(options));
|
|
179
193
|
}
|
|
180
194
|
else if (fallbackBindings) {
|
|
181
|
-
return fallbackBindings.printSync(
|
|
195
|
+
return fallbackBindings.printSync(m, options);
|
|
182
196
|
}
|
|
183
197
|
throw new Error('Bindings not found.');
|
|
184
198
|
}
|
|
185
199
|
transform(src, options) {
|
|
186
200
|
var _a, _b, _c;
|
|
187
201
|
return __awaiter(this, void 0, void 0, function* () {
|
|
188
|
-
if (!bindings && !!fallbackBindings) {
|
|
189
|
-
throw new Error('Fallback bindings does not support this interface yet.');
|
|
190
|
-
}
|
|
191
|
-
else if (!bindings) {
|
|
192
|
-
throw new Error('Bindings not found.');
|
|
193
|
-
}
|
|
194
202
|
const isModule = typeof src !== "string";
|
|
195
203
|
options = options || {};
|
|
196
204
|
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
|
|
197
205
|
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
|
|
198
206
|
}
|
|
199
207
|
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
200
|
-
if (
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
208
|
+
if (bindings) {
|
|
209
|
+
if (plugin) {
|
|
210
|
+
const m = typeof src === "string"
|
|
211
|
+
? yield this.parse(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename)
|
|
212
|
+
: src;
|
|
213
|
+
return this.transform(plugin(m), newOptions);
|
|
214
|
+
}
|
|
215
|
+
return bindings.transform(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
|
|
216
|
+
}
|
|
217
|
+
else if (fallbackBindings) {
|
|
218
|
+
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
|
|
219
|
+
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
|
|
220
|
+
this.fallbackBindingsPluginWarningDisplayed = true;
|
|
221
|
+
}
|
|
222
|
+
return fallbackBindings.transform(src, options);
|
|
205
223
|
}
|
|
206
|
-
|
|
224
|
+
throw new Error('Bindings not found.');
|
|
207
225
|
});
|
|
208
226
|
}
|
|
209
227
|
transformSync(src, options) {
|
|
@@ -213,8 +231,8 @@ class Compiler {
|
|
|
213
231
|
if ((_a = options === null || options === void 0 ? void 0 : options.jsc) === null || _a === void 0 ? void 0 : _a.parser) {
|
|
214
232
|
options.jsc.parser.syntax = (_b = options.jsc.parser.syntax) !== null && _b !== void 0 ? _b : 'ecmascript';
|
|
215
233
|
}
|
|
234
|
+
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
216
235
|
if (bindings) {
|
|
217
|
-
const { plugin } = options, newOptions = __rest(options, ["plugin"]);
|
|
218
236
|
if (plugin) {
|
|
219
237
|
const m = typeof src === "string" ? this.parseSync(src, (_c = options === null || options === void 0 ? void 0 : options.jsc) === null || _c === void 0 ? void 0 : _c.parser, options.filename) : src;
|
|
220
238
|
return this.transformSync(plugin(m), newOptions);
|
|
@@ -222,7 +240,11 @@ class Compiler {
|
|
|
222
240
|
return bindings.transformSync(isModule ? JSON.stringify(src) : src, isModule, toBuffer(newOptions));
|
|
223
241
|
}
|
|
224
242
|
else if (fallbackBindings) {
|
|
225
|
-
|
|
243
|
+
if (plugin && !this.fallbackBindingsPluginWarningDisplayed) {
|
|
244
|
+
console.warn(`Fallback bindings does not support legacy plugins, it'll be ignored.`);
|
|
245
|
+
this.fallbackBindingsPluginWarningDisplayed = true;
|
|
246
|
+
}
|
|
247
|
+
return fallbackBindings.transformSync(isModule ? JSON.stringify(src) : src, options);
|
|
226
248
|
}
|
|
227
249
|
throw new Error("Bindings not found");
|
|
228
250
|
}
|
|
@@ -385,7 +407,7 @@ exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobal
|
|
|
385
407
|
*/
|
|
386
408
|
function getBinaryMetadata() {
|
|
387
409
|
return {
|
|
388
|
-
target: bindings.getTargetTriple()
|
|
410
|
+
target: bindings ? bindings === null || bindings === void 0 ? void 0 : bindings.getTargetTriple() : undefined
|
|
389
411
|
};
|
|
390
412
|
}
|
|
391
413
|
exports.getBinaryMetadata = getBinaryMetadata;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.222",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"prepublishOnly": "tsc -d && napi prepublish -p scripts/npm --tagstyle npm",
|
|
60
60
|
"pack": "wasm-pack",
|
|
61
61
|
"build:ts": "tsc -d",
|
|
62
|
-
"build:wasm": "npm-run-all \"pack -- build ./crates/
|
|
62
|
+
"build:wasm": "npm-run-all \"pack -- build ./crates/binding_core_wasm --scope swc {1} -t {2} --features plugin\" --",
|
|
63
63
|
"build": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node --release",
|
|
64
64
|
"build:dev": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts -p binding_core_node",
|
|
65
65
|
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --config ./node-swc/jest.config.js",
|
|
@@ -96,6 +96,7 @@
|
|
|
96
96
|
"@babel/preset-typescript": "^7.13.0",
|
|
97
97
|
"@babel/types": "^7.14.0",
|
|
98
98
|
"@napi-rs/cli": "^2.10.0",
|
|
99
|
+
"@swc/core": "^1.2.220",
|
|
99
100
|
"@swc/helpers": "^0.4.2",
|
|
100
101
|
"@taplo/cli": "^0.3.2",
|
|
101
102
|
"@types/jest": "^28.1.4",
|
|
@@ -137,19 +138,19 @@
|
|
|
137
138
|
"url": "https://opencollective.com/swc"
|
|
138
139
|
},
|
|
139
140
|
"optionalDependencies": {
|
|
140
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
141
|
-
"@swc/core-darwin-x64": "1.2.
|
|
142
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
143
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
144
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
145
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
146
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
147
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
148
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
149
|
-
"@swc/core-android-arm64": "1.2.
|
|
150
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
151
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
152
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
141
|
+
"@swc/core-win32-x64-msvc": "1.2.222",
|
|
142
|
+
"@swc/core-darwin-x64": "1.2.222",
|
|
143
|
+
"@swc/core-linux-x64-gnu": "1.2.222",
|
|
144
|
+
"@swc/core-linux-x64-musl": "1.2.222",
|
|
145
|
+
"@swc/core-freebsd-x64": "1.2.222",
|
|
146
|
+
"@swc/core-win32-ia32-msvc": "1.2.222",
|
|
147
|
+
"@swc/core-linux-arm64-gnu": "1.2.222",
|
|
148
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.222",
|
|
149
|
+
"@swc/core-darwin-arm64": "1.2.222",
|
|
150
|
+
"@swc/core-android-arm64": "1.2.222",
|
|
151
|
+
"@swc/core-linux-arm64-musl": "1.2.222",
|
|
152
|
+
"@swc/core-win32-arm64-msvc": "1.2.222",
|
|
153
|
+
"@swc/core-android-arm-eabi": "1.2.222"
|
|
153
154
|
},
|
|
154
155
|
"files": [
|
|
155
156
|
"CHANGELOG.md",
|
|
@@ -169,6 +170,7 @@
|
|
|
169
170
|
"package.json",
|
|
170
171
|
"spack.d.ts",
|
|
171
172
|
"types.js",
|
|
172
|
-
"postinstall.js"
|
|
173
|
+
"postinstall.js",
|
|
174
|
+
"crates/binding_core_wasm/pkg/binding_core_wasm.d.ts"
|
|
173
175
|
]
|
|
174
176
|
}
|
package/postinstall.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/spack.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|