-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Inject `__source` and `__self` in JSX elements earlier This fixes an issue where `this` was not correct inside arrow functions, similar to https://astexplorer.net/#/gist/86638d64cd21c496e7fecaea46313d95/906f8be24d7d99f3f5cd5a956a48355e1864f4b1 * Add test * Remove try-catch * Update error * Update fixtures * Update windows fixtures
- Loading branch information
1 parent
0a02a12
commit 11292a3
Showing
22 changed files
with
221 additions
and
250 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...el-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div />; | ||
() => <div />; | ||
|
||
function fn() { | ||
<div />; | ||
() => <div />; | ||
} |
38 changes: 38 additions & 0 deletions
38
...l-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; | ||
|
||
var _jsxFileName = "<CWD>/packages/babel-plugin-transform-react-jsx-development/test/fixtures/linux/self-inside-arrow/input.mjs", | ||
_this = this; | ||
|
||
/*#__PURE__*/ | ||
_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 1, | ||
columnNumber: 1 | ||
}, this); | ||
|
||
(function () { | ||
return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 2, | ||
columnNumber: 7 | ||
}, _this); | ||
}); | ||
|
||
function fn() { | ||
var _this2 = this; | ||
|
||
/*#__PURE__*/ | ||
_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 5, | ||
columnNumber: 3 | ||
}, this); | ||
|
||
(function () { | ||
return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 6, | ||
columnNumber: 9 | ||
}, _this2); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
...transform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/input.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<div />; | ||
() => <div />; | ||
|
||
function fn() { | ||
<div />; | ||
() => <div />; | ||
} |
38 changes: 38 additions & 0 deletions
38
...ransform-react-jsx-development/test/fixtures/windows/self-inside-arrow-windows/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { jsxDEV as _jsxDEV } from "react/jsx-dev-runtime"; | ||
|
||
var _jsxFileName = "C:\\Users\\travis\\build\\babel\\babel\\packages\\babel-plugin-transform-react-jsx-development\\test\\fixtures\\windows\\self-inside-arrow-windows\\input.mjs", | ||
_this = this; | ||
|
||
/*#__PURE__*/ | ||
_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 1, | ||
columnNumber: 1 | ||
}, this); | ||
|
||
(function () { | ||
return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 2, | ||
columnNumber: 7 | ||
}, _this); | ||
}); | ||
|
||
function fn() { | ||
var _this2 = this; | ||
|
||
/*#__PURE__*/ | ||
_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 5, | ||
columnNumber: 3 | ||
}, this); | ||
|
||
(function () { | ||
return /*#__PURE__*/_jsxDEV("div", {}, void 0, false, { | ||
fileName: _jsxFileName, | ||
lineNumber: 6, | ||
columnNumber: 9 | ||
}, _this2); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 0 additions & 32 deletions
32
...form-react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic-windows/exec.js
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
...react-jsx/test/fixtures/nextReact/does-not-add-source-self-automatic-windows/options.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.