@swc/core 1.2.146 → 1.2.149
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 +315 -0
- package/README.md +1 -1
- package/Visitor.d.ts +2 -2
- package/Visitor.js +7 -14
- package/binding.d.ts +1 -1
- package/binding.js +2 -2
- package/index.js +3 -1
- package/package.json +17 -14
- package/run_swcx.d.ts +2 -0
- package/run_swcx.js +85 -0
- package/types.d.ts +11 -6
- package/docs/adr/00000-whats-the-big-idea.md +0 -1
- package/docs/adr/00001-support-transformation-plugin-native.md +0 -94
- package/docs/adr/README.md +0 -13
- package/docs/adr/template.md +0 -72
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,321 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(css/lints)** Allow empty `@layer` at-rule before `@import` at-rule (#3842) ([90fdbab](https://github.com/swc-project/swc/commit/90fdbab0d67f1fca8b52fb6df9b927cc35219445))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/lints)** Ignore identifiers used as types while checking for duplicate bindings (#3869) ([d10e662](https://github.com/swc-project/swc/commit/d10e66285bab3ae6aadd1d4e6ef3ae0d5c977ec4))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/minifier)** Don't remove comments if `compress` is not configured (#3866) ([e70c9d8](https://github.com/swc-project/swc/commit/e70c9d8f22ad91f7a1246ac60b0ace8a3b3e7d79))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/module)** Fix `jest.spyOn` (#3845) ([9546eef](https://github.com/swc-project/swc/commit/9546eefe72178bbc7059d0fc6c5e7e9bbca089e0))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/module)** Visit the value of class properties (#3877) ([6a005fc](https://github.com/swc-project/swc/commit/6a005fc15a16c0d056a559fe3695a61b2e63944b))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(es/parser)** Use unicode id instead of xid (#3867) ([4426250](https://github.com/swc-project/swc/commit/44262508c6e122e7f9dd8e0ad961a4d6ad4a8a0c))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(es/parser)** Allow `await` in non-strict mode (#3871) ([f757163](https://github.com/swc-project/swc/commit/f7571630caf249b4a10101a2f1c86b2bbc12d4d6))
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(cli)** Setup subcommands for the features (#3858) ([367a57d](https://github.com/swc-project/swc/commit/367a57df6d66bc11dd750c6b7c30bf3a114e00fa))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(css)** Improve error recovery (#3853) ([c84bf13](https://github.com/swc-project/swc/commit/c84bf133a6ffce311548170cb9c4b0edb9804478))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
- **(css/lints)** Allow using regex in ignore list (#3855) ([dc0de58](https://github.com/swc-project/swc/commit/dc0de58a46c495bb520a99c4d8e8fcf380713f54))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- **(css/minifier)** Compress `@import` at-rule (#3850) ([ccfb4bf](https://github.com/swc-project/swc/commit/ccfb4bfc0b10375d96620f2748b0a3d022c4e359))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(es/compat)** Implement loose mode for `async_to_generator` (#3870) ([c7f2bdb](https://github.com/swc-project/swc/commit/c7f2bdb8138f4fbe59b6a03f9d6aa74966389d04))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(es/minifier)** Implement `pure_getters` partially (#3872) ([a264360](https://github.com/swc-project/swc/commit/a2643608a7aeda910da0ed03a705cff3ddecd543))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
- **(es/module/cjs)** Support regex-based patterns for lazy config (#3704) ([1f70fa6](https://github.com/swc-project/swc/commit/1f70fa6e08e9b400c2e34ee9f0d6749cf21b9e3f))
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
- **(es/transform)** Unify logic for handling class properties (#3766) ([6f076e4](https://github.com/swc-project/swc/commit/6f076e4927fca646882709832826dc0eb7106e35))
|
|
54
|
+
|
|
55
|
+
### Performance
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
- **(es)** Filter logs for `cranelift` out (#3801) ([225f9a7](https://github.com/swc-project/swc/commit/225f9a7f2a3dad917aaf2a231463ec05699b4064))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- **(es/ast)** Implement `Clone` without inline for some enums (#3878) ([3b04789](https://github.com/swc-project/swc/commit/3b04789a5750532ab9ccb78a833226b39b47a714))
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
- **(es/compat)** Add tracing support to transforms for from es2017 to es2019 (#3844) ([a933db5](https://github.com/swc-project/swc/commit/a933db5a1a54804efefd1b1d901b85a44ba059a5))
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- **(es/compat)** Add tracing support for es2015 transforms (#3857) ([cd8bb0f](https://github.com/swc-project/swc/commit/cd8bb0fb2c70c30ea421842fc6c5b6837e3ff182))
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
- **(es/transform)** Use `SingleThreadedComments` for transform (#3847) ([73ec0b3](https://github.com/swc-project/swc/commit/73ec0b3dd734dfd1ee79addfe078c709620ade17))
|
|
72
|
+
|
|
73
|
+
### Testing
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
- **(es)** Add a test for a fixed issue (#3873) ([0ab3263](https://github.com/swc-project/swc/commit/0ab32639a1ce04eba221a0bc958d150ba65fa656))
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
- **(es)** Add tests for fixed issues (#3874) ([2605e13](https://github.com/swc-project/swc/commit/2605e132e683ad0b649621a321be31347e0ac5e6))
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
- **(es)** Add tests for fixed issues (#3875) ([8d3c9d3](https://github.com/swc-project/swc/commit/8d3c9d39f036a1e876ca98bd801515edfe1cee5b))
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
- **(es/transform/jest)** Ensure that sourcemap is working (#3864) ([fc87f43](https://github.com/swc-project/swc/commit/fc87f43507ed398eb0941cffb426321e1b781980))
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
- **(swc)** Use external helpers for reference testing (#3865) ([8400708](https://github.com/swc-project/swc/commit/84007087688292fe7fcb1becea56538944dabc66))
|
|
90
|
+
|
|
91
|
+
## [1.2.148] - 2022-03-04
|
|
92
|
+
|
|
93
|
+
### Bug Fixes
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
- **(css/codegen)** Fix codegen of preserved tokens (#3819) ([7ba5861](https://github.com/swc-project/swc/commit/7ba5861a334657cb443b2f143222f632fcbcf752))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- **(css/codegen)** Fix the output of `SimpleBlock` (#3838) ([e3a5c14](https://github.com/swc-project/swc/commit/e3a5c142d5f6e965478bd68201714e6d0b4bc863))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
- **(css/parser)** Fix parsing of `;` in values (#3821) ([30cd29b](https://github.com/swc-project/swc/commit/30cd29b0f0153bd732f0004dfcb10892635ee027))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
- **(es/compat)** Fix block scoping of variables (#3826) ([406b8ea](https://github.com/swc-project/swc/commit/406b8eaeafa37d1ec68a5d5aca0f8dd337ae39ec))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
- **(es/hygiene)** Fix renaming bugs (#3824) ([043fba2](https://github.com/swc-project/swc/commit/043fba274e13055dad4b2f6cee85b1bf751572ca))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
- **(es/minifier)** Preserve more variables (#3805) ([89388e6](https://github.com/swc-project/swc/commit/89388e6ac3669f129d1dfc1f687ad7792373dbc9))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
- **(es/minifier)** Don't reorder unnecessarily (#3817) ([8a468f7](https://github.com/swc-project/swc/commit/8a468f7544ae7e717de4d629c33e5cdffdfcc7de))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
- **(es/minifier)** Support declaring multiple bindings with the same name (#3837) ([0fc819e](https://github.com/swc-project/swc/commit/0fc819e2ef04a5a809d1c15523262b2f3fbc580a))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
- **(node-swc)** Correctly close trace spans after completion (#3811) ([ffb2ee8](https://github.com/swc-project/swc/commit/ffb2ee85e6e3cac7136578c2eaaff73b883f208c))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
- **(node-swc)** Fix handling of `OptionalChainingExpression` in `Visitor` (#3809) ([4d123c3](https://github.com/swc-project/swc/commit/4d123c3789cd5a837de08014675e945990122c62))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
- **(node-swc/types)** Add a missing field of `ExportNamedDeclaration` (#3822) ([bde7577](https://github.com/swc-project/swc/commit/bde75770988a6e1c9bb6ae4b850866cea79b0f2c))
|
|
128
|
+
|
|
129
|
+
### Features
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
- **(config)** Add a dedicated cached regex (#3832) ([efc6741](https://github.com/swc-project/swc/commit/efc67417a5afd7813c2d09938300b5c372d1a978))
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
- **(css)** Support color functions (#3836) ([3df887c](https://github.com/swc-project/swc/commit/3df887ca3744813d8cfc6c253a7bb3decaca54db))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
- **(css/lints)** Add `font-family-no-duplicate-names` rule (#3818) ([2d273d6](https://github.com/swc-project/swc/commit/2d273d60b9dec4d9f969f0e691ba21ce4b252b7d))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
- **(css/lints)** Implement `color-hex-alpha` rule (#3829) ([818b408](https://github.com/swc-project/swc/commit/818b40857328ae9b855d78d774621fa1ab243da9))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
- **(css/minifier)** Compress more declarations (#3840) ([0db6915](https://github.com/swc-project/swc/commit/0db6915e32d6c1de848b0f5aeacea2c4cb4522f8))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
- **(css/parser)** Improve error recovery (#3810) ([f969f8c](https://github.com/swc-project/swc/commit/f969f8c5f54e3028576a74ccfcaae72b1c19eaf9))
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
- **(css/parser)** Improve error recovery (#3828) ([fbb98aa](https://github.com/swc-project/swc/commit/fbb98aa73cbbac186493065af8cfa0fd31407fe6))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
- **(es/lints)** Implement `radix` rule (#3651) ([f6b4bbe](https://github.com/swc-project/swc/commit/f6b4bbe47beccb6052d60c8e6d7d8c8c7fec5100))
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
- **(es/minifier)** Drop more function parameters in strict mode (#3814) ([789eb7b](https://github.com/swc-project/swc/commit/789eb7baa9ece80e85f0ffd9a92f4d07214d9b11))
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
- **(es/minifier)** Improve sequential inlining (#3820) ([364532e](https://github.com/swc-project/swc/commit/364532e9a74ee55196cecb37eb3fc8256e3a23df))
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
- **(es/minifier)** Implement more rules (#3841) ([260c2a8](https://github.com/swc-project/swc/commit/260c2a885e16332a0e3401bccb65d1381bfab3f3))
|
|
164
|
+
|
|
165
|
+
### Miscellaneous Tasks
|
|
166
|
+
- **general**: Ignore linguist detection for CSS test files (#3831) ([8755ce1](https://github.com/swc-project/swc/commit/8755ce160f9fa6f9ce75c4ac40fc02d5df236d2d))
|
|
167
|
+
|
|
168
|
+
### Performance
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
- **(es)** Use `Mutex` from `parking_lot` (#3830) ([351b814](https://github.com/swc-project/swc/commit/351b814ed0f1ca36a1e8fd352674689ffe392eda))
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
- **(es/parser)** Remove duplicated instantiations of `Parser` to reduce binary size (#3813) ([f5103a7](https://github.com/swc-project/swc/commit/f5103a77256060e2c27ca360d0c58bbcc6b92b13))
|
|
176
|
+
|
|
177
|
+
### Testing
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
- **(es/compat)** Organize tests (#3825) ([814dcc0](https://github.com/swc-project/swc/commit/814dcc09d66f9c7a968348fc3a08573cadd036f8))
|
|
182
|
+
|
|
183
|
+
## [1.2.147] - 2022-03-02
|
|
184
|
+
|
|
185
|
+
### Bug Fixes
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
- **(es/compat)** Initialize class fields as a last step (#3767) ([11bf29f](https://github.com/swc-project/swc/commit/11bf29f44b4233b2e7f60b750ef56429dbe47ce9))
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
- **(es/minifier)** Disable some operations for asm.js codes (#3572) ([e7f7f69](https://github.com/swc-project/swc/commit/e7f7f69db4f327b35005e863d3669bad382626c6))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
- **(es/minifier)** Fix inlining logic (#3776) ([cfc0363](https://github.com/swc-project/swc/commit/cfc036381a5c174798198f4ecf7e0a62abce5a75))
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
- **(es/minifier)** Preserve unresolved references (#3780) ([73cab63](https://github.com/swc-project/swc/commit/73cab638a11978da9f94c886a5fafc462b1556b7))
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
- **(es/minifier)** Fix optimizations of terminating expressions (#3794) ([8beaa20](https://github.com/swc-project/swc/commit/8beaa202e2a8c321a0f2266378d0f0a3ecb06c03))
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
- **(es/react)** Catch refresh directives widely (#3791) ([5ae907f](https://github.com/swc-project/swc/commit/5ae907f6f21d31da708ac7237536bd6f838856c3))
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
- **(es/react)** Fix logic for extracting refresh comments (#3796) ([b485b5a](https://github.com/swc-project/swc/commit/b485b5a1d5480548de9ce2c22060be37298e6346))
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
- **(es/typescript)** Transform `this` in TypeScript classes (#3764) ([5f3f9ef](https://github.com/swc-project/swc/commit/5f3f9ef033797a1b13d32bd854c3acf3cbaf4495))
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
- **(node-swc/cli)** Correctly expose `swcx` entrypoint (#3784) ([95ecc01](https://github.com/swc-project/swc/commit/95ecc013fe9b0ab0c2f52465bd961616315938c3))
|
|
214
|
+
|
|
215
|
+
### Documentation
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
- **(adr)** Add `adr-00002` for event trace profiling (#3787) ([3c1c5d0](https://github.com/swc-project/swc/commit/3c1c5d0363b231a8ac3f5bdfd15f1b2ec9224849))
|
|
220
|
+
|
|
221
|
+
### Features
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
- **(css/ast)** Union `Value` and `ComponentValue` (#3804) ([3ec45a6](https://github.com/swc-project/swc/commit/3ec45a6858a24c56ee1fe143410f3763b2b5e4b4))
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
- **(css/lints)** Add CSS linter (#3765) ([66c6cae](https://github.com/swc-project/swc/commit/66c6cae8dc7d614aac83a620b4dff022459f54d7))
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
- **(css/lints)** Add `selector-max-combinators` rule (#3789) ([e389bef](https://github.com/swc-project/swc/commit/e389bef3ad0f27382d2d6c5f2be62dd28e65e757))
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
- **(css/minifier)** Convert more length (#3769) ([500d62c](https://github.com/swc-project/swc/commit/500d62c0850a93321baafb44fa4ac4b8a9bff3f8))
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
- **(es/codegen)** Optimize output of new expressions without arguments (#3800) ([e1b13eb](https://github.com/swc-project/swc/commit/e1b13eb21a6eb1ec094a64ab30852042b89748a8))
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
- **(es/compat)** Optimize handling of literals in computed property names (#3756) ([8ed4d2f](https://github.com/swc-project/swc/commit/8ed4d2fcaccf27733e8fbfe19da810504653ce6b))
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
- **(es/compat)** Add tracing support for `es2022` transforms (#3785) ([4d70482](https://github.com/swc-project/swc/commit/4d7048291fae26c081754a496d9c77ddb2215575))
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
- **(es/compat)** Use sequence expressions instead of iife in `classes` pass (#3773) ([5b6beca](https://github.com/swc-project/swc/commit/5b6beca1afb7e4278629840c94c775a083288cd2))
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
- **(es/compat)** Add tracing support for es2020 transforms (#3798) ([8f41d7a](https://github.com/swc-project/swc/commit/8f41d7a10e99c21dc12176ee7724f0e13ca702dd))
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
- **(es/dep-graph)** Add support for `require.resolve` (#3783) ([19b84e7](https://github.com/swc-project/swc/commit/19b84e7723c381843c98df90f64e5123acdd5808))
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
- **(es/minifier)** Consider `arguments` while dropping unused assignments (#3775) ([714e05e](https://github.com/swc-project/swc/commit/714e05e5535dd4f8552ce700cc5b582d134d8a08))
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
- **(es/module)** Workaround stack overflow bug of JavaScriptCore related to too many exports (#3763) ([ad0a853](https://github.com/swc-project/swc/commit/ad0a8539e058fda49e40cc8fab167e2602576d48))
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
- **(es/modules)** Support system js (#3659) ([557a520](https://github.com/swc-project/swc/commit/557a520a6d6814f79625ca0227c47fa2d42a806e))
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
- **(es/parser)** Raise a syntax error on an invalid shorthand assignment (#3734) ([2aa3b21](https://github.com/swc-project/swc/commit/2aa3b2123fc73bc187099b5c4a0b1f796b0a51f4))
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
- **(es/quote)** Implement quasi quoter partially (#3155) ([fe0ddcc](https://github.com/swc-project/swc/commit/fe0ddcc54b0f8343a3a3d227bde8b38fa47ebd80))
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
- **(es/quote)** Support variables (#3774) ([e3c374b](https://github.com/swc-project/swc/commit/e3c374b53bdd3fe8baef5be7a63b10d2efcd47e4))
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
- **(plugin)** Expose `swc_ecma_quote` (#3790) ([bc60a6e](https://github.com/swc-project/swc/commit/bc60a6e90ccc1adcb8d9eda9ef47725e20fbfa23))
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
- **(plugin/runner)** Update `wasmer` to `v2.2` (#3788) ([99d536e](https://github.com/swc-project/swc/commit/99d536e4869df5a9cc642ed0a155683165ee93c9))
|
|
277
|
+
|
|
278
|
+
### Miscellaneous Tasks
|
|
279
|
+
- **general**: Update `rustc` (#3768) ([3798436](https://github.com/swc-project/swc/commit/3798436201a0838e55beac974792f4d560b47657))
|
|
280
|
+
|
|
281
|
+
### Performance
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
- **(css/lints)** Skip disabled rules (#3803) ([0336029](https://github.com/swc-project/swc/commit/0336029c22a8751d2acb9765f11ead79c77115dc))
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
- **(plugin/runner)** Optimize `write_into_memory_view` (#3797) ([7fd0eee](https://github.com/swc-project/swc/commit/7fd0eeecb844a182fef39872178e3991356e3ae0))
|
|
289
|
+
|
|
290
|
+
### Refactor
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
- **(css/ast)** Simplify AST types (#3753) ([815a489](https://github.com/swc-project/swc/commit/815a489dcfb72df928fc03f216dbe4a21b0e0716))
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
- **(css/lints)** Simplify error reporting API (#3781) ([b8211da](https://github.com/swc-project/swc/commit/b8211da1c9a8277cf09a8a3a1d7ae537b5d6e783))
|
|
298
|
+
|
|
299
|
+
### Testing
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
- **(css/parser)** Add tests for selectors (#3770) ([1651bcc](https://github.com/swc-project/swc/commit/1651bccf4578ff2d44a9c37eab3845c006b5164d))
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
- **(css/parser)** Add css files for material design (#3777) ([189707a](https://github.com/swc-project/swc/commit/189707a1fd5ef8547b3b80ac82f7f422f295086a))
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
- **(es/minifier)** Prepare porting more rules from `terser` (#3779) ([86072b5](https://github.com/swc-project/swc/commit/86072b57f9e0cf59b660f88cdb2c9cee15f33720))
|
|
310
|
+
|
|
311
|
+
### Build
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
- **(node-swc)** Rename entrypoint to avoid artifact collision (#3806) ([b485a2f](https://github.com/swc-project/swc/commit/b485a2fc267e0f373b9882e61c14b9fbf7a92471))
|
|
316
|
+
|
|
317
|
+
## [1.2.146] - 2022-02-27
|
|
318
|
+
|
|
319
|
+
### Bug Fixes
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
|
|
8
323
|
- **(css)** Fix processing of integers (#3752) ([f258ee4](https://github.com/swc-project/swc/commit/f258ee4729ccd007b43b1a08d77359d99f53ca87))
|
|
9
324
|
|
|
10
325
|
|
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
<p align="center">
|
|
12
12
|
<a href="https://www.npmjs.com/package/@swc/core">
|
|
13
|
-
<img alt="npm Downloads" src="https://img.shields.io/npm/
|
|
13
|
+
<img alt="npm Downloads" src="https://img.shields.io/npm/dm/@swc/core">
|
|
14
14
|
</a>
|
|
15
15
|
<a href="https://crates.io/crates/swc_ecma_parser">
|
|
16
16
|
<img alt="undefined" src="https://img.shields.io/crates/d/swc_ecma_parser.svg?label=crates.io%20downloads">
|
package/Visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsImportEqualsDeclaration, TsIndexSignature, TsInterfaceBody, TsInterfaceDeclaration, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsQualifiedName, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
|
|
1
|
+
import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsImportEqualsDeclaration, TsIndexSignature, TsInterfaceBody, TsInterfaceDeclaration, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsQualifiedName, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
|
|
2
2
|
export declare class Visitor {
|
|
3
3
|
visitProgram(n: Program): Program;
|
|
4
4
|
visitModule(m: Module): Module;
|
|
@@ -91,7 +91,6 @@ export declare class Visitor {
|
|
|
91
91
|
visitAccessibility(n: Accessibility | undefined): Accessibility | undefined;
|
|
92
92
|
visitClassProperty(n: ClassProperty): ClassMember;
|
|
93
93
|
visitClassMethod(n: ClassMethod): ClassMember;
|
|
94
|
-
visitPropertName(n: PropertyName): PropertyName;
|
|
95
94
|
visitComputedPropertyKey(n: ComputedPropName): ComputedPropName;
|
|
96
95
|
visitClass<T extends Class>(n: T): T;
|
|
97
96
|
visitFunction<T extends Fn>(n: T): T;
|
|
@@ -186,6 +185,7 @@ export declare class Visitor {
|
|
|
186
185
|
visitIdentifier(n: Identifier): Identifier;
|
|
187
186
|
visitStringLiteral(n: StringLiteral): StringLiteral;
|
|
188
187
|
visitNumericLiteral(n: NumericLiteral): NumericLiteral;
|
|
188
|
+
visitBigIntLiteral(n: BigIntLiteral): BigIntLiteral;
|
|
189
189
|
visitPattern(n: Pattern): Pattern;
|
|
190
190
|
visitRestElement(n: RestElement): RestElement;
|
|
191
191
|
visitAssignmentPattern(n: AssignmentPattern): Pattern;
|
package/Visitor.js
CHANGED
|
@@ -586,6 +586,8 @@ class Visitor {
|
|
|
586
586
|
return this.visitStringLiteral(key);
|
|
587
587
|
case "NumericLiteral":
|
|
588
588
|
return this.visitNumericLiteral(key);
|
|
589
|
+
case "BigIntLiteral":
|
|
590
|
+
return this.visitBigIntLiteral(key);
|
|
589
591
|
default:
|
|
590
592
|
return this.visitComputedPropertyKey(key);
|
|
591
593
|
}
|
|
@@ -596,7 +598,7 @@ class Visitor {
|
|
|
596
598
|
visitClassProperty(n) {
|
|
597
599
|
n.accessibility = this.visitAccessibility(n.accessibility);
|
|
598
600
|
n.decorators = this.visitDecorators(n.decorators);
|
|
599
|
-
n.key = this.
|
|
601
|
+
n.key = this.visitPropertyName(n.key);
|
|
600
602
|
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
601
603
|
n.value = this.visitOptionalExpression(n.value);
|
|
602
604
|
return n;
|
|
@@ -607,18 +609,6 @@ class Visitor {
|
|
|
607
609
|
n.key = this.visitPropertyName(n.key);
|
|
608
610
|
return n;
|
|
609
611
|
}
|
|
610
|
-
visitPropertName(n) {
|
|
611
|
-
switch (n.type) {
|
|
612
|
-
case "Identifier":
|
|
613
|
-
return this.visitIdentifier(n);
|
|
614
|
-
case "NumericLiteral":
|
|
615
|
-
return this.visitNumericLiteral(n);
|
|
616
|
-
case "StringLiteral":
|
|
617
|
-
return this.visitStringLiteral(n);
|
|
618
|
-
case "Computed":
|
|
619
|
-
return this.visitComputedPropertyKey(n);
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
612
|
visitComputedPropertyKey(n) {
|
|
623
613
|
n.expression = this.visitExpression(n.expression);
|
|
624
614
|
return n;
|
|
@@ -779,7 +769,7 @@ class Visitor {
|
|
|
779
769
|
}
|
|
780
770
|
}
|
|
781
771
|
visitOptionalChainingExpression(n) {
|
|
782
|
-
n.
|
|
772
|
+
n.base = this.visitExpression(n.base);
|
|
783
773
|
return n;
|
|
784
774
|
}
|
|
785
775
|
visitAssignmentExpression(n) {
|
|
@@ -1241,6 +1231,9 @@ class Visitor {
|
|
|
1241
1231
|
visitNumericLiteral(n) {
|
|
1242
1232
|
return n;
|
|
1243
1233
|
}
|
|
1234
|
+
visitBigIntLiteral(n) {
|
|
1235
|
+
return n;
|
|
1236
|
+
}
|
|
1244
1237
|
visitPattern(n) {
|
|
1245
1238
|
switch (n.type) {
|
|
1246
1239
|
case "Identifier":
|
package/binding.d.ts
CHANGED
package/binding.js
CHANGED
|
@@ -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, initCustomTraceSubscriber, Compiler } = nativeBinding;
|
|
247
247
|
module.exports.bundle = bundle;
|
|
248
248
|
module.exports.minify = minify;
|
|
249
249
|
module.exports.minifySync = minifySync;
|
|
@@ -257,5 +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.
|
|
260
|
+
module.exports.initCustomTraceSubscriber = initCustomTraceSubscriber;
|
|
261
261
|
module.exports.Compiler = Compiler;
|
package/index.js
CHANGED
|
@@ -258,7 +258,9 @@ exports.minifySync = minifySync;
|
|
|
258
258
|
* or bug report at https://github.com/swc-project/swc/discussions.
|
|
259
259
|
*/
|
|
260
260
|
function __experimental_registerGlobalTraceConfig(traceConfig) {
|
|
261
|
-
|
|
261
|
+
if (traceConfig.type === 'traceEvent') {
|
|
262
|
+
bindings.initCustomTraceSubscriber(traceConfig.fileName);
|
|
263
|
+
}
|
|
262
264
|
}
|
|
263
265
|
exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobalTraceConfig;
|
|
264
266
|
exports.DEFAULT_EXTENSIONS = Object.freeze([
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.149",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"swcx": "run_swcx.js"
|
|
9
|
+
},
|
|
7
10
|
"author": "강동윤 <kdy1997.dev@gmail.com>",
|
|
8
11
|
"license": "Apache-2.0",
|
|
9
12
|
"keywords": [
|
|
@@ -104,18 +107,18 @@
|
|
|
104
107
|
"url": "https://opencollective.com/swc"
|
|
105
108
|
},
|
|
106
109
|
"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.
|
|
110
|
+
"@swc/core-win32-x64-msvc": "1.2.149",
|
|
111
|
+
"@swc/core-darwin-x64": "1.2.149",
|
|
112
|
+
"@swc/core-linux-x64-gnu": "1.2.149",
|
|
113
|
+
"@swc/core-linux-x64-musl": "1.2.149",
|
|
114
|
+
"@swc/core-freebsd-x64": "1.2.149",
|
|
115
|
+
"@swc/core-win32-ia32-msvc": "1.2.149",
|
|
116
|
+
"@swc/core-linux-arm64-gnu": "1.2.149",
|
|
117
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.149",
|
|
118
|
+
"@swc/core-darwin-arm64": "1.2.149",
|
|
119
|
+
"@swc/core-android-arm64": "1.2.149",
|
|
120
|
+
"@swc/core-linux-arm64-musl": "1.2.149",
|
|
121
|
+
"@swc/core-win32-arm64-msvc": "1.2.149",
|
|
122
|
+
"@swc/core-android-arm-eabi": "1.2.149"
|
|
120
123
|
}
|
|
121
124
|
}
|
package/run_swcx.d.ts
ADDED
package/run_swcx.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
4
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
5
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
6
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
7
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
8
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
9
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
13
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
14
|
+
};
|
|
15
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
16
|
+
/**
|
|
17
|
+
* Lightweight entrypoint to native swc cli binary.
|
|
18
|
+
*
|
|
19
|
+
* This is to locate corresponding per-platform executables correctly, as well as
|
|
20
|
+
* let npm links binary to `node_modules/.bin` allows npm-related ecosystem (`npx swcx`, etcs)
|
|
21
|
+
* works correctly. However, it means spawning native binary still requires warmup from node.js
|
|
22
|
+
* process.
|
|
23
|
+
*
|
|
24
|
+
* NOTE: THIS IS NOT A PERMANENT APPROACH.
|
|
25
|
+
* Distribution of native cli binary is not fully concluded yet. This allows easier
|
|
26
|
+
* opt-in while implementation is in progress to collect feedback.
|
|
27
|
+
*/
|
|
28
|
+
const child_process_1 = require("child_process");
|
|
29
|
+
const path_1 = __importDefault(require("path"));
|
|
30
|
+
const fs_1 = require("fs");
|
|
31
|
+
const { platform, arch } = process;
|
|
32
|
+
const isMusl = () => (() => {
|
|
33
|
+
function isMusl() {
|
|
34
|
+
if (!process.report || typeof process.report.getReport !== "function") {
|
|
35
|
+
try {
|
|
36
|
+
return (0, fs_1.readFileSync)("/usr/bin/ldd", "utf8").includes("musl");
|
|
37
|
+
}
|
|
38
|
+
catch (e) {
|
|
39
|
+
return true;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
const { glibcVersionRuntime } = process.report.getReport().header;
|
|
44
|
+
return !glibcVersionRuntime;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return isMusl();
|
|
48
|
+
})();
|
|
49
|
+
const platformPackagesMap = {
|
|
50
|
+
"android": {
|
|
51
|
+
"arm64": "@swc/core-android-arm64",
|
|
52
|
+
"arm": "@swc/core-android-arm-eabi",
|
|
53
|
+
},
|
|
54
|
+
"win32": {
|
|
55
|
+
"x64": "@swc/core-win32-x64-msvc",
|
|
56
|
+
"ia32": "@swc/core-win32-ia32-msvc",
|
|
57
|
+
"arm64": "@swc/core-win32-arm64-msvc"
|
|
58
|
+
},
|
|
59
|
+
"darwin": {
|
|
60
|
+
"x64": "@swc/core-darwin-x64",
|
|
61
|
+
"arm64": "@swc/core-darwin-arm64",
|
|
62
|
+
},
|
|
63
|
+
"freebsd": {
|
|
64
|
+
"x64": "@swc/core-freebsd-x64",
|
|
65
|
+
},
|
|
66
|
+
"linux": {
|
|
67
|
+
"x64": `@swc/core-linux-x64-${isMusl() ? 'musl' : 'gnu'}`,
|
|
68
|
+
"arm64": `@swc/core-linux-arm64-${isMusl() ? 'musl' : 'gnu'}`,
|
|
69
|
+
"arm": "@swc/core-linux-arm64-gnu"
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const inferBinaryName = () => {
|
|
73
|
+
const packageName = platformPackagesMap[platform][arch];
|
|
74
|
+
if (!packageName) {
|
|
75
|
+
throw new Error(`Unsupported platform: binary for '${platform} ${arch}' is not available`);
|
|
76
|
+
}
|
|
77
|
+
return path_1.default.join(path_1.default.dirname(require.resolve(packageName)), platform === 'win32' ? 'swc.exe' : 'swc');
|
|
78
|
+
};
|
|
79
|
+
const executeBinary = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
80
|
+
const binary = inferBinaryName();
|
|
81
|
+
const [, , ...args] = process.argv;
|
|
82
|
+
const options = { cwd: process.cwd(), stdio: "inherit" };
|
|
83
|
+
return (0, child_process_1.spawn)(binary, args, options);
|
|
84
|
+
});
|
|
85
|
+
executeBinary().catch((e) => console.error(e));
|
package/types.d.ts
CHANGED
|
@@ -455,6 +455,7 @@ export interface TransformConfig {
|
|
|
455
455
|
*/
|
|
456
456
|
decoratorMetadata?: boolean;
|
|
457
457
|
treatConstEnumAsEnum?: boolean;
|
|
458
|
+
useDefineForClassFields?: boolean;
|
|
458
459
|
}
|
|
459
460
|
export interface ReactConfig {
|
|
460
461
|
/**
|
|
@@ -662,20 +663,19 @@ export interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
|
|
|
662
663
|
value?: Expression;
|
|
663
664
|
typeAnnotation?: TsTypeAnnotation;
|
|
664
665
|
is_static: boolean;
|
|
665
|
-
computed: boolean;
|
|
666
666
|
accessibility?: Accessibility;
|
|
667
|
-
is_abstract: boolean;
|
|
668
667
|
is_optional: boolean;
|
|
669
668
|
readonly: boolean;
|
|
670
|
-
definite: boolean;
|
|
671
669
|
}
|
|
672
670
|
export interface ClassProperty extends ClassPropertyBase {
|
|
673
671
|
type: "ClassProperty";
|
|
674
|
-
key:
|
|
672
|
+
key: PropertyName;
|
|
675
673
|
}
|
|
676
674
|
export interface PrivateProperty extends ClassPropertyBase {
|
|
677
675
|
type: "PrivateProperty";
|
|
678
676
|
key: PrivateName;
|
|
677
|
+
is_abstract: boolean;
|
|
678
|
+
definite: boolean;
|
|
679
679
|
}
|
|
680
680
|
export interface Param extends Node, HasSpan, HasDecorator {
|
|
681
681
|
type: "Parameter";
|
|
@@ -742,7 +742,7 @@ export interface OptionalChainingExpression extends ExpressionBase {
|
|
|
742
742
|
/**
|
|
743
743
|
* Call expression or member expression.
|
|
744
744
|
*/
|
|
745
|
-
|
|
745
|
+
base: Expression;
|
|
746
746
|
}
|
|
747
747
|
export interface ThisExpression extends ExpressionBase {
|
|
748
748
|
type: "ThisExpression";
|
|
@@ -993,6 +993,10 @@ export interface NumericLiteral extends Node, HasSpan {
|
|
|
993
993
|
type: "NumericLiteral";
|
|
994
994
|
value: number;
|
|
995
995
|
}
|
|
996
|
+
export interface BigIntLiteral extends Node, HasSpan {
|
|
997
|
+
type: "BigIntLiteral";
|
|
998
|
+
value: bigint;
|
|
999
|
+
}
|
|
996
1000
|
export declare type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
|
|
997
1001
|
export interface ExportDefaultExpression extends Node, HasSpan {
|
|
998
1002
|
type: "ExportDefaultExpression";
|
|
@@ -1020,6 +1024,7 @@ export interface ExportNamedDeclaration extends Node, HasSpan {
|
|
|
1020
1024
|
type: "ExportNamedDeclaration";
|
|
1021
1025
|
specifiers: ExportSpecifier[];
|
|
1022
1026
|
source?: StringLiteral;
|
|
1027
|
+
typeOnly: boolean;
|
|
1023
1028
|
}
|
|
1024
1029
|
export interface ExportDefaultDeclaration extends Node, HasSpan {
|
|
1025
1030
|
type: "ExportDefaultDeclaration";
|
|
@@ -1158,7 +1163,7 @@ export interface SetterProperty extends PropBase, HasSpan {
|
|
|
1158
1163
|
export interface MethodProperty extends PropBase, Fn {
|
|
1159
1164
|
type: "MethodProperty";
|
|
1160
1165
|
}
|
|
1161
|
-
export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName;
|
|
1166
|
+
export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | BigIntLiteral | ComputedPropName;
|
|
1162
1167
|
export interface ComputedPropName extends Node, HasSpan {
|
|
1163
1168
|
type: "Computed";
|
|
1164
1169
|
expression: Expression;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
### This adr attempts to describe 10,000ft view for the swc project itself. To be filled gradually.
|
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
# Support transform plugin in native rust binaries
|
|
2
|
-
|
|
3
|
-
- Status: accepted <!-- optional -->
|
|
4
|
-
- Deciders: @kdy1, @kwonoj <!-- optional -->
|
|
5
|
-
- Date: 2021-01-01 <!-- optional -->
|
|
6
|
-
|
|
7
|
-
Technical Story: [Issue](https://github.com/swc-project/swc/issues/2635) <!-- optional -->
|
|
8
|
-
|
|
9
|
-
## Context and Problem Statement
|
|
10
|
-
|
|
11
|
-
SWC wants to support load, run plugins in the native binary for the custom transform behavior. SWC already have priliminary support to load plugins in its node.js JS bindings but it has known limitations.
|
|
12
|
-
|
|
13
|
-
## Decision Drivers <!-- optional -->
|
|
14
|
-
|
|
15
|
-
- Allow to write a plugin binary can be loaded in the SWC's native binary without involving JS binding interop.
|
|
16
|
-
- Provide good, satisfactory performance while loading, running plugin's custom transformation.
|
|
17
|
-
- Keep abi stability as much, plugin binary should work across different versions of SWC host binary except intended breaking changes.
|
|
18
|
-
- Allow to write a plugin without caring much around the native platform targets binaries.
|
|
19
|
-
|
|
20
|
-
## Considered Options
|
|
21
|
-
|
|
22
|
-
- [option 1] JS-based plugins, including babel plugins
|
|
23
|
-
|
|
24
|
-
- [option 2] Plugins based on `abi_stable` and native dynamic libraries
|
|
25
|
-
|
|
26
|
-
- [option 3] Wasm plugins based on `wasmtime`
|
|
27
|
-
|
|
28
|
-
- **[option 4]** Wasm plugins based on `wasmer`
|
|
29
|
-
|
|
30
|
-
## Decision Outcome
|
|
31
|
-
|
|
32
|
-
Chosen option: **[option 4] Wasm plugins based on `wasmer`**
|
|
33
|
-
|
|
34
|
-
This decision is taken because
|
|
35
|
-
|
|
36
|
-
- It was relatively easy plugin author to generate single binary works across most of platforms SWC's host binary supports, without concern of cross-target compilations.
|
|
37
|
-
- It was relatively easy to achieve abi-stable between SWC host to plugin binaries.
|
|
38
|
-
- It doesn't require to have separate, specialized AST struct (named `plugin_ast`) to pass into ffi boundary of the plugin.
|
|
39
|
-
- Its serialization / deserialization performance is near identical or faster than `abi_stable` based ffi
|
|
40
|
-
|
|
41
|
-
## Pros and Cons of the Options <!-- optional -->
|
|
42
|
-
|
|
43
|
-
### [option 1] JS-based plugins, including babel plugins
|
|
44
|
-
|
|
45
|
-
SWC allow implementing plugins using javascript, and call it from worker threads as required.
|
|
46
|
-
This includes babel plugins, to make migration from babel more convenient.
|
|
47
|
-
|
|
48
|
-
- Good, because users can use rich ecosystem of babel.
|
|
49
|
-
- Good, because users are used to javascript.
|
|
50
|
-
- Good, because all platforms are supported.
|
|
51
|
-
- Bad, because passing data to and from javascript is very costly. ([SWC issue: Speed up `parse`](https://github.com/swc-project/swc/issues/2175))
|
|
52
|
-
- Bad, because js plugins require and block the main javascript thread.
|
|
53
|
-
- Bad, because the main javascript is singled threaded and be bottleneck.
|
|
54
|
-
- Bad, because `napi` (renamed to `node-api`) does not provide a way to get the return value of a function called from other thread than js thread. To workaround this, we should implement a complex request-response system based using lots of mutex.
|
|
55
|
-
- Bad, because node js worker thread is not an event loop. This means worker we cannot `yield` from a worker thread when we need to call js plugin. As a result, the when main js thread is busy because of js plugins, worker threads are also blocked without doing any task.
|
|
56
|
-
|
|
57
|
-
### [option 2] Plugins based on `abi_stable` and native dynamic libraries
|
|
58
|
-
|
|
59
|
-
Plugins are written in rust, and built as native libraries for each platforms. SWC pass data to plugin using special form of AST, which has stable memory representation regardless of the version of `rustc`.
|
|
60
|
-
|
|
61
|
-
- Good, because it's fast, even on the first run.
|
|
62
|
-
- Good, because it does not require very complex request-response system.
|
|
63
|
-
- Good, because plugin authors can use all features of rust.
|
|
64
|
-
- Bad, because configuring CI for publishing plugins is very hard.
|
|
65
|
-
- Bad, because plugin developer cannot publish a plugin from a single machine.
|
|
66
|
-
- Bad, because loading of plugins is complex. Path for dynamic libraries are platform-dependant.
|
|
67
|
-
- Bad, because we have to handle quirks of each platforms.
|
|
68
|
-
- Bad, because `@swc/wasm` has no way to support plugins.
|
|
69
|
-
|
|
70
|
-
### [option 3] Wasm plugins based on `wasmtime`
|
|
71
|
-
|
|
72
|
-
SWC embeds `wasmtime`, loads plugin built as web assembly.
|
|
73
|
-
|
|
74
|
-
- Good, because it's fast except the first run.
|
|
75
|
-
- Good, because configuring CI is simple.
|
|
76
|
-
- Good, because plugin authors can publish a plugin without CI, even with a single machine.
|
|
77
|
-
- Bad, because `@swc/wasm` has no way to support plugins.
|
|
78
|
-
- Bad, because first run is slow.
|
|
79
|
-
- Bad, because we have to manage the cache of compiled wasm files.
|
|
80
|
-
- Bad, because `wasmtime` does not support all platforms.
|
|
81
|
-
|
|
82
|
-
### [option 4] Wasm plugins based on `wasmer`
|
|
83
|
-
|
|
84
|
-
SWC embeds web assembly runtime (https://wasmer.io/), loads plugin built as web assembly.
|
|
85
|
-
|
|
86
|
-
- Good, because it's fast except the first run.
|
|
87
|
-
- Good, because configuring CI is simple.
|
|
88
|
-
- Good, because plugin authors can publish a plugin without CI, even with a single machine.
|
|
89
|
-
- Good, because `@swc/wasm` can support plugins in future as `wasmer` officially supports using it within a wasm file.
|
|
90
|
-
- Bad, because first run is slow.
|
|
91
|
-
- Bad, because we have to manage the cache of compiled wasm files.
|
|
92
|
-
- Bad, because `wasmer` does not support all platforms.
|
|
93
|
-
|
|
94
|
-
## Links
|
package/docs/adr/README.md
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
# Architectural Decision Records
|
|
2
|
-
|
|
3
|
-
This directory contains a series of [Architectural Decision Records](https://adr.github.io/)
|
|
4
|
-
or "ADRs" for the `swc` project. We're going to try to use it as a kind of collective
|
|
5
|
-
memory of the decisions we've made and the path we've taken to get the project to its current
|
|
6
|
-
point.
|
|
7
|
-
|
|
8
|
-
Note that these are *historical references* that do not supersede (but might enhance) the living
|
|
9
|
-
documentation of the project itself, which you can find inline in the source code.
|
|
10
|
-
|
|
11
|
-
Proposing a non-trivial change to the way `swc` works? You might like to start with an ADR
|
|
12
|
-
by copying `template.md` into a new file, filling out a first version of the proposal, and
|
|
13
|
-
posting it as a PR on the github repo for discussion.
|
package/docs/adr/template.md
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# [short title of solved problem and solution]
|
|
2
|
-
|
|
3
|
-
* Status: [proposed | rejected | accepted | deprecated | … | superseded by [ADR-0005](0005-example.md)] <!-- optional -->
|
|
4
|
-
* Deciders: [list everyone involved in the decision] <!-- optional -->
|
|
5
|
-
* Date: [YYYY-MM-DD when the decision was last updated] <!-- optional -->
|
|
6
|
-
|
|
7
|
-
Technical Story: [description | ticket/issue URL] <!-- optional -->
|
|
8
|
-
|
|
9
|
-
## Context and Problem Statement
|
|
10
|
-
|
|
11
|
-
[Describe the context and problem statement, e.g., in free form using two to three sentences. You may want to articulate the problem in form of a question.]
|
|
12
|
-
|
|
13
|
-
## Decision Drivers <!-- optional -->
|
|
14
|
-
|
|
15
|
-
* [driver 1, e.g., a force, facing concern, …]
|
|
16
|
-
* [driver 2, e.g., a force, facing concern, …]
|
|
17
|
-
* … <!-- numbers of drivers can vary -->
|
|
18
|
-
|
|
19
|
-
## Considered Options
|
|
20
|
-
|
|
21
|
-
* [option 1]
|
|
22
|
-
* [option 2]
|
|
23
|
-
* [option 3]
|
|
24
|
-
* … <!-- numbers of options can vary -->
|
|
25
|
-
|
|
26
|
-
## Decision Outcome
|
|
27
|
-
|
|
28
|
-
Chosen option: "[option 1]", because [justification. e.g., only option, which meets k.o. criterion decision driver | which resolves force force | … | comes out best (see below)].
|
|
29
|
-
|
|
30
|
-
### Positive Consequences <!-- optional -->
|
|
31
|
-
|
|
32
|
-
* [e.g., improvement of quality attribute satisfaction, follow-up decisions required, …]
|
|
33
|
-
* …
|
|
34
|
-
|
|
35
|
-
### Negative Consequences <!-- optional -->
|
|
36
|
-
|
|
37
|
-
* [e.g., compromising quality attribute, follow-up decisions required, …]
|
|
38
|
-
* …
|
|
39
|
-
|
|
40
|
-
## Pros and Cons of the Options <!-- optional -->
|
|
41
|
-
|
|
42
|
-
### [option 1]
|
|
43
|
-
|
|
44
|
-
[example | description | pointer to more information | …] <!-- optional -->
|
|
45
|
-
|
|
46
|
-
* Good, because [argument a]
|
|
47
|
-
* Good, because [argument b]
|
|
48
|
-
* Bad, because [argument c]
|
|
49
|
-
* … <!-- numbers of pros and cons can vary -->
|
|
50
|
-
|
|
51
|
-
### [option 2]
|
|
52
|
-
|
|
53
|
-
[example | description | pointer to more information | …] <!-- optional -->
|
|
54
|
-
|
|
55
|
-
* Good, because [argument a]
|
|
56
|
-
* Good, because [argument b]
|
|
57
|
-
* Bad, because [argument c]
|
|
58
|
-
* … <!-- numbers of pros and cons can vary -->
|
|
59
|
-
|
|
60
|
-
### [option 3]
|
|
61
|
-
|
|
62
|
-
[example | description | pointer to more information | …] <!-- optional -->
|
|
63
|
-
|
|
64
|
-
* Good, because [argument a]
|
|
65
|
-
* Good, because [argument b]
|
|
66
|
-
* Bad, because [argument c]
|
|
67
|
-
* … <!-- numbers of pros and cons can vary -->
|
|
68
|
-
|
|
69
|
-
## Links <!-- optional -->
|
|
70
|
-
|
|
71
|
-
* [Link type] [Link to ADR] <!-- example: Refined by [ADR-0005](0005-example.md) -->
|
|
72
|
-
* … <!-- numbers of links can vary -->
|