@vitejs/plugin-react 1.2.0 → 1.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.
- package/dist/index.d.ts +6 -0
- package/dist/index.js +12 -18
- package/package.json +5 -6
- package/src/index.ts +8 -1
- package/CHANGELOG.md +0 -141
package/dist/index.d.ts
CHANGED
@@ -23,6 +23,12 @@ export declare interface Options {
|
|
23
23
|
* @default "react"
|
24
24
|
*/
|
25
25
|
jsxImportSource?: string;
|
26
|
+
/**
|
27
|
+
* Set this to `true` to annotate the JSX factory with `\/* @__PURE__ *\/`.
|
28
|
+
* This option is ignored when `jsxRuntime` is not `"automatic"`.
|
29
|
+
* @default true
|
30
|
+
*/
|
31
|
+
jsxPure?: boolean;
|
26
32
|
/**
|
27
33
|
* Babel configuration applied in both dev and prod.
|
28
34
|
*/
|
package/dist/index.js
CHANGED
@@ -21,7 +21,6 @@ var __spreadValues = (a, b) => {
|
|
21
21
|
return a;
|
22
22
|
};
|
23
23
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
24
|
-
var __markAsModule = (target) => __defProp(target, "__esModule", { value: true });
|
25
24
|
var __esm = (fn, res) => function __init() {
|
26
25
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
27
26
|
};
|
@@ -29,22 +28,16 @@ var __export = (target, all) => {
|
|
29
28
|
for (var name in all)
|
30
29
|
__defProp(target, name, { get: all[name], enumerable: true });
|
31
30
|
};
|
32
|
-
var
|
33
|
-
if (
|
34
|
-
for (let key of __getOwnPropNames(
|
35
|
-
if (!__hasOwnProp.call(
|
36
|
-
__defProp(
|
31
|
+
var __copyProps = (to, from, except, desc) => {
|
32
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
33
|
+
for (let key of __getOwnPropNames(from))
|
34
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
35
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
37
36
|
}
|
38
|
-
return
|
37
|
+
return to;
|
39
38
|
};
|
40
|
-
var __toESM = (
|
41
|
-
|
42
|
-
};
|
43
|
-
var __toCommonJS = /* @__PURE__ */ ((cache) => {
|
44
|
-
return (module2, temp) => {
|
45
|
-
return cache && cache.get(module2) || (temp = __reExport(__markAsModule({}), module2, 1), cache && cache.set(module2, temp), temp);
|
46
|
-
};
|
47
|
-
})(typeof WeakMap !== "undefined" ? /* @__PURE__ */ new WeakMap() : 0);
|
39
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
|
40
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
48
41
|
|
49
42
|
// src/jsx-runtime/babel-restore-jsx.ts
|
50
43
|
var babel_restore_jsx_exports = {};
|
@@ -178,6 +171,8 @@ var src_exports = {};
|
|
178
171
|
__export(src_exports, {
|
179
172
|
default: () => viteReact
|
180
173
|
});
|
174
|
+
module.exports = viteReact;
|
175
|
+
viteReact['default'] = viteReact;
|
181
176
|
var babel = __toESM(require("@babel/core"));
|
182
177
|
var import_pluginutils = require("@rollup/pluginutils");
|
183
178
|
var import_resolve = __toESM(require("resolve"));
|
@@ -407,7 +402,8 @@ function viteReact(opts = {}) {
|
|
407
402
|
await loadPlugin("@babel/plugin-transform-react-jsx" + (isProduction ? "" : "-development")),
|
408
403
|
{
|
409
404
|
runtime: "automatic",
|
410
|
-
importSource: opts.jsxImportSource
|
405
|
+
importSource: opts.jsxImportSource,
|
406
|
+
pure: opts.jsxPure !== false
|
411
407
|
}
|
412
408
|
]);
|
413
409
|
if (isCommonJS) {
|
@@ -536,8 +532,6 @@ viteReact.preambleCode = preambleCode;
|
|
536
532
|
function loadPlugin(path) {
|
537
533
|
return Promise.resolve().then(() => __toESM(require(path))).then((module2) => module2.default || module2);
|
538
534
|
}
|
539
|
-
module.exports = viteReact;
|
540
|
-
viteReact['default'] = viteReact;
|
541
535
|
// Annotate the CommonJS export names for ESM import in node:
|
542
536
|
0 && (module.exports = {});
|
543
537
|
/**
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@vitejs/plugin-react",
|
3
|
-
"version": "1.
|
3
|
+
"version": "1.3.0",
|
4
4
|
"license": "MIT",
|
5
5
|
"author": "Evan You",
|
6
6
|
"contributors": [
|
@@ -18,8 +18,7 @@
|
|
18
18
|
"build-bundle": "esbuild src/index.ts --bundle --platform=node --target=node12 --external:@babel/* --external:@rollup/* --external:resolve --external:react-refresh/* --outfile=dist/index.js && npm run patch-dist",
|
19
19
|
"patch-dist": "ts-node ../../scripts/patchEsbuildDist.ts dist/index.js viteReact",
|
20
20
|
"build-types": "tsc -p . --emitDeclarationOnly --outDir temp && api-extractor run && rimraf temp",
|
21
|
-
"
|
22
|
-
"release": "ts-node ../../scripts/release.ts"
|
21
|
+
"prepublishOnly": "(cd ../vite && npm run build) && npm run build"
|
23
22
|
},
|
24
23
|
"engines": {
|
25
24
|
"node": ">=12.0.0"
|
@@ -34,12 +33,12 @@
|
|
34
33
|
},
|
35
34
|
"homepage": "https://github.com/vitejs/vite/tree/main/packages/plugin-react#readme",
|
36
35
|
"dependencies": {
|
37
|
-
"@babel/core": "^7.
|
38
|
-
"@babel/plugin-transform-react-jsx": "^7.
|
36
|
+
"@babel/core": "^7.17.8",
|
37
|
+
"@babel/plugin-transform-react-jsx": "^7.17.3",
|
39
38
|
"@babel/plugin-transform-react-jsx-development": "^7.16.7",
|
40
39
|
"@babel/plugin-transform-react-jsx-self": "^7.16.7",
|
41
40
|
"@babel/plugin-transform-react-jsx-source": "^7.16.7",
|
42
|
-
"@rollup/pluginutils": "^4.
|
41
|
+
"@rollup/pluginutils": "^4.2.0",
|
43
42
|
"react-refresh": "^0.11.0",
|
44
43
|
"resolve": "^1.22.0"
|
45
44
|
}
|
package/src/index.ts
CHANGED
@@ -32,6 +32,12 @@ export interface Options {
|
|
32
32
|
* @default "react"
|
33
33
|
*/
|
34
34
|
jsxImportSource?: string
|
35
|
+
/**
|
36
|
+
* Set this to `true` to annotate the JSX factory with `\/* @__PURE__ *\/`.
|
37
|
+
* This option is ignored when `jsxRuntime` is not `"automatic"`.
|
38
|
+
* @default true
|
39
|
+
*/
|
40
|
+
jsxPure?: boolean
|
35
41
|
|
36
42
|
/**
|
37
43
|
* Babel configuration applied in both dev and prod.
|
@@ -195,7 +201,8 @@ export default function viteReact(opts: Options = {}): PluginOption[] {
|
|
195
201
|
),
|
196
202
|
{
|
197
203
|
runtime: 'automatic',
|
198
|
-
importSource: opts.jsxImportSource
|
204
|
+
importSource: opts.jsxImportSource,
|
205
|
+
pure: opts.jsxPure !== false
|
199
206
|
}
|
200
207
|
])
|
201
208
|
|
package/CHANGELOG.md
DELETED
@@ -1,141 +0,0 @@
|
|
1
|
-
# [1.2.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.4...plugin-react@1.2.0) (2022-02-09)
|
2
|
-
|
3
|
-
|
4
|
-
### Features
|
5
|
-
|
6
|
-
* **plugin-react:** ensure `overrides` array exists before `api.reactBabel` hooks are called ([#6750](https://github.com/vitejs/vite/issues/6750)) ([104bdb5](https://github.com/vitejs/vite/commit/104bdb5b5e44e79bf3456cabe15f3753f7c1ef28))
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
## [1.1.4](https://github.com/vitejs/vite/compare/plugin-react@1.1.3...plugin-react@1.1.4) (2022-01-04)
|
11
|
-
|
12
|
-
|
13
|
-
### Bug Fixes
|
14
|
-
|
15
|
-
* **plugin-react:** check for import React statement in .js files ([#6320](https://github.com/vitejs/vite/issues/6320)) ([bd9e97b](https://github.com/vitejs/vite/commit/bd9e97bd1b9156059b78b531871a12f6f47c04b1)), closes [#6148](https://github.com/vitejs/vite/issues/6148) [#6148](https://github.com/vitejs/vite/issues/6148)
|
16
|
-
* **plugin-react:** restore-jsx bug when component name is lowercase ([#6110](https://github.com/vitejs/vite/issues/6110)) ([ce65c56](https://github.com/vitejs/vite/commit/ce65c567a64fad3be4209cbd1132e62e905fe349))
|
17
|
-
|
18
|
-
|
19
|
-
### Features
|
20
|
-
|
21
|
-
* **plugin-react:** check for `api.reactBabel` on other plugins ([#5454](https://github.com/vitejs/vite/issues/5454)) ([2ab41b3](https://github.com/vitejs/vite/commit/2ab41b3184d2452be4fa0b427f05c791311644aa))
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
## [1.1.3](https://github.com/vitejs/vite/compare/plugin-react@1.1.2...plugin-react@1.1.3) (2021-12-13)
|
26
|
-
|
27
|
-
|
28
|
-
### Bug Fixes
|
29
|
-
|
30
|
-
* **plugin-react:** only detect preamble in hmr context ([#6096](https://github.com/vitejs/vite/issues/6096)) ([8735294](https://github.com/vitejs/vite/commit/8735294055ce16308a6b8302eba4538f4a2931d0))
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
## [1.1.2](https://github.com/vitejs/vite/compare/plugin-react@1.1.1...plugin-react@1.1.2) (2021-12-13)
|
35
|
-
|
36
|
-
|
37
|
-
### Bug Fixes
|
38
|
-
|
39
|
-
* ignore babel config when running restore-jsx ([#6047](https://github.com/vitejs/vite/issues/6047)) ([9c2843c](https://github.com/vitejs/vite/commit/9c2843cf0506844ee32f042a04c22c440434df2a))
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
## [1.1.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0...plugin-react@1.1.1) (2021-12-07)
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
# [1.1.0](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.1...plugin-react@1.1.0) (2021-11-22)
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
# [1.1.0-beta.1](https://github.com/vitejs/vite/compare/plugin-react@1.1.0-beta.0...plugin-react@1.1.0-beta.1) (2021-11-19)
|
52
|
-
|
53
|
-
|
54
|
-
### Bug Fixes
|
55
|
-
|
56
|
-
* **plugin-react:** apply `babel.plugins` to project files only ([#5255](https://github.com/vitejs/vite/issues/5255)) ([377d0be](https://github.com/vitejs/vite/commit/377d0be5cf85a50240e160beaaafda77b7199452))
|
57
|
-
* **plugin-react:** remove querystring from sourcemap filename ([#5760](https://github.com/vitejs/vite/issues/5760)) ([d93a9fa](https://github.com/vitejs/vite/commit/d93a9fab8986f3659e79d7b0b065e99ef625a5dd))
|
58
|
-
* **plugin-react:** restore usage of extension instead of id ([#5761](https://github.com/vitejs/vite/issues/5761)) ([59471b1](https://github.com/vitejs/vite/commit/59471b186612d3da0083543e23d660747d3287f3))
|
59
|
-
* **plugin-react:** uncompiled JSX in linked pkgs ([#5669](https://github.com/vitejs/vite/issues/5669)) ([41a7c9c](https://github.com/vitejs/vite/commit/41a7c9ccfbc1a7bc60aec672056eac3966ddd036))
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
# [1.1.0-beta.0](https://github.com/vitejs/vite/compare/plugin-react@1.0.6...plugin-react@1.1.0-beta.0) (2021-10-28)
|
64
|
-
|
65
|
-
|
66
|
-
### Bug Fixes
|
67
|
-
|
68
|
-
* **plugin-react:** avoid mangling the sourcemaps of virtual modules ([#5421](https://github.com/vitejs/vite/issues/5421)) ([8556ffe](https://github.com/vitejs/vite/commit/8556ffe3c59952d7e64565422bf433699e97756e))
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
## [1.0.6](https://github.com/vitejs/vite/compare/plugin-react@1.0.5...plugin-react@1.0.6) (2021-10-25)
|
73
|
-
|
74
|
-
|
75
|
-
### Bug Fixes
|
76
|
-
|
77
|
-
* **plugin-react:** account for querystring in transform hook ([#5333](https://github.com/vitejs/vite/issues/5333)) ([13c3813](https://github.com/vitejs/vite/commit/13c381368caf8302a0c5b7cec07dfc0eb344bede))
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
## [1.0.5](https://github.com/vitejs/vite/compare/plugin-react@1.0.4...plugin-react@1.0.5) (2021-10-18)
|
82
|
-
|
83
|
-
|
84
|
-
### Bug Fixes
|
85
|
-
|
86
|
-
* **plugin-react:** fix regex for react imports ([#5274](https://github.com/vitejs/vite/issues/5274)) ([00b3e4f](https://github.com/vitejs/vite/commit/00b3e4fe102652b2d92e76a05e8c7a5b766b1d03))
|
87
|
-
* **plugin-react:** transform .mjs files ([#5314](https://github.com/vitejs/vite/issues/5314)) ([8ce2ea1](https://github.com/vitejs/vite/commit/8ce2ea17d51b80c660f2cdca7844d4fc6991baed))
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
## [1.0.4](https://github.com/vitejs/vite/compare/plugin-react@1.0.3...plugin-react@1.0.4) (2021-10-11)
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
## [1.0.3](https://github.com/vitejs/vite/compare/plugin-react@1.0.2...plugin-react@1.0.3) (2021-10-11)
|
96
|
-
|
97
|
-
|
98
|
-
### Bug Fixes
|
99
|
-
|
100
|
-
* **plugin-react:** turn off jsx for .ts ([#5198](https://github.com/vitejs/vite/issues/5198)) ([916f9d3](https://github.com/vitejs/vite/commit/916f9d3984d5e83f7cb869b3606a1f043a814b97)), closes [#5102](https://github.com/vitejs/vite/issues/5102)
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
## [1.0.2](https://github.com/vitejs/vite/compare/plugin-react@1.0.1...plugin-react@1.0.2) (2021-10-05)
|
105
|
-
|
106
|
-
|
107
|
-
### Bug Fixes
|
108
|
-
|
109
|
-
* **plugin-react:** respect `opts.fastRefresh` in viteBabel ([#5139](https://github.com/vitejs/vite/issues/5139)) ([5cf4e69](https://github.com/vitejs/vite/commit/5cf4e69cd3afc7f960e02072171c7c441747e8f0))
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
## [1.0.1](https://github.com/vitejs/vite/compare/plugin-react@1.0.0...plugin-react@1.0.1) (2021-09-22)
|
114
|
-
|
115
|
-
|
116
|
-
### Bug Fixes
|
117
|
-
|
118
|
-
* **plugin-react:** inconsistent error warning ([#5031](https://github.com/vitejs/vite/issues/5031)) ([89ba8ce](https://github.com/vitejs/vite/commit/89ba8cedb8636968516bc38b37e1d2d5ed6234bb))
|
119
|
-
|
120
|
-
|
121
|
-
### Features
|
122
|
-
|
123
|
-
* **plugin-react:** pre-optimize jsx-dev-runtime ([#5036](https://github.com/vitejs/vite/issues/5036)) ([a34dd27](https://github.com/vitejs/vite/commit/a34dd2725e64fedf626e23ba9ced480f5465a59b))
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
# [1.0.0](https://github.com/vitejs/vite/compare/plugin-react@1.0.0-beta.0...plugin-react@1.0.0) (2021-09-22)
|
128
|
-
|
129
|
-
See the [readme](https://github.com/aleclarson/vite/blob/f8129ce6e87684eb7a4edd8106351c5d98207d7b/packages/plugin-react/README.md#vitejsplugin-react-) for more information.
|
130
|
-
|
131
|
-
- Support for [automatic JSX runtime](https://github.com/alloc/vite-react-jsx)
|
132
|
-
- Babel integration for both development and production builds
|
133
|
-
- Add `react` and `react-dom` to [`resolve.dedupe`](https://vitejs.dev/config/#resolve-dedupe) automatically
|
134
|
-
|
135
|
-
Thanks to @aleclarson and @pengx17 for preparing this release!
|
136
|
-
|
137
|
-
# Legacy
|
138
|
-
|
139
|
-
Before `@vitejs/plugin-react`, there was `@vitejs/plugin-react-refresh`.
|
140
|
-
|
141
|
-
See its changelog [here.](https://github.com/vitejs/vite/blob/b9e837a2aa2c1a7a8f93d4b19df9f72fd3c6fb09/packages/plugin-react-refresh/CHANGELOG.md)
|