@vitejs/plugin-react 4.1.1 → 4.2.1

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.
package/dist/index.cjs CHANGED
@@ -94,7 +94,7 @@ function viteReact(opts = {}) {
94
94
  let skipFastRefresh = false;
95
95
  let runPluginOverrides;
96
96
  let staticBabelOptions;
97
- const importReactRE = /(?:^|\s)import\s+(?:\*\s+as\s+)?React(?:,|\s+)/;
97
+ const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
98
98
  const viteBabel = {
99
99
  name: "vite:react-babel",
100
100
  enforce: "pre",
@@ -110,7 +110,8 @@ function viteReact(opts = {}) {
110
110
  esbuild: {
111
111
  jsx: "automatic",
112
112
  jsxImportSource: opts.jsxImportSource
113
- }
113
+ },
114
+ optimizeDeps: { esbuildOptions: { jsx: "automatic" } }
114
115
  };
115
116
  }
116
117
  },
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformOptions, ParserOptions } from '@babel/core';
2
- import { ResolvedConfig, PluginOption } from 'vite';
2
+ import { PluginOption, ResolvedConfig } from 'vite';
3
3
 
4
4
  interface Options {
5
5
  include?: string | RegExp | Array<string | RegExp>;
@@ -40,19 +40,15 @@ type ReactBabelHookContext = {
40
40
  ssr: boolean;
41
41
  id: string;
42
42
  };
43
- declare module 'vite' {
44
- interface Plugin {
45
- api?: {
46
- /**
47
- * Manipulate the Babel options of `@vitejs/plugin-react`
48
- */
49
- reactBabel?: ReactBabelHook;
50
- };
51
- }
52
- }
43
+ type ViteReactPluginApi = {
44
+ /**
45
+ * Manipulate the Babel options of `@vitejs/plugin-react`
46
+ */
47
+ reactBabel?: ReactBabelHook;
48
+ };
53
49
  declare function viteReact(opts?: Options): PluginOption[];
54
50
  declare namespace viteReact {
55
51
  var preambleCode: string;
56
52
  }
57
53
 
58
- export { type BabelOptions, type Options, type ReactBabelOptions, viteReact as default };
54
+ export { type BabelOptions, type Options, type ReactBabelOptions, type ViteReactPluginApi, viteReact as default };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformOptions, ParserOptions } from '@babel/core';
2
- import { ResolvedConfig, PluginOption } from 'vite';
2
+ import { PluginOption, ResolvedConfig } from 'vite';
3
3
 
4
4
  interface Options {
5
5
  include?: string | RegExp | Array<string | RegExp>;
@@ -40,19 +40,15 @@ type ReactBabelHookContext = {
40
40
  ssr: boolean;
41
41
  id: string;
42
42
  };
43
- declare module 'vite' {
44
- interface Plugin {
45
- api?: {
46
- /**
47
- * Manipulate the Babel options of `@vitejs/plugin-react`
48
- */
49
- reactBabel?: ReactBabelHook;
50
- };
51
- }
52
- }
43
+ type ViteReactPluginApi = {
44
+ /**
45
+ * Manipulate the Babel options of `@vitejs/plugin-react`
46
+ */
47
+ reactBabel?: ReactBabelHook;
48
+ };
53
49
  declare function viteReact(opts?: Options): PluginOption[];
54
50
  declare namespace viteReact {
55
51
  var preambleCode: string;
56
52
  }
57
53
 
58
- export { type BabelOptions, type Options, type ReactBabelOptions, viteReact as default };
54
+ export { type BabelOptions, type Options, type ReactBabelOptions, type ViteReactPluginApi, viteReact as default };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { TransformOptions, ParserOptions } from '@babel/core';
2
- import { ResolvedConfig, PluginOption } from 'vite';
2
+ import { PluginOption, ResolvedConfig } from 'vite';
3
3
 
4
4
  interface Options {
5
5
  include?: string | RegExp | Array<string | RegExp>;
@@ -40,19 +40,15 @@ type ReactBabelHookContext = {
40
40
  ssr: boolean;
41
41
  id: string;
42
42
  };
43
- declare module 'vite' {
44
- interface Plugin {
45
- api?: {
46
- /**
47
- * Manipulate the Babel options of `@vitejs/plugin-react`
48
- */
49
- reactBabel?: ReactBabelHook;
50
- };
51
- }
52
- }
43
+ type ViteReactPluginApi = {
44
+ /**
45
+ * Manipulate the Babel options of `@vitejs/plugin-react`
46
+ */
47
+ reactBabel?: ReactBabelHook;
48
+ };
53
49
  declare function viteReact(opts?: Options): PluginOption[];
54
50
  declare namespace viteReact {
55
51
  var preambleCode: string;
56
52
  }
57
53
 
58
- export { type BabelOptions, type Options, type ReactBabelOptions, viteReact as default };
54
+ export { type BabelOptions, type Options, type ReactBabelOptions, type ViteReactPluginApi, viteReact as default };
package/dist/index.mjs CHANGED
@@ -86,7 +86,7 @@ function viteReact(opts = {}) {
86
86
  let skipFastRefresh = false;
87
87
  let runPluginOverrides;
88
88
  let staticBabelOptions;
89
- const importReactRE = /(?:^|\s)import\s+(?:\*\s+as\s+)?React(?:,|\s+)/;
89
+ const importReactRE = /\bimport\s+(?:\*\s+as\s+)?React\b/;
90
90
  const viteBabel = {
91
91
  name: "vite:react-babel",
92
92
  enforce: "pre",
@@ -102,7 +102,8 @@ function viteReact(opts = {}) {
102
102
  esbuild: {
103
103
  jsx: "automatic",
104
104
  jsxImportSource: opts.jsxImportSource
105
- }
105
+ },
106
+ optimizeDeps: { esbuildOptions: { jsx: "automatic" } }
106
107
  };
107
108
  }
108
109
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vitejs/plugin-react",
3
- "version": "4.1.1",
3
+ "version": "4.2.1",
4
4
  "license": "MIT",
5
5
  "author": "Evan You",
6
6
  "contributors": [
@@ -38,13 +38,13 @@
38
38
  },
39
39
  "homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react#readme",
40
40
  "dependencies": {
41
- "@babel/core": "^7.23.2",
42
- "@babel/plugin-transform-react-jsx-self": "^7.22.5",
43
- "@babel/plugin-transform-react-jsx-source": "^7.22.5",
44
- "@types/babel__core": "^7.20.3",
41
+ "@babel/core": "^7.23.5",
42
+ "@babel/plugin-transform-react-jsx-self": "^7.23.3",
43
+ "@babel/plugin-transform-react-jsx-source": "^7.23.3",
44
+ "@types/babel__core": "^7.20.5",
45
45
  "react-refresh": "^0.14.0"
46
46
  },
47
47
  "peerDependencies": {
48
- "vite": "^4.2.0"
48
+ "vite": "^4.2.0 || ^5.0.0"
49
49
  }
50
50
  }