@swc/core 1.15.47 → 1.16.0
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/Visitor.d.ts +4 -2
- package/Visitor.js +21 -13
- package/package.json +14 -14
package/Visitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Accessibility, Argument, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BindingIdentifier, 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, ExprOrSpread, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, Import, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttrValue, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, 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, Param, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SuperPropExpression, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstAssertion, 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, TsSatisfiesExpression, TsSetterSignature, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression } from "@swc/types";
|
|
1
|
+
import { Accessibility, Argument, ArrayExpression, ArrayPattern, ArrowFunctionExpression, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BindingIdentifier, 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, ExprOrSpread, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionBody, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, Import, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttrValue, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, 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, Param, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StaticBlock, StringLiteral, Super, SuperPropExpression, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsCallSignatureDeclaration, TsConstAssertion, 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, TsThisParameter, TsQualifiedName, TsSatisfiesExpression, TsSetterSignature, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression } from "@swc/types";
|
|
2
2
|
/**
|
|
3
3
|
* @deprecated JavaScript API is deprecated. Please use Wasm plugin instead.
|
|
4
4
|
*/
|
|
@@ -36,7 +36,8 @@ export declare class Visitor {
|
|
|
36
36
|
visitSpreadElement(e: SpreadElement): SpreadElement;
|
|
37
37
|
visitOptionalExpression(e: Expression | undefined): Expression | undefined;
|
|
38
38
|
visitArrowFunctionExpression(e: ArrowFunctionExpression): Expression;
|
|
39
|
-
visitArrowBody(body:
|
|
39
|
+
visitArrowBody(body: FunctionBody | Expression): FunctionBody | Expression;
|
|
40
|
+
visitFunctionBody(body: FunctionBody): FunctionBody;
|
|
40
41
|
visitBlockStatement(block: BlockStatement): BlockStatement;
|
|
41
42
|
visitStatements(stmts: Statement[]): Statement[];
|
|
42
43
|
visitStatement(stmt: Statement): Statement;
|
|
@@ -90,6 +91,7 @@ export declare class Visitor {
|
|
|
90
91
|
visitTsIndexSignature(n: TsIndexSignature): TsIndexSignature;
|
|
91
92
|
visitTsFnParameters(params: TsFnParameter[]): TsFnParameter[];
|
|
92
93
|
visitTsFnParameter(n: TsFnParameter): TsFnParameter;
|
|
94
|
+
visitTsThisParameter(n: TsThisParameter): TsThisParameter;
|
|
93
95
|
visitPrivateProperty(n: PrivateProperty): ClassMember;
|
|
94
96
|
visitPrivateMethod(n: PrivateMethod): ClassMember;
|
|
95
97
|
visitPrivateName(n: PrivateName): PrivateName;
|
package/Visitor.js
CHANGED
|
@@ -210,12 +210,16 @@ class Visitor {
|
|
|
210
210
|
}
|
|
211
211
|
visitArrowBody(body) {
|
|
212
212
|
switch (body.type) {
|
|
213
|
-
case "
|
|
214
|
-
return this.
|
|
213
|
+
case "FunctionBody":
|
|
214
|
+
return this.visitFunctionBody(body);
|
|
215
215
|
default:
|
|
216
216
|
return this.visitExpression(body);
|
|
217
217
|
}
|
|
218
218
|
}
|
|
219
|
+
visitFunctionBody(body) {
|
|
220
|
+
body.stmts = this.visitStatements(body.stmts);
|
|
221
|
+
return body;
|
|
222
|
+
}
|
|
219
223
|
visitBlockStatement(block) {
|
|
220
224
|
block.stmts = this.visitStatements(block.stmts);
|
|
221
225
|
return block;
|
|
@@ -591,6 +595,10 @@ class Visitor {
|
|
|
591
595
|
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
592
596
|
return n;
|
|
593
597
|
}
|
|
598
|
+
visitTsThisParameter(n) {
|
|
599
|
+
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
600
|
+
return n;
|
|
601
|
+
}
|
|
594
602
|
visitPrivateProperty(n) {
|
|
595
603
|
n.decorators = this.visitDecorators(n.decorators);
|
|
596
604
|
n.key = this.visitPrivateName(n.key);
|
|
@@ -612,7 +620,7 @@ class Visitor {
|
|
|
612
620
|
n.key = this.visitPropertyName(n.key);
|
|
613
621
|
n.params = this.visitConstructorParameters(n.params);
|
|
614
622
|
if (n.body) {
|
|
615
|
-
n.body = this.
|
|
623
|
+
n.body = this.visitFunctionBody(n.body);
|
|
616
624
|
}
|
|
617
625
|
return n;
|
|
618
626
|
}
|
|
@@ -688,9 +696,12 @@ class Visitor {
|
|
|
688
696
|
}
|
|
689
697
|
visitFunction(n) {
|
|
690
698
|
n.decorators = this.visitDecorators(n.decorators);
|
|
699
|
+
if (n.thisParam) {
|
|
700
|
+
n.thisParam = this.visitTsThisParameter(n.thisParam);
|
|
701
|
+
}
|
|
691
702
|
n.params = this.visitParameters(n.params);
|
|
692
703
|
if (n.body) {
|
|
693
|
-
n.body = this.
|
|
704
|
+
n.body = this.visitFunctionBody(n.body);
|
|
694
705
|
}
|
|
695
706
|
n.returnType = this.visitTsTypeAnnotation(n.returnType);
|
|
696
707
|
n.typeParameters = this.visitTsTypeParameterDeclaration(n.typeParameters);
|
|
@@ -980,16 +991,16 @@ class Visitor {
|
|
|
980
991
|
}
|
|
981
992
|
visitSetterProperty(n) {
|
|
982
993
|
n.key = this.visitPropertyName(n.key);
|
|
983
|
-
n.
|
|
984
|
-
if (n.body) {
|
|
985
|
-
n.body = this.visitBlockStatement(n.body);
|
|
986
|
-
}
|
|
994
|
+
n.function = this.visitFunction(n.function);
|
|
987
995
|
return n;
|
|
988
996
|
}
|
|
989
997
|
visitMethodProperty(n) {
|
|
990
998
|
n.key = this.visitPropertyName(n.key);
|
|
999
|
+
if (n.thisParam) {
|
|
1000
|
+
n.thisParam = this.visitTsThisParameter(n.thisParam);
|
|
1001
|
+
}
|
|
991
1002
|
if (n.body) {
|
|
992
|
-
n.body = this.
|
|
1003
|
+
n.body = this.visitFunctionBody(n.body);
|
|
993
1004
|
}
|
|
994
1005
|
n.decorators = this.visitDecorators(n.decorators);
|
|
995
1006
|
n.params = this.visitParameters(n.params);
|
|
@@ -1004,10 +1015,7 @@ class Visitor {
|
|
|
1004
1015
|
}
|
|
1005
1016
|
visitGetterProperty(n) {
|
|
1006
1017
|
n.key = this.visitPropertyName(n.key);
|
|
1007
|
-
|
|
1008
|
-
n.body = this.visitBlockStatement(n.body);
|
|
1009
|
-
}
|
|
1010
|
-
n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
|
|
1018
|
+
n.function = this.visitFunction(n.function);
|
|
1011
1019
|
return n;
|
|
1012
1020
|
}
|
|
1013
1021
|
visitAssignmentProperty(n) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@swc/core",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.16.0",
|
|
4
4
|
"description": "Super-fast alternative for babel",
|
|
5
5
|
"homepage": "https://swc.rs",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
],
|
|
84
84
|
"dependencies": {
|
|
85
85
|
"@swc/counter": "^0.1.3",
|
|
86
|
-
"@swc/types": "^0.1.
|
|
86
|
+
"@swc/types": "^0.1.28"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@napi-rs/cli": "^3.2.0",
|
|
@@ -92,18 +92,18 @@
|
|
|
92
92
|
"typescript": "^5.3.3"
|
|
93
93
|
},
|
|
94
94
|
"optionalDependencies": {
|
|
95
|
-
"@swc/core-darwin-x64": "1.
|
|
96
|
-
"@swc/core-win32-x64-msvc": "1.
|
|
97
|
-
"@swc/core-linux-x64-gnu": "1.
|
|
98
|
-
"@swc/core-linux-ppc64-gnu": "1.
|
|
99
|
-
"@swc/core-linux-s390x-gnu": "1.
|
|
100
|
-
"@swc/core-linux-x64-musl": "1.
|
|
101
|
-
"@swc/core-win32-ia32-msvc": "1.
|
|
102
|
-
"@swc/core-linux-arm-gnueabihf": "1.
|
|
103
|
-
"@swc/core-darwin-arm64": "1.
|
|
104
|
-
"@swc/core-linux-arm64-gnu": "1.
|
|
105
|
-
"@swc/core-linux-arm64-musl": "1.
|
|
106
|
-
"@swc/core-win32-arm64-msvc": "1.
|
|
95
|
+
"@swc/core-darwin-x64": "1.16.0",
|
|
96
|
+
"@swc/core-win32-x64-msvc": "1.16.0",
|
|
97
|
+
"@swc/core-linux-x64-gnu": "1.16.0",
|
|
98
|
+
"@swc/core-linux-ppc64-gnu": "1.16.0",
|
|
99
|
+
"@swc/core-linux-s390x-gnu": "1.16.0",
|
|
100
|
+
"@swc/core-linux-x64-musl": "1.16.0",
|
|
101
|
+
"@swc/core-win32-ia32-msvc": "1.16.0",
|
|
102
|
+
"@swc/core-linux-arm-gnueabihf": "1.16.0",
|
|
103
|
+
"@swc/core-darwin-arm64": "1.16.0",
|
|
104
|
+
"@swc/core-linux-arm64-gnu": "1.16.0",
|
|
105
|
+
"@swc/core-linux-arm64-musl": "1.16.0",
|
|
106
|
+
"@swc/core-win32-arm64-msvc": "1.16.0"
|
|
107
107
|
},
|
|
108
108
|
"scripts": {
|
|
109
109
|
"postinstall": "node postinstall.js",
|