@vitejs/plugin-react-swc 4.2.3 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +1 -1
  2. package/index.js +3 -8
  3. package/package.json +3 -3
package/README.md CHANGED
@@ -163,4 +163,4 @@ For React refresh to work correctly, your file should only export React componen
163
163
 
164
164
  If an incompatible change in exports is found, the module will be invalidated and HMR will propagate. To make it easier to export simple constants alongside your component, the module is only invalidated when their value changes.
165
165
 
166
- You can catch mistakes and get more detailed warning with this [eslint rule](https://github.com/ArnaudBarre/eslint-plugin-react-refresh).
166
+ You can catch mistakes and get more detailed warnings with this [ESLint rule](https://github.com/ArnaudBarre/eslint-plugin-react-refresh), or the equivalent [Oxlint rule](https://oxc.rs/docs/guide/usage/linter/rules/react/only-export-components.html).
package/index.js CHANGED
@@ -4,7 +4,6 @@ import { join } from "node:path";
4
4
  import { exactRegex } from "@rolldown/pluginutils";
5
5
  import { transform } from "@swc/core";
6
6
  import * as vite from "vite";
7
-
8
7
  //#region ../common/refresh-utils.ts
9
8
  const runtimePublicPath = "/@react-refresh";
10
9
  const reactCompRE = /extends\s+(?:React\.)?(?:Pure)?Component/;
@@ -66,7 +65,6 @@ function virtualPreamblePlugin({ name, isEnabled }) {
66
65
  }
67
66
  };
68
67
  }
69
-
70
68
  //#endregion
71
69
  //#region ../common/warning.ts
72
70
  const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warning, defaultHandler) {
@@ -75,7 +73,6 @@ const silenceUseClientWarning = (userConfig) => ({ rollupOptions: { onwarn(warni
75
73
  if (userConfig.build?.rollupOptions?.onwarn) userConfig.build.rollupOptions.onwarn(warning, defaultHandler);
76
74
  else defaultHandler(warning);
77
75
  } } });
78
-
79
76
  //#endregion
80
77
  //#region src/index.ts
81
78
  const resolve = createRequire(import.meta.url).resolve;
@@ -99,11 +96,11 @@ const react = (_options) => {
99
96
  enforce: "pre",
100
97
  resolveId: {
101
98
  filter: { id: exactRegex(runtimePublicPath) },
102
- handler: (id) => id === runtimePublicPath ? id : void 0
99
+ handler: (id) => id === "/@react-refresh" ? id : void 0
103
100
  },
104
101
  load: {
105
102
  filter: { id: exactRegex(runtimePublicPath) },
106
- handler: (id) => id === runtimePublicPath ? readFileSync(join(import.meta.dirname, "refresh-runtime.js"), "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc") : void 0
103
+ handler: (id) => id === "/@react-refresh" ? readFileSync(join(import.meta.dirname, "refresh-runtime.js"), "utf-8").replace(/__README_URL__/g, "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc") : void 0
107
104
  }
108
105
  },
109
106
  {
@@ -235,11 +232,9 @@ const transformWithOptions = async (id, code, target, options, viteCacheRoot, re
235
232
  }
236
233
  return result;
237
234
  };
238
- var src_default = react;
239
235
  function pluginForCjs(options) {
240
236
  return react.call(this, options);
241
237
  }
242
238
  Object.assign(pluginForCjs, { default: pluginForCjs });
243
-
244
239
  //#endregion
245
- export { src_default as default, pluginForCjs as "module.exports" };
240
+ export { react as default, pluginForCjs as "module.exports" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react-swc",
3
- "version": "4.2.3",
3
+ "version": "4.3.0",
4
4
  "description": "Speed up your Vite dev server with SWC",
5
5
  "keywords": [
6
6
  "fast refresh",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "type": "module",
25
25
  "dependencies": {
26
- "@rolldown/pluginutils": "1.0.0-rc.2",
26
+ "@rolldown/pluginutils": "1.0.0-rc.7",
27
27
  "@swc/core": "^1.15.11"
28
28
  },
29
29
  "peerDependencies": {
30
- "vite": "^4 || ^5 || ^6 || ^7"
30
+ "vite": "^4 || ^5 || ^6 || ^7 || ^8"
31
31
  },
32
32
  "engines": {
33
33
  "node": "^20.19.0 || >=22.12.0"