🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more →

@swc/core

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/core - npm Package Compare versions

Comparing version

to
1.3.56

@@ -108,13 +108,2 @@ "use strict";

case 'darwin':
localFileExisted = existsSync(join(__dirname, 'swc.darwin-universal.node'));
try {
if (localFileExisted) {
nativeBinding = require('./swc.darwin-universal.node');
}
else {
nativeBinding = require('@swc/core-darwin-universal');
}
break;
}
catch (_a) { }
switch (arch) {

@@ -121,0 +110,0 @@ case 'x64':

@@ -422,3 +422,5 @@ "use strict";

".ts",
".tsx"
".tsx",
".cts",
".mts"
]);

@@ -425,0 +427,0 @@ function toBuffer(t) {

{
"name": "@swc/core",
"version": "1.3.29",
"version": "1.3.56",
"description": "Super-fast alternative for babel",

@@ -59,3 +59,2 @@ "homepage": "https://swc.rs",

"build:dev": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts --cargo-cwd ./bindings -p binding_core_node",
"build:bytecheck": "tsc -d && napi build --platform --cargo-name binding_core_node --js ./node-swc/src/binding.js --dts ./node-swc/src/binding.d.ts --cargo-cwd ./bindings --features swc_v1,plugin_bytecheck -p binding_core_node --cargo-flags=--no-default-features --release",
"test": "cross-env NODE_OPTIONS='--experimental-vm-modules' jest --config ./node-swc/jest.config.js",

@@ -97,4 +96,4 @@ "version": "napi version -p scripts/npm"

"@swc/core": "=1.2.220",
"@swc/helpers": "^0.4.2",
"@swc/plugin-jest": "1.5.25",
"@swc/helpers": "^0.5.0",
"@swc/plugin-jest": "1.5.59",
"@taplo/cli": "^0.3.2",

@@ -138,2 +137,10 @@ "@types/jest": "^28.1.4",

},
"peerDependencies": {
"@swc/helpers": "^0.5.0"
},
"peerDependenciesMeta": {
"@swc/helpers": {
"optional": true
}
},
"funding": {

@@ -144,12 +151,12 @@ "type": "opencollective",

"optionalDependencies": {
"@swc/core-win32-x64-msvc": "1.3.29",
"@swc/core-darwin-x64": "1.3.29",
"@swc/core-linux-x64-gnu": "1.3.29",
"@swc/core-linux-x64-musl": "1.3.29",
"@swc/core-win32-ia32-msvc": "1.3.29",
"@swc/core-linux-arm64-gnu": "1.3.29",
"@swc/core-linux-arm-gnueabihf": "1.3.29",
"@swc/core-darwin-arm64": "1.3.29",
"@swc/core-linux-arm64-musl": "1.3.29",
"@swc/core-win32-arm64-msvc": "1.3.29"
"@swc/core-win32-x64-msvc": "1.3.56",
"@swc/core-darwin-x64": "1.3.56",
"@swc/core-linux-x64-gnu": "1.3.56",
"@swc/core-linux-x64-musl": "1.3.56",
"@swc/core-win32-ia32-msvc": "1.3.56",
"@swc/core-linux-arm64-gnu": "1.3.56",
"@swc/core-linux-arm-gnueabihf": "1.3.56",
"@swc/core-darwin-arm64": "1.3.56",
"@swc/core-linux-arm64-musl": "1.3.56",
"@swc/core-win32-arm64-msvc": "1.3.56"
},

@@ -176,3 +183,3 @@ "files": [

],
"packageManager": "yarn@3.3.0"
"packageManager": "yarn@3.5.0"
}

@@ -13,4 +13,9 @@ <p align="center">

<a href="https://www.npmjs.com/package/@swc/core">
<img alt="npm Downloads" src="https://img.shields.io/npm/dm/@swc/helpers">
<img alt="downloads (@swc/core)" src="https://img.shields.io/npm/dm/@swc/core?label=downloads%20%28%40swc%2Fcore%29">
</a>
<a href="https://www.npmjs.com/package/@swc/helpers">
<img alt="downloads (3rd party)" src="https://img.shields.io/npm/dm/@swc/helpers?label=downloads%20%283rd%20party%29">
</a>
</p>
<p align="center">
<a href="https://crates.io/crates/swc_ecma_parser">

@@ -45,3 +50,3 @@ <img alt="undefined" src="https://img.shields.io/crates/d/swc_ecma_parser.svg?label=crates.io%20downloads">

MSRV of crates named `swc_ecma_*` is the current stable, and nightly for others.
MSRV of crates is currently nightly, but we will support stable rustc again in the future.

@@ -67,14 +72,5 @@ ---

<p align="center">
<a href="#backers">
<img alt="Backers on Open Collective" src="https://opencollective.com/swc/tiers/backer/badge.svg?label=backer&color=brightgreen" />
<a href="https://opencollective.com/swc">
<img src="https://raw.githubusercontent.com/swc-project/swc-sponsor-images/main/sponsors.svg" alt="Sponsors">
</a>
<a href="#gold-sponsors">
<img alt="Gold sponsors on Open Collective" src="https://opencollective.com/swc/tiers/gold-sponsors/badge.svg?label=Gold%20sponsors&color=brightgreen"/>
</a>
<a href="#silver-sponsors">
<img alt="Silver sponsors on Open Collective" src="https://opencollective.com/swc/tiers/silver-sponsors/badge.svg?label=Silver%20sponsors&color=brightgreen"/>
</a>
<a href="#bronze-sponsors">
<img alt="Bronze sponsors on Open Collective" src="https://opencollective.com/swc/tiers/bronze-sponsors/badge.svg?label=Bronze%20sponsors&color=brightgreen"/>
</a>
</p>

@@ -84,4 +80,4 @@

- Giving developer time on the project. (Message us on [Discord](https://discord.gg/GnHbXTdZz6) (preferred) or [Github discussions](https://github.com/swc-project/swc/discussions) for guidance!)
- Giving funds by becoming a sponsor (see https://opencollective.com/swc)!
- Giving developer time on the project. (Message us on [Discord](https://discord.gg/GnHbXTdZz6) (preferred) or [Github discussions](https://github.com/swc-project/swc/discussions) for guidance!)
- Giving funds by becoming a sponsor (see https://opencollective.com/swc)!

@@ -88,0 +84,0 @@ ## Contributing

import { Options } from "./types";
export type BundleInput = BundleOptions | BundleOptions[];
export declare const isLocalFile: RegExp;
export declare function compileBundleOptions(config: BundleInput | string | undefined): Promise<BundleInput>;

@@ -4,0 +5,0 @@ /**

@@ -35,4 +35,5 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
exports.config = exports.compileBundleOptions = void 0;
exports.config = exports.compileBundleOptions = exports.isLocalFile = void 0;
const path = __importStar(require("path"));
exports.isLocalFile = /^\.{0,2}\//; // starts with '/' './' '../'
function compileBundleOptions(config) {

@@ -42,4 +43,5 @@ return __awaiter(this, void 0, void 0, function* () {

try {
const file = typeof f === 'string' ? f : path.resolve('spack.config.js');
let configFromFile = require(file);
const filepath = typeof f === 'string' ? f : 'spack.config.js';
const fileModule = exports.isLocalFile.test(filepath) ? path.resolve(filepath) : filepath;
let configFromFile = require(fileModule);
if (configFromFile.default) {

@@ -46,0 +48,0 @@ configFromFile = configFromFile.default;

@@ -477,3 +477,3 @@ export interface Plugin {

}
export type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022";
export type JscTarget = "es3" | "es5" | "es2015" | "es2016" | "es2017" | "es2018" | "es2019" | "es2020" | "es2021" | "es2022" | "esnext";
export type ParserConfig = TsParserConfig | EsParserConfig;

@@ -618,2 +618,3 @@ export interface TsParserConfig {

* Use `Object.assign()` instead of `_extends`. Defaults to false.
* @deprecated
*/

@@ -767,7 +768,7 @@ useBuiltins?: boolean;

*
* function _interopRequireDefault(obj) {
* function _interop_require_default(obj) {
* return obj && obj.__esModule ? obj : { default: obj };
* }
*
* var _foo = _interopRequireDefault(require("foo"));
* var _foo = _interop_require_default(require("foo"));
* var _bar = require("bar");

@@ -812,3 +813,3 @@ *

* If you know that the imported file has been transformed with a compiler that stores the `default` export on
* `exports.default` (such as swc or Babel), you can safely omit the `_interopRequireDefault` helper.
* `exports.default` (such as swc or Babel), you can safely omit the `_interop_require_default` helper.
*

@@ -834,2 +835,10 @@ * ```javascript

/**
* Emits `cjs-module-lexer` annotation
* `cjs-module-lexer` is used in Node.js core for detecting the named exports available when importing a CJS module into ESM.
* swc will emit `cjs-module-lexer` detectable annotation with this option enabled.
*
* Defaults to `true` if import_interop is Node, else `false`
*/
exportInteropAnnotation?: boolean;
/**
* If set to true, dynamic imports will be preserved.

@@ -981,3 +990,3 @@ */

}
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;
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;
interface ExpressionBase extends Node, HasSpan {

@@ -1854,2 +1863,7 @@ }

}
export interface TsSatisfiesExpression extends ExpressionBase {
type: "TsSatisfiesExpression";
expression: Expression;
typeAnnotation: TsType;
}
export interface TsInstantiation extends Node, HasSpan {

@@ -1856,0 +1870,0 @@ type: "TsInstantiation";

@@ -1,2 +0,2 @@

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";
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";
export declare class Visitor {

@@ -130,2 +130,3 @@ visitProgram(n: Program): Program;

visitTsAsExpression(n: TsAsExpression): Expression;
visitTsSatisfiesExpression(n: TsSatisfiesExpression): Expression;
visitThisExpression(n: ThisExpression): Expression;

@@ -196,3 +197,3 @@ visitTemplateLiteral(n: TemplateLiteral): Expression;

visitImportDefaultSpecifier(node: ImportDefaultSpecifier): ImportSpecifier;
visitBindingIdentifier(i: Identifier): Identifier;
visitBindingIdentifier(i: BindingIdentifier): BindingIdentifier;
visitIdentifierReference(i: Identifier): Identifier;

@@ -199,0 +200,0 @@ visitLabelIdentifier(label: Identifier): Identifier;

@@ -816,2 +816,4 @@ "use strict";

return this.visitTsAsExpression(n);
case "TsSatisfiesExpression":
return this.visitTsSatisfiesExpression(n);
case "TsNonNullExpression":

@@ -907,2 +909,7 @@ return this.visitTsNonNullExpression(n);

}
visitTsSatisfiesExpression(n) {
n.expression = this.visitExpression(n.expression);
n.typeAnnotation = this.visitTsType(n.typeAnnotation);
return n;
}
visitThisExpression(n) {

@@ -1306,2 +1313,5 @@ return n;

visitBindingIdentifier(i) {
if (i.typeAnnotation) {
i.typeAnnotation = this.visitTsTypeAnnotation(i.typeAnnotation);
}
return this.visitIdentifier(i);

@@ -1308,0 +1318,0 @@ }

Sorry, the diff of this file is too big to display