@vitejs/plugin-react-swc
Advanced tools
Comparing version 3.0.1 to 3.1.0-beta.2
@@ -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; |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
Debug access
Supply chain riskUses debug, reflection and dynamic code execution features.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28717
741
76
2
5
1
+ Added@swc/core@1.7.23(transitive)
+ Added@swc/core-darwin-arm64@1.7.23(transitive)
+ Added@swc/core-darwin-x64@1.7.23(transitive)
+ Added@swc/core-linux-arm-gnueabihf@1.7.23(transitive)
+ Added@swc/core-linux-arm64-gnu@1.7.23(transitive)
+ Added@swc/core-linux-arm64-musl@1.7.23(transitive)
+ Added@swc/core-linux-x64-gnu@1.7.23(transitive)
+ Added@swc/core-linux-x64-musl@1.7.23(transitive)
+ Added@swc/core-win32-arm64-msvc@1.7.23(transitive)
+ Added@swc/core-win32-ia32-msvc@1.7.23(transitive)
+ Added@swc/core-win32-x64-msvc@1.7.23(transitive)
- Removed@swc/core@1.7.24(transitive)
- Removed@swc/core-darwin-arm64@1.7.24(transitive)
- Removed@swc/core-darwin-x64@1.7.24(transitive)
- Removed@swc/core-linux-arm-gnueabihf@1.7.24(transitive)
- Removed@swc/core-linux-arm64-gnu@1.7.24(transitive)
- Removed@swc/core-linux-arm64-musl@1.7.24(transitive)
- Removed@swc/core-linux-x64-gnu@1.7.24(transitive)
- Removed@swc/core-linux-x64-musl@1.7.24(transitive)
- Removed@swc/core-win32-arm64-msvc@1.7.24(transitive)
- Removed@swc/core-win32-ia32-msvc@1.7.24(transitive)
- Removed@swc/core-win32-x64-msvc@1.7.24(transitive)
Updated@swc/core@^1.3.26