vite-plugin-swc-react-refresh
Advanced tools
+1
-1
| { | ||
| "name": "vite-plugin-swc-react-refresh", | ||
| "description": "Use the versatility of swc for development and the maturity of esbuild for production", | ||
| "version": "2.0.3", | ||
| "version": "2.1.0", | ||
| "license": "MIT", | ||
@@ -6,0 +6,0 @@ "author": "Arnaud Barré (https://github.com/ArnaudBarre)", |
@@ -49,2 +49,3 @@ "use strict"; | ||
| configFile: false, | ||
| sourceMaps: true, | ||
| jsc: { | ||
@@ -63,2 +64,3 @@ target: "es2020", | ||
| }); | ||
| let mappingPrefix = ""; | ||
| if (!automaticRuntime && | ||
@@ -68,6 +70,7 @@ result.code.includes("React.createElement") && | ||
| result.code = `import React from "react";\n${result.code}`; | ||
| mappingPrefix += ";"; | ||
| } | ||
| if (!result.code.includes("$RefreshReg$")) | ||
| return result; | ||
| const header = `import * as RefreshRuntime from "${runtimePublicPath}"; | ||
| if (result.code.includes("$RefreshReg$")) { | ||
| mappingPrefix += ";;;;;;;;;;;;"; | ||
| result.code = `import * as RefreshRuntime from "${runtimePublicPath}"; | ||
@@ -83,11 +86,18 @@ let prevRefreshReg; | ||
| window.$RefreshSig$ = RefreshRuntime.createSignatureFunctionForTransform; | ||
| `; | ||
| const footer = ` | ||
| ${result.code} | ||
| window.$RefreshReg$ = prevRefreshReg; | ||
| window.$RefreshSig$ = prevRefreshSig; | ||
| import.meta.hot.accept(); | ||
| RefreshRuntime.enqueueUpdate();`; | ||
| return { code: `${header}${result.code}${footer}`, map: result.map }; | ||
| RefreshRuntime.enqueueUpdate(); | ||
| `; | ||
| } | ||
| if (!mappingPrefix) | ||
| return result; | ||
| const sourceMap = JSON.parse(result.map); | ||
| sourceMap.mappings = mappingPrefix + sourceMap.mappings; | ||
| return { code: result.code, map: sourceMap }; | ||
| }, | ||
| }); | ||
| exports.swcReactRefresh = swcReactRefresh; |
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
24571
1.09%562
1.44%