Skip to content

Commit 8a2ac38

Browse files
magic-akarikdy1
authored andcommitted
refactor(es/react): Set automatic as default jsx runtime (#10688)
1 parent 7238b5a commit 8a2ac38

File tree

355 files changed

+5056
-1705
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

355 files changed

+5056
-1705
lines changed

bindings/binding_core_wasm/__tests__/simple.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,17 +113,17 @@ describe("parse", () => {
113113
"ctxt": 2,
114114
"optional": false,
115115
"span": {
116-
"end": 254,
117-
"start": 251,
116+
"end": 114,
117+
"start": 111,
118118
},
119119
"type": "Identifier",
120120
"value": "Foo",
121121
},
122122
"implements": [],
123123
"isAbstract": false,
124124
"span": {
125-
"end": 257,
126-
"start": 245,
125+
"end": 117,
126+
"start": 105,
127127
},
128128
"superClass": null,
129129
"superTypeParams": null,
@@ -133,8 +133,8 @@ describe("parse", () => {
133133
],
134134
"interpreter": null,
135135
"span": {
136-
"end": 257,
137-
"start": 245,
136+
"end": 117,
137+
"start": 105,
138138
},
139139
"type": "Module",
140140
}
@@ -159,17 +159,17 @@ describe("parse", () => {
159159
"ctxt": 2,
160160
"optional": false,
161161
"span": {
162-
"end": 267,
163-
"start": 264,
162+
"end": 127,
163+
"start": 124,
164164
},
165165
"type": "Identifier",
166166
"value": "Foo",
167167
},
168168
"implements": [],
169169
"isAbstract": false,
170170
"span": {
171-
"end": 270,
172-
"start": 258,
171+
"end": 130,
172+
"start": 118,
173173
},
174174
"superClass": null,
175175
"superTypeParams": null,
@@ -179,8 +179,8 @@ describe("parse", () => {
179179
],
180180
"interpreter": null,
181181
"span": {
182-
"end": 270,
183-
"start": 258,
182+
"end": 130,
183+
"start": 118,
184184
},
185185
"type": "Module",
186186
}

crates/swc/tests/fixture/codegen/jsx-1/output/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
export default /*#__PURE__*/ React.createElement(A, {
1+
import { jsx as _jsx } from "react/jsx-runtime";
2+
export default /*#__PURE__*/ _jsx(A, {
23
className: b,
34
header: "C",
45
subheader: "D E"
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1+
var _require = require("react/jsx-runtime"), _jsx = _require.jsx;
12
;
2-
React.createElement("a", null);
3+
_jsx("a", {});
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
var _require = require("react/jsx-runtime"), _jsx = _require.jsx, _Fragment = _require.Fragment;
12
var a = function() {
2-
return /*#__PURE__*/ React.createElement(React.Fragment, null, "\xb7");
3+
return /*#__PURE__*/ _jsx(_Fragment, {
4+
children: "\xb7"
5+
});
36
};
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
var _require = require("react/jsx-runtime"), _jsx = _require.jsx;
12
function Component() {
2-
return /*#__PURE__*/ React.createElement("div", {
3+
return /*#__PURE__*/ _jsx("div", {
34
name: "A B"
45
});
56
}
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
const Span = /*#__PURE__*/ React.createElement("span", null, "with ");
1+
const { jsx: _jsx } = require("react/jsx-runtime");
2+
const Span = /*#__PURE__*/ _jsx("span", {
3+
children: "with "
4+
});
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
const Span = /*#__PURE__*/ React.createElement("span", null, "with&nbsp");
1+
const { jsx: _jsx } = require("react/jsx-runtime");
2+
const Span = /*#__PURE__*/ _jsx("span", {
3+
children: "with&nbsp"
4+
});
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
1-
/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement("span", null, "Hello something long to not trigger line break"), " ");
1+
/*#__PURE__*/ const { jsx: _jsx, jsxs: _jsxs, Fragment: _Fragment } = require("react/jsx-runtime");
2+
_jsxs(_Fragment, {
3+
children: [
4+
/*#__PURE__*/ _jsx("span", {
5+
children: "Hello something long to not trigger line break"
6+
}),
7+
" "
8+
]
9+
});
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
const a = /*#__PURE__*/ React.createElement("div", {
1+
const { jsx: _jsx } = require("react/jsx-runtime");
2+
const a = /*#__PURE__*/ _jsx("div", {
23
id: "abc>"
34
});
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
var a = /*#__PURE__*/ React.createElement("div", {
1+
var _require = require("react/jsx-runtime"), _jsx = _require.jsx;
2+
var a = /*#__PURE__*/ _jsx("div", {
23
id: "abc>"
34
});

0 commit comments

Comments
 (0)