@swc/core 1.2.147 → 1.2.150

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 CHANGED
@@ -5,6 +5,198 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/module)** Fix `jsc.paths` (#3879) ([a65755f](https://github.com/swc-project/swc/commit/a65755fd9a2dfa9bad929df735bb7b3c21613972))
9
+
10
+
11
+ - **(es/parser)** Fix parsing of `const` in ambient context (#3883) ([aea59b8](https://github.com/swc-project/swc/commit/aea59b844ce224250e42315b44ca19db19fbc537))
12
+
13
+ ## [1.2.149] - 2022-03-06
14
+
15
+ ### Bug Fixes
16
+
17
+
18
+
19
+ - **(css/lints)** Allow empty `@layer` at-rule before `@import` at-rule (#3842) ([90fdbab](https://github.com/swc-project/swc/commit/90fdbab0d67f1fca8b52fb6df9b927cc35219445))
20
+
21
+
22
+ - **(es/lints)** Ignore identifiers used as types while checking for duplicate bindings (#3869) ([d10e662](https://github.com/swc-project/swc/commit/d10e66285bab3ae6aadd1d4e6ef3ae0d5c977ec4))
23
+
24
+
25
+ - **(es/minifier)** Don't remove comments if `compress` is not configured (#3866) ([e70c9d8](https://github.com/swc-project/swc/commit/e70c9d8f22ad91f7a1246ac60b0ace8a3b3e7d79))
26
+
27
+
28
+ - **(es/module)** Fix `jest.spyOn` (#3845) ([9546eef](https://github.com/swc-project/swc/commit/9546eefe72178bbc7059d0fc6c5e7e9bbca089e0))
29
+
30
+
31
+ - **(es/module)** Visit the value of class properties (#3877) ([6a005fc](https://github.com/swc-project/swc/commit/6a005fc15a16c0d056a559fe3695a61b2e63944b))
32
+
33
+
34
+ - **(es/parser)** Use unicode id instead of xid (#3867) ([4426250](https://github.com/swc-project/swc/commit/44262508c6e122e7f9dd8e0ad961a4d6ad4a8a0c))
35
+
36
+
37
+ - **(es/parser)** Allow `await` in non-strict mode (#3871) ([f757163](https://github.com/swc-project/swc/commit/f7571630caf249b4a10101a2f1c86b2bbc12d4d6))
38
+
39
+ ### Features
40
+
41
+
42
+
43
+ - **(cli)** Setup subcommands for the features (#3858) ([367a57d](https://github.com/swc-project/swc/commit/367a57df6d66bc11dd750c6b7c30bf3a114e00fa))
44
+
45
+
46
+ - **(css)** Improve error recovery (#3853) ([c84bf13](https://github.com/swc-project/swc/commit/c84bf133a6ffce311548170cb9c4b0edb9804478))
47
+
48
+
49
+ - **(css/lints)** Allow using regex in ignore list (#3855) ([dc0de58](https://github.com/swc-project/swc/commit/dc0de58a46c495bb520a99c4d8e8fcf380713f54))
50
+
51
+
52
+ - **(css/minifier)** Compress `@import` at-rule (#3850) ([ccfb4bf](https://github.com/swc-project/swc/commit/ccfb4bfc0b10375d96620f2748b0a3d022c4e359))
53
+
54
+
55
+ - **(es/compat)** Implement loose mode for `async_to_generator` (#3870) ([c7f2bdb](https://github.com/swc-project/swc/commit/c7f2bdb8138f4fbe59b6a03f9d6aa74966389d04))
56
+
57
+
58
+ - **(es/minifier)** Implement `pure_getters` partially (#3872) ([a264360](https://github.com/swc-project/swc/commit/a2643608a7aeda910da0ed03a705cff3ddecd543))
59
+
60
+
61
+ - **(es/module/cjs)** Support regex-based patterns for lazy config (#3704) ([1f70fa6](https://github.com/swc-project/swc/commit/1f70fa6e08e9b400c2e34ee9f0d6749cf21b9e3f))
62
+
63
+
64
+ - **(es/transform)** Unify logic for handling class properties (#3766) ([6f076e4](https://github.com/swc-project/swc/commit/6f076e4927fca646882709832826dc0eb7106e35))
65
+
66
+ ### Performance
67
+
68
+
69
+
70
+ - **(es)** Filter logs for `cranelift` out (#3801) ([225f9a7](https://github.com/swc-project/swc/commit/225f9a7f2a3dad917aaf2a231463ec05699b4064))
71
+
72
+
73
+ - **(es/ast)** Implement `Clone` without inline for some enums (#3878) ([3b04789](https://github.com/swc-project/swc/commit/3b04789a5750532ab9ccb78a833226b39b47a714))
74
+
75
+
76
+ - **(es/compat)** Add tracing support to transforms for from es2017 to es2019 (#3844) ([a933db5](https://github.com/swc-project/swc/commit/a933db5a1a54804efefd1b1d901b85a44ba059a5))
77
+
78
+
79
+ - **(es/compat)** Add tracing support for es2015 transforms (#3857) ([cd8bb0f](https://github.com/swc-project/swc/commit/cd8bb0fb2c70c30ea421842fc6c5b6837e3ff182))
80
+
81
+
82
+ - **(es/transform)** Use `SingleThreadedComments` for transform (#3847) ([73ec0b3](https://github.com/swc-project/swc/commit/73ec0b3dd734dfd1ee79addfe078c709620ade17))
83
+
84
+ ### Testing
85
+
86
+
87
+
88
+ - **(es)** Add a test for a fixed issue (#3873) ([0ab3263](https://github.com/swc-project/swc/commit/0ab32639a1ce04eba221a0bc958d150ba65fa656))
89
+
90
+
91
+ - **(es)** Add tests for fixed issues (#3874) ([2605e13](https://github.com/swc-project/swc/commit/2605e132e683ad0b649621a321be31347e0ac5e6))
92
+
93
+
94
+ - **(es)** Add tests for fixed issues (#3875) ([8d3c9d3](https://github.com/swc-project/swc/commit/8d3c9d39f036a1e876ca98bd801515edfe1cee5b))
95
+
96
+
97
+ - **(es/transform/jest)** Ensure that sourcemap is working (#3864) ([fc87f43](https://github.com/swc-project/swc/commit/fc87f43507ed398eb0941cffb426321e1b781980))
98
+
99
+
100
+ - **(swc)** Use external helpers for reference testing (#3865) ([8400708](https://github.com/swc-project/swc/commit/84007087688292fe7fcb1becea56538944dabc66))
101
+
102
+ ## [1.2.148] - 2022-03-04
103
+
104
+ ### Bug Fixes
105
+
106
+
107
+
108
+ - **(css/codegen)** Fix codegen of preserved tokens (#3819) ([7ba5861](https://github.com/swc-project/swc/commit/7ba5861a334657cb443b2f143222f632fcbcf752))
109
+
110
+
111
+ - **(css/codegen)** Fix the output of `SimpleBlock` (#3838) ([e3a5c14](https://github.com/swc-project/swc/commit/e3a5c142d5f6e965478bd68201714e6d0b4bc863))
112
+
113
+
114
+ - **(css/parser)** Fix parsing of `;` in values (#3821) ([30cd29b](https://github.com/swc-project/swc/commit/30cd29b0f0153bd732f0004dfcb10892635ee027))
115
+
116
+
117
+ - **(es/compat)** Fix block scoping of variables (#3826) ([406b8ea](https://github.com/swc-project/swc/commit/406b8eaeafa37d1ec68a5d5aca0f8dd337ae39ec))
118
+
119
+
120
+ - **(es/hygiene)** Fix renaming bugs (#3824) ([043fba2](https://github.com/swc-project/swc/commit/043fba274e13055dad4b2f6cee85b1bf751572ca))
121
+
122
+
123
+ - **(es/minifier)** Preserve more variables (#3805) ([89388e6](https://github.com/swc-project/swc/commit/89388e6ac3669f129d1dfc1f687ad7792373dbc9))
124
+
125
+
126
+ - **(es/minifier)** Don't reorder unnecessarily (#3817) ([8a468f7](https://github.com/swc-project/swc/commit/8a468f7544ae7e717de4d629c33e5cdffdfcc7de))
127
+
128
+
129
+ - **(es/minifier)** Support declaring multiple bindings with the same name (#3837) ([0fc819e](https://github.com/swc-project/swc/commit/0fc819e2ef04a5a809d1c15523262b2f3fbc580a))
130
+
131
+
132
+ - **(node-swc)** Correctly close trace spans after completion (#3811) ([ffb2ee8](https://github.com/swc-project/swc/commit/ffb2ee85e6e3cac7136578c2eaaff73b883f208c))
133
+
134
+
135
+ - **(node-swc)** Fix handling of `OptionalChainingExpression` in `Visitor` (#3809) ([4d123c3](https://github.com/swc-project/swc/commit/4d123c3789cd5a837de08014675e945990122c62))
136
+
137
+
138
+ - **(node-swc/types)** Add a missing field of `ExportNamedDeclaration` (#3822) ([bde7577](https://github.com/swc-project/swc/commit/bde75770988a6e1c9bb6ae4b850866cea79b0f2c))
139
+
140
+ ### Features
141
+
142
+
143
+
144
+ - **(config)** Add a dedicated cached regex (#3832) ([efc6741](https://github.com/swc-project/swc/commit/efc67417a5afd7813c2d09938300b5c372d1a978))
145
+
146
+
147
+ - **(css)** Support color functions (#3836) ([3df887c](https://github.com/swc-project/swc/commit/3df887ca3744813d8cfc6c253a7bb3decaca54db))
148
+
149
+
150
+ - **(css/lints)** Add `font-family-no-duplicate-names` rule (#3818) ([2d273d6](https://github.com/swc-project/swc/commit/2d273d60b9dec4d9f969f0e691ba21ce4b252b7d))
151
+
152
+
153
+ - **(css/lints)** Implement `color-hex-alpha` rule (#3829) ([818b408](https://github.com/swc-project/swc/commit/818b40857328ae9b855d78d774621fa1ab243da9))
154
+
155
+
156
+ - **(css/minifier)** Compress more declarations (#3840) ([0db6915](https://github.com/swc-project/swc/commit/0db6915e32d6c1de848b0f5aeacea2c4cb4522f8))
157
+
158
+
159
+ - **(css/parser)** Improve error recovery (#3810) ([f969f8c](https://github.com/swc-project/swc/commit/f969f8c5f54e3028576a74ccfcaae72b1c19eaf9))
160
+
161
+
162
+ - **(css/parser)** Improve error recovery (#3828) ([fbb98aa](https://github.com/swc-project/swc/commit/fbb98aa73cbbac186493065af8cfa0fd31407fe6))
163
+
164
+
165
+ - **(es/lints)** Implement `radix` rule (#3651) ([f6b4bbe](https://github.com/swc-project/swc/commit/f6b4bbe47beccb6052d60c8e6d7d8c8c7fec5100))
166
+
167
+
168
+ - **(es/minifier)** Drop more function parameters in strict mode (#3814) ([789eb7b](https://github.com/swc-project/swc/commit/789eb7baa9ece80e85f0ffd9a92f4d07214d9b11))
169
+
170
+
171
+ - **(es/minifier)** Improve sequential inlining (#3820) ([364532e](https://github.com/swc-project/swc/commit/364532e9a74ee55196cecb37eb3fc8256e3a23df))
172
+
173
+
174
+ - **(es/minifier)** Implement more rules (#3841) ([260c2a8](https://github.com/swc-project/swc/commit/260c2a885e16332a0e3401bccb65d1381bfab3f3))
175
+
176
+ ### Miscellaneous Tasks
177
+ - **general**: Ignore linguist detection for CSS test files (#3831) ([8755ce1](https://github.com/swc-project/swc/commit/8755ce160f9fa6f9ce75c4ac40fc02d5df236d2d))
178
+
179
+ ### Performance
180
+
181
+
182
+
183
+ - **(es)** Use `Mutex` from `parking_lot` (#3830) ([351b814](https://github.com/swc-project/swc/commit/351b814ed0f1ca36a1e8fd352674689ffe392eda))
184
+
185
+
186
+ - **(es/parser)** Remove duplicated instantiations of `Parser` to reduce binary size (#3813) ([f5103a7](https://github.com/swc-project/swc/commit/f5103a77256060e2c27ca360d0c58bbcc6b92b13))
187
+
188
+ ### Testing
189
+
190
+
191
+
192
+ - **(es/compat)** Organize tests (#3825) ([814dcc0](https://github.com/swc-project/swc/commit/814dcc09d66f9c7a968348fc3a08573cadd036f8))
193
+
194
+ ## [1.2.147] - 2022-03-02
195
+
196
+ ### Bug Fixes
197
+
198
+
199
+
8
200
  - **(es/compat)** Initialize class fields as a last step (#3767) ([11bf29f](https://github.com/swc-project/swc/commit/11bf29f44b4233b2e7f60b750ef56429dbe47ce9))
9
201
 
10
202
 
@@ -127,6 +319,12 @@
127
319
 
128
320
  - **(es/minifier)** Prepare porting more rules from `terser` (#3779) ([86072b5](https://github.com/swc-project/swc/commit/86072b57f9e0cf59b660f88cdb2c9cee15f33720))
129
321
 
322
+ ### Build
323
+
324
+
325
+
326
+ - **(node-swc)** Rename entrypoint to avoid artifact collision (#3806) ([b485a2f](https://github.com/swc-project/swc/commit/b485a2fc267e0f373b9882e61c14b9fbf7a92471))
327
+
130
328
  ## [1.2.146] - 2022-02-27
131
329
 
132
330
  ### Bug Fixes
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://www.npmjs.com/package/@swc/core">
13
- <img alt="npm Downloads" src="https://img.shields.io/npm/dw/@swc/core">
13
+ <img alt="npm Downloads" src="https://img.shields.io/npm/dm/@swc/core">
14
14
  </a>
15
15
  <a href="https://crates.io/crates/swc_ecma_parser">
16
16
  <img alt="undefined" src="https://img.shields.io/crates/d/swc_ecma_parser.svg?label=crates.io%20downloads">
package/Visitor.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsImportEqualsDeclaration, TsIndexSignature, TsInterfaceBody, TsInterfaceDeclaration, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsQualifiedName, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
1
+ import { Accessibility, ArrayExpression, ArrayPattern, ArrowFunctionExpression, Argument, AssignmentExpression, AssignmentPattern, AssignmentPatternProperty, AssignmentProperty, AwaitExpression, BigIntLiteral, BinaryExpression, BlockStatement, BooleanLiteral, BreakStatement, CallExpression, CatchClause, Class, ClassDeclaration, ClassExpression, ClassMember, ClassMethod, ClassProperty, ComputedPropName, ConditionalExpression, Constructor, ContinueStatement, DebuggerStatement, Declaration, Decorator, DefaultDecl, DoWhileStatement, EmptyStatement, ExportAllDeclaration, ExportDeclaration, ExportDefaultDeclaration, ExportDefaultExpression, ExportDefaultSpecifier, ExportNamedDeclaration, ExportNamespaceSpecifier, ExportSpecifier, Expression, ExpressionStatement, Fn, ForInStatement, ForOfStatement, ForStatement, FunctionDeclaration, FunctionExpression, GetterProperty, Identifier, IfStatement, ImportDeclaration, ImportDefaultSpecifier, ImportNamespaceSpecifier, ImportSpecifier, JSXAttribute, JSXAttributeName, JSXAttributeOrSpread, JSXAttrValue, JSXClosingElement, JSXClosingFragment, JSXElement, JSXElementChild, JSXElementName, JSXEmptyExpression, JSXExpressionContainer, JSXFragment, JSXMemberExpression, JSXNamespacedName, JSXObject, JSXOpeningElement, JSXOpeningFragment, JSXSpreadChild, JSXText, KeyValuePatternProperty, KeyValueProperty, LabeledStatement, MemberExpression, MetaProperty, MethodProperty, Module, ModuleDeclaration, ModuleItem, NamedExportSpecifier, NamedImportSpecifier, NewExpression, NullLiteral, NumericLiteral, ObjectExpression, ObjectPattern, ObjectPatternProperty, OptionalChainingExpression, ParenthesisExpression, Pattern, PrivateMethod, PrivateName, PrivateProperty, Program, Property, PropertyName, RegExpLiteral, RestElement, ReturnStatement, Script, SequenceExpression, SetterProperty, SpreadElement, Statement, StringLiteral, Super, SwitchCase, SwitchStatement, TaggedTemplateExpression, TemplateLiteral, ThisExpression, ThrowStatement, TryStatement, TsAsExpression, TsEntityName, TsEnumDeclaration, TsEnumMember, TsEnumMemberId, TsExportAssignment, TsExpressionWithTypeArguments, TsExternalModuleReference, TsFnParameter, TsImportEqualsDeclaration, TsIndexSignature, TsInterfaceBody, TsInterfaceDeclaration, TsModuleBlock, TsModuleDeclaration, TsModuleName, TsModuleReference, TsNamespaceBody, TsNamespaceDeclaration, TsNamespaceExportDeclaration, TsNonNullExpression, TsParameterProperty, TsParameterPropertyParameter, TsQualifiedName, TsType, TsTypeAliasDeclaration, TsTypeAnnotation, TsTypeAssertion, TsTypeElement, TsTypeParameter, TsTypeParameterDeclaration, TsTypeParameterInstantiation, UnaryExpression, UpdateExpression, VariableDeclaration, VariableDeclarator, WhileStatement, WithStatement, YieldExpression, Param, ExprOrSpread, TsConstAssertion, Import, SuperPropExpression } from "./types";
2
2
  export declare class Visitor {
3
3
  visitProgram(n: Program): Program;
4
4
  visitModule(m: Module): Module;
@@ -91,7 +91,6 @@ export declare class Visitor {
91
91
  visitAccessibility(n: Accessibility | undefined): Accessibility | undefined;
92
92
  visitClassProperty(n: ClassProperty): ClassMember;
93
93
  visitClassMethod(n: ClassMethod): ClassMember;
94
- visitPropertName(n: PropertyName): PropertyName;
95
94
  visitComputedPropertyKey(n: ComputedPropName): ComputedPropName;
96
95
  visitClass<T extends Class>(n: T): T;
97
96
  visitFunction<T extends Fn>(n: T): T;
@@ -186,6 +185,7 @@ export declare class Visitor {
186
185
  visitIdentifier(n: Identifier): Identifier;
187
186
  visitStringLiteral(n: StringLiteral): StringLiteral;
188
187
  visitNumericLiteral(n: NumericLiteral): NumericLiteral;
188
+ visitBigIntLiteral(n: BigIntLiteral): BigIntLiteral;
189
189
  visitPattern(n: Pattern): Pattern;
190
190
  visitRestElement(n: RestElement): RestElement;
191
191
  visitAssignmentPattern(n: AssignmentPattern): Pattern;
package/Visitor.js CHANGED
@@ -586,6 +586,8 @@ class Visitor {
586
586
  return this.visitStringLiteral(key);
587
587
  case "NumericLiteral":
588
588
  return this.visitNumericLiteral(key);
589
+ case "BigIntLiteral":
590
+ return this.visitBigIntLiteral(key);
589
591
  default:
590
592
  return this.visitComputedPropertyKey(key);
591
593
  }
@@ -596,7 +598,7 @@ class Visitor {
596
598
  visitClassProperty(n) {
597
599
  n.accessibility = this.visitAccessibility(n.accessibility);
598
600
  n.decorators = this.visitDecorators(n.decorators);
599
- n.key = this.visitExpression(n.key);
601
+ n.key = this.visitPropertyName(n.key);
600
602
  n.typeAnnotation = this.visitTsTypeAnnotation(n.typeAnnotation);
601
603
  n.value = this.visitOptionalExpression(n.value);
602
604
  return n;
@@ -607,18 +609,6 @@ class Visitor {
607
609
  n.key = this.visitPropertyName(n.key);
608
610
  return n;
609
611
  }
610
- visitPropertName(n) {
611
- switch (n.type) {
612
- case "Identifier":
613
- return this.visitIdentifier(n);
614
- case "NumericLiteral":
615
- return this.visitNumericLiteral(n);
616
- case "StringLiteral":
617
- return this.visitStringLiteral(n);
618
- case "Computed":
619
- return this.visitComputedPropertyKey(n);
620
- }
621
- }
622
612
  visitComputedPropertyKey(n) {
623
613
  n.expression = this.visitExpression(n.expression);
624
614
  return n;
@@ -779,7 +769,7 @@ class Visitor {
779
769
  }
780
770
  }
781
771
  visitOptionalChainingExpression(n) {
782
- n.expr = this.visitExpression(n.expr);
772
+ n.base = this.visitExpression(n.base);
783
773
  return n;
784
774
  }
785
775
  visitAssignmentExpression(n) {
@@ -1241,6 +1231,9 @@ class Visitor {
1241
1231
  visitNumericLiteral(n) {
1242
1232
  return n;
1243
1233
  }
1234
+ visitBigIntLiteral(n) {
1235
+ return n;
1236
+ }
1244
1237
  visitPattern(n) {
1245
1238
  switch (n.type) {
1246
1239
  case "Identifier":
package/binding.d.ts CHANGED
@@ -11,5 +11,5 @@ export const transform: any;
11
11
  export const transformSync: any;
12
12
  export const transformFile: any;
13
13
  export const transformFileSync: any;
14
- export const initTraceOnce: any;
14
+ export const initCustomTraceSubscriber: any;
15
15
  export const Compiler: any;
package/binding.js CHANGED
@@ -243,7 +243,7 @@ if (!nativeBinding) {
243
243
  }
244
244
  throw new Error(`Failed to load native binding`);
245
245
  }
246
- const { bundle, minify, minifySync, parse, parseSync, parseFileSync, parseFile, print, printSync, transform, transformSync, transformFile, transformFileSync, initTraceOnce, Compiler } = nativeBinding;
246
+ const { bundle, minify, minifySync, parse, parseSync, parseFileSync, parseFile, print, printSync, transform, transformSync, transformFile, transformFileSync, initCustomTraceSubscriber, Compiler } = nativeBinding;
247
247
  module.exports.bundle = bundle;
248
248
  module.exports.minify = minify;
249
249
  module.exports.minifySync = minifySync;
@@ -257,5 +257,5 @@ module.exports.transform = transform;
257
257
  module.exports.transformSync = transformSync;
258
258
  module.exports.transformFile = transformFile;
259
259
  module.exports.transformFileSync = transformFileSync;
260
- module.exports.initTraceOnce = initTraceOnce;
260
+ module.exports.initCustomTraceSubscriber = initCustomTraceSubscriber;
261
261
  module.exports.Compiler = Compiler;
package/index.js CHANGED
@@ -258,7 +258,9 @@ exports.minifySync = minifySync;
258
258
  * or bug report at https://github.com/swc-project/swc/discussions.
259
259
  */
260
260
  function __experimental_registerGlobalTraceConfig(traceConfig) {
261
- bindings.initTraceOnce(traceConfig.type === 'traceEvent', traceConfig.fileName);
261
+ if (traceConfig.type === 'traceEvent') {
262
+ bindings.initCustomTraceSubscriber(traceConfig.fileName);
263
+ }
262
264
  }
263
265
  exports.__experimental_registerGlobalTraceConfig = __experimental_registerGlobalTraceConfig;
264
266
  exports.DEFAULT_EXTENSIONS = Object.freeze([
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.2.147",
3
+ "version": "1.2.150",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -107,18 +107,18 @@
107
107
  "url": "https://opencollective.com/swc"
108
108
  },
109
109
  "optionalDependencies": {
110
- "@swc/core-win32-x64-msvc": "1.2.147",
111
- "@swc/core-darwin-x64": "1.2.147",
112
- "@swc/core-linux-x64-gnu": "1.2.147",
113
- "@swc/core-linux-x64-musl": "1.2.147",
114
- "@swc/core-freebsd-x64": "1.2.147",
115
- "@swc/core-win32-ia32-msvc": "1.2.147",
116
- "@swc/core-linux-arm64-gnu": "1.2.147",
117
- "@swc/core-linux-arm-gnueabihf": "1.2.147",
118
- "@swc/core-darwin-arm64": "1.2.147",
119
- "@swc/core-android-arm64": "1.2.147",
120
- "@swc/core-linux-arm64-musl": "1.2.147",
121
- "@swc/core-win32-arm64-msvc": "1.2.147",
122
- "@swc/core-android-arm-eabi": "1.2.147"
110
+ "@swc/core-win32-x64-msvc": "1.2.150",
111
+ "@swc/core-darwin-x64": "1.2.150",
112
+ "@swc/core-linux-x64-gnu": "1.2.150",
113
+ "@swc/core-linux-x64-musl": "1.2.150",
114
+ "@swc/core-freebsd-x64": "1.2.150",
115
+ "@swc/core-win32-ia32-msvc": "1.2.150",
116
+ "@swc/core-linux-arm64-gnu": "1.2.150",
117
+ "@swc/core-linux-arm-gnueabihf": "1.2.150",
118
+ "@swc/core-darwin-arm64": "1.2.150",
119
+ "@swc/core-android-arm64": "1.2.150",
120
+ "@swc/core-linux-arm64-musl": "1.2.150",
121
+ "@swc/core-win32-arm64-msvc": "1.2.150",
122
+ "@swc/core-android-arm-eabi": "1.2.150"
123
123
  }
124
124
  }
package/types.d.ts CHANGED
@@ -455,6 +455,7 @@ export interface TransformConfig {
455
455
  */
456
456
  decoratorMetadata?: boolean;
457
457
  treatConstEnumAsEnum?: boolean;
458
+ useDefineForClassFields?: boolean;
458
459
  }
459
460
  export interface ReactConfig {
460
461
  /**
@@ -662,20 +663,19 @@ export interface ClassPropertyBase extends Node, HasSpan, HasDecorator {
662
663
  value?: Expression;
663
664
  typeAnnotation?: TsTypeAnnotation;
664
665
  is_static: boolean;
665
- computed: boolean;
666
666
  accessibility?: Accessibility;
667
- is_abstract: boolean;
668
667
  is_optional: boolean;
669
668
  readonly: boolean;
670
- definite: boolean;
671
669
  }
672
670
  export interface ClassProperty extends ClassPropertyBase {
673
671
  type: "ClassProperty";
674
- key: Expression;
672
+ key: PropertyName;
675
673
  }
676
674
  export interface PrivateProperty extends ClassPropertyBase {
677
675
  type: "PrivateProperty";
678
676
  key: PrivateName;
677
+ is_abstract: boolean;
678
+ definite: boolean;
679
679
  }
680
680
  export interface Param extends Node, HasSpan, HasDecorator {
681
681
  type: "Parameter";
@@ -742,7 +742,7 @@ export interface OptionalChainingExpression extends ExpressionBase {
742
742
  /**
743
743
  * Call expression or member expression.
744
744
  */
745
- expr: Expression;
745
+ base: Expression;
746
746
  }
747
747
  export interface ThisExpression extends ExpressionBase {
748
748
  type: "ThisExpression";
@@ -993,6 +993,10 @@ export interface NumericLiteral extends Node, HasSpan {
993
993
  type: "NumericLiteral";
994
994
  value: number;
995
995
  }
996
+ export interface BigIntLiteral extends Node, HasSpan {
997
+ type: "BigIntLiteral";
998
+ value: bigint;
999
+ }
996
1000
  export declare type ModuleDeclaration = ImportDeclaration | ExportDeclaration | ExportNamedDeclaration | ExportDefaultDeclaration | ExportDefaultExpression | ExportAllDeclaration | TsImportEqualsDeclaration | TsExportAssignment | TsNamespaceExportDeclaration;
997
1001
  export interface ExportDefaultExpression extends Node, HasSpan {
998
1002
  type: "ExportDefaultExpression";
@@ -1020,6 +1024,7 @@ export interface ExportNamedDeclaration extends Node, HasSpan {
1020
1024
  type: "ExportNamedDeclaration";
1021
1025
  specifiers: ExportSpecifier[];
1022
1026
  source?: StringLiteral;
1027
+ typeOnly: boolean;
1023
1028
  }
1024
1029
  export interface ExportDefaultDeclaration extends Node, HasSpan {
1025
1030
  type: "ExportDefaultDeclaration";
@@ -1158,7 +1163,7 @@ export interface SetterProperty extends PropBase, HasSpan {
1158
1163
  export interface MethodProperty extends PropBase, Fn {
1159
1164
  type: "MethodProperty";
1160
1165
  }
1161
- export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | ComputedPropName;
1166
+ export declare type PropertyName = Identifier | StringLiteral | NumericLiteral | BigIntLiteral | ComputedPropName;
1162
1167
  export interface ComputedPropName extends Node, HasSpan {
1163
1168
  type: "Computed";
1164
1169
  expression: Expression;