Socket
Socket
Sign inDemoInstall

@swc/core-darwin-arm64

Package Overview
Dependencies
Maintainers
2
Versions
549
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@swc/core-darwin-arm64

Super-fast alternative for babel


Version published
Weekly downloads
1.9M
increased by6.37%
Maintainers
2
Weekly downloads
 
Created

What is @swc/core-darwin-arm64?

The @swc/core-darwin-arm64 npm package is a precompiled binary of SWC (Speedy Web Compiler) specifically for macOS on ARM64 architecture. SWC is a super-fast compiler written in Rust that compiles JavaScript/TypeScript down to efficient, optimized JavaScript code. It is designed to be used as a faster alternative to Babel and can perform tasks such as transpilation, minification, and bundling.

What are @swc/core-darwin-arm64's main functionalities?

Transpilation

Transpiles TypeScript or modern JavaScript to a specified ECMAScript target version. The code sample demonstrates how to transpile TypeScript code to ES5.

const { transformSync } = require('@swc/core-darwin-arm64');

const sourceCode = `const x: number = 1;`;
const output = transformSync(sourceCode, {
  filename: 'example.ts',
  jsc: {
    parser: {
      syntax: 'typescript',
    },
    target: 'es5',
  },
});

console.log(output.code);

Minification

Minifies JavaScript code to reduce file size by removing unnecessary characters and renaming variables. The code sample shows how to minify a simple function.

const { minifySync } = require('@swc/core-darwin-arm64');

const sourceCode = `function add(a, b) { return a + b; }`;
const minified = minifySync(sourceCode, {
  compress: true,
  mangle: true
});

console.log(minified.code);

Source Maps

Generates source maps to help with debugging by mapping the transformed code back to the original source code. The code sample demonstrates generating a source map for a file.

const { transformFileSync } = require('@swc/core-darwin-arm64');

const result = transformFileSync('input.js', {
  sourceMaps: true,
  filename: 'input.js',
  jsc: {
    target: 'es5'
  }
});

console.log(result.map);

Other packages similar to @swc/core-darwin-arm64

Keywords

FAQs

Package last updated on 02 Sep 2024

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc