@swc/core 1.2.127 → 1.2.131
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 +293 -0
- package/Visitor.d.ts +3 -2
- package/Visitor.js +32 -8
- package/clippy.toml +2 -0
- package/docs/adr/00000-whats-the-big-idea.md +1 -0
- package/docs/adr/00001-support-transformation-plugin-native.md +94 -0
- package/docs/adr/README.md +13 -0
- package/docs/adr/template.md +72 -0
- package/package.json +14 -14
- package/types.d.ts +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,260 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(common)** Use `siphasher` directly and upgrade transitive dependencies to avoid UB (#3299) ([641265b](https://github.com/swc-project/swc/commit/641265b147da9478f5d205ddc0c7c16ed94b8676))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/compat)** Apply `static_blocks` before `class_properties` (#3292) ([89235b8](https://github.com/swc-project/swc/commit/89235b8294dedb4dd50c85e2a3b3ce41bddac85e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/minifier)** Fix analysis of unary expressions (#3286) ([b55ae4b](https://github.com/swc-project/swc/commit/b55ae4b312b5677efeb9f3e9697dc2bcff81e322))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/minifier)** Inline into interpolations in tagged template literals (#3287) ([fa5c063](https://github.com/swc-project/swc/commit/fa5c063144246ce634305399787e08498765eb8f))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/minifier)** Remove more side-effect-free expressions. (#3301) ([18a11d7](https://github.com/swc-project/swc/commit/18a11d7c8f6582df2a486ef8fdafca85d323bee7))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(es/minifier)** Don't emit invalid code (#3302) ([8e796cd](https://github.com/swc-project/swc/commit/8e796cdc0ac59d7cab7e9e845afc2f98ee89c3ae))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(es/minifier)** Fix logic for checking `arguments` (#3313) ([1aa494b](https://github.com/swc-project/swc/commit/1aa494b1c0d26151c56500dd2bab283b7a4222c5))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **(es/minifier)** Prevent infinite loop due to negation (#3310) ([b4d21bf](https://github.com/swc-project/swc/commit/b4d21bf0778d973d651b6f1825c4eb27dc150ea2))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(es/resolver)** Ignore names of jsx attributes (#3289) ([9a89895](https://github.com/swc-project/swc/commit/9a898951bc14e96af926e8a47a87d9220eaf4826))
|
|
33
|
+
|
|
34
|
+
### Documentation
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
- **(swc)** Document `typescript::strip` (#3305) ([18cd98e](https://github.com/swc-project/swc/commit/18cd98e54cdd3c651fc12815aa59a6640a1c0dcb))
|
|
39
|
+
|
|
40
|
+
### Features
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(es/compat)** Use remove useless source map entries generated by `classes` (#3242) ([2352920](https://github.com/swc-project/swc/commit/2352920889c217be41dd5d18c2af6088e1cd0473))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(es/minifier)** Drop more expressions from parallel optimizer (#3303) ([210ecf8](https://github.com/swc-project/swc/commit/210ecf83bb2d23d72f903243c173a249cf4ffccb))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
- **(plugin)** Add `PluginError` (#3300) ([c6ffdc8](https://github.com/swc-project/swc/commit/c6ffdc87172e504adff5757ebbb6ec2014136cf1))
|
|
51
|
+
|
|
52
|
+
### Refactor
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
- **(es)** Add `visit_obj_and_computed` macro (#3304) ([9e636c7](https://github.com/swc-project/swc/commit/9e636c7e582ff898ca2e374f0b3938dda98a5b67))
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
- **(es/minifier)** Fix clippy warnings (#3312) ([2891220](https://github.com/swc-project/swc/commit/289122009bff1e8d57178ca2cc1706f52335d1c5))
|
|
60
|
+
|
|
61
|
+
### Testing
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
- **(plugin/runner)** Pin dependencies for the integration test (#3306) ([7ba8a83](https://github.com/swc-project/swc/commit/7ba8a838819ae40f54801808a41af3d5334421b6))
|
|
66
|
+
|
|
67
|
+
## [1.2.130] - 2022-01-17
|
|
68
|
+
|
|
69
|
+
### Bug Fixes
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
- **(css/lexer)** Resolve a `TODO` (#3260) ([ade8ab8](https://github.com/swc-project/swc/commit/ade8ab8c35b9d1c61d740f42672fb4d27977346d))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/ast)** Update `EsVersion::latest()` (#3261) ([6997851](https://github.com/swc-project/swc/commit/69978518c9f6be3797f401dcaf9a429de88e8ce1))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(es/minifier)** Preserve side effects in correct position (#3263) ([efd8671](https://github.com/swc-project/swc/commit/efd86715c9827197278914df5dbc9f4fab1a35d9))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
- **(es/parser)** Throw an error when function body has use strict and paramaters is not simple (#3278) ([6406b49](https://github.com/swc-project/swc/commit/6406b49df259eb10424ecbcc7fbbc9e4acdd37db))
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- **(es/react)** Fix `createElement` (#3277) ([88a258a](https://github.com/swc-project/swc/commit/88a258a5fb91a58feb571096c4a73d6779b3128d))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
- **(es/resolver)** Treat a switch statement as a block scope (#3275) ([f4b3cb7](https://github.com/swc-project/swc/commit/f4b3cb714aac1f936523f4d95467b67e554e583d))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- **(es/transforms)** Fix `this` in async arrow class properties (#3252) ([7c19e26](https://github.com/swc-project/swc/commit/7c19e26d0f41002a35c1695c259172916e578eab))
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
- **(es/transforms)** Remove unsafe `new String("...")` optimization (#3284) ([162c1fe](https://github.com/swc-project/swc/commit/162c1fe047631c35f8b8105c1a40ad6728e6edff))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
- **(es/transforms)** Handle template literals within `jsonify` pass (#3282) ([b76d1da](https://github.com/swc-project/swc/commit/b76d1da699ab0475d349a0c9d5b06ffdd7a6b48f))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- **(swc)** Remove `wrong-target` (#3251) ([0843f74](https://github.com/swc-project/swc/commit/0843f742c5db3e0a8dc2fc2767b96fe0fad76bd1))
|
|
101
|
+
|
|
102
|
+
### Documentation
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
- **(adr)** Configure adr and add `00001-plugin` (#3249) ([8652b2d](https://github.com/swc-project/swc/commit/8652b2df99c37527fcd973bd8f0cd3c54bfa9485))
|
|
107
|
+
|
|
108
|
+
### Features
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
- **(css)** Support `@layer` at-rule (#3258) ([c195335](https://github.com/swc-project/swc/commit/c1953350121a0703f6b71474e348bc9408de085c))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
- **(es/ast)** Improve AST api for plugin authors (#3281) ([9dd0647](https://github.com/swc-project/swc/commit/9dd0647e3ae6c00a4fcea3bdb82c269ebb1e61ca))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
- **(es/compat)** Use `var` for `_len` and `args` in rest parameters (#3267) ([d3cc488](https://github.com/swc-project/swc/commit/d3cc488ac1f41bc752903a3e15a123a909a2b765))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
- **(plugin/runner)** Free allocated memory on errors (#3270) ([66d1a92](https://github.com/swc-project/swc/commit/66d1a92635c4e04041af1c106dbda8b4d692ba8a))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
- **(plugin/runnner)** Support `wasm32-wasi` targets (#3271) ([a4c4974](https://github.com/swc-project/swc/commit/a4c497464da5691fee1aff1246d3d36d1b3579af))
|
|
125
|
+
|
|
126
|
+
### Miscellaneous Tasks
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
- **(ci)** Configure `clippy` (#3250) ([978de59](https://github.com/swc-project/swc/commit/978de5943e60a09b5596b20b9c96596d392393c9))
|
|
131
|
+
|
|
132
|
+
### Refactor
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
- **(*)** Fix some clippy warnings (#3257) ([15b604b](https://github.com/swc-project/swc/commit/15b604b6d6f55353a0df13293333367851962f6c))
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
- **(*)** Cleanup (#3274) ([357a350](https://github.com/swc-project/swc/commit/357a35039082c79ba698ce64a69e9022d790632d))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
- **(es)** More fix for clippy (#3280) ([e8670b3](https://github.com/swc-project/swc/commit/e8670b3383b4baf02a94702bc92a6dcdcd647755))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
- **(es/transforms)** Cleanup (#3273) ([2690742](https://github.com/swc-project/swc/commit/2690742db0bf59246d0d9b96dfc5f6248fcbb3a0))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
- **(es/utils)** Merge the super field visitor with `FnEnvHoister` (#3279) ([90a62bb](https://github.com/swc-project/swc/commit/90a62bb21528035eef02fe7fa99de6f6e014d0ca))
|
|
149
|
+
|
|
150
|
+
### Build
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
- **(node)** Fix glibc issue on linux gnu arm (#3255) ([2144271](https://github.com/swc-project/swc/commit/214427157ddf155da14b2bede3b315d3f6ce1e77))
|
|
155
|
+
|
|
156
|
+
## [1.2.129] - 2022-01-13
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **(es/compat)** Transform `&&=` operator (#3225) ([2e5150d](https://github.com/swc-project/swc/commit/2e5150d2b714ba86bd228506eb0f008d9f5859e1))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
- **(es/minifier)** Fix handling of inlined call to a hoisted function (#3223) ([78720c4](https://github.com/swc-project/swc/commit/78720c4c91530165b24585dab635f13eea9997a3))
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
- **(es/minifier)** Fix optimization of assignment expressions (#3231) ([12dd0a6](https://github.com/swc-project/swc/commit/12dd0a6c1fb6eeaf603f0f1a6da3a4231c8c47f6))
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
- **(es/minifier)** Fix bugs (#3238) ([74fd353](https://github.com/swc-project/swc/commit/74fd3530535813023b77739dd8f37a682269be67))
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
- **(es/parser)** Fix span of `ComputedPropName` (#3234) ([105cbc2](https://github.com/swc-project/swc/commit/105cbc2017e20a7c6a5d7dfdd7a9a4c396032be9))
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
- **(es/typescript)** Remove rogue `println` (#3244) ([282232c](https://github.com/swc-project/swc/commit/282232c9958309e70a18799449802ef5d7e88123))
|
|
178
|
+
|
|
179
|
+
### Features
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
- **(plugin)** Don't serialize/deserialize needlessly (#3227) ([a2f2b5a](https://github.com/swc-project/swc/commit/a2f2b5ac8924ce635fc9547057da287864fe188a))
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
- **(plugin/macro)** Add safe API for plugins based on a proc-macro (#3240) ([432d5d3](https://github.com/swc-project/swc/commit/432d5d3fb7d870b08f8c16e4147c3f5421693d2b))
|
|
187
|
+
|
|
188
|
+
## [1.2.128] - 2022-01-11
|
|
189
|
+
|
|
190
|
+
### Bug Fixes
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
- **(es/helpers)** Don't transpile `_typeof` helper (#3208) ([54353a6](https://github.com/swc-project/swc/commit/54353a6fb5ab53ed4762161ecdda1a3ec0d77c62))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
- **(es/hygiene)** Visit computed properties in usage analyzer (#3217) ([cdb46cf](https://github.com/swc-project/swc/commit/cdb46cfb9180e67915c88eabdfd48317870e330d))
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
- **(es/minifier)** Disable inlining of expressions from `collapse_vars` (#3200) ([69b5f79](https://github.com/swc-project/swc/commit/69b5f799f3d40947ce3b5bc851ee44d3caad5328))
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
- **(es/minifier)** Drop unreachable statements eagerly (#3204) ([0105939](https://github.com/swc-project/swc/commit/01059394268791d85d48d9c1cbfa11564b1eb85e))
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
- **(es/modules)** Fix lazy import handling (#3211) ([9565149](https://github.com/swc-project/swc/commit/956514953940556847e7a5b42d7f1f21cffe9dd8))
|
|
207
|
+
|
|
208
|
+
### Features
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
- **(es/ast)** Use `ModuleExportName` for `ExportNamespaceSpecifier` (#3195) ([432f877](https://github.com/swc-project/swc/commit/432f87779003e50f17bcaedc35edb8583644c548))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
- **(es/ast)** Update `is-macro` (#3226) ([1edbf1a](https://github.com/swc-project/swc/commit/1edbf1a37a37c5e3a9bf695b4793d0c35c2d6592))
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
- **(es/compat)** Implement object super (#3127) ([b649d23](https://github.com/swc-project/swc/commit/b649d23bac1faf5ae0ba9463ba9069d09055b63c))
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
- **(es/parser)** Accept strings for import/exports (#3190) ([3fb76f6](https://github.com/swc-project/swc/commit/3fb76f64c4e5ee49b0415757b3ead5fc753a93b6))
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
- **(es/transforms)** Add `Assumptions` (#3215) ([42f7268](https://github.com/swc-project/swc/commit/42f726873e6c9e813a750acbf6d818bd4e914e31))
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
- **(plugin)** Pass serialized ast to a wasm file (#3199) ([92de2c7](https://github.com/swc-project/swc/commit/92de2c78841ee1dc8b372268690637a19c3f4307))
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
- **(plugin)** Allow multi-value for the plugin signature (#3216) ([c9ded9b](https://github.com/swc-project/swc/commit/c9ded9b72080b013466f450d9b3917055e40fa23))
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
- **(plugin)** Perform actual transforms in plugins (#3220) ([7e7421e](https://github.com/swc-project/swc/commit/7e7421ea527f499c6488de19fb8171f2b65787b4))
|
|
234
|
+
|
|
235
|
+
### Miscellaneous Tasks
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
- **(es/minifier)** Add scripts to extract tests automatically (#3212) ([057fca4](https://github.com/swc-project/swc/commit/057fca4196263dcfc05e6161cb727ec4888d7e10))
|
|
240
|
+
|
|
241
|
+
### Refactor
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
- **(es/ast)** Change types of member-like expressions (#3178) ([f58b50b](https://github.com/swc-project/swc/commit/f58b50bea7507def95b94b498ba9c5faf55df802))
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
- **(es/compat)** Preserve length of functions in `async_generator` (#3202) ([5bee4e4](https://github.com/swc-project/swc/commit/5bee4e490229a3a045d4008b156034c4233ec89e))
|
|
249
|
+
|
|
250
|
+
### Security
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
- **(repo)** Fix crev integration (#3210) ([70c2f3b](https://github.com/swc-project/swc/commit/70c2f3b3a57ec9afc1f28ec1c6377dbbf4e920b6))
|
|
255
|
+
|
|
256
|
+
## [1.2.127] - 2022-01-06
|
|
257
|
+
|
|
258
|
+
### Bug Fixes
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
|
|
8
262
|
- **(es/lints)** Fix incorrect duplicate binding error (#3194) ([913c82a](https://github.com/swc-project/swc/commit/913c82a2ab94e14eb350e1573af736aa87c7f2bb))
|
|
9
263
|
|
|
10
264
|
|
|
@@ -31,6 +285,39 @@
|
|
|
31
285
|
|
|
32
286
|
- **(ci)** Split cargo docs (#3187) ([46949d3](https://github.com/swc-project/swc/commit/46949d39ebdcb14347156eb00490e53d37d06707))
|
|
33
287
|
|
|
288
|
+
|
|
289
|
+
- **(ci)** Fix publish scripts ([3458e9f](https://github.com/swc-project/swc/commit/3458e9f1d3eac7c47ba00a5768d3f8f41c8037ef))
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
- **(ci)** Fix publish scripts again ([b292126](https://github.com/swc-project/swc/commit/b292126b387c4efff0576517c7d706b16c08bca3))
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
- **(ci)** Fix `--cargo-flags` ([a20f5d9](https://github.com/swc-project/swc/commit/a20f5d9a7cd007d3c5fb671710d1344cd1577119))
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
- **(ci)** Use `--cargo-flags` in correct place ([ef4ea2f](https://github.com/swc-project/swc/commit/ef4ea2fc7b10ec50d317118680f58c70cf64c89b))
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
- **(ci)** Use `RUSTFLAGS` for linux ([4cbe8d1](https://github.com/swc-project/swc/commit/4cbe8d18bb10dfa8a333931767ebf958dab3bbae))
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
- **(ci)** Use more `RUSTFLAGS` ([bf0acd1](https://github.com/swc-project/swc/commit/bf0acd13da50a500414edbaf686a0632736f66fd))
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
- **(ci)** Fix musl ([fef8449](https://github.com/swc-project/swc/commit/fef844954b6aecd610c87ccb5ec30a2b08bd328a))
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
- **(ci)** Fix `aarch64-pc-windows-msvc` ([1ebbe62](https://github.com/swc-project/swc/commit/1ebbe622909a974abd0ea96929adee1c33f8f256))
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
- **(ci)** Change version of `rustc` ([d901b62](https://github.com/swc-project/swc/commit/d901b6222f8a77beed64968fcb4764bbacf8c755))
|
|
314
|
+
|
|
315
|
+
|
|
316
|
+
- **(ci)** Fix publish script (#3197) ([c34f1a9](https://github.com/swc-project/swc/commit/c34f1a977fac44813ebda5beb77b6444469e36e4))
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
- **(ci)** Remove redudant plugin test ([e19fe7d](https://github.com/swc-project/swc/commit/e19fe7d33b2a18c1b068c2f808f3ea72f1ccff15))
|
|
320
|
+
|
|
34
321
|
### Refactor
|
|
35
322
|
|
|
36
323
|
|
|
@@ -46,6 +333,12 @@
|
|
|
46
333
|
|
|
47
334
|
- **(plugin/runner)** Avoid redundant filesystem reads (#3186) ([b61c49f](https://github.com/swc-project/swc/commit/b61c49fe39acf28e09888e7b2163c7be5cceff4b))
|
|
48
335
|
|
|
336
|
+
|
|
337
|
+
- **(plugin/runner)** Replace wasm runtime (#3196) ([c3895ca](https://github.com/swc-project/swc/commit/c3895ca9aaf4c8b76f1eb1bf2c8655d8acb20b94))
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
- **(plugin/runner)** Reuse wasmer ([28ff059](https://github.com/swc-project/swc/commit/28ff0592a4005e89561500f915929ffa25da9160))
|
|
341
|
+
|
|
49
342
|
## [1.2.126] - 2022-01-03
|
|
50
343
|
|
|
51
344
|
### Bug Fixes
|
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 } from "./types";
|
|
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";
|
|
2
2
|
export declare class Visitor {
|
|
3
3
|
visitProgram(n: Program): Program;
|
|
4
4
|
visitModule(m: Module): Module;
|
|
@@ -140,7 +140,8 @@ export declare class Visitor {
|
|
|
140
140
|
visitArgument(n: Argument): Argument;
|
|
141
141
|
visitMetaProperty(n: MetaProperty): Expression;
|
|
142
142
|
visitMemberExpression(n: MemberExpression): Expression;
|
|
143
|
-
|
|
143
|
+
visitSuperPropExpression(n: SuperPropExpression): Expression;
|
|
144
|
+
visitCallee(n: Expression | Super | Import): Expression | Super | Import;
|
|
144
145
|
visitJSXText(n: JSXText): JSXText;
|
|
145
146
|
visitJSXNamespacedName(n: JSXNamespacedName): JSXNamespacedName;
|
|
146
147
|
visitJSXMemberExpression(n: JSXMemberExpression): JSXMemberExpression;
|
package/Visitor.js
CHANGED
|
@@ -730,6 +730,8 @@ class Visitor {
|
|
|
730
730
|
return this.visitJSXText(n);
|
|
731
731
|
case "MemberExpression":
|
|
732
732
|
return this.visitMemberExpression(n);
|
|
733
|
+
case "SuperPropExpression":
|
|
734
|
+
return this.visitSuperPropExpression(n);
|
|
733
735
|
case "MetaProperty":
|
|
734
736
|
return this.visitMetaProperty(n);
|
|
735
737
|
case "NewExpression":
|
|
@@ -955,17 +957,39 @@ class Visitor {
|
|
|
955
957
|
return n;
|
|
956
958
|
}
|
|
957
959
|
visitMetaProperty(n) {
|
|
958
|
-
n.meta = this.visitIdentifierReference(n.meta);
|
|
959
|
-
n.property = this.visitIdentifier(n.property);
|
|
960
960
|
return n;
|
|
961
961
|
}
|
|
962
962
|
visitMemberExpression(n) {
|
|
963
|
-
n.object = this.
|
|
964
|
-
|
|
965
|
-
|
|
963
|
+
n.object = this.visitExpression(n.object);
|
|
964
|
+
switch (n.property.type) {
|
|
965
|
+
case 'Computed': {
|
|
966
|
+
n.property = this.visitComputedPropertyKey(n.property);
|
|
967
|
+
return n;
|
|
968
|
+
}
|
|
969
|
+
case 'Identifier': {
|
|
970
|
+
n.property = this.visitIdentifier(n.property);
|
|
971
|
+
return n;
|
|
972
|
+
}
|
|
973
|
+
case 'PrivateName': {
|
|
974
|
+
n.property = this.visitPrivateName(n.property);
|
|
975
|
+
return n;
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}
|
|
979
|
+
visitSuperPropExpression(n) {
|
|
980
|
+
switch (n.property.type) {
|
|
981
|
+
case 'Computed': {
|
|
982
|
+
n.property = this.visitComputedPropertyKey(n.property);
|
|
983
|
+
return n;
|
|
984
|
+
}
|
|
985
|
+
case 'Identifier': {
|
|
986
|
+
n.property = this.visitIdentifier(n.property);
|
|
987
|
+
return n;
|
|
988
|
+
}
|
|
989
|
+
}
|
|
966
990
|
}
|
|
967
|
-
|
|
968
|
-
if (n.type === "Super") {
|
|
991
|
+
visitCallee(n) {
|
|
992
|
+
if (n.type === "Super" || n.type === "Import") {
|
|
969
993
|
return n;
|
|
970
994
|
}
|
|
971
995
|
return this.visitExpression(n);
|
|
@@ -1116,7 +1140,7 @@ class Visitor {
|
|
|
1116
1140
|
return n;
|
|
1117
1141
|
}
|
|
1118
1142
|
visitCallExpression(n) {
|
|
1119
|
-
n.callee = this.
|
|
1143
|
+
n.callee = this.visitCallee(n.callee);
|
|
1120
1144
|
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
1121
1145
|
if (n.arguments) {
|
|
1122
1146
|
n.arguments = this.visitArguments(n.arguments);
|
package/clippy.toml
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
### This adr attempts to describe 10,000ft view for the swc project itself. To be filled gradually.
|
|
@@ -0,0 +1,94 @@
|
|
|
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
|
|
@@ -0,0 +1,13 @@
|
|
|
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.
|
|
@@ -0,0 +1,72 @@
|
|
|
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 -->
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.131",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -51,19 +51,19 @@
|
|
|
51
51
|
"@node-rs/helper": "^1.0.0"
|
|
52
52
|
},
|
|
53
53
|
"optionalDependencies": {
|
|
54
|
-
"@swc/core-win32-x64-msvc": "1.2.
|
|
55
|
-
"@swc/core-darwin-x64": "1.2.
|
|
56
|
-
"@swc/core-linux-x64-gnu": "1.2.
|
|
57
|
-
"@swc/core-linux-x64-musl": "1.2.
|
|
58
|
-
"@swc/core-freebsd-x64": "1.2.
|
|
59
|
-
"@swc/core-win32-ia32-msvc": "1.2.
|
|
60
|
-
"@swc/core-linux-arm64-gnu": "1.2.
|
|
61
|
-
"@swc/core-linux-arm-gnueabihf": "1.2.
|
|
62
|
-
"@swc/core-darwin-arm64": "1.2.
|
|
63
|
-
"@swc/core-android-arm64": "1.2.
|
|
64
|
-
"@swc/core-linux-arm64-musl": "1.2.
|
|
65
|
-
"@swc/core-win32-arm64-msvc": "1.2.
|
|
66
|
-
"@swc/core-android-arm-eabi": "1.2.
|
|
54
|
+
"@swc/core-win32-x64-msvc": "1.2.131",
|
|
55
|
+
"@swc/core-darwin-x64": "1.2.131",
|
|
56
|
+
"@swc/core-linux-x64-gnu": "1.2.131",
|
|
57
|
+
"@swc/core-linux-x64-musl": "1.2.131",
|
|
58
|
+
"@swc/core-freebsd-x64": "1.2.131",
|
|
59
|
+
"@swc/core-win32-ia32-msvc": "1.2.131",
|
|
60
|
+
"@swc/core-linux-arm64-gnu": "1.2.131",
|
|
61
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.131",
|
|
62
|
+
"@swc/core-darwin-arm64": "1.2.131",
|
|
63
|
+
"@swc/core-android-arm64": "1.2.131",
|
|
64
|
+
"@swc/core-linux-arm64-musl": "1.2.131",
|
|
65
|
+
"@swc/core-win32-arm64-msvc": "1.2.131",
|
|
66
|
+
"@swc/core-android-arm-eabi": "1.2.131"
|
|
67
67
|
},
|
|
68
68
|
"types": "./index.d.ts",
|
|
69
69
|
"scripts": {
|
package/types.d.ts
CHANGED
|
@@ -719,7 +719,7 @@ export interface VariableDeclarator extends Node, HasSpan {
|
|
|
719
719
|
init?: Expression;
|
|
720
720
|
definite: boolean;
|
|
721
721
|
}
|
|
722
|
-
export declare type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | PrivateName | OptionalChainingExpression | Invalid;
|
|
722
|
+
export declare type Expression = ThisExpression | ArrayExpression | ObjectExpression | FunctionExpression | UnaryExpression | UpdateExpression | BinaryExpression | AssignmentExpression | MemberExpression | SuperPropExpression | ConditionalExpression | CallExpression | NewExpression | SequenceExpression | Identifier | Literal | TemplateLiteral | TaggedTemplateExpression | ArrowFunctionExpression | ClassExpression | YieldExpression | MetaProperty | AwaitExpression | ParenthesisExpression | JSXMemberExpression | JSXNamespacedName | JSXEmptyExpression | JSXElement | JSXFragment | TsTypeAssertion | TsConstAssertion | TsNonNullExpression | TsAsExpression | PrivateName | OptionalChainingExpression | Invalid;
|
|
723
723
|
interface ExpressionBase extends Node, HasSpan {
|
|
724
724
|
}
|
|
725
725
|
export interface OptionalChainingExpression extends ExpressionBase {
|
|
@@ -787,9 +787,13 @@ export interface AssignmentExpression extends ExpressionBase {
|
|
|
787
787
|
}
|
|
788
788
|
export interface MemberExpression extends ExpressionBase {
|
|
789
789
|
type: "MemberExpression";
|
|
790
|
-
object: Expression
|
|
791
|
-
property:
|
|
792
|
-
|
|
790
|
+
object: Expression;
|
|
791
|
+
property: Identifier | PrivateName | ComputedPropName;
|
|
792
|
+
}
|
|
793
|
+
export interface SuperPropExpression extends ExpressionBase {
|
|
794
|
+
type: "SuperPropExpression";
|
|
795
|
+
object: Super;
|
|
796
|
+
property: Identifier | ComputedPropName;
|
|
793
797
|
}
|
|
794
798
|
export interface ConditionalExpression extends ExpressionBase {
|
|
795
799
|
type: "ConditionalExpression";
|
|
@@ -800,9 +804,12 @@ export interface ConditionalExpression extends ExpressionBase {
|
|
|
800
804
|
export interface Super extends Node, HasSpan {
|
|
801
805
|
type: "Super";
|
|
802
806
|
}
|
|
807
|
+
export interface Import extends Node, HasSpan {
|
|
808
|
+
type: "Import";
|
|
809
|
+
}
|
|
803
810
|
export interface CallExpression extends ExpressionBase {
|
|
804
811
|
type: "CallExpression";
|
|
805
|
-
callee: Expression | Super;
|
|
812
|
+
callee: Expression | Super | Import;
|
|
806
813
|
arguments: Argument[];
|
|
807
814
|
typeArguments?: TsTypeParameterInstantiation;
|
|
808
815
|
}
|
|
@@ -832,8 +839,7 @@ export interface YieldExpression extends ExpressionBase {
|
|
|
832
839
|
}
|
|
833
840
|
export interface MetaProperty extends Node {
|
|
834
841
|
type: "MetaProperty";
|
|
835
|
-
|
|
836
|
-
property: Identifier;
|
|
842
|
+
kind: 'ImportMeta' | 'NewTarget';
|
|
837
843
|
}
|
|
838
844
|
export interface AwaitExpression extends ExpressionBase {
|
|
839
845
|
type: "AwaitExpression";
|