Socket
Socket
Sign inDemoInstall

@swc/core

Package Overview
Dependencies
13
Maintainers
2
Versions
566
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @swc/core

Super-fast alternative for babel


Version published
Weekly downloads
6.4M
decreased by-0.26%
Maintainers
2
Install size
48.3 MB
Created
Weekly downloads
 

Package description

What is @swc/core?

The @swc/core package is a super-fast compiler written in Rust that allows for transforming ECMAScript 2015+ code into a backwards compatible version of JavaScript that can be run in older browsers or environments. It is designed to be highly performant and offers features such as transpilation, minification, and source maps generation.

What are @swc/core's main functionalities?

JavaScript/TypeScript Transpilation

Transpiles TypeScript or modern JavaScript to a specified ECMAScript target version. This example demonstrates transpiling TypeScript code to ES5.

require('@swc/core').transformSync('const x: number = 1;', { jsc: { parser: { syntax: 'typescript' }, target: 'es5' } });

Code Minification

Minifies JavaScript code to reduce file size, which is beneficial for production environments. This example shows how to minify a simple expression.

require('@swc/core').transformSync('const x = 1 + 2;', { minify: true });

Source Maps

Generates source maps for the transformed code, aiding in debugging by mapping the transformed code back to the original source code. This example demonstrates generating a source map for a file named 'input.js'.

require('@swc/core').transformFileSync('input.js', { sourceMaps: true });

Other packages similar to @swc/core

Changelog

Source

[1.5.0] - 2024-04-24

Bug Fixes

  • (es/minifier) Abort seq inline on recursive usage (#8887) (cd4548f)

Features

Readme

Source

swc

Make the web (development) faster.

downloads (@swc/core) downloads (3rd party)

undefined GitHub release (latest SemVer)

GitHub code size in bytes node-current (scoped)

Discord

SWC (stands for Speedy Web Compiler) is a super-fast TypeScript / JavaScript compiler written in Rust. It's a library for Rust and JavaScript at the same time. If you are using SWC from Rust, see rustdoc and for most users, your entry point for using the library will be parser.

Also, SWC tries to ensure that

If you select the latest version of each crates, it will work

for rust users.

MSRV of crates is currently 1.71.

To update all SWC crates you use, you can run curl https://raw.githubusercontent.com/swc-project/swc/main/scripts/update-all-swc-crates.sh | bash -s. This script will update all dependencies to the latest version and run cargo build to ensure that everything works. Note that you need

  • jq
  • cargo upgrade

command to run the script.


If you are using SWC from JavaScript, please refer to docs on the website.

Documentation

Check out the documentation in the website.

Features

Please see comparison with babel.

Performance

Please see benchmark results on the website.

Supporting swc

Sponsors

SWC is a community-driven project, and is maintained by a group of volunteers. If you'd like to help support the future of the project, please consider:

Contributing

See CONTRIBUTING.md. You may also find the architecture documentation useful (ARCHITECTURE.md).

License

SWC is primarily distributed under the terms of the Apache License (Version 2.0).

See LICENSE for details.

Keywords

FAQs

Last updated on 24 Apr 2024

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc