@swc/core 1.3.53 → 1.3.55

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,43 @@
5
5
 
6
6
 
7
7
 
8
+ - **(es/helpers)** Add `src/*.mjs` entry back (#7328) ([84af855](https://github.com/swc-project/swc/commit/84af85563f91a9593e0eb319f46c49c1d4cf7895))
9
+
10
+ ### Features
11
+
12
+
13
+
14
+ - **(es/module)** Add `export_interop_annotation` flag (#7330) ([caee073](https://github.com/swc-project/swc/commit/caee073935a9abb08f0b5e2e0e9160d80064995b))
15
+
16
+ ## [1.3.54] - 2023-04-25
17
+
18
+ ### Bug Fixes
19
+
20
+
21
+
22
+ - **(bindings/node)** Support `TsSatisfiesExpression` (#7317) ([761ef83](https://github.com/swc-project/swc/commit/761ef8389dd000e465bd385ec925654a8cb2ae09))
23
+
24
+
25
+ - **(common)** Workaround the `Arc` and `rkyv` issue (#7321) ([577f81e](https://github.com/swc-project/swc/commit/577f81ec405f4f3a3e58e3f97c07d3720dd80912))
26
+
27
+
28
+ - **(es/codegen)** Fix codegen of `TsModuleDecl` (#7319) ([0ca05d8](https://github.com/swc-project/swc/commit/0ca05d8b69b6301e2346e5de6c45a77c863676e9))
29
+
30
+
31
+ - **(es/compat)** Transform curried function call with optional chaining (#7313) ([66b5b11](https://github.com/swc-project/swc/commit/66b5b110bf94259e0e0223224940bb8d0384e9b6))
32
+
33
+ ### Testing
34
+
35
+
36
+
37
+ - **(es)** Update tsc test suite (#7323) ([603f22d](https://github.com/swc-project/swc/commit/603f22de76eaeac1a64ee5e5f2e1dd095f908604))
38
+
39
+ ## [1.3.53] - 2023-04-21
40
+
41
+ ### Bug Fixes
42
+
43
+
44
+
8
45
  - **(es)** Fix a crash related to source map (#7307) ([e7f7b01](https://github.com/swc-project/swc/commit/e7f7b01f59b622c993ee584ae825a39c390b2570))
9
46
 
10
47
 
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, 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, BindingIdentifier } from "./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, 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 "./types";
2
2
  export declare class Visitor {
3
3
  visitProgram(n: Program): Program;
4
4
  visitModule(m: Module): Module;
@@ -127,6 +127,7 @@ export declare class Visitor {
127
127
  visitTsInstantiation(n: TsInstantiation): TsInstantiation;
128
128
  visitTsNonNullExpression(n: TsNonNullExpression): Expression;
129
129
  visitTsAsExpression(n: TsAsExpression): Expression;
130
+ visitTsSatisfiesExpression(n: TsSatisfiesExpression): Expression;
130
131
  visitThisExpression(n: ThisExpression): Expression;
131
132
  visitTemplateLiteral(n: TemplateLiteral): Expression;
132
133
  visitParameters(n: Param[]): Param[];
package/Visitor.js CHANGED
@@ -813,6 +813,8 @@ class Visitor {
813
813
  return this.visitThisExpression(n);
814
814
  case "TsAsExpression":
815
815
  return this.visitTsAsExpression(n);
816
+ case "TsSatisfiesExpression":
817
+ return this.visitTsSatisfiesExpression(n);
816
818
  case "TsNonNullExpression":
817
819
  return this.visitTsNonNullExpression(n);
818
820
  case "TsTypeAssertion":
@@ -903,6 +905,11 @@ class Visitor {
903
905
  n.typeAnnotation = this.visitTsType(n.typeAnnotation);
904
906
  return n;
905
907
  }
908
+ visitTsSatisfiesExpression(n) {
909
+ n.expression = this.visitExpression(n.expression);
910
+ n.typeAnnotation = this.visitTsType(n.typeAnnotation);
911
+ return n;
912
+ }
906
913
  visitThisExpression(n) {
907
914
  return n;
908
915
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swc/core",
3
- "version": "1.3.53",
3
+ "version": "1.3.55",
4
4
  "description": "Super-fast alternative for babel",
5
5
  "homepage": "https://swc.rs",
6
6
  "main": "./index.js",
@@ -145,16 +145,16 @@
145
145
  "url": "https://opencollective.com/swc"
146
146
  },
147
147
  "optionalDependencies": {
148
- "@swc/core-win32-x64-msvc": "1.3.53",
149
- "@swc/core-darwin-x64": "1.3.53",
150
- "@swc/core-linux-x64-gnu": "1.3.53",
151
- "@swc/core-linux-x64-musl": "1.3.53",
152
- "@swc/core-win32-ia32-msvc": "1.3.53",
153
- "@swc/core-linux-arm64-gnu": "1.3.53",
154
- "@swc/core-linux-arm-gnueabihf": "1.3.53",
155
- "@swc/core-darwin-arm64": "1.3.53",
156
- "@swc/core-linux-arm64-musl": "1.3.53",
157
- "@swc/core-win32-arm64-msvc": "1.3.53"
148
+ "@swc/core-win32-x64-msvc": "1.3.55",
149
+ "@swc/core-darwin-x64": "1.3.55",
150
+ "@swc/core-linux-x64-gnu": "1.3.55",
151
+ "@swc/core-linux-x64-musl": "1.3.55",
152
+ "@swc/core-win32-ia32-msvc": "1.3.55",
153
+ "@swc/core-linux-arm64-gnu": "1.3.55",
154
+ "@swc/core-linux-arm-gnueabihf": "1.3.55",
155
+ "@swc/core-darwin-arm64": "1.3.55",
156
+ "@swc/core-linux-arm64-musl": "1.3.55",
157
+ "@swc/core-win32-arm64-msvc": "1.3.55"
158
158
  },
159
159
  "files": [
160
160
  "CHANGELOG.md",
package/types.d.ts CHANGED
@@ -827,6 +827,14 @@ export interface BaseModuleConfig {
827
827
  * ```
828
828
  */
829
829
  importInterop?: "swc" | "babel" | "node" | "none";
830
+ /**
831
+ * Emits `cjs-module-lexer` annotation
832
+ * `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
833
+ * swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
834
+ *
835
+ * Defaults to `true` if import_interop is Node, else `false`
836
+ */
837
+ exportInteropAnnotation?: boolean;
830
838
  /**
831
839
  * If set to true, dynamic imports will be preserved.
832
840
  */
@@ -974,7 +982,7 @@ export interface VariableDeclarator extends Node, HasSpan {
974
982
  init?: Expression;
975
983
  definite: boolean;
976
984
  }
977
- export 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 | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
985
+ export 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 | TsSatisfiesExpression | TsInstantiation | PrivateName | OptionalChainingExpression | Invalid;
978
986
  interface ExpressionBase extends Node, HasSpan {
979
987
  }
980
988
  export interface Identifier extends ExpressionBase {
@@ -1846,6 +1854,11 @@ export interface TsAsExpression extends ExpressionBase {
1846
1854
  expression: Expression;
1847
1855
  typeAnnotation: TsType;
1848
1856
  }
1857
+ export interface TsSatisfiesExpression extends ExpressionBase {
1858
+ type: "TsSatisfiesExpression";
1859
+ expression: Expression;
1860
+ typeAnnotation: TsType;
1861
+ }
1849
1862
  export interface TsInstantiation extends Node, HasSpan {
1850
1863
  type: "TsInstantiation";
1851
1864
  expression: Expression;