Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@swc/core-darwin-x64
Advanced tools
@swc/core-darwin-x64 is a precompiled binary of the SWC (Speedy Web Compiler) core for macOS on x64 architectures. SWC is a super-fast compiler written in Rust that can be used to transpile JavaScript and TypeScript code to a lower version of JavaScript, enabling compatibility with older browsers or environments. It can also minify code and handle JSX for React applications.
JavaScript/TypeScript Transpilation
This feature allows you to transpile TypeScript or modern JavaScript to a compatible version for older browsers or environments. The code sample demonstrates how to transpile TypeScript code to ES5.
const swc = require('@swc/core-darwin-x64');
swc.transformSync('const x: number = 123;', {
filename: 'input.ts',
jsc: {
parser: {
syntax: 'typescript',
},
target: 'es5',
}
});
Code Minification
This feature enables the minification of JavaScript code to reduce file size, which is beneficial for production environments. The code sample shows how to minify a simple JavaScript expression.
const swc = require('@swc/core-darwin-x64');
swc.transformSync('const x = 1 + 2;', {
minify: true
});
JSX Handling
This feature is used to transform JSX syntax into JavaScript code that can be understood by browsers or other environments. The code sample demonstrates how to handle JSX for a React application.
const swc = require('@swc/core-darwin-x64');
swc.transformSync('<div>Hello, SWC!</div>', {
jsc: {
parser: {
syntax: 'ecmascript',
jsx: true
},
transform: {
react: {
pragma: 'React.createElement',
pragmaFrag: 'React.Fragment',
throwIfNamespace: true,
development: false,
useBuiltins: false
}
}
}
});
Babel is a widely-used JavaScript compiler that allows you to use next-generation JavaScript, today. It can transpile ES6 and beyond into backwards compatible JavaScript and handle JSX for React applications. Babel is plugin-based and has a larger ecosystem, but it is generally slower than SWC.
The TypeScript compiler is used to transpile TypeScript code to JavaScript. It provides type checking and the latest ECMAScript features. While TypeScript is powerful for type checking, it is not as fast as SWC for transpilation and does not include minification.
UglifyJS is a JavaScript minifier that can parse, minify, and compress JavaScript files. It is focused on minification and does not handle transpilation or JSX transformation, making it less versatile than SWC but still useful for reducing the size of JavaScript files.
Esbuild is an extremely fast JavaScript bundler and minifier. It can also transpile JavaScript and TypeScript code. Esbuild is known for its speed, which rivals that of SWC, and it has a simple API. However, it does not have as extensive a plugin ecosystem as Babel.
@swc/core-darwin-x64
This is the x86_64-apple-darwin binary for @swc/core
[1.9.3] - 2024-11-22
(@swc/types) Tsc build file ignored by npm (#9754) (14a5c1e)
(es) Source map super(...args)
calls in injected constructors (#9745) (35b0ca0)
(es/plugin) Migrate swc plugin new
to use .cargo/config.toml
(#9740) (4ffb21e)
(es/resolver) Ignore VarDecl
with declare: true
(#9734) (aa0f784)
FAQs
Super-fast alternative for babel
The npm package @swc/core-darwin-x64 receives a total of 1,701,490 weekly downloads. As such, @swc/core-darwin-x64 popularity was classified as popular.
We found that @swc/core-darwin-x64 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.