@swc/core 1.2.212 → 1.2.218
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 +179 -0
- package/Visitor.d.ts +17 -4
- package/Visitor.js +96 -9
- package/index.js +123 -11
- package/package.json +40 -18
- package/postinstall.js +143 -0
- package/types.d.ts +163 -95
- package/.prettierignore +0 -63
- package/.prettierrc.json +0 -1
- package/babel.d.ts +0 -14
- package/babel.js +0 -2
- package/run_swcx.d.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,185 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
+
- **(cli)** Emit sourcemap with file inputs (#5213) ([3e3be80](https://github.com/swc-project/swc/commit/3e3be80efda09ae494f8962947562b4411874061))
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
- **(es)** Fix resolving of symlinks (#5222) ([27cc45d](https://github.com/swc-project/swc/commit/27cc45d50fa035fbb7bbab307752ec55c8d5ed0c))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
- **(es/lints)** Disallow duplicate export functions (#5234) ([c68d484](https://github.com/swc-project/swc/commit/c68d484305d3dfac3e14e45682c9d5ec10b49a45))
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
- **(es/minifier)** Fix size calculation of numbers (#5232) ([2e9c9be](https://github.com/swc-project/swc/commit/2e9c9bea1ad5c95a1e4867eba2f9bbe53c466fc7))
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
- **(es/modules)** Preserve order for ts import equals (#5215) ([6b1ce09](https://github.com/swc-project/swc/commit/6b1ce09b6f59e53a750a71e447a148aedcef8468))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
- **(html/parser)** Fix span (#5209) ([b4daa30](https://github.com/swc-project/swc/commit/b4daa3005803be23676bec666bb8f8791f2472b3))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
- **(html/parser)** Improve span (#5230) ([0f7646c](https://github.com/swc-project/swc/commit/0f7646cc4763f2d79d0b3cb4529a0c7ec7df94e8))
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
- **(testing)** Allow space in file names (#5237) ([de76868](https://github.com/swc-project/swc/commit/de76868cad88b9afe103a60331c1456a3f02e37e))- **general**: Fix(es/lints: Handle ts export import equals (#5225)
|
|
30
|
+
|
|
31
|
+
([04de455](https://github.com/swc-project/swc/commit/04de455a9a34dbcbb193bffc9ab504c0e30e8706))
|
|
32
|
+
|
|
33
|
+
### Features
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
- **(css/ast)** Make `raw` optional (#5211) ([b65a16c](https://github.com/swc-project/swc/commit/b65a16c7aa58bca57ad861ca015867f89fb80a79))
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
- **(es/lints)** Support `ignoreReadBeforeAssign` for `prefer-const` (#4933) ([d035648](https://github.com/swc-project/swc/commit/d0356489cb1dfae8e6ced8dd239643bf6f5b029d))
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
- **(html/ast)** Add `raw` to attributes (#5208) ([64237fa](https://github.com/swc-project/swc/commit/64237fa7fb9c95030f92892143f476c2573bed75))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
- **(html/ast)** Add `raw` to doctype (#5198) ([945510a](https://github.com/swc-project/swc/commit/945510a6954db87f78dcffa888f49b630f4eb74d))
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
- **(html/minifier)** Compress more default attributes (#5182) ([625fc18](https://github.com/swc-project/swc/commit/625fc18da01643d81af535eefd4c636e5a632af0))
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
- **(html/minifier)** Improve minifier (#5227) ([1da6016](https://github.com/swc-project/swc/commit/1da6016da7db783a4207cfff480b057ea911006c))
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
- **(node)** Use wasm as a fallback (#5233) ([1cebf62](https://github.com/swc-project/swc/commit/1cebf626e66b52f0fe325f679443d8243ab9eba3))
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
- **(plugin)** Pass `unresolved_mark` to plugins (#5212) ([92c0153](https://github.com/swc-project/swc/commit/92c0153cb56a6b3b7d6503216a14d5ed78df71dc))
|
|
59
|
+
|
|
60
|
+
### Miscellaneous Tasks
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
- **(ci)** Fix publish script (#5241) ([66550d6](https://github.com/swc-project/swc/commit/66550d6e87582bb3cb34d18c0dffd8f33814d81d))
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
- **(visit)** Specify version of `swc_macros_common` (#5231) ([1aa0223](https://github.com/swc-project/swc/commit/1aa022361e7918f4077eacae6e51899eac007be5))- **general**: Typo (#5239) ([17f1cee](https://github.com/swc-project/swc/commit/17f1cee0a8132c79712c742f645e098df9309999))- **general**: Typo (#5238) ([df426d7](https://github.com/swc-project/swc/commit/df426d7b1d2ca74505051bfe78aa78a2a315e0ab))
|
|
68
|
+
|
|
69
|
+
### Testing
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
- **(css/parser)** Add a test (#5228) ([8e5efb6](https://github.com/swc-project/swc/commit/8e5efb65d55706883663a25a0e281a4ef013001b))
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
- **(es/plugin)** Build plugins for e2e testing (#5210) ([cd94f0a](https://github.com/swc-project/swc/commit/cd94f0a2e9a7331073d20638031ae86d3308760e))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
- **(plugin)** Fix e2e tests on windows (#5216) ([f1ba332](https://github.com/swc-project/swc/commit/f1ba3327cfcc37534484362293cfac19587110da))
|
|
80
|
+
|
|
81
|
+
### Build
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
- **(node)** Use explicit list for package files (#5229) ([b01b6cf](https://github.com/swc-project/swc/commit/b01b6cf57ee2dcd33886ba9196f364bcb9273afe))
|
|
86
|
+
|
|
87
|
+
## [1.2.216] - 2022-07-14
|
|
88
|
+
|
|
89
|
+
### Bug Fixes
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
- **(es)** Check the syntax context of `arguments` (#5174) ([375774d](https://github.com/swc-project/swc/commit/375774d31e690142faeb8422fed4cc996bf1de16))
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
- **(es/codegen)** Mark bigint as an item starting with number (#5207) ([387d5e4](https://github.com/swc-project/swc/commit/387d5e41db260893297b65d0fd9084f60c71443a))
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
- **(es/fixer)** Handle invalid numeric literals (#5201) ([436f620](https://github.com/swc-project/swc/commit/436f6200bc05d1d88c9b3fb991f793ed308f607b))
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
- **(es/parser)** Fix parsing of export specifiers (#5190) ([ec93783](https://github.com/swc-project/swc/commit/ec9378370dd870c304143219afed04624075141f))
|
|
103
|
+
|
|
104
|
+
### Features
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
- **(es)** Add quote to `swc_ecmascript` (#5199) ([fbfa59b](https://github.com/swc-project/swc/commit/fbfa59b5b78ed76350be246eecba86f8fe8b4234))
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
- **(es/plugin)** Print filename on failure (#5200) ([f69dee7](https://github.com/swc-project/swc/commit/f69dee75f208a6385b64fa79147eef57bd24944e))
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
- **(html/parser)** Add `raw` to comments (#5196) ([dead719](https://github.com/swc-project/swc/commit/dead719550b1ac3024e07f77905ce7b064f102c4))
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
- **(quote)** Support different types for variables (#5194) ([c91abb2](https://github.com/swc-project/swc/commit/c91abb2ca75ff98e8fad7a4740b6feccec62cd54))
|
|
118
|
+
|
|
119
|
+
### Miscellaneous Tasks
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
- **(ci)** Skip plugin e2e tests for unsupported targets (#5203) ([6b6b582](https://github.com/swc-project/swc/commit/6b6b5825438bf05ac959e932a798db72dab79c69))
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
- **(ci)** Disable plugin tests while publishing ([31bbf2d](https://github.com/swc-project/swc/commit/31bbf2ddbbd2babd5f2431ed39a6bcb464dbb7c4))
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
- **(ci)** Disable some tests ([ff949b0](https://github.com/swc-project/swc/commit/ff949b0bc7df790a6d1df11f2129d589b0dd46b8))
|
|
130
|
+
|
|
131
|
+
### Testing
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
- **(css/codegen)** Add tests (#5195) ([fa4c2de](https://github.com/swc-project/swc/commit/fa4c2de7064a213eb70cc7712b50d4a41d2bfdfe))
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
- **(plugin)** Setup e2e fixture testing for plugins (#5192) ([2fa51ec](https://github.com/swc-project/swc/commit/2fa51ecd7819b460837467d2a9093730671dd3fc))
|
|
139
|
+
|
|
140
|
+
## [1.2.213] - 2022-07-13
|
|
141
|
+
|
|
142
|
+
### Bug Fixes
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
- **(css/codegen)** Fix sourcemap of multibyte characters (#5183) ([5b70233](https://github.com/swc-project/swc/commit/5b70233400a5b67cf51650bebbd59dcd0699ba78))
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
- **(css/parser)** Avoid skipping whitespaces if not required (#5181) ([7b28521](https://github.com/swc-project/swc/commit/7b28521d72776a33f5d51c8ac9fdc674268fa418))
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
- **(es/minifier)** Don't merge exported declarations (#5193) ([16ece4d](https://github.com/swc-project/swc/commit/16ece4dce0acdbb0e368b085dc1fcbeec3017789))
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
- **(html/codegen)** Fix source map generation (#5184) ([60ca553](https://github.com/swc-project/swc/commit/60ca5538f9c658a5f9bb7b9dd83d1795ed18bde3))
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
- **(node/types)** Fix AST type definitions (#5175) ([afd5171](https://github.com/swc-project/swc/commit/afd5171240835c6c2dbd5e06584409796ba08501))
|
|
159
|
+
|
|
160
|
+
### Features
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
- **(es/codegen)** Emit comments in `emit_module` (#5132) ([1ef541e](https://github.com/swc-project/swc/commit/1ef541eec4a98dc23bef706f881fac9dddd196ca))
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
- **(html/minifier)** Allow specifying options for other tools (#5125) ([dada2d7](https://github.com/swc-project/swc/commit/dada2d7d554fa0733a3c65c512777f1548d41a35))
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
- **(visit)** Improve API (#5185) ([4744d43](https://github.com/swc-project/swc/commit/4744d438a9cf44d59dc899ea054ae5e65f6490c8))
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
- **(visit)** Implement serde for `AstParentKind` (#5191) ([d1418ee](https://github.com/swc-project/swc/commit/d1418ee977428597b3f9833b8cee6ca434186ae4))
|
|
174
|
+
|
|
175
|
+
### Testing
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
- **(node)** Refactor tests (#5187) ([a4b14c3](https://github.com/swc-project/swc/commit/a4b14c38065cba3a244118c3eaf74e8ebb0d938d))
|
|
180
|
+
|
|
181
|
+
## [1.2.212] - 2022-07-11
|
|
182
|
+
|
|
183
|
+
### Bug Fixes
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
8
187
|
- **(es/modules)** Add the missing span for `export default` (#5170) ([997240c](https://github.com/swc-project/swc/commit/997240cfe68ff7787d73e93758f2d2304715e249))
|
|
9
188
|
|
|
10
189
|
|
package/Visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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";
|
|
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, ModuleExportName, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingCall, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstructSignatureDeclaration, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsGetterSignature, TsImportEqualsDeclaration, TsIndexSignature, TsInstantiation, TsInterfaceBody, TsInterfaceDeclaration, TsMethodSignature, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsPropertySignature, TsQualifiedName, TsSetterSignature, 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;
|
|
@@ -17,6 +17,7 @@ export declare class Visitor {
|
|
|
17
17
|
visitExportSpecifiers(nodes: ExportSpecifier[]): ExportSpecifier[];
|
|
18
18
|
visitExportSpecifier(n: ExportSpecifier): ExportSpecifier;
|
|
19
19
|
visitNamedExportSpecifier(n: NamedExportSpecifier): ExportSpecifier;
|
|
20
|
+
visitModuleExportName(n: ModuleExportName): ModuleExportName;
|
|
20
21
|
visitExportNamespaceSpecifier(n: ExportNamespaceSpecifier): ExportSpecifier;
|
|
21
22
|
visitExportDefaultSpecifier(n: ExportDefaultSpecifier): ExportSpecifier;
|
|
22
23
|
visitOptionalStringLiteral(n: StringLiteral | undefined): StringLiteral | undefined;
|
|
@@ -28,6 +29,7 @@ export declare class Visitor {
|
|
|
28
29
|
visitArrayExpression(e: ArrayExpression): Expression;
|
|
29
30
|
visitArrayElement(e: ExprOrSpread | undefined): ExprOrSpread | undefined;
|
|
30
31
|
visitExprOrSpread(e: ExprOrSpread): ExprOrSpread;
|
|
32
|
+
visitExprOrSpreads(nodes: ExprOrSpread[]): ExprOrSpread[];
|
|
31
33
|
visitSpreadElement(e: SpreadElement): SpreadElement;
|
|
32
34
|
visitOptionalExpression(e: Expression | undefined): Expression | undefined;
|
|
33
35
|
visitArrowFunctionExpression(e: ArrowFunctionExpression): Expression;
|
|
@@ -50,7 +52,7 @@ export declare class Visitor {
|
|
|
50
52
|
visitForStatement(stmt: ForStatement): Statement;
|
|
51
53
|
visitForOfStatement(stmt: ForOfStatement): Statement;
|
|
52
54
|
visitForInStatement(stmt: ForInStatement): Statement;
|
|
53
|
-
visitEmptyStatement(stmt: EmptyStatement):
|
|
55
|
+
visitEmptyStatement(stmt: EmptyStatement): EmptyStatement;
|
|
54
56
|
visitDoWhileStatement(stmt: DoWhileStatement): Statement;
|
|
55
57
|
visitDebuggerStatement(stmt: DebuggerStatement): Statement;
|
|
56
58
|
visitWithStatement(stmt: WithStatement): Statement;
|
|
@@ -68,6 +70,12 @@ export declare class Visitor {
|
|
|
68
70
|
visitTsInterfaceBody(n: TsInterfaceBody): TsInterfaceBody;
|
|
69
71
|
visitTsTypeElements(nodes: TsTypeElement[]): TsTypeElement[];
|
|
70
72
|
visitTsTypeElement(n: TsTypeElement): TsTypeElement;
|
|
73
|
+
visitTsCallSignatureDeclaration(n: TsCallSignatureDeclaration): TsCallSignatureDeclaration;
|
|
74
|
+
visitTsConstructSignatureDeclaration(n: TsConstructSignatureDeclaration): TsConstructSignatureDeclaration;
|
|
75
|
+
visitTsPropertySignature(n: TsPropertySignature): TsPropertySignature;
|
|
76
|
+
visitTsGetterSignature(n: TsGetterSignature): TsGetterSignature;
|
|
77
|
+
visitTsSetterSignature(n: TsSetterSignature): TsSetterSignature;
|
|
78
|
+
visitTsMethodSignature(n: TsMethodSignature): TsMethodSignature;
|
|
71
79
|
visitTsEnumDeclaration(n: TsEnumDeclaration): Declaration;
|
|
72
80
|
visitTsEnumMembers(nodes: TsEnumMember[]): TsEnumMember[];
|
|
73
81
|
visitTsEnumMember(n: TsEnumMember): TsEnumMember;
|
|
@@ -76,7 +84,7 @@ export declare class Visitor {
|
|
|
76
84
|
visitClassDeclaration(decl: ClassDeclaration): Declaration;
|
|
77
85
|
visitClassBody(members: ClassMember[]): ClassMember[];
|
|
78
86
|
visitClassMember(member: ClassMember): ClassMember;
|
|
79
|
-
visitTsIndexSignature(n: TsIndexSignature):
|
|
87
|
+
visitTsIndexSignature(n: TsIndexSignature): TsIndexSignature;
|
|
80
88
|
visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[];
|
|
81
89
|
visitTsFnParameter(n: TsFnParameter): TsFnParameter;
|
|
82
90
|
visitPrivateProperty(n: PrivateProperty): ClassMember;
|
|
@@ -85,6 +93,7 @@ export declare class Visitor {
|
|
|
85
93
|
visitConstructor(n: Constructor): ClassMember;
|
|
86
94
|
visitConstructorParameters(nodes: (Param | TsParameterProperty)[]): (Param | TsParameterProperty)[];
|
|
87
95
|
visitConstructorParameter(n: Param | TsParameterProperty): Param | TsParameterProperty;
|
|
96
|
+
visitStaticBlock(n: StaticBlock): StaticBlock;
|
|
88
97
|
visitTsParameterProperty(n: TsParameterProperty): TsParameterProperty | Param;
|
|
89
98
|
visitTsParameterPropertyParameter(n: TsParameterPropertyParameter): TsParameterPropertyParameter;
|
|
90
99
|
visitPropertyName(key: PropertyName): PropertyName;
|
|
@@ -106,6 +115,8 @@ export declare class Visitor {
|
|
|
106
115
|
visitContinueStatement(stmt: ContinueStatement): Statement;
|
|
107
116
|
visitExpression(n: Expression): Expression;
|
|
108
117
|
visitOptionalChainingExpression(n: OptionalChainingExpression): Expression;
|
|
118
|
+
visitMemberExpressionOrOptionalChainingCall(n: MemberExpression | OptionalChainingCall): MemberExpression | OptionalChainingCall;
|
|
119
|
+
visitOptionalChainingCall(n: OptionalChainingCall): OptionalChainingCall;
|
|
109
120
|
visitAssignmentExpression(n: AssignmentExpression): Expression;
|
|
110
121
|
visitPatternOrExpression(n: Pattern | Expression): Pattern | Expression;
|
|
111
122
|
visitYieldExpression(n: YieldExpression): Expression;
|
|
@@ -113,6 +124,7 @@ export declare class Visitor {
|
|
|
113
124
|
visitUnaryExpression(n: UnaryExpression): Expression;
|
|
114
125
|
visitTsTypeAssertion(n: TsTypeAssertion): Expression;
|
|
115
126
|
visitTsConstAssertion(n: TsConstAssertion): Expression;
|
|
127
|
+
visitTsInstantiation(n: TsInstantiation): TsInstantiation;
|
|
116
128
|
visitTsNonNullExpression(n: TsNonNullExpression): Expression;
|
|
117
129
|
visitTsAsExpression(n: TsAsExpression): Expression;
|
|
118
130
|
visitThisExpression(n: ThisExpression): Expression;
|
|
@@ -138,7 +150,7 @@ export declare class Visitor {
|
|
|
138
150
|
visitArguments(nodes: Argument[]): Argument[];
|
|
139
151
|
visitArgument(n: Argument): Argument;
|
|
140
152
|
visitMetaProperty(n: MetaProperty): Expression;
|
|
141
|
-
visitMemberExpression(n: MemberExpression):
|
|
153
|
+
visitMemberExpression(n: MemberExpression): MemberExpression;
|
|
142
154
|
visitSuperPropExpression(n: SuperPropExpression): Expression;
|
|
143
155
|
visitCallee(n: Expression | Super | Import): Expression | Super | Import;
|
|
144
156
|
visitJSXText(n: JSXText): JSXText;
|
|
@@ -159,6 +171,7 @@ export declare class Visitor {
|
|
|
159
171
|
visitJSXOpeningElement(n: JSXOpeningElement): JSXOpeningElement;
|
|
160
172
|
visitJSXAttributes(attrs: JSXAttributeOrSpread[] | undefined): JSXAttributeOrSpread[] | undefined;
|
|
161
173
|
visitJSXAttributeOrSpread(n: JSXAttributeOrSpread): JSXAttributeOrSpread;
|
|
174
|
+
visitJSXAttributeOrSpreads(nodes: JSXAttributeOrSpread[]): JSXAttributeOrSpread[];
|
|
162
175
|
visitJSXAttribute(n: JSXAttribute): JSXAttributeOrSpread;
|
|
163
176
|
visitJSXAttributeValue(n: JSXAttrValue | undefined): JSXAttrValue | undefined;
|
|
164
177
|
visitJSXAttributeName(n: JSXAttributeName): JSXAttributeName;
|
package/Visitor.js
CHANGED
|
@@ -83,7 +83,7 @@ class Visitor {
|
|
|
83
83
|
}
|
|
84
84
|
}
|
|
85
85
|
visitTsExternalModuleReference(n) {
|
|
86
|
-
n.expression = this.
|
|
86
|
+
n.expression = this.visitStringLiteral(n.expression);
|
|
87
87
|
return n;
|
|
88
88
|
}
|
|
89
89
|
visitExportAllDeclaration(n) {
|
|
@@ -114,13 +114,21 @@ class Visitor {
|
|
|
114
114
|
}
|
|
115
115
|
visitNamedExportSpecifier(n) {
|
|
116
116
|
if (n.exported) {
|
|
117
|
-
n.exported = this.
|
|
117
|
+
n.exported = this.visitModuleExportName(n.exported);
|
|
118
118
|
}
|
|
119
|
-
n.orig = this.
|
|
119
|
+
n.orig = this.visitModuleExportName(n.orig);
|
|
120
120
|
return n;
|
|
121
121
|
}
|
|
122
|
+
visitModuleExportName(n) {
|
|
123
|
+
switch (n.type) {
|
|
124
|
+
case "Identifier":
|
|
125
|
+
return this.visitIdentifier(n);
|
|
126
|
+
case "StringLiteral":
|
|
127
|
+
return this.visitStringLiteral(n);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
122
130
|
visitExportNamespaceSpecifier(n) {
|
|
123
|
-
n.name = this.
|
|
131
|
+
n.name = this.visitModuleExportName(n.name);
|
|
124
132
|
return n;
|
|
125
133
|
}
|
|
126
134
|
visitExportDefaultSpecifier(n) {
|
|
@@ -178,6 +186,9 @@ class Visitor {
|
|
|
178
186
|
visitExprOrSpread(e) {
|
|
179
187
|
return Object.assign(Object.assign({}, e), { expression: this.visitExpression(e.expression) });
|
|
180
188
|
}
|
|
189
|
+
visitExprOrSpreads(nodes) {
|
|
190
|
+
return nodes.map(this.visitExprOrSpread.bind(this));
|
|
191
|
+
}
|
|
181
192
|
visitSpreadElement(e) {
|
|
182
193
|
e.arguments = this.visitExpression(e.arguments);
|
|
183
194
|
return e;
|
|
@@ -466,10 +477,51 @@ class Visitor {
|
|
|
466
477
|
return nodes.map(this.visitTsTypeElement.bind(this));
|
|
467
478
|
}
|
|
468
479
|
visitTsTypeElement(n) {
|
|
480
|
+
switch (n.type) {
|
|
481
|
+
case "TsCallSignatureDeclaration":
|
|
482
|
+
return this.visitTsCallSignatureDeclaration(n);
|
|
483
|
+
case "TsConstructSignatureDeclaration":
|
|
484
|
+
return this.visitTsConstructSignatureDeclaration(n);
|
|
485
|
+
case "TsPropertySignature":
|
|
486
|
+
return this.visitTsPropertySignature(n);
|
|
487
|
+
case "TsGetterSignature":
|
|
488
|
+
return this.visitTsGetterSignature(n);
|
|
489
|
+
case "TsSetterSignature":
|
|
490
|
+
return this.visitTsSetterSignature(n);
|
|
491
|
+
case "TsMethodSignature":
|
|
492
|
+
return this.visitTsMethodSignature(n);
|
|
493
|
+
case "TsIndexSignature":
|
|
494
|
+
return this.visitTsIndexSignature(n);
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
visitTsCallSignatureDeclaration(n) {
|
|
498
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
499
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
500
|
+
return n;
|
|
501
|
+
}
|
|
502
|
+
visitTsConstructSignatureDeclaration(n) {
|
|
503
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
504
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
505
|
+
return n;
|
|
506
|
+
}
|
|
507
|
+
visitTsPropertySignature(n) {
|
|
469
508
|
n.params = this.visitTsFnParameters(n.params);
|
|
470
509
|
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
471
510
|
return n;
|
|
472
511
|
}
|
|
512
|
+
visitTsGetterSignature(n) {
|
|
513
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
514
|
+
return n;
|
|
515
|
+
}
|
|
516
|
+
visitTsSetterSignature(n) {
|
|
517
|
+
n.param = this.visitTsFnParameter(n.param);
|
|
518
|
+
return n;
|
|
519
|
+
}
|
|
520
|
+
visitTsMethodSignature(n) {
|
|
521
|
+
n.params = this.visitTsFnParameters(n.params);
|
|
522
|
+
n.typeAnn = this.visitTsTypeAnnotation(n.typeAnn);
|
|
523
|
+
return n;
|
|
524
|
+
}
|
|
473
525
|
visitTsEnumDeclaration(n) {
|
|
474
526
|
n.id = this.visitIdentifier(n.id);
|
|
475
527
|
n.members = this.visitTsEnumMembers(n.members);
|
|
@@ -518,11 +570,16 @@ class Visitor {
|
|
|
518
570
|
return this.visitPrivateProperty(member);
|
|
519
571
|
case "TsIndexSignature":
|
|
520
572
|
return this.visitTsIndexSignature(member);
|
|
573
|
+
case "EmptyStatement":
|
|
574
|
+
return this.visitEmptyStatement(member);
|
|
575
|
+
case "StaticBlock":
|
|
576
|
+
return this.visitStaticBlock(member);
|
|
521
577
|
}
|
|
522
578
|
}
|
|
523
579
|
visitTsIndexSignature(n) {
|
|
524
580
|
n.params = this.visitTsFnParameters(n.params);
|
|
525
|
-
|
|
581
|
+
if (n.typeAnnotation)
|
|
582
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
526
583
|
return n;
|
|
527
584
|
}
|
|
528
585
|
visitTsFnParameters(params) {
|
|
@@ -568,6 +625,10 @@ class Visitor {
|
|
|
568
625
|
return this.visitParameter(n);
|
|
569
626
|
}
|
|
570
627
|
}
|
|
628
|
+
visitStaticBlock(n) {
|
|
629
|
+
n.body = this.visitBlockStatement(n.body);
|
|
630
|
+
return n;
|
|
631
|
+
}
|
|
571
632
|
visitTsParameterProperty(n) {
|
|
572
633
|
n.accessibility = this.visitAccessibility(n.accessibility);
|
|
573
634
|
n.decorators = this.visitDecorators(n.decorators);
|
|
@@ -637,7 +698,7 @@ class Visitor {
|
|
|
637
698
|
return nodes.map(this.visitTsExpressionWithTypeArguments.bind(this));
|
|
638
699
|
}
|
|
639
700
|
visitTsExpressionWithTypeArguments(n) {
|
|
640
|
-
n.expression = this.
|
|
701
|
+
n.expression = this.visitExpression(n.expression);
|
|
641
702
|
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
642
703
|
return n;
|
|
643
704
|
}
|
|
@@ -692,6 +753,8 @@ class Visitor {
|
|
|
692
753
|
return this.visitAssignmentExpression(n);
|
|
693
754
|
case "AwaitExpression":
|
|
694
755
|
return this.visitAwaitExpression(n);
|
|
756
|
+
case "BigIntLiteral":
|
|
757
|
+
return this.visitBigIntLiteral(n);
|
|
695
758
|
case "BinaryExpression":
|
|
696
759
|
return this.visitBinaryExpression(n);
|
|
697
760
|
case "BooleanLiteral":
|
|
@@ -756,6 +819,8 @@ class Visitor {
|
|
|
756
819
|
return this.visitTsTypeAssertion(n);
|
|
757
820
|
case "TsConstAssertion":
|
|
758
821
|
return this.visitTsConstAssertion(n);
|
|
822
|
+
case "TsInstantiation":
|
|
823
|
+
return this.visitTsInstantiation(n);
|
|
759
824
|
case "UnaryExpression":
|
|
760
825
|
return this.visitUnaryExpression(n);
|
|
761
826
|
case "UpdateExpression":
|
|
@@ -769,7 +834,22 @@ class Visitor {
|
|
|
769
834
|
}
|
|
770
835
|
}
|
|
771
836
|
visitOptionalChainingExpression(n) {
|
|
772
|
-
n.base = this.
|
|
837
|
+
n.base = this.visitMemberExpressionOrOptionalChainingCall(n.base);
|
|
838
|
+
return n;
|
|
839
|
+
}
|
|
840
|
+
visitMemberExpressionOrOptionalChainingCall(n) {
|
|
841
|
+
switch (n.type) {
|
|
842
|
+
case "MemberExpression":
|
|
843
|
+
return this.visitMemberExpression(n);
|
|
844
|
+
case "CallExpression":
|
|
845
|
+
return this.visitOptionalChainingCall(n);
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
visitOptionalChainingCall(n) {
|
|
849
|
+
n.callee = this.visitExpression(n.callee);
|
|
850
|
+
n.arguments = this.visitExprOrSpreads(n.arguments);
|
|
851
|
+
if (n.typeArguments)
|
|
852
|
+
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
773
853
|
return n;
|
|
774
854
|
}
|
|
775
855
|
visitAssignmentExpression(n) {
|
|
@@ -810,6 +890,10 @@ class Visitor {
|
|
|
810
890
|
n.expression = this.visitExpression(n.expression);
|
|
811
891
|
return n;
|
|
812
892
|
}
|
|
893
|
+
visitTsInstantiation(n) {
|
|
894
|
+
n.expression = this.visitExpression(n.expression);
|
|
895
|
+
return n;
|
|
896
|
+
}
|
|
813
897
|
visitTsNonNullExpression(n) {
|
|
814
898
|
n.expression = this.visitExpression(n.expression);
|
|
815
899
|
return n;
|
|
@@ -1072,7 +1156,7 @@ class Visitor {
|
|
|
1072
1156
|
visitJSXOpeningElement(n) {
|
|
1073
1157
|
n.name = this.visitJSXElementName(n.name);
|
|
1074
1158
|
n.typeArguments = this.visitTsTypeParameterInstantiation(n.typeArguments);
|
|
1075
|
-
n.attributes = this.
|
|
1159
|
+
n.attributes = this.visitJSXAttributeOrSpreads(n.attributes);
|
|
1076
1160
|
return n;
|
|
1077
1161
|
}
|
|
1078
1162
|
visitJSXAttributes(attrs) {
|
|
@@ -1087,6 +1171,9 @@ class Visitor {
|
|
|
1087
1171
|
return this.visitSpreadElement(n);
|
|
1088
1172
|
}
|
|
1089
1173
|
}
|
|
1174
|
+
visitJSXAttributeOrSpreads(nodes) {
|
|
1175
|
+
return nodes.map(this.visitJSXAttributeOrSpread.bind(this));
|
|
1176
|
+
}
|
|
1090
1177
|
visitJSXAttribute(n) {
|
|
1091
1178
|
n.name = this.visitJSXAttributeName(n.name);
|
|
1092
1179
|
n.value = this.visitJSXAttributeValue(n.value);
|
|
@@ -1201,7 +1288,7 @@ class Visitor {
|
|
|
1201
1288
|
visitNamedImportSpecifier(node) {
|
|
1202
1289
|
node.local = this.visitBindingIdentifier(node.local);
|
|
1203
1290
|
if (node.imported) {
|
|
1204
|
-
node.imported = this.
|
|
1291
|
+
node.imported = this.visitModuleExportName(node.imported);
|
|
1205
1292
|
}
|
|
1206
1293
|
return node;
|
|
1207
1294
|
}
|