Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions packages/jest/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# @swc/plugin-jest

The SWC implementation of `babel-jest`. This plugin transforms test files using SWC, enabling fast Jest-based testing without Babel. It replaces `babel-jest` as the transformer in Jest configurations and supports TypeScript, JSX, and modern JavaScript features.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Move these README edits into the template files

I checked scripts/bump-npm.sh:7-8, and every release regenerates each package README.md from its README.tmpl.md. Because this patch only updates the generated README files and leaves the templates untouched (for example packages/jest/README.tmpl.md:1-3 is still just the changelog placeholder), the new descriptions will be overwritten the next time maintainers run the bump script. The same problem applies to the other README.md-only edits in this commit.

Useful? React with 👍 / 👎.


## Usage

Install the plugin and configure Jest to use SWC as the transformer:

```sh
npm install --save-dev @swc/plugin-jest @swc/jest @swc/core
```

Then update your Jest configuration (e.g. `jest.config.js`):

```js
module.exports = {
transform: {
"^.+\\.(t|j)sx?$": "@swc/jest",
Comment on lines +15 to +18
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document how to enable the Jest wasm plugin

This example swaps Jest over to @swc/jest, but it never enables @swc/plugin-jest itself. The package only publishes a wasm artifact (packages/jest/package.json:9), and the in-repo test coverage loads it via jsc.experimental.plugins (packages/jest/__tests__/wasm.test.ts:12-23). If a user copies this snippet as-is, they install @swc/plugin-jest but still won't get the hoisting transform, so tests that depend on jest.mock() being hoisted will continue to fail.

Useful? React with 👍 / 👎.

},
};
```

# @swc/plugin-jest

## 12.7.0
Expand Down
2 changes: 2 additions & 0 deletions packages/loadable-components/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# loadable-components

SWC plugin for [`@loadable/component`](https://loadable-components.com/). It transforms dynamic imports inside loadable functions to add chunk names and enable server-side rendering (SSR) support for code-splitting. This is the SWC equivalent of [`babel-plugin-loadable-components`](https://github.com/gregberge/loadable-components/tree/main/packages/babel-plugin).

## Config

```json
Expand Down
14 changes: 14 additions & 0 deletions packages/noop/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
# @swc/plugin-noop

A no-operation (noop) SWC plugin that passes the AST through unchanged. Useful for debugging the SWC plugin infrastructure, measuring plugin overhead, or as a minimal starting template for new plugins.

## Usage

```json
{
"jsc": {
"experimental": {
"plugins": [["@swc/plugin-noop", {}]]
}
}
}
```

# @swc/plugin-noop

## 12.7.0
Expand Down
4 changes: 3 additions & 1 deletion packages/react-remove-properties/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# react-remove-properties
# @swc/plugin-react-remove-properties

Removes custom React properties (such as `data-testid`) from JSX elements at build time. This reduces bundle size and prevents test-only attributes from being shipped to production. By default it removes all `data-testid` attributes, but you can configure it to target any property using a regex pattern.

See https://nextjs.org/docs/architecture/nextjs-compiler#remove-react-properties for more information.

Expand Down
4 changes: 4 additions & 0 deletions packages/relay/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# @swc/plugin-relay

SWC plugin for [Relay](https://relay.dev/), Facebook's GraphQL client framework for React. It compiles `graphql` tagged template literals into Relay-compatible artifacts, replacing them with `require()` calls to the compiled query files. This is the SWC equivalent of [`babel-plugin-relay`](https://www.npmjs.com/package/babel-plugin-relay).

### `@swc/plugin-relay`

#### Setup
Expand Down
4 changes: 3 additions & 1 deletion packages/remove-console/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# remove-console
# @swc/plugin-remove-console

Removes `console.*` calls (e.g. `console.log`, `console.warn`, `console.error`) from JavaScript/TypeScript code at build time. This reduces bundle size and prevents debug output from being included in production builds. Specific console methods can be excluded from removal (e.g. keeping `console.error`).

See https://nextjs.org/docs/architecture/nextjs-compiler#remove-console for more information.

Expand Down
4 changes: 4 additions & 0 deletions packages/styled-components/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# @swc/plugin-styled-components

SWC plugin for [styled-components](https://styled-components.com/), a popular CSS-in-JS library. It adds display names for better debugging, server-side rendering (SSR) support via deterministic class names, and smaller bundles by removing unnecessary code in production. This is the SWC equivalent of [`babel-plugin-styled-components`](https://github.com/styled-components/babel-plugin-styled-components).

### `@swc/plugin-styled-components`

#### Setup
Expand Down
18 changes: 18 additions & 0 deletions packages/styled-jsx/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# @swc/plugin-styled-jsx

SWC plugin for [styled-jsx](https://github.com/vercel/styled-jsx), Vercel's CSS-in-JS solution. It transforms `<style jsx>` elements within JSX components into scoped CSS, allowing you to write component-level styles in plain CSS syntax that are automatically scoped to the component.

## Usage

```sh
npm install --save-dev @swc/plugin-styled-jsx @swc/core
Comment on lines +7 to +8
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add the styled-jsx runtime to the install example

The new usage block only installs @swc/plugin-styled-jsx and @swc/core, but the transform's own snapshots show that the output imports styled-jsx/style (packages/styled-jsx/__tests__/__snapshots__/wasm.test.ts.snap:3-5). In a project that does not already depend on styled-jsx, following these docs leads to a module-resolution failure at build/runtime, so the install command needs to mention the runtime package too.

Useful? React with 👍 / 👎.

```

```json
{
"jsc": {
"experimental": {
"plugins": [["@swc/plugin-styled-jsx", {}]]
}
}
}
```

# @swc/plugin-styled-jsx

## 13.7.0
Expand Down
2 changes: 2 additions & 0 deletions packages/swc-confidential/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @swc/plugin-swc-confidential

Encrypts confidential string literals at build time. Strings marked with the `/*#__CONFIDENTIAL__*/` comment annotation are replaced with AES-encrypted values, preventing sensitive data (such as feature flag names, API keys, or internal identifiers) from being exposed as plain text in the compiled bundle.

## Usage

.swcrc:
Expand Down
2 changes: 2 additions & 0 deletions packages/swc-magic/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @swc/plugin-swc-magic

SWC plugin for the [`@swc/magic`](https://www.npmjs.com/package/@swc/magic) package. It processes magic annotations in your code, such as `markAsPure`, which marks function calls as side-effect-free so the SWC minifier can safely tree-shake (remove) them when their result is unused.

## Usage

.swcrc:
Expand Down
4 changes: 3 additions & 1 deletion packages/swc-sdk/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# @swc/plugin-swc-sdk

# Usage
SWC plugin for the [`@swc/sdk`](https://www.npmjs.com/package/@swc/sdk) package. It provides build-time code transformations including `markAsPure` (marks function calls as pure/side-effect-free for tree-shaking) and `/*#__DYNAMIC__*/` annotations (converts static imports into dynamic imports for conditional lazy loading).

## Usage

.swcrc:

Expand Down
6 changes: 5 additions & 1 deletion packages/transform-imports/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
# transform-imports
# @swc/plugin-transform-imports

Transforms named module imports into direct imports from individual files, reducing bundle size by avoiding the import of entire libraries when only specific members are needed. This is the SWC equivalent of [`babel-plugin-transform-imports`](https://www.npmjs.com/package/babel-plugin-transform-imports).

For example, `import { Button } from 'react-bootstrap'` becomes `import Button from 'react-bootstrap/lib/Button'`.

## Config

Expand Down
Loading