@swc/core 1.2.143 → 1.2.146
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 +275 -0
- package/binding.d.ts +1 -0
- package/binding.js +61 -60
- package/index.d.ts +22 -0
- package/index.js +23 -1
- package/package.json +15 -15
- package/types.d.ts +1 -0
- package/.kodiak.toml +0 -15
- package/clippy.toml +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,281 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
## [unreleased]
|
|
3
3
|
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
- **(css)** Fix processing of integers (#3752) ([f258ee4](https://github.com/swc-project/swc/commit/f258ee4729ccd007b43b1a08d77359d99f53ca87))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/codegen)** Fix escaping of unicodes in es5 (#3636) ([dba90ea](https://github.com/swc-project/swc/commit/dba90eae875bbaec9911c6dd72d482b75de77982))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/helpers)** Cast the result of the `instanceof` helper to boolean (#3728) ([72c9e6c](https://github.com/swc-project/swc/commit/72c9e6ca2b8186c4b297658bec1ce37912898d9f))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/parser)** Handle trailing comma and bracket after an arrow function in conditional (#3685) ([342dccc](https://github.com/swc-project/swc/commit/342dccce473aa507eabb3eed96485e2ff0674188))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/typescript)** Allow empty nested namespaces (#3754) ([f5a3647](https://github.com/swc-project/swc/commit/f5a364736420c2977a5d1211ead55ea91700fccb))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(plugin/macro)** Do not free guest memory twice (#3732) ([d8b0166](https://github.com/swc-project/swc/commit/d8b01660dcd0bca43993043e8fa6ed33c62894a9))- **general**: Fix(es/parser) Throw a syntax error for `const` without initializer in strict mode (#3742)
|
|
24
|
+
|
|
25
|
+
Co-authored-by: Donny/강동윤 <kdy1997.dev@gmail.com> ([abc0572](https://github.com/swc-project/swc/commit/abc05725575b0ee29319f32beadb014e70af5e06))
|
|
26
|
+
|
|
27
|
+
### Features
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
- **(cli)** Add tracing options for `compile` command (#3746) ([41f92d2](https://github.com/swc-project/swc/commit/41f92d228b778193e12c51466630a42cb8953599))
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
- **(css/ast)** Support more selectors (#3729) ([f5c5e77](https://github.com/swc-project/swc/commit/f5c5e7761297e4413a1615e2537ade885ec12280))
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- **(css/ast)** Allow more syntax for `@supports` at-rule (#3740) ([9b92eba](https://github.com/swc-project/swc/commit/9b92eba63686fee2176715fad8d072d6d6d34fe9))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
- **(css/ast)** Improve type definitions for unicode ranges (#3757) ([91cf965](https://github.com/swc-project/swc/commit/91cf965e07a5382349262c6d6993477fde68aa58))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- **(css/minifier)** Compress `display` (#3706) ([8512719](https://github.com/swc-project/swc/commit/8512719e126d4041133a78e106bce6c7eca30154))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
- **(es/codegen)** Add sourcemap entry for injected semicolons (#3750) ([0fd4fd2](https://github.com/swc-project/swc/commit/0fd4fd242287fde0e6a744dabf7c09430fb23d21))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- **(es/compat)** Implement loose mode for `class_properties` (#3722) ([14155eb](https://github.com/swc-project/swc/commit/14155eb0e7f6295471c92067afa4dfb84b3224ca))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
- **(es/dep-graph)** Add `TsImportEqualsDecl` for `DependencyCollector` (#3758) ([7de7eca](https://github.com/swc-project/swc/commit/7de7ecaa85f21d074d8ca8a05dae2bf5b4ab3ce8))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- **(es/parser)** Provide more api for reducing binary size (#3747) ([47ccff8](https://github.com/swc-project/swc/commit/47ccff8a7ca0054fcd761ea5878a92165f7e1c6b))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- **(macros)** Add `#[swc_trace]` (#3738) ([b4830b6](https://github.com/swc-project/swc/commit/b4830b61dc7be716fd4de3703537517e6adefdba))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
- **(node-swc)** Add experimental trace support in `@swc/core` (#3731) ([a454996](https://github.com/swc-project/swc/commit/a454996314f31ed9d8672e10588ef94815b16e98))
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
- **(plugin)** Support tracing plugin execution (#3744) ([5c29f15](https://github.com/swc-project/swc/commit/5c29f156404002d6946fbc7a71d76a6c97d7b82a))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
- **(visit)** Allow using `?Sized` as visitor (#3745) ([b0b5d5d](https://github.com/swc-project/swc/commit/b0b5d5d0c2779e48d815fbbc65c01d5344590763))
|
|
68
|
+
|
|
69
|
+
### Miscellaneous Tasks
|
|
70
|
+
- **general**: Skip CI for automated commits (#3760) ([6d98d14](https://github.com/swc-project/swc/commit/6d98d146a65e801677e63069bc52e66bb5315617))- **general**: Skip more actions for automated commits (#3761) ([0ff4ad3](https://github.com/swc-project/swc/commit/0ff4ad37c3783e7b141c6d879ed0a5a7e85135a3))
|
|
71
|
+
|
|
72
|
+
### Performance
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/modules)** Reduce usage of generics (#3743) ([1094018](https://github.com/swc-project/swc/commit/1094018153bc7d0373d9b7b533193191f416406d))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(es/parser)** Reduce usage of generics to reduce binary size (#3726) ([e21579d](https://github.com/swc-project/swc/commit/e21579d84ec287632393480e86032cc228bef0ce))
|
|
80
|
+
|
|
81
|
+
### Refactor
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- **(es)** Make compilation faster (#3749) ([3d94465](https://github.com/swc-project/swc/commit/3d944656bfa47532a79925f5b7392e2aec1a8a30))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
- **(es/transforms)** Use recommended ast apis (#3735) ([fd22379](https://github.com/swc-project/swc/commit/fd223793e86f70400a3a69d7f7c8a4775b8abaad))
|
|
89
|
+
|
|
90
|
+
### Testing
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- **(css/parser)** Add malformed hex color tests (#3762) ([9f90882](https://github.com/swc-project/swc/commit/9f90882b27d345fac79f938d42e1b5fd04d4b1b5))
|
|
95
|
+
|
|
96
|
+
## [1.2.145] - 2022-02-24
|
|
97
|
+
|
|
98
|
+
### Bug Fixes
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
- **(es/codegen)** Fix sourcemap of comments (#3723) ([b8b0c92](https://github.com/swc-project/swc/commit/b8b0c920e49c235fb65ca5585d343d2af79f9526))
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
- **(es/compat)** Throw an error if a private property is initialized multiple times (#3665) ([b6434e5](https://github.com/swc-project/swc/commit/b6434e52e70e79b96a12d48c4cebe2b0f6d8b7f5))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- **(es/parser)** Emit an error for non-last rest element in an object pattern (#3675) ([6a9d778](https://github.com/swc-project/swc/commit/6a9d77808b8513246592129e8c9e154f686fa8a9))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
- **(es/parser)** Allow `Expr::TsInstantiation` in extends clause (#3696) ([d499b8c](https://github.com/swc-project/swc/commit/d499b8c14f0f75fd48fd7f5e4b7ad6e790bf4882))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
- **(es/parser)** Disallow using reserved words as an expression in typescript (#3697) ([d6522f3](https://github.com/swc-project/swc/commit/d6522f3a37f38aef713c7cbba06349708b56ee27))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
- **(es/parser)** Fix a typescript instantiation expression followed by EOF (#3699) ([010fe04](https://github.com/swc-project/swc/commit/010fe048c20bc5a0acfbc65fe43cdd38aeae8fc1))
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
- **(es/parser)** Fix the span of an export declaration containing a const enum (#3701) ([4318a2e](https://github.com/swc-project/swc/commit/4318a2e73b1ab7df07da809cf3207268942d77b7))
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
- **(es/parser)** Don't attach comments to `;` (#3720) ([8b87bb4](https://github.com/swc-project/swc/commit/8b87bb48702f22e270574a0a67206b0dcc0b8058))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- **(es/typescript)** Fix `name` of decorated classes (#3689) ([1e49fcd](https://github.com/swc-project/swc/commit/1e49fcd44daa3107a180f7016d72f8138fb56688))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(es/typescript)** Support heterogeneous enums (#3721) ([1761cab](https://github.com/swc-project/swc/commit/1761cab6ff1e3989281493adffda07859eb90a0d))
|
|
130
|
+
|
|
131
|
+
### Features
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(cli)** Support stdin (#3688) ([3cf3b20](https://github.com/swc-project/swc/commit/3cf3b20f15e8ddbb2c32405c71183cfdbbb87835))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
- **(css/minifier)** Compress urange (#3668) ([b1476d2](https://github.com/swc-project/swc/commit/b1476d2ac6b7ff37653192fe7f46de9ae282b8cd))
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
- **(css/minifier)** Compress lengths (#3698) ([7079e88](https://github.com/swc-project/swc/commit/7079e88744ece43ebf82b05a376c5683c8015084))
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
- **(css/minifier)** Compress more properties (#3708) ([cd95ac4](https://github.com/swc-project/swc/commit/cd95ac4caf0af06db9195790707a475938a5fcb7))
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
- **(css/minifier)** Compress alpha of values (#3707) ([bff04b4](https://github.com/swc-project/swc/commit/bff04b4afecb9a57046352aaa92e4cec0e25363b))
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
- **(es/lints)** Implement `default-param-last` rule (#3681) ([e252265](https://github.com/swc-project/swc/commit/e252265a3f21a4c0dcef2e9c13aa7365f683b235))
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
- **(es/typescript)** Inline typescript `enum`s (#3647) ([1743302](https://github.com/swc-project/swc/commit/1743302819cd385f57c8d30aa8869a0765e1c5b6))
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
- **(node-swc)** Expose the new `swc_cli` as a binary named `swcx` (#3684) ([9cc094a](https://github.com/swc-project/swc/commit/9cc094ab574940f87f78328e8e1c1a346e62e5bf))
|
|
157
|
+
|
|
158
|
+
### Miscellaneous Tasks
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **(ci)** Reduce CI time (#3719) ([76ec275](https://github.com/swc-project/swc/commit/76ec275c3cea182386ad6124c264bc809e1b1633))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
- **(clippy)** Improve config (#3691) ([e35d73a](https://github.com/swc-project/swc/commit/e35d73adf4efbd7329cae6c63215e1c0a9193f8d))
|
|
166
|
+
|
|
167
|
+
### Refactor
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
- **(css/ast)** Fix the type definitions for an plus b syntax (#3682) ([321ee75](https://github.com/swc-project/swc/commit/321ee756d95f287ed4d81a9568da59c637febf19))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
- **(es)** Improve ast apis (#3690) ([135acf3](https://github.com/swc-project/swc/commit/135acf3b42221b8a9e684e39d762ad8481c75f73))
|
|
175
|
+
|
|
176
|
+
## [1.2.144] - 2022-02-22
|
|
177
|
+
|
|
178
|
+
### Bug Fixes
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
- **(es/ast)** Fix definition of `Expr::TsInstantiation` (#3657) ([68a1551](https://github.com/swc-project/swc/commit/68a155165bd04530e97ef62ecede617d954fa98d))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
- **(es/parser)** Allow type arguments inside optional chaining (#3653) ([581b63c](https://github.com/swc-project/swc/commit/581b63cf3640f5cfc35a09819dd927c87a7db2b7))
|
|
186
|
+
|
|
187
|
+
### Features
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
- **(cli)** Improve the template `package.json` for plugins (#3641) ([f237aee](https://github.com/swc-project/swc/commit/f237aeea79e140e5b6e105304fccfc48960462bf))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
- **(css/ast)** Improve parsing of colors (#3680) ([003a7b8](https://github.com/swc-project/swc/commit/003a7b85a4b458f50d057af06c9cc6ec69b592da))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
- **(css/minifier)** Compress selectors (#3623) ([9e691fe](https://github.com/swc-project/swc/commit/9e691fe75b60c73ff3ab2a7939c36f6cea167d06))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
- **(css/minifier)** Compress declarations (#3649) ([7d15316](https://github.com/swc-project/swc/commit/7d15316ee12506327b25d0ab6aaf972ac687709b))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
- **(css/minifier)** Compress degrees to zero (#3664) ([0b5f554](https://github.com/swc-project/swc/commit/0b5f5544c60136bde3bd07c9c75459086cf4b0d5))
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
- **(css/minifier)** Compress urls (#3666) ([fab6473](https://github.com/swc-project/swc/commit/fab6473183e6c3c4a8541e0146514da1264a2db6))
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
- **(css/minifier)** Compress transform functions (#3663) ([1afbd1b](https://github.com/swc-project/swc/commit/1afbd1b6e961869b001a03a90a9e24f0fe7304a6))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
- **(css/minifier)** Compress frequency (#3669) ([9b28d4d](https://github.com/swc-project/swc/commit/9b28d4da792a67275ed5d1e33acafc929f67d86f))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
- **(es/ast)** Support TypeScript Instantiation Expression (#3642) ([61e711c](https://github.com/swc-project/swc/commit/61e711c912bc31453a24dce2d1e1d98044aab3df))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
- **(es/lints)** Implement `no-new` rule (#3634) ([7ff4cbc](https://github.com/swc-project/swc/commit/7ff4cbcbe12b26ff54ffa2db9d30592f770132a2))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
- **(es/lints)** Implement `no-bitwise` rule (#3635) ([5a9d0cf](https://github.com/swc-project/swc/commit/5a9d0cf8a75275f457ae60157f34a14ada2fe852))
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
- **(es/lints)** Add `no-loop-func` rule (#3630) ([f4af363](https://github.com/swc-project/swc/commit/f4af3634de94076e571836a65b491210e096b2b8))
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
- **(es/lints)** Implement `no-empty-function` rule (#3565) ([319d501](https://github.com/swc-project/swc/commit/319d501f1733febb5861b55782dc5fe742015d2f))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
- **(es/minifier)** Merge exports (#3643) ([10adf1e](https://github.com/swc-project/swc/commit/10adf1e548c381d3ff6beef7929d409b1ff1fb60))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
- **(es/minifier)** Improve name mangler (#3638) ([e9fabd6](https://github.com/swc-project/swc/commit/e9fabd61e883edc9089cd7ddca44fda5e387b3b8))
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
- **(es/minifier)** Drop more unused vars (#3656) ([de6effc](https://github.com/swc-project/swc/commit/de6effc6e16665a0f18f23014aec15c66603a039))
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
- **(es/preset-env)** Upgrade `browserslist-rs` (#3670) ([3199966](https://github.com/swc-project/swc/commit/319996698d5531ea04afe8a6b3f3ed657620f8b4))
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
- **(plugin)** Pass `NODE_ENV` to plugins using the plugin context (#3677) ([ca0a448](https://github.com/swc-project/swc/commit/ca0a448e8ff85a4a0d02e3229ebcb2603a0b5d9a))
|
|
243
|
+
|
|
244
|
+
### Miscellaneous Tasks
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
- **(ci)** Kill previous runs (#3678) ([f733c9c](https://github.com/swc-project/swc/commit/f733c9c82f0ab942e4a02e7f97d2fda0ef88bfc1))
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
- **(cli)** Improve the plugin template (#3632) ([0f1afcb](https://github.com/swc-project/swc/commit/0f1afcb8963b27bc04145bc3e947f7408c8d9a18))- **general**: Typo (#3646) ([c5f0e87](https://github.com/swc-project/swc/commit/c5f0e87ebf20259eae230c478da200530f9430e0))
|
|
252
|
+
|
|
253
|
+
### Performance
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
- **(es/minifier)** Parallelize `join_vars` (#3655) ([da2c77d](https://github.com/swc-project/swc/commit/da2c77d9afe179b4f4f0ca1921294ba311f9306e))
|
|
258
|
+
|
|
259
|
+
### Refactor
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
- **(es/ast)** Change definition of optional chaining expressions (#3645) ([2cb66ae](https://github.com/swc-project/swc/commit/2cb66ae075ba45968f302d5cd756b0ce0dbcee41))
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
- **(preset-env)** Extract common logic for `browserslist` support (#3674) ([b1d2470](https://github.com/swc-project/swc/commit/b1d24702e3ca857c60b0c91d7f81652fd178ea31))
|
|
267
|
+
|
|
268
|
+
### Build
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
- **(cargo)** Use `lld` for windows-x64 (#3683) ([82914d4](https://github.com/swc-project/swc/commit/82914d4edf709c47e0c3338c961b81b6613b5db7))
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
- **(swc)** Remove unused dependencies (#3673) ([210f17a](https://github.com/swc-project/swc/commit/210f17af8c028dd9742a2e0ff46ce3b3869c6064))
|
|
276
|
+
|
|
277
|
+
## [1.2.143] - 2022-02-19
|
|
278
|
+
|
|
4
279
|
### Features
|
|
5
280
|
|
|
6
281
|
|
package/binding.d.ts
CHANGED
package/binding.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const { existsSync, readFileSync } = require(
|
|
3
|
-
const { join } = require(
|
|
2
|
+
const { existsSync, readFileSync } = require('fs');
|
|
3
|
+
const { join } = require('path');
|
|
4
4
|
const { platform, arch } = process;
|
|
5
5
|
let nativeBinding = null;
|
|
6
6
|
let localFileExisted = false;
|
|
7
7
|
let loadError = null;
|
|
8
8
|
function isMusl() {
|
|
9
9
|
// For Node 10
|
|
10
|
-
if (!process.report || typeof process.report.getReport !==
|
|
10
|
+
if (!process.report || typeof process.report.getReport !== 'function') {
|
|
11
11
|
try {
|
|
12
|
-
return readFileSync(
|
|
12
|
+
return readFileSync('/usr/bin/ldd', 'utf8').includes('musl');
|
|
13
13
|
}
|
|
14
14
|
catch (e) {
|
|
15
15
|
return true;
|
|
@@ -21,30 +21,30 @@ function isMusl() {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
switch (platform) {
|
|
24
|
-
case
|
|
24
|
+
case 'android':
|
|
25
25
|
switch (arch) {
|
|
26
|
-
case
|
|
27
|
-
localFileExisted = existsSync(join(__dirname,
|
|
26
|
+
case 'arm64':
|
|
27
|
+
localFileExisted = existsSync(join(__dirname, 'swc.android-arm64.node'));
|
|
28
28
|
try {
|
|
29
29
|
if (localFileExisted) {
|
|
30
|
-
nativeBinding = require(
|
|
30
|
+
nativeBinding = require('./swc.android-arm64.node');
|
|
31
31
|
}
|
|
32
32
|
else {
|
|
33
|
-
nativeBinding = require(
|
|
33
|
+
nativeBinding = require('@swc/core-android-arm64');
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
catch (e) {
|
|
37
37
|
loadError = e;
|
|
38
38
|
}
|
|
39
39
|
break;
|
|
40
|
-
case
|
|
41
|
-
localFileExisted = existsSync(join(__dirname,
|
|
40
|
+
case 'arm':
|
|
41
|
+
localFileExisted = existsSync(join(__dirname, 'swc.android-arm-eabi.node'));
|
|
42
42
|
try {
|
|
43
43
|
if (localFileExisted) {
|
|
44
|
-
nativeBinding = require(
|
|
44
|
+
nativeBinding = require('./swc.android-arm-eabi.node');
|
|
45
45
|
}
|
|
46
46
|
else {
|
|
47
|
-
nativeBinding = require(
|
|
47
|
+
nativeBinding = require('@swc/core-android-arm-eabi');
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
catch (e) {
|
|
@@ -55,44 +55,44 @@ switch (platform) {
|
|
|
55
55
|
throw new Error(`Unsupported architecture on Android ${arch}`);
|
|
56
56
|
}
|
|
57
57
|
break;
|
|
58
|
-
case
|
|
58
|
+
case 'win32':
|
|
59
59
|
switch (arch) {
|
|
60
|
-
case
|
|
61
|
-
localFileExisted = existsSync(join(__dirname,
|
|
60
|
+
case 'x64':
|
|
61
|
+
localFileExisted = existsSync(join(__dirname, 'swc.win32-x64-msvc.node'));
|
|
62
62
|
try {
|
|
63
63
|
if (localFileExisted) {
|
|
64
|
-
nativeBinding = require(
|
|
64
|
+
nativeBinding = require('./swc.win32-x64-msvc.node');
|
|
65
65
|
}
|
|
66
66
|
else {
|
|
67
|
-
nativeBinding = require(
|
|
67
|
+
nativeBinding = require('@swc/core-win32-x64-msvc');
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
catch (e) {
|
|
71
71
|
loadError = e;
|
|
72
72
|
}
|
|
73
73
|
break;
|
|
74
|
-
case
|
|
75
|
-
localFileExisted = existsSync(join(__dirname,
|
|
74
|
+
case 'ia32':
|
|
75
|
+
localFileExisted = existsSync(join(__dirname, 'swc.win32-ia32-msvc.node'));
|
|
76
76
|
try {
|
|
77
77
|
if (localFileExisted) {
|
|
78
|
-
nativeBinding = require(
|
|
78
|
+
nativeBinding = require('./swc.win32-ia32-msvc.node');
|
|
79
79
|
}
|
|
80
80
|
else {
|
|
81
|
-
nativeBinding = require(
|
|
81
|
+
nativeBinding = require('@swc/core-win32-ia32-msvc');
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
catch (e) {
|
|
85
85
|
loadError = e;
|
|
86
86
|
}
|
|
87
87
|
break;
|
|
88
|
-
case
|
|
89
|
-
localFileExisted = existsSync(join(__dirname,
|
|
88
|
+
case 'arm64':
|
|
89
|
+
localFileExisted = existsSync(join(__dirname, 'swc.win32-arm64-msvc.node'));
|
|
90
90
|
try {
|
|
91
91
|
if (localFileExisted) {
|
|
92
|
-
nativeBinding = require(
|
|
92
|
+
nativeBinding = require('./swc.win32-arm64-msvc.node');
|
|
93
93
|
}
|
|
94
94
|
else {
|
|
95
|
-
nativeBinding = require(
|
|
95
|
+
nativeBinding = require('@swc/core-win32-arm64-msvc');
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
catch (e) {
|
|
@@ -103,30 +103,30 @@ switch (platform) {
|
|
|
103
103
|
throw new Error(`Unsupported architecture on Windows: ${arch}`);
|
|
104
104
|
}
|
|
105
105
|
break;
|
|
106
|
-
case
|
|
106
|
+
case 'darwin':
|
|
107
107
|
switch (arch) {
|
|
108
|
-
case
|
|
109
|
-
localFileExisted = existsSync(join(__dirname,
|
|
108
|
+
case 'x64':
|
|
109
|
+
localFileExisted = existsSync(join(__dirname, 'swc.darwin-x64.node'));
|
|
110
110
|
try {
|
|
111
111
|
if (localFileExisted) {
|
|
112
|
-
nativeBinding = require(
|
|
112
|
+
nativeBinding = require('./swc.darwin-x64.node');
|
|
113
113
|
}
|
|
114
114
|
else {
|
|
115
|
-
nativeBinding = require(
|
|
115
|
+
nativeBinding = require('@swc/core-darwin-x64');
|
|
116
116
|
}
|
|
117
117
|
}
|
|
118
118
|
catch (e) {
|
|
119
119
|
loadError = e;
|
|
120
120
|
}
|
|
121
121
|
break;
|
|
122
|
-
case
|
|
123
|
-
localFileExisted = existsSync(join(__dirname,
|
|
122
|
+
case 'arm64':
|
|
123
|
+
localFileExisted = existsSync(join(__dirname, 'swc.darwin-arm64.node'));
|
|
124
124
|
try {
|
|
125
125
|
if (localFileExisted) {
|
|
126
|
-
nativeBinding = require(
|
|
126
|
+
nativeBinding = require('./swc.darwin-arm64.node');
|
|
127
127
|
}
|
|
128
128
|
else {
|
|
129
|
-
nativeBinding = require(
|
|
129
|
+
nativeBinding = require('@swc/core-darwin-arm64');
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
catch (e) {
|
|
@@ -137,34 +137,34 @@ switch (platform) {
|
|
|
137
137
|
throw new Error(`Unsupported architecture on macOS: ${arch}`);
|
|
138
138
|
}
|
|
139
139
|
break;
|
|
140
|
-
case
|
|
141
|
-
if (arch !==
|
|
140
|
+
case 'freebsd':
|
|
141
|
+
if (arch !== 'x64') {
|
|
142
142
|
throw new Error(`Unsupported architecture on FreeBSD: ${arch}`);
|
|
143
143
|
}
|
|
144
|
-
localFileExisted = existsSync(join(__dirname,
|
|
144
|
+
localFileExisted = existsSync(join(__dirname, 'swc.freebsd-x64.node'));
|
|
145
145
|
try {
|
|
146
146
|
if (localFileExisted) {
|
|
147
|
-
nativeBinding = require(
|
|
147
|
+
nativeBinding = require('./swc.freebsd-x64.node');
|
|
148
148
|
}
|
|
149
149
|
else {
|
|
150
|
-
nativeBinding = require(
|
|
150
|
+
nativeBinding = require('@swc/core-freebsd-x64');
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
153
|
catch (e) {
|
|
154
154
|
loadError = e;
|
|
155
155
|
}
|
|
156
156
|
break;
|
|
157
|
-
case
|
|
157
|
+
case 'linux':
|
|
158
158
|
switch (arch) {
|
|
159
|
-
case
|
|
159
|
+
case 'x64':
|
|
160
160
|
if (isMusl()) {
|
|
161
|
-
localFileExisted = existsSync(join(__dirname,
|
|
161
|
+
localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-musl.node'));
|
|
162
162
|
try {
|
|
163
163
|
if (localFileExisted) {
|
|
164
|
-
nativeBinding = require(
|
|
164
|
+
nativeBinding = require('./swc.linux-x64-musl.node');
|
|
165
165
|
}
|
|
166
166
|
else {
|
|
167
|
-
nativeBinding = require(
|
|
167
|
+
nativeBinding = require('@swc/core-linux-x64-musl');
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
catch (e) {
|
|
@@ -172,13 +172,13 @@ switch (platform) {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
else {
|
|
175
|
-
localFileExisted = existsSync(join(__dirname,
|
|
175
|
+
localFileExisted = existsSync(join(__dirname, 'swc.linux-x64-gnu.node'));
|
|
176
176
|
try {
|
|
177
177
|
if (localFileExisted) {
|
|
178
|
-
nativeBinding = require(
|
|
178
|
+
nativeBinding = require('./swc.linux-x64-gnu.node');
|
|
179
179
|
}
|
|
180
180
|
else {
|
|
181
|
-
nativeBinding = require(
|
|
181
|
+
nativeBinding = require('@swc/core-linux-x64-gnu');
|
|
182
182
|
}
|
|
183
183
|
}
|
|
184
184
|
catch (e) {
|
|
@@ -186,15 +186,15 @@ switch (platform) {
|
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
break;
|
|
189
|
-
case
|
|
189
|
+
case 'arm64':
|
|
190
190
|
if (isMusl()) {
|
|
191
|
-
localFileExisted = existsSync(join(__dirname,
|
|
191
|
+
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-musl.node'));
|
|
192
192
|
try {
|
|
193
193
|
if (localFileExisted) {
|
|
194
|
-
nativeBinding = require(
|
|
194
|
+
nativeBinding = require('./swc.linux-arm64-musl.node');
|
|
195
195
|
}
|
|
196
196
|
else {
|
|
197
|
-
nativeBinding = require(
|
|
197
|
+
nativeBinding = require('@swc/core-linux-arm64-musl');
|
|
198
198
|
}
|
|
199
199
|
}
|
|
200
200
|
catch (e) {
|
|
@@ -202,13 +202,13 @@ switch (platform) {
|
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
204
|
else {
|
|
205
|
-
localFileExisted = existsSync(join(__dirname,
|
|
205
|
+
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm64-gnu.node'));
|
|
206
206
|
try {
|
|
207
207
|
if (localFileExisted) {
|
|
208
|
-
nativeBinding = require(
|
|
208
|
+
nativeBinding = require('./swc.linux-arm64-gnu.node');
|
|
209
209
|
}
|
|
210
210
|
else {
|
|
211
|
-
nativeBinding = require(
|
|
211
|
+
nativeBinding = require('@swc/core-linux-arm64-gnu');
|
|
212
212
|
}
|
|
213
213
|
}
|
|
214
214
|
catch (e) {
|
|
@@ -216,14 +216,14 @@ switch (platform) {
|
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
break;
|
|
219
|
-
case
|
|
220
|
-
localFileExisted = existsSync(join(__dirname,
|
|
219
|
+
case 'arm':
|
|
220
|
+
localFileExisted = existsSync(join(__dirname, 'swc.linux-arm-gnueabihf.node'));
|
|
221
221
|
try {
|
|
222
222
|
if (localFileExisted) {
|
|
223
|
-
nativeBinding = require(
|
|
223
|
+
nativeBinding = require('./swc.linux-arm-gnueabihf.node');
|
|
224
224
|
}
|
|
225
225
|
else {
|
|
226
|
-
nativeBinding = require(
|
|
226
|
+
nativeBinding = require('@swc/core-linux-arm-gnueabihf');
|
|
227
227
|
}
|
|
228
228
|
}
|
|
229
229
|
catch (e) {
|
|
@@ -243,7 +243,7 @@ if (!nativeBinding) {
|
|
|
243
243
|
}
|
|
244
244
|
throw new Error(`Failed to load native binding`);
|
|
245
245
|
}
|
|
246
|
-
const { bundle, minify, minifySync, parse, parseSync, parseFileSync, parseFile, print, printSync, transform, transformSync, transformFile, transformFileSync,
|
|
246
|
+
const { bundle, minify, minifySync, parse, parseSync, parseFileSync, parseFile, print, printSync, transform, transformSync, transformFile, transformFileSync, initTraceOnce, Compiler } = nativeBinding;
|
|
247
247
|
module.exports.bundle = bundle;
|
|
248
248
|
module.exports.minify = minify;
|
|
249
249
|
module.exports.minifySync = minifySync;
|
|
@@ -257,4 +257,5 @@ module.exports.transform = transform;
|
|
|
257
257
|
module.exports.transformSync = transformSync;
|
|
258
258
|
module.exports.transformFile = transformFile;
|
|
259
259
|
module.exports.transformFileSync = transformFileSync;
|
|
260
|
+
module.exports.initTraceOnce = initTraceOnce;
|
|
260
261
|
module.exports.Compiler = Compiler;
|
package/index.d.ts
CHANGED
|
@@ -70,4 +70,26 @@ export declare function bundle(options?: BundleInput | string): Promise<{
|
|
|
70
70
|
}>;
|
|
71
71
|
export declare function minify(src: string, opts?: JsMinifyOptions): Promise<Output>;
|
|
72
72
|
export declare function minifySync(src: string, opts?: JsMinifyOptions): Output;
|
|
73
|
+
/**
|
|
74
|
+
* Configure custom trace configuration runs for a process lifecycle.
|
|
75
|
+
* Currently only chromium's trace event format is supported.
|
|
76
|
+
* (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
|
|
77
|
+
*
|
|
78
|
+
* This should be called before calling any binding interfaces exported in `@swc/core`, such as
|
|
79
|
+
* `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
|
|
80
|
+
* sets default trace subscriber if not set.
|
|
81
|
+
*
|
|
82
|
+
* Unlike other configuration, this does not belong to individual api surface using swcrc
|
|
83
|
+
* or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
|
|
84
|
+
* can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
|
|
85
|
+
* time won't cause error, subsequent calls will be ignored.
|
|
86
|
+
*
|
|
87
|
+
* As name implies currently this is experimental interface may change over time without semver
|
|
88
|
+
* major breaking changes. Please provide feedbacks,
|
|
89
|
+
* or bug report at https://github.com/swc-project/swc/discussions.
|
|
90
|
+
*/
|
|
91
|
+
export declare function __experimental_registerGlobalTraceConfig(traceConfig: {
|
|
92
|
+
type: 'traceEvent';
|
|
93
|
+
fileName?: string;
|
|
94
|
+
}): void;
|
|
73
95
|
export declare const DEFAULT_EXTENSIONS: readonly string[];
|
package/index.js
CHANGED
|
@@ -30,7 +30,7 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
30
30
|
return t;
|
|
31
31
|
};
|
|
32
32
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
33
|
-
exports.DEFAULT_EXTENSIONS = exports.minifySync = exports.minify = exports.bundle = exports.transformFileSync = exports.transformFile = exports.transformSync = exports.transform = exports.printSync = exports.print = exports.parseFileSync = exports.parseFile = exports.parseSync = exports.parse = exports.Compiler = exports.plugins = exports.version = void 0;
|
|
33
|
+
exports.DEFAULT_EXTENSIONS = exports.__experimental_registerGlobalTraceConfig = exports.minifySync = exports.minify = exports.bundle = exports.transformFileSync = exports.transformFile = exports.transformSync = exports.transform = exports.printSync = exports.print = exports.parseFileSync = exports.parseFile = exports.parseSync = exports.parse = exports.Compiler = exports.plugins = exports.version = void 0;
|
|
34
34
|
const path_1 = require("path");
|
|
35
35
|
__exportStar(require("./types"), exports);
|
|
36
36
|
const spack_1 = require("./spack");
|
|
@@ -239,6 +239,28 @@ function minifySync(src, opts) {
|
|
|
239
239
|
return compiler.minifySync(src, opts);
|
|
240
240
|
}
|
|
241
241
|
exports.minifySync = minifySync;
|
|
242
|
+
/**
|
|
243
|
+
* Configure custom trace configuration runs for a process lifecycle.
|
|
244
|
+
* Currently only chromium's trace event format is supported.
|
|
245
|
+
* (https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview)
|
|
246
|
+
*
|
|
247
|
+
* This should be called before calling any binding interfaces exported in `@swc/core`, such as
|
|
248
|
+
* `transform*`, or `parse*` or anything. To avoid breaking changes, each binding fn internally
|
|
249
|
+
* sets default trace subscriber if not set.
|
|
250
|
+
*
|
|
251
|
+
* Unlike other configuration, this does not belong to individual api surface using swcrc
|
|
252
|
+
* or api's parameters (`transform(..., {trace})`). This is due to current tracing subscriber
|
|
253
|
+
* can be configured only once for the global scope. Calling `registerGlobalTraceConfig` multiple
|
|
254
|
+
* time won't cause error, subsequent calls will be ignored.
|
|
255
|
+
*
|
|
256
|
+
* As name implies currently this is experimental interface may change over time without semver
|
|
257
|
+
* major breaking changes. Please provide feedbacks,
|
|
258
|
+
* or bug report at https://github.com/swc-project/swc/discussions.
|
|
259
|
+
*/
|
|
260
|
+
function __experimental_registerGlobalTraceConfig(traceConfig) {
|
|
261
|
+
bindings.initTraceOnce(traceConfig.type === 'traceEvent', traceConfig.fileName);
|
|
262
|
+
}
|
|
263
|
+
exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobalTraceConfig;
|
|
242
264
|
exports.DEFAULT_EXTENSIONS = Object.freeze([
|
|
243
265
|
".js",
|
|
244
266
|
".jsx",
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.146",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
7
7
|
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
|
8
|
-
"license": "Apache-2.0
|
|
8
|
+
"license": "Apache-2.0",
|
|
9
9
|
"keywords": [
|
|
10
10
|
"swc",
|
|
11
11
|
"swcpack",
|
|
@@ -104,18 +104,18 @@
|
|
|
104
104
|
"url": "https://opencollective.com/swc"
|
|
105
105
|
},
|
|
106
106
|
"optionalDependencies": {
|
|
107
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
108
|
-
"@swc/core-darwin-x64": "1.2.
|
|
109
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
110
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
111
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
112
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
113
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
114
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
115
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
116
|
-
"@swc/core-android-arm64": "1.2.
|
|
117
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
118
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
119
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
107
|
+
"@swc/core-win32-x64-msvc": "1.2.146",
|
|
108
|
+
"@swc/core-darwin-x64": "1.2.146",
|
|
109
|
+
"@swc/core-linux-x64-gnu": "1.2.146",
|
|
110
|
+
"@swc/core-linux-x64-musl": "1.2.146",
|
|
111
|
+
"@swc/core-freebsd-x64": "1.2.146",
|
|
112
|
+
"@swc/core-win32-ia32-msvc": "1.2.146",
|
|
113
|
+
"@swc/core-linux-arm64-gnu": "1.2.146",
|
|
114
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.146",
|
|
115
|
+
"@swc/core-darwin-arm64": "1.2.146",
|
|
116
|
+
"@swc/core-android-arm64": "1.2.146",
|
|
117
|
+
"@swc/core-linux-arm64-musl": "1.2.146",
|
|
118
|
+
"@swc/core-win32-arm64-msvc": "1.2.146",
|
|
119
|
+
"@swc/core-android-arm-eabi": "1.2.146"
|
|
120
120
|
}
|
|
121
121
|
}
|
package/types.d.ts
CHANGED
package/.kodiak.toml
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# .kodiak.toml
|
|
2
|
-
version = 1
|
|
3
|
-
|
|
4
|
-
# We can't use automerge because of version bumping.
|
|
5
|
-
# But to make merging faster, we auto-update PRs.
|
|
6
|
-
[merge]
|
|
7
|
-
do_not_merge = true
|
|
8
|
-
|
|
9
|
-
[update]
|
|
10
|
-
autoupdate_label = "S-approved"
|
|
11
|
-
require_automerge_label = false
|
|
12
|
-
|
|
13
|
-
# I want to use auto-merge feature of github
|
|
14
|
-
[approve]
|
|
15
|
-
auto_approve_usernames = ["kdy1"]
|
package/clippy.toml
DELETED