> ## Documentation Index
> Fetch the complete documentation index at: https://site.aspect.build/llms.txt
> Use this file to discover all available pages before exploring further.

# @aspect_rules_swc//swc:toolchain.bzl

> Bazel rules_swc Starlark toolchain rule swc_toolchain that exposes the SWC compiler binary to Bazel for JavaScript and TypeScript transpilation.

<Callout icon="book">
  Documentation for [@aspect\_rules\_swc@v2.6.1](https://registry.bazel.build/modules/aspect_rules_swc/2.6.1) -- <Icon icon="github" iconType="brands" /> [View source](https://github.com/aspect-build/rules_swc/blob/v2.6.1/swc/toolchain.bzl)
</Callout>

This module implements the language-specific toolchain rule.

## Rule: `swc_toolchain`

Defines a swc compiler/runtime toolchain.

For usage see [https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains](https://docs.bazel.build/versions/main/toolchains.html#defining-toolchains).

### Attributes

<ParamField body="name" type="name" required>
  A unique name for this target.
</ParamField>

<ParamField body="target_tool" type="label" default={`None`}>
  A hermetically downloaded 'swcx' cli for the target platform.
</ParamField>

<ParamField body="target_tool_path" type="string" default={`""`}>
  Path to an existing 'swcx' cli for the target platform.
</ParamField>

## Provider: `SwcInfo`

Information about how to invoke the tool executable.

### Fields

<ResponseField name="swc_binary">
  Path to the rust-native 'swcx' cli for the target platform.
</ResponseField>

<ResponseField name="tool_files">
  Files required in runfiles to make the tool executable available.

  May be empty if the target\_tool\_path points to a locally installed tool binary.
</ResponseField>
