@swc/core 1.2.124 → 1.2.128
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 +248 -0
- package/Visitor.d.ts +3 -2
- package/Visitor.js +32 -8
- package/package.json +14 -14
- package/types.d.ts +13 -7
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,251 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(es/helpers)** Don't transpile `_typeof` helper (#3208) ([54353a6](https://github.com/swc-project/swc/commit/54353a6fb5ab53ed4762161ecdda1a3ec0d77c62))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es/hygiene)** Visit computed properties in usage analyzer (#3217) ([cdb46cf](https://github.com/swc-project/swc/commit/cdb46cfb9180e67915c88eabdfd48317870e330d))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/minifier)** Disable inlining of expressions from `collapse_vars` (#3200) ([69b5f79](https://github.com/swc-project/swc/commit/69b5f799f3d40947ce3b5bc851ee44d3caad5328))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/minifier)** Drop unreachable statements eagerly (#3204) ([0105939](https://github.com/swc-project/swc/commit/01059394268791d85d48d9c1cbfa11564b1eb85e))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/modules)** Fix lazy import handling (#3211) ([9565149](https://github.com/swc-project/swc/commit/956514953940556847e7a5b42d7f1f21cffe9dd8))
|
|
21
|
+
|
|
22
|
+
### Features
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(es/ast)** Use `ModuleExportName` for `ExportNamespaceSpecifier` (#3195) ([432f877](https://github.com/swc-project/swc/commit/432f87779003e50f17bcaedc35edb8583644c548))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **(es/ast)** Update `is-macro` (#3226) ([1edbf1a](https://github.com/swc-project/swc/commit/1edbf1a37a37c5e3a9bf695b4793d0c35c2d6592))
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- **(es/compat)** Implement object super (#3127) ([b649d23](https://github.com/swc-project/swc/commit/b649d23bac1faf5ae0ba9463ba9069d09055b63c))
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
- **(es/parser)** Accept strings for import/exports (#3190) ([3fb76f6](https://github.com/swc-project/swc/commit/3fb76f64c4e5ee49b0415757b3ead5fc753a93b6))
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
- **(es/transforms)** Add `Assumptions` (#3215) ([42f7268](https://github.com/swc-project/swc/commit/42f726873e6c9e813a750acbf6d818bd4e914e31))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
- **(plugin)** Pass serialized ast to a wasm file (#3199) ([92de2c7](https://github.com/swc-project/swc/commit/92de2c78841ee1dc8b372268690637a19c3f4307))
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
- **(plugin)** Allow multi-value for the plugin signature (#3216) ([c9ded9b](https://github.com/swc-project/swc/commit/c9ded9b72080b013466f450d9b3917055e40fa23))
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
- **(plugin)** Perform actual transforms in plugins (#3220) ([7e7421e](https://github.com/swc-project/swc/commit/7e7421ea527f499c6488de19fb8171f2b65787b4))
|
|
48
|
+
|
|
49
|
+
### Miscellaneous Tasks
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
- **(es/minifier)** Add scripts to extract tests automatically (#3212) ([057fca4](https://github.com/swc-project/swc/commit/057fca4196263dcfc05e6161cb727ec4888d7e10))
|
|
54
|
+
|
|
55
|
+
### Refactor
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
- **(es/ast)** Change types of member-like expressions (#3178) ([f58b50b](https://github.com/swc-project/swc/commit/f58b50bea7507def95b94b498ba9c5faf55df802))
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
- **(es/compat)** Preserve length of functions in `async_generator` (#3202) ([5bee4e4](https://github.com/swc-project/swc/commit/5bee4e490229a3a045d4008b156034c4233ec89e))
|
|
63
|
+
|
|
64
|
+
### Security
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
- **(repo)** Fix crev integration (#3210) ([70c2f3b](https://github.com/swc-project/swc/commit/70c2f3b3a57ec9afc1f28ec1c6377dbbf4e920b6))
|
|
69
|
+
|
|
70
|
+
## [1.2.127] - 2022-01-06
|
|
71
|
+
|
|
72
|
+
### Bug Fixes
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/lints)** Fix incorrect duplicate binding error (#3194) ([913c82a](https://github.com/swc-project/swc/commit/913c82a2ab94e14eb350e1573af736aa87c7f2bb))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(es/minifier)** Fix bugs (#2955) ([1c1c9f0](https://github.com/swc-project/swc/commit/1c1c9f0eaee4993d2a8e7c9714e3bab00123f14b))
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
- **(es/visit)** Make `noop_visit_type` visit typescript nodes that executes at runtime (#3192) ([517662c](https://github.com/swc-project/swc/commit/517662c9c243aa56451025563a7b7e57fd24d9d0))
|
|
83
|
+
|
|
84
|
+
### Features
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
- **(es/dep-graph)** Improve DependencyDescriptor to combine `import_assertions` with `dynamic_import_assertions` (#3183) ([e5e6e84](https://github.com/swc-project/swc/commit/e5e6e843004b7ad3ce0ffa95f583d2c2a808736a))
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
- **(esdiff)** Create a command to determine problematic file (#3181) ([51c792e](https://github.com/swc-project/swc/commit/51c792eb302a4e22104912a1289d19f80610d480))
|
|
92
|
+
|
|
93
|
+
### Miscellaneous Tasks
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
- **(*)** Update `rustc` (#3185) ([7d0a8a1](https://github.com/swc-project/swc/commit/7d0a8a12f145c42fba2ec6a80c4d9b720f29c40e))
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
- **(ci)** Split cargo docs (#3187) ([46949d3](https://github.com/swc-project/swc/commit/46949d39ebdcb14347156eb00490e53d37d06707))
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
- **(ci)** Fix publish scripts ([3458e9f](https://github.com/swc-project/swc/commit/3458e9f1d3eac7c47ba00a5768d3f8f41c8037ef))
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
- **(ci)** Fix publish scripts again ([b292126](https://github.com/swc-project/swc/commit/b292126b387c4efff0576517c7d706b16c08bca3))
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
- **(ci)** Fix `--cargo-flags` ([a20f5d9](https://github.com/swc-project/swc/commit/a20f5d9a7cd007d3c5fb671710d1344cd1577119))
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
- **(ci)** Use `--cargo-flags` in correct place ([ef4ea2f](https://github.com/swc-project/swc/commit/ef4ea2fc7b10ec50d317118680f58c70cf64c89b))
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
- **(ci)** Use `RUSTFLAGS` for linux ([4cbe8d1](https://github.com/swc-project/swc/commit/4cbe8d18bb10dfa8a333931767ebf958dab3bbae))
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
- **(ci)** Use more `RUSTFLAGS` ([bf0acd1](https://github.com/swc-project/swc/commit/bf0acd13da50a500414edbaf686a0632736f66fd))
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
- **(ci)** Fix musl ([fef8449](https://github.com/swc-project/swc/commit/fef844954b6aecd610c87ccb5ec30a2b08bd328a))
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
- **(ci)** Fix `aarch64-pc-windows-msvc` ([1ebbe62](https://github.com/swc-project/swc/commit/1ebbe622909a974abd0ea96929adee1c33f8f256))
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
- **(ci)** Change version of `rustc` ([d901b62](https://github.com/swc-project/swc/commit/d901b6222f8a77beed64968fcb4764bbacf8c755))
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
- **(ci)** Fix publish script (#3197) ([c34f1a9](https://github.com/swc-project/swc/commit/c34f1a977fac44813ebda5beb77b6444469e36e4))
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
- **(ci)** Remove redudant plugin test ([e19fe7d](https://github.com/swc-project/swc/commit/e19fe7d33b2a18c1b068c2f808f3ea72f1ccff15))
|
|
134
|
+
|
|
135
|
+
### Refactor
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
- **(dbg-swc)** Rename `esdiff` to `dbg-swc` (#3189) ([c758997](https://github.com/swc-project/swc/commit/c758997180793502b76d737cf56ebc10b0d88004))
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
- **(plugin)** Add a loader for wasm-based plugin system (#3179) ([fc4c670](https://github.com/swc-project/swc/commit/fc4c6708f24cda39640fbbfe56123f2f6eeb2474))
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
- **(plugin)** Remove codes related to the plugin system based on `abi_stable` (#3188) ([32d3342](https://github.com/swc-project/swc/commit/32d3342283ec788842a89bf129e4f04cfab13eb6))
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
- **(plugin/runner)** Avoid redundant filesystem reads (#3186) ([b61c49f](https://github.com/swc-project/swc/commit/b61c49fe39acf28e09888e7b2163c7be5cceff4b))
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
- **(plugin/runner)** Replace wasm runtime (#3196) ([c3895ca](https://github.com/swc-project/swc/commit/c3895ca9aaf4c8b76f1eb1bf2c8655d8acb20b94))
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
- **(plugin/runner)** Reuse wasmer ([28ff059](https://github.com/swc-project/swc/commit/28ff0592a4005e89561500f915929ffa25da9160))
|
|
155
|
+
|
|
156
|
+
## [1.2.126] - 2022-01-03
|
|
157
|
+
|
|
158
|
+
### Bug Fixes
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
- **(es/minifier)** Fix comparison of objects, numbers and strings (#3172) ([db51ce4](https://github.com/swc-project/swc/commit/db51ce44614e3661c9c25c562d39b7581e521850))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
- **(node-swc)** Recover from ldd not found ([1dfc2ee](https://github.com/swc-project/swc/commit/1dfc2ee1054d20b0d04699ebef3ab09b2f6fc4f8))
|
|
166
|
+
|
|
167
|
+
### Features
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
- **(es/ast)** Add `ModuleExportName` (#3048) ([07c0489](https://github.com/swc-project/swc/commit/07c0489575188846b82b1af3e4bd711466e006ca))
|
|
172
|
+
|
|
173
|
+
## [1.2.125] - 2022-01-02
|
|
174
|
+
|
|
175
|
+
### Bug Fixes
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
- **(es/compat)** Visit all private class methods (#3150) ([35b6461](https://github.com/swc-project/swc/commit/35b64613bb1f6de52d7362e66d28c50513dbbe12))
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
- **(es/compat)** Fix length of async functions (#3136) ([f78d005](https://github.com/swc-project/swc/commit/f78d005a9587d2ea44741c4cef80fa711e8a1d26))
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
- **(es/compat)** Fix `new.target` in class properties (#3156) ([e112103](https://github.com/swc-project/swc/commit/e11210309cf2aab4aae77a76e4cdfba0bf9efa40))
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
- **(es/minifier)** Fix for modules (#3170) ([790c506](https://github.com/swc-project/swc/commit/790c50631ba1daa124e62bcee299f89031a4ec3d))
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
- **(es/typescript)** Fix handling of references in a TypeScript enum (#3163) ([e02307d](https://github.com/swc-project/swc/commit/e02307d4c82e043079131b414198ee5b4b7560e5))
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
- **(es/typescript)** Declare the exported variables in a namespace (#3162) ([366dc0e](https://github.com/swc-project/swc/commit/366dc0eec3e19b4e608dc4df8eb728f6d710f9b7))
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
- **(es/utils)** Fix handling of `new.target` (#3145) ([356082a](https://github.com/swc-project/swc/commit/356082ad84fa69cf09b5627598a2576bd1b27c36))
|
|
198
|
+
|
|
199
|
+
### Documentation
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
- **(es/ast)** Improve rustdoc (#3142) ([333acb5](https://github.com/swc-project/swc/commit/333acb56223139817c1df0c8b3763190b55a6295))- **general**: Update discord link (#3161) ([fb20480](https://github.com/swc-project/swc/commit/fb2048035f0aa67761aa213c58795accfde7a6d0))
|
|
204
|
+
|
|
205
|
+
### Features
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
- **(es/ast)** Add `rkyv` support (#3166) ([bf751cb](https://github.com/swc-project/swc/commit/bf751cb6905c7520f0846b9f0a6f4f44edecbdb3))
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
- **(es/codegen)** Make the output for empty objects and empty statements pretty (#3171) ([5296180](https://github.com/swc-project/swc/commit/52961804d19c413c09ff4e08c327647ffc3d0bea))
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
- **(es/diff)** Add a internal CLI program for debugging minifier (#3168) ([1aa55e6](https://github.com/swc-project/swc/commit/1aa55e616a7bc2ffa791600e908ddb10a4009e7b))
|
|
216
|
+
|
|
217
|
+
### Miscellaneous Tasks
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
- **(ci)** Update `github-action-benchmark` (#3148) ([5a3bdc9](https://github.com/swc-project/swc/commit/5a3bdc9ed37ba39a0591c66bd89eddb95f6df850))- **general**: Add `enhancement` label to `feature_request` template (#3164) ([360ad7b](https://github.com/swc-project/swc/commit/360ad7b41c6fa35ce3afc81c2237d9acdae9a549))
|
|
222
|
+
|
|
223
|
+
### Performance
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
- **(es/ast/serde)** Make deserialization faster (#3160) ([7a83c0c](https://github.com/swc-project/swc/commit/7a83c0cb575b0ec6510d8dff6d1bd44d9c97fdb9))
|
|
228
|
+
|
|
229
|
+
### Refactor
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
- **(*)** Drop unused dependencies (#3138) ([72c9636](https://github.com/swc-project/swc/commit/72c963662d63338235378d71ee856c782cdeddfe))
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
- **(*)** Use 2021 edition (#3151) ([194b3e9](https://github.com/swc-project/swc/commit/194b3e9b67fb096dee8dbd12fff9167e4217174b))
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
- **(bundler)** Improve test suite (#3144) ([8a1016f](https://github.com/swc-project/swc/commit/8a1016fb406dd04dcf432ccf4e07036f81d4c9c6))
|
|
240
|
+
|
|
241
|
+
### Testing
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
- **(es/parser)** Add tests about null escape (#3147) ([a4e8e53](https://github.com/swc-project/swc/commit/a4e8e53c1958f842206916eade24a269d582d69c))
|
|
246
|
+
|
|
247
|
+
## [1.2.124] - 2021-12-29
|
|
248
|
+
|
|
249
|
+
### Bug Fixes
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
|
|
8
253
|
- **(es)** Handle import assertions correctly (#3113) ([c9adf03](https://github.com/swc-project/swc/commit/c9adf0333811b2830fe3f3c06d6fd9706f7bb9ae))
|
|
9
254
|
|
|
10
255
|
|
|
@@ -23,6 +268,9 @@
|
|
|
23
268
|
- **(es/parser)** Support import assertions in specifier-less imports (#3134) ([2f3ca22](https://github.com/swc-project/swc/commit/2f3ca22ecf7f567256695c39a904f02ff75e2c85))
|
|
24
269
|
|
|
25
270
|
|
|
271
|
+
- **(es/renamer)** Fix renamer (#3139) ([43c8cda](https://github.com/swc-project/swc/commit/43c8cda31a89bfc027ea3948bd9653d97d3fc29c))
|
|
272
|
+
|
|
273
|
+
|
|
26
274
|
- **(es/utils)** Fix `is_valid_ident` (#3133) ([ec7e0ae](https://github.com/swc-project/swc/commit/ec7e0aee256cc7cc13f81ef22164c29f42bb43be))
|
|
27
275
|
|
|
28
276
|
|
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.128",
|
|
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.128",
|
|
55
|
+
"@swc/core-darwin-x64": "1.2.128",
|
|
56
|
+
"@swc/core-linux-x64-gnu": "1.2.128",
|
|
57
|
+
"@swc/core-linux-x64-musl": "1.2.128",
|
|
58
|
+
"@swc/core-freebsd-x64": "1.2.128",
|
|
59
|
+
"@swc/core-win32-ia32-msvc": "1.2.128",
|
|
60
|
+
"@swc/core-linux-arm64-gnu": "1.2.128",
|
|
61
|
+
"@swc/core-linux-arm-gnueabihf": "1.2.128",
|
|
62
|
+
"@swc/core-darwin-arm64": "1.2.128",
|
|
63
|
+
"@swc/core-android-arm64": "1.2.128",
|
|
64
|
+
"@swc/core-linux-arm64-musl": "1.2.128",
|
|
65
|
+
"@swc/core-win32-arm64-msvc": "1.2.128",
|
|
66
|
+
"@swc/core-android-arm-eabi": "1.2.128"
|
|
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";
|