open-index/open-npm huggingface dataset:
npm package: @swc/next-minifier-backport
Description: Backport SWC Minifier without the need to upgrade Next.js
Author: 강동윤
Latest version: 0.1.0

# @swc/next-minifier-backport

You can install `@swc/next-minifier-backport`, and set the environment variable `NEXT_SWC_MINIFY_BACKPORT` while running `next build`.

```bash
npm install @swc/next-minifier-backport
```

```bash

NEXT_SWC_MINIFY_BACKPORT=true next build
```
npm package: @swc/plugin-constify
Description: SWC plugin for optimization
Author: 강동윤
Latest version: 0.1.44

# `@swc/constify`

This plugin can be used to hoist constant parts of any expressions as constant variables, without affecting the runtime behavior or readability of the code.

## Why?

There are lots of cases where some parts of expressions are constant and thus can be reused, but others are not.

## Configuration

This plugin can be configured with `.swcrc`

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

## Usage

Basically, this plugins is about extracting some parts of expressions.

```ts
import { constify, lazyConst } from "@swc/constify";

export function call(dynamic) {
  const options = [
    constify({
      code: 1,
      onClick() {},
    }),
    {
      code: 2,
      onClick() {
        console.log(dynamic);
      },
    },
    lazyConst({
      code: 3,
      onClick() {},
    }),
  ];

  return options;
}
```

becomes

```ts
const __CONST_0__ = {
  code: 1,
  onClick() {},
};
function __CONST_1__() {
  const __data__ = {
    code: 3,
    onClick() {},
  };
  return (__CONST_1__ = function () {
    return __data__;
  })();
}

export function call(dynamic) {
  const options = [
    __CONST_0__,
    {
      code: 2,
      onClick() {
        console.log(dynamic);
      },
    },
    __CONST_1__(),
  ];

  return options;
}
```

Note that this plugin supports using non-top-level variables. Those are hoisted to uppermost scope with the all used variable in the scope.
In other words, you can write code like

```ts
import { constify, lazyConst } from "@swc/constify";

export function call(d1) {
  function a(d2) {
    function a1() {
      return [
        constify({
          code: d1,
          onClick() {},
        }),
        constify({
          code: d2,
          onClick() {
            console.log(d2);
          },
        }),
        lazyConst({
          code: d1,
          onClick() {},
        }),
      ];
    }

    return a1;
  }

  return a;
}
```

and it will be compiled as

```ts
export function call(d1) {
  const __CONST_0__ = {
    code: d1,
    onClick() {},
  };

  function __CONST_2__() {
    const __data__ = {
      code: d1,
      onClick() {},
    };
    return (__CONST_2__ = function () {
      return __data__;
    })();
  }

  function a(d2) {
    const __CONST_1__ = {
      code: d2,
      onClick() {
        console.log(d2);
      },
    };

    function a1() {
      return [__CONST_0__, __CONST_1__, __CONST_2__()];
    }

    return a1;
  }

  return a;
}
```

# @swc/plugin-constify

## 0.1.44

### Patch Changes

- 4ef0b7f: Add changelog to the readme

## 0.1.43

### Patch Changes

- 4e72680: swc_core@0.88.0

## 0.1.42

### Patch Changes

- 16bb4d8: swc_core@0.82.x
npm package: @swc/plugin-emotion
Description: SWC plugin for emotion css-in-js library
Author: 강동윤
Latest version: 14.8.0

# emotion

The official plugin for emotion css-in-js library.

## Configuration

The plugin uses the same config as described in [Next emotion documentation](https://nextjs.org/docs/advanced-features/compiler#emotion).

```js
{
  jsc: {
    ...
   experimental: {
     plugins: [ ['@swc/plugin-emotion', {
      // default is true. It will be disabled when build type is production.
      sourceMap?: boolean,
      // default is 'dev-only'.
      autoLabel?: 'never' | 'dev-only' | 'always',
      // default is '[local]'.
      // Allowed values: `[local]` `[filename]` and `[dirname]`
      // This option only works when autoLabel is set to 'dev-only' or 'always'.
      // It allows you to define the format of the resulting label.
      // The format is defined via string where variable parts are enclosed in square brackets [].
      // For example labelFormat: "my-classname--[local]", where [local] will be replaced with the name of the variable the result is assigned to.
      labelFormat?: string,
    }] ]
   }
}
```

## Credit

Source code for plugin itself (not transforms) are copied from https://github.com/IvanRodriCalleja/emotion-swc-plugin

${CHANGELOG}
npm package: @swc/plugin-formatjs
Description: FormatJS SWC plugin
Author: 강동윤
Latest version: 9.8.0

# @swc/plugin-formatjs

FormatJS SWC plugin, maintained by SWC team.

## Usage

The default message descriptors for the app's default language will be processed from: `defineMessages()`, `defineMessage()`, `intl.formatMessage` and `<FormattedMessage>`; all of which are named exports of the React Intl package.

### Next.js

```tsx
import { NextConfig } from 'next';

const nextConfig: NextConfig = {
  experimental: {
    swcPlugins: [
      [
        require.resolve('@swc/plugin-formatjs'),
        {
          idInterpolationPattern: '[md5:contenthash:hex:10]',
          additionalComponentNames: ['F'],
          ast: true,
        },
      ],
    ],
  }
}
```

### Vite
```tsx
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'

export default defineConfig((env) => ({
  plugins: [
    react({
      tsDecorators: true,
      plugins: [
        [
          '@swc/plugin-formatjs',
          {
            idInterpolationPattern: '[md5:contenthash:hex:10]',
            additionalComponentNames: ['F'],
            ast: true,
          },
        ],
      ],
    }),
  ]
}))
```

## Options

### **`idInterpolationPattern`**

A template string that allows you to override the ID both in the extracted javascript and messages. It's used only if the message ID is empty.

### **`removeDefaultMessage`**

Remove `defaultMessage` field in generated js after extraction.

### **`extractSourceLocation`**

Whether the metadata about the location of the message in the source file should be extracted. If `true`, then `file`, `start`, and `end` fields will exist for each extracted message descriptors. Defaults to `false`.

### **`additionalComponentNames`**

Additional component names to extract messages from, e.g: `['FormattedFooBarMessage']`. **NOTE**: By default we check for the fact that `FormattedMessage` are imported from `moduleSourceName` to make sure variable alias works. This option does not do that so it's less safe.

### **`additionalFunctionNames`**

Additional function names to extract messages from, e.g: `['$formatMessage']`. Use this if you prefer to alias `formatMessage` to something shorter like `$t`.

### **`ast`**

Pre-parse `defaultMessage` into AST for faster runtime perf. This flag doesn't do anything when `removeDefaultMessage` is `true`.

### **`preserveWhitespace`**

Whether to preserve whitespace and newlines.

### **`pragma`**

A string that allows you to extract metadata from comments in your source files. When set, the plugin will look for comments containing the pragma string and parse key:value pairs that follow it.

For example, with `pragma: "@formatjs"`, a comment like:

```js
// @formatjs project:web locale:en region:us
```

Will extract the metadata: `{project: "web", locale: "en", region: "us"}` that gets included with the extracted messages. This is useful for adding contextual information to your message extractions.

${CHANGELOG}
npm package: @swc/plugin-jest
Description: SWC plugin for jest
Author: 강동윤
Latest version: 12.8.0

# @swc/plugin-jest

`@swc/plugin-jest` is an SWC transform that hoists Jest calls such as `jest.mock`, `jest.unmock`, and `jest.enableAutomock` in the same spirit as Jest's Babel hoist behavior.

${CHANGELOG}
npm package: @swc/plugin-loadable-components
Description: SWC plugin for `@loadable/components`
Author: 강동윤
Latest version: 11.8.0

# loadable-components

`@swc/plugin-loadable-components` transforms `@loadable/component` dynamic imports to support server-side rendering (SSR) and code splitting. It is the SWC equivalent of the `@loadable/babel-plugin` and enables the full `@loadable/component` SSR workflow when using SWC as your compiler.

## Config

```json
["loadable-components", {}]
```

Sometimes you need to wrap loadable with your own custom logic. There are many use cases for it, from injecting telemetry to hiding external libraries behind facade.
By default `loadable-components` are configured to transform dynamic imports used only inside loadable helpers, but can be configured to instrument any other function of your choice.

### Custom signatures with specific package sources

```json
["loadable-components", { "signatures": [
    {
        "from": "myLoadableWrapper",
        "name": "default"
    },
    {
        "from": "myLoadableWrapper",
        "name": "lazy"
    }]
}]
```

### Custom signatures without package source (matches any import)

To match any import with a specific name regardless of the source package (useful for vendored or aliased packages), omit the `from` field:

```json
["loadable-components", { "signatures": [
    {
        "name": "loadable"
    }]
}]
```

This will transform any default import named `loadable`, regardless of where it's imported from:
```js
import loadable from 'my-vendored-loadable';  // will be transformed
import loadable from '@loadable/component';   // will be transformed
```

${CHANGELOG}
npm package: @swc/plugin-noop
Description: Noop SWC plugin, for debugging
Author: 강동윤
Latest version: 12.8.0

# @swc/plugin-noop

`@swc/plugin-noop` is a no-operation SWC plugin that passes code through without any transformation. It is useful for testing the SWC plugin system, benchmarking plugin infrastructure overhead, and as a template for building new plugins.

${CHANGELOG}
npm package: @swc/plugin-prefresh
Description: SWC plugin for preact refresh
Author: 강동윤
Latest version: 12.8.0

# @swc/plugin-prefresh

The SWC implementation of the [prefresh babel plugin](https://github.com/preactjs/prefresh/tree/main/packages/babel).

## Usage

Prefresh babel plugin is a forked equivalent of the react-refresh babel plugin difference being that we need a way to memoize createContext between HMR.

And SWC has built-in React Refresh transformation, therefore, this plugin only implements the `createContext` processing part and need to be used with `jsc.transform.react.refresh`.

.swcrc:

```json
{
  "jsc": {
    "experimental": {
      "plugins": [
        [
          // enable prefresh specific transformation
          "@swc/plugin-prefresh",
          {
            // the customizable preact name, default is `["preact", "preact/compat", "react"]`
            "library": ["preact-like-framework"]
          }
        ]
      ]
    },
    "parser": {
      "jsx": true
    },
    "transform": {
      "react": {
        "development": true,
        "refresh": true, // enable react refresh transformation
      }
    }
  }
}
```

${CHANGELOG}
npm package: @swc/plugin-react-remove-properties
Description: SWC plugin for https://www.npmjs.com/package/babel-plugin-react-remove-properties
Author: 강동윤
Latest version: 12.8.0

# react-remove-properties

`@swc/plugin-react-remove-properties` removes React component properties (such as `data-testid`) from your production builds. This is useful for stripping test-only attributes that you don't want shipped to end users. See https://nextjs.org/docs/architecture/nextjs-compiler#remove-react-properties for more information.

## Config

```json
["react-remove-properties"]
```

or

```json
[
  "react-remove-properties",
  {
    // The regexes defined here are processed in Rust so the syntax is different from
    // JavaScript `RegExp`s. See https://docs.rs/regex.
    "properties": ["^data-custom$"]
  }
]
```

${CHANGELOG}
npm package: @swc/plugin-relay
Description: SWC plugin for relay
Author: 강동윤
Latest version: 12.8.0

### `@swc/plugin-relay`

`@swc/plugin-relay` compiles Relay GraphQL `graphql` tagged template literals into the corresponding Relay-generated artifact imports. It is the SWC equivalent of `babel-plugin-relay`, enabling projects that use the Relay framework to leverage SWC for faster compilation.

#### Setup

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

### Example

The below shows how to configure `@swc/plugin-relay` and pass the options to Webpack:

Create an `.swcrc.js` file like the below:

```js
// .swcrc.js

module.exports = {
  jsc: {
    experimental: {
      plugins: [
        [
          "@swc/plugin-relay",
          {
            rootDir: __dirname,
            artifactDirectory: "src/__generated__",
            language: "typescript",
            eagerEsModules: true,
          },
        ],
        // Or if you want to use multiple projects
        [
          "@swc/plugin-relay",
          {
            projects: [
              {
                rootDir: path.resolve(__dirname, '../project1'),
              },
              {
                rootDir: path.resolve(__dirname, '../project2'),
              }
            ],
            language: "typescript",
            eagerEsModules: true,
          },
        ],
      ],
    },
    parser: {
      syntax: "typescript",
      tsx: true,
    },
    transform: {
      react: {
        runtime: "automatic",
      },
    },
  },
};
```

And then update your `swc-loader` Webpack config:

```js
const swcConfig = require("./.swcrc.js")

// ...

{
  include: path.resolve("./src"),
  test: /\.ts$/,
  use: [
    {
      loader: "swc-loader",
      options: swcConfig,
    },
  ],
}
```

> Note: We're using a `.swcrc.js` file extension up above and importing the config directly because Relay needs access to `__dirname`, which can't be derived from the default JSON parsed from `.swcrc`.

#### Output import paths

By default, `@swc/plugin-relay` will transpile import paths based on the `language` option.
You can use `outputFileExtension` to change the file extension of the generated import paths.

```js
plugins: [
    [
        "@swc/plugin-relay",
        {
            rootDir: __dirname,
            artifactDirectory: "src/__generated__",
            language: "typescript",
            eagerEsModules: true,
            outputFileExtension: "js",
        },
    ],
],
```

In this example typescript graphql files will output transpiled import path of `javascript` ending with `.js`.

${CHANGELOG}
npm package: @swc/plugin-remove-console
Description: SWC plugin for https://www.npmjs.com/package/babel-plugin-remove-console
Author: 강동윤
Latest version: 12.8.0

# remove-console

`@swc/plugin-remove-console` strips `console.*` calls from your production builds, helping to reduce bundle size and avoid leaking debug information to end users. You can optionally exclude specific console methods (e.g. `console.error`) from removal. See https://nextjs.org/docs/architecture/nextjs-compiler#remove-console for more information.

## Config

```json
["@swc/plugin-remove-console"]
```

or

```json
[
  "@swc/plugin-remove-console",
  {
    "exclude": ["error"]
  }
]
```

${CHANGELOG}
npm package: @swc/plugin-styled-components
Description: SWC plugin for styled-components
Author: 강동윤
Latest version: 12.8.0

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

`@swc/plugin-styled-components` is the SWC equivalent of `babel-plugin-styled-components`. It adds display names to styled-components for better debugging, generates deterministic class names for server-side rendering (SSR), and enables other optimizations provided by the styled-components Babel plugin.

#### Setup

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

Then update your `.swcrc` file like below:

```json
{
  "jsc": {
    "experimental": {
      "plugins": [
        [
          "@swc/plugin-styled-components",
          {
            "displayName": true,
            "ssr": true
          }
        ]
      ]
    }
  }
}
```

${CHANGELOG}
npm package: @swc/plugin-styled-jsx
Description: SWC plugin for styled-jsx
Author: 강동윤
Latest version: 13.8.0

# @swc/plugin-styled-jsx

`@swc/plugin-styled-jsx` transforms `<style jsx>` tags in JSX components into scoped CSS, providing component-level style isolation. It is the SWC equivalent of the `styled-jsx` Babel plugin used by Next.js.

${CHANGELOG}
npm package: @swc/plugin-swc-confidential
Description: SWC plugin for swc-confidential
Author: 강동윤
Latest version: 11.8.0

# @swc/plugin-swc-confidential

`@swc/plugin-swc-confidential` encrypts string literals marked with the `/*#__CONFIDENTIAL__*/` comment using AES encryption at build time. This lets you ship sensitive strings (such as feature flag names or identifiers) in an obfuscated form so they are not trivially readable in your production bundle.

## Usage

.swcrc:

```json
{
  "jsc": {
    "experimental": {
      "plugins": ["@swc/plugin-swc-confidential", {
        // Possible values:
        //
        // AES-128
        // AES-192
        // AES-256
        algorithm: "AES-256",
        encryptionKey: process.env.FLAGS_SECRET,
        prefix: "secure:"
      }]
    }
  }
}
```

### Input

```js
console.log(/*#__CONFIDENTIAL__*/ "newDashboard")
```

### Output



```js
console.log("secure:de454774988d624b8f317bbe9dadfe1f");
```
npm package: @swc/plugin-swc-magic
Description: SWC plugin for swc-magic
Author: 강동윤
Latest version: 12.8.0

# @swc/plugin-swc-magic

`@swc/plugin-swc-magic` processes magic annotations from the `@swc/magic` package, such as `markAsPure`, which annotates expressions so the SWC minifier can eliminate them as dead code during tree-shaking.

## Usage

.swcrc:

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

### `markAsPure`

```js
import { markAsPure } from "@swc/magic";

markAsPure(() => console.log("This will be removed by the SWC minifier"));
```

${CHANGELOG}
npm package: @swc/plugin-swc-sdk
Description: SWC plugin for swc-sdk
Author: 강동윤
Latest version: 12.8.0

# @swc/plugin-swc-sdk

`@swc/plugin-swc-sdk` provides build-time transformations for the `@swc/sdk` package. It supports converting static imports annotated with `/*#__DYNAMIC__*/` into dynamic imports, and applies configured SDK feature-flag transforms.

# Usage

.swcrc:

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

## `/*#__DYNAMIC__*/` on imports

You can annotate on a normal import statement to make it dynamic import.

### Input

```js
/*#__DYNAMIC__*/
import { log } from "./logger";

export async function work() {
  if (process.env.NODE_ENV !== "production") {
    await log("Starting work");
  }

  if (process.env.NODE_ENV !== "production") {
    log("Without await");
  }
}

export function sync() {
  if (process.env.NODE_ENV !== "production") {
    log("Without async");
  }
}
```

### Output

```js
export function work() {
  if (process.env.NODE_ENV !== "production") {
    await import('./logger').then(m => m.log("Starting work"))
  }

  if (process.env.NODE_ENV !== "production") {
    import('./logger').then(m => m.log("Without await"))
  }
}

export function sync() {
  if (process.env.NODE_ENV !== "production") {
    import('./logger').then(m => m.log("Without async"))
  }
}
```

${CHANGELOG}
npm package: @swc/plugin-transform-imports
Description: SWC plugin for https://www.npmjs.com/package/babel-plugin-transform-imports
Author: 강동윤
Latest version: 12.8.0

# transform-imports

`@swc/plugin-transform-imports` rewrites named imports into direct, member-level imports to reduce bundle size. For example, `import { Button } from 'react-bootstrap'` becomes `import Button from 'react-bootstrap/lib/Button'`, which allows bundlers to include only the specific module rather than the entire library.

## Config

```json
[
  "transform-imports",
  {
    "react-bootstrap": {
      "transform": "react-bootstrap/lib/{{member}}"
    },
    "lodash": {
      "transform": "lodash/{{member}}"
    }
  }
]
```

${CHANGELOG}
npm package: @swc/types
Description: Typings for the swc project.
Author: 강동윤
Latest version: 0.1.26

# @swc/types

Typings for `@swc/core` APIs. This is a separate package because SWC is used by various tools but not all of them want to depend on `@swc/core`.
This package is very cheap, so feel free to depend on this.
npm package: @swc/wasm-typescript
Description: wasm module for swc
Latest version: 1.15.24

# @swc/wasm-typescript

This package provides a Wasm binding for the TypeScript transform.

The supported TypeScript version is currently 5.5.4, except the stage 3 decorator proposal.

## Contributing

See [the main repository](https://github.com/swc-project/swc)'s contributing guide.

## License

Apache 2.0
npm package: @swc/wasm-typescript-esm
Description: wasm module for swc
Latest version: 1.15.24

# @swc/wasm-typescript

This package provides a Wasm binding for the TypeScript transform.

The supported TypeScript version is currently 5.5.4, except the stage 3 decorator proposal.

## Contributing

See [the main repository](https://github.com/swc-project/swc)'s contributing guide.

## License

Apache 2.0