Socket
Socket
Sign inDemoInstall

@vitejs/plugin-react-swc

Package Overview
Dependencies
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@vitejs/plugin-react-swc - npm Package Compare versions

Comparing version 3.0.1 to 3.1.0-beta.2

12

index.d.ts

@@ -8,4 +8,14 @@ import { PluginOption } from "vite";

jsxImportSource?: string;
/**
* Enable TypeScript decorators. Requires experimentalDecorators in tsconfig.
* @default false
*/
tsDecorators?: boolean;
/**
* Use SWC plugins. Enable SWC at build time.
* @default undefined
*/
plugins?: [string, Record<string, any>][];
};
declare const react: (options?: Options) => PluginOption[];
declare const react: (_options?: Options) => PluginOption[];
export default react;

4

package.json
{
"name": "@vitejs/plugin-react-swc",
"description": "Speed up your Vite dev server with SWC",
"version": "3.0.1",
"version": "3.1.0-beta.2",
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",

@@ -30,4 +30,4 @@ "license": "MIT",

"dependencies": {
"@swc/core": "^1.3.22"
"@swc/core": "^1.3.26"
}
}

@@ -27,3 +27,3 @@ # @vitejs/plugin-react-swc [![npm](https://img.shields.io/npm/v/@vitejs/plugin-react-swc)](https://www.npmjs.com/package/@vitejs/plugin-react-swc)

This plugin is only used in development and aims to be kept simple to enable good performances and be transpiler agnostic. Here is the list of non-configurable options that impact runtime behaviour:
This plugin has limited options to enable good performances and be transpiler agnostic. Here is the list of non-configurable options that impact runtime behaviour:

@@ -38,15 +38,28 @@ - [useDefineForClassFields](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#the-usedefineforclassfields-flag-and-the-declare-property-modifier) is always activated, as this matches the current ECMAScript spec

## Changing the JSX import source
## Options
You can use the jsxImportSource option like this:
### jsxImportSource
Control where the JSX factory is imported from.
```ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react-swc";
react({ jsxImportSource: "@emotion/react" });
```
export default defineConfig({
plugins: [react({ jsxImportSource: "@emotion/react" })],
});
### tsDecorators
Enable TypeScript decorators. Requires `experimentalDecorators` in tsconfig.
```ts
react({ tsDecorators: true });
```
## plugins
Use SWC plugins. Enable SWC at build time.
```ts
react({ plugins: [["@swc/plugin-styled-components", {}]] });
```
## Consistent components exports

@@ -53,0 +66,0 @@

@@ -114,3 +114,5 @@ /*! Copyright (c) Meta Platforms, Inc. and affiliates. **/

updatedFamilies,
// Families that will re-render preserving state
staleFamilies
// Families that will be remounted
};

@@ -379,2 +381,12 @@ helpersByRendererID.forEach(function(helpers) {

}
function registerExportsForReactRefresh(filename, moduleExports) {
for (const key in moduleExports) {
if (key === "__esModule")
continue;
const exportValue = moduleExports[key];
if (isLikelyComponentType(exportValue)) {
register(exportValue, filename + " " + key);
}
}
}
function validateRefreshBoundaryAndEnqueueUpdate(prevExports, nextExports) {

@@ -414,8 +426,3 @@ if (!predicateOnExport(prevExports, (key) => !!nextExports[key])) {

}
var refresh_runtime_default = {
getRefreshReg,
injectIntoGlobalHook,
createSignatureFunctionForTransform,
validateRefreshBoundaryAndEnqueueUpdate
};
var refresh_runtime_default = { injectIntoGlobalHook };
export {

@@ -426,3 +433,4 @@ createSignatureFunctionForTransform,

injectIntoGlobalHook,
registerExportsForReactRefresh,
validateRefreshBoundaryAndEnqueueUpdate
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc