Mark transpiled JSX elements as pure (#11126)
* Mark transpiled JSX elements as pure * Avoid duble annotation * Add "pure" option to the React preset * Fix generator indentation * Update tests * Add tests for the "pure" option * Update windows fixtures
This commit is contained in:
@@ -3,11 +3,11 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { Fragment as _Fragment } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx(_Fragment, {
|
||||
children: _jsxs("div", {
|
||||
children: [_jsx("div", {}, "1"), _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsx(_Fragment, {
|
||||
children: /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", {
|
||||
meow: "wolf"
|
||||
}, "2"), _jsx("div", {}, "3"), _createElement("div", { ...props,
|
||||
}, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props,
|
||||
key: "4"
|
||||
})]
|
||||
})
|
||||
|
||||
@@ -2,11 +2,11 @@ var _react = require("react");
|
||||
|
||||
var _reactJsxRuntime = require("react/jsx-runtime");
|
||||
|
||||
var x = _reactJsxRuntime.jsx(_reactJsxRuntime.Fragment, {
|
||||
children: _reactJsxRuntime.jsxs("div", {
|
||||
children: [_reactJsxRuntime.jsx("div", {}, "1"), _reactJsxRuntime.jsx("div", {
|
||||
var x = /*#__PURE__*/_reactJsxRuntime.jsx(_reactJsxRuntime.Fragment, {
|
||||
children: /*#__PURE__*/_reactJsxRuntime.jsxs("div", {
|
||||
children: [/*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "1"), /*#__PURE__*/_reactJsxRuntime.jsx("div", {
|
||||
meow: "wolf"
|
||||
}, "2"), _reactJsxRuntime.jsx("div", {}, "3"), _react.createElement("div", { ...props,
|
||||
}, "2"), /*#__PURE__*/_reactJsxRuntime.jsx("div", {}, "3"), /*#__PURE__*/_react.createElement("div", { ...props,
|
||||
key: "4"
|
||||
})]
|
||||
})
|
||||
|
||||
@@ -15,11 +15,11 @@ const Bar = () => {
|
||||
|
||||
var jsx = 1;
|
||||
var _jsx = 2;
|
||||
return _jsx2("div", {});
|
||||
return /*#__PURE__*/_jsx2("div", {});
|
||||
}
|
||||
|
||||
;
|
||||
return _jsx2("span", {});
|
||||
return /*#__PURE__*/_jsx2("span", {});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -15,11 +15,11 @@ const Bar = () => {
|
||||
|
||||
var jsx = 1;
|
||||
var _jsx = 2;
|
||||
return _reactJsxRuntime.jsx("div", {});
|
||||
return /*#__PURE__*/_reactJsxRuntime.jsx("div", {});
|
||||
}
|
||||
|
||||
;
|
||||
return _reactJsxRuntime.jsx("span", {});
|
||||
return /*#__PURE__*/_reactJsxRuntime.jsx("span", {});
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -6,10 +6,10 @@ var y = react.createElement("div", {
|
||||
foo: 1
|
||||
});
|
||||
|
||||
var x = _jsxs("div", {
|
||||
children: [_jsx("div", {}, "1"), _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", {
|
||||
meow: "wolf"
|
||||
}, "2"), _jsx("div", {}, "3"), _createElement("div", { ...props,
|
||||
}, "2"), /*#__PURE__*/_jsx("div", {}, "3"), /*#__PURE__*/_createElement("div", { ...props,
|
||||
key: "4"
|
||||
})]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx(Component, { ...props,
|
||||
sound: "moo"
|
||||
});
|
||||
|
||||
@@ -4,7 +4,7 @@ var foo = function () {
|
||||
var _this = this;
|
||||
|
||||
return function () {
|
||||
return _jsx(_this, {});
|
||||
return /*#__PURE__*/_jsx(_this, {});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -12,6 +12,6 @@ var bar = function () {
|
||||
var _this2 = this;
|
||||
|
||||
return function () {
|
||||
return _jsx(_this2.foo, {});
|
||||
return /*#__PURE__*/_jsx(_this2.foo, {});
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var div = _jsx(Component, { ...props,
|
||||
var div = /*#__PURE__*/_jsx(Component, { ...props,
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsxs("div", {
|
||||
children: ["foo", "bar", "baz", _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsxs("div", {
|
||||
children: ["foo", "bar", "baz", /*#__PURE__*/_jsx("div", {
|
||||
children: "buz bang"
|
||||
}), "qux", null, "quack"]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsxs(Text, {
|
||||
children: ["To get started, edit index.ios.js!!!", "\n", "Press Cmd+R to reload"]
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import * as React from "react";
|
||||
|
||||
var x = _jsx(React.Fragment, {}, "foo");
|
||||
var x = /*#__PURE__*/_jsx(React.Fragment, {}, "foo");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { Fragment as _Fragment } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx(_Fragment, {});
|
||||
var x = /*#__PURE__*/_jsx(_Fragment, {});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { Fragment as _Fragment } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx(_Fragment, {
|
||||
children: _jsx("div", {})
|
||||
var x = /*#__PURE__*/_jsx(_Fragment, {
|
||||
children: /*#__PURE__*/_jsx("div", {})
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
children: [_jsx("span", {}, '0'), _jsx("span", {}, '1')]
|
||||
});
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
children: [/*#__PURE__*/_jsx("span", {}, '0'), /*#__PURE__*/_jsx("span", {}, '1')]
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsxs("div", {
|
||||
children: [_jsx("span", {}), [_jsx("span", {}, '0'), _jsx("span", {}, '1')]]
|
||||
});
|
||||
var x = /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("span", {}), [/*#__PURE__*/_jsx("span", {}, '0'), /*#__PURE__*/_jsx("span", {}, '1')]]
|
||||
});
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx(Foo, {});
|
||||
|
||||
var profile = _jsxs("div", {
|
||||
children: [_jsx("img", {
|
||||
var profile = /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("img", {
|
||||
src: "avatar.png",
|
||||
className: "profile"
|
||||
}), _jsx("h3", {
|
||||
}), /*#__PURE__*/_jsx("h3", {
|
||||
children: [user.firstName, user.lastName].join(" ")
|
||||
})]
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1 +1 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";var div = _jsx("div", { children: "test" });
|
||||
import { jsx as _jsx } from "react/jsx-runtime";var div = /*#__PURE__*/_jsx("div", { children: "test" });
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var div = _jsx("div", {
|
||||
var div = /*#__PURE__*/_jsx("div", {
|
||||
children: "test"
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3,6 +3,6 @@ const props = {
|
||||
foo: true
|
||||
};
|
||||
|
||||
var x = _createElement("div", { ...props,
|
||||
var x = /*#__PURE__*/_createElement("div", { ...props,
|
||||
key: undefined
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
var _ref = /*#__PURE__*/<div className="navbar-header">
|
||||
var _ref = <div className="navbar-header">
|
||||
<a className="navbar-brand" href="/">
|
||||
<img src="/img/logo/logo-96x36.png" />
|
||||
</a>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var es3 = _jsx(F, {
|
||||
var es3 = /*#__PURE__*/_jsx(F, {
|
||||
aaa: true,
|
||||
"new": true,
|
||||
"const": true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx(Component, {
|
||||
constructor: "foo"
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
_jsx(Namespace.DeepNamespace.Component, {});
|
||||
/*#__PURE__*/
|
||||
_jsx(Namespace.DeepNamespace.Component, {});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
attr: _jsx("div", {})
|
||||
attr: /*#__PURE__*/_jsx("div", {})
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
_jsx(Namespace.Component, {});
|
||||
/*#__PURE__*/
|
||||
_jsx(Namespace.Component, {});
|
||||
|
||||
@@ -2,18 +2,19 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { Fragment as _Fragment } from "react/jsx-runtime";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: _jsxs(_Fragment, {
|
||||
children: [_jsxs(_Fragment, {
|
||||
children: [_jsx("span", {
|
||||
children: /*#__PURE__*/_jsxs(_Fragment, {
|
||||
children: [/*#__PURE__*/_jsxs(_Fragment, {
|
||||
children: [/*#__PURE__*/_jsx("span", {
|
||||
children: "Hello"
|
||||
}), _jsx("span", {
|
||||
}), /*#__PURE__*/_jsx("span", {
|
||||
children: "world"
|
||||
})]
|
||||
}), _jsxs(_Fragment, {
|
||||
children: [_jsx("span", {
|
||||
}), /*#__PURE__*/_jsxs(_Fragment, {
|
||||
children: [/*#__PURE__*/_jsx("span", {
|
||||
children: "Goodbye"
|
||||
}), _jsx("span", {
|
||||
}), /*#__PURE__*/_jsx("span", {
|
||||
children: "world"
|
||||
})]
|
||||
})]
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
children: _jsx(Component, {})
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
children: /*#__PURE__*/_jsx(Component, {})
|
||||
});
|
||||
|
||||
var x = _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
children: props.children
|
||||
});
|
||||
|
||||
var x = _jsx(Composite, {
|
||||
var x = /*#__PURE__*/_jsx(Composite, {
|
||||
children: props.children
|
||||
});
|
||||
|
||||
var x = _jsx(Composite, {
|
||||
children: _jsx(Composite2, {})
|
||||
var x = /*#__PURE__*/_jsx(Composite, {
|
||||
children: /*#__PURE__*/_jsx(Composite2, {})
|
||||
});
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {});
|
||||
var x = /*#__PURE__*/_jsx("div", {});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
children: "text"
|
||||
});
|
||||
|
||||
@@ -1,13 +1,16 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
id: "w\xF4w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
id: "\\w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
id: "w < w"
|
||||
});
|
||||
|
||||
@@ -1,38 +1,47 @@
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "wow"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "w\xF4w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "w & w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "w & w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "w \xA0 w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "this should not parse as unicode: \\u00a0"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "this should parse as nbsp: \xA0 "
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsxs("div", {
|
||||
children: ["this should parse as unicode: ", '\u00a0 ']
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "w < w"
|
||||
});
|
||||
|
||||
@@ -3,13 +3,13 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
var HelloMessage = React.createClass({
|
||||
displayName: "HelloMessage",
|
||||
render: function () {
|
||||
return _jsxs("div", {
|
||||
return /*#__PURE__*/_jsxs("div", {
|
||||
children: ["Hello ", this.props.name]
|
||||
});
|
||||
}
|
||||
});
|
||||
React.render(_jsx(HelloMessage, {
|
||||
name: _jsx("span", {
|
||||
React.render( /*#__PURE__*/_jsx(HelloMessage, {
|
||||
name: /*#__PURE__*/_jsx("span", {
|
||||
children: "Sebastian"
|
||||
})
|
||||
}), mountNode);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("hasOwnProperty", {
|
||||
children: "testing"
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsxs("div", {
|
||||
children: [_jsx("div", {
|
||||
children: _jsx("br", {})
|
||||
}), _jsxs(Component, {
|
||||
children: [foo, _jsx("br", {}), bar]
|
||||
}), _jsx("br", {})]
|
||||
var x = /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("div", {
|
||||
children: /*#__PURE__*/_jsx("br", {})
|
||||
}), /*#__PURE__*/_jsxs(Component, {
|
||||
children: [foo, /*#__PURE__*/_jsx("br", {}), bar]
|
||||
}), /*#__PURE__*/_jsx("br", {})]
|
||||
});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
attr1: "foo" + "bar",
|
||||
attr2: "foo" + "bar" + "baz" + "bug",
|
||||
attr3: "foo" + "bar" + "baz" + "bug",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var e = _jsx(F, {
|
||||
var e = /*#__PURE__*/_jsx(F, {
|
||||
aaa: true,
|
||||
new: true,
|
||||
const: true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("button", {
|
||||
"data-value": "a value\n with\nnewlines\n and spaces",
|
||||
children: "Button"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "\xA0 "
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("div", {
|
||||
children: "\xA0"
|
||||
});
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsx("div", {
|
||||
/* a multi-line
|
||||
comment */
|
||||
attr1: "foo",
|
||||
children: _jsx("span", {
|
||||
children: /*#__PURE__*/_jsx("span", {
|
||||
// a double-slash comment
|
||||
attr2: "bar"
|
||||
})
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { jsxs as _jsxs } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsxs("div", {
|
||||
children: [_jsx("div", {}, "1"), _jsx("div", {
|
||||
var x = /*#__PURE__*/_jsxs("div", {
|
||||
children: [/*#__PURE__*/_jsx("div", {}, "1"), /*#__PURE__*/_jsx("div", {
|
||||
meow: "wolf"
|
||||
}, "2"), _jsx("div", {}, "3")]
|
||||
});
|
||||
}, "2"), /*#__PURE__*/_jsx("div", {}, "3")]
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
var foo = null;
|
||||
|
||||
var x = _jsx("div", { ...foo
|
||||
var x = /*#__PURE__*/_jsx("div", { ...foo
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("button", {
|
||||
"data-value": "a value",
|
||||
children: "Button"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx("f:image", {
|
||||
"n:attr": true
|
||||
});
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
_jsx("font-face", {});
|
||||
/*#__PURE__*/
|
||||
_jsx("font-face", {});
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { createElement as _createElement } from "react";
|
||||
|
||||
var x = _createElement("div", { ...props,
|
||||
var x = /*#__PURE__*/_createElement("div", { ...props,
|
||||
key: "1",
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var x = _jsx("div", { ...props,
|
||||
var x = /*#__PURE__*/_jsx("div", { ...props,
|
||||
foo: "bar"
|
||||
}, "1");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
var div = _jsx(this.foo, {
|
||||
var div = /*#__PURE__*/_jsx(this.foo, {
|
||||
children: "test"
|
||||
});
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx(Component, {
|
||||
y: 2,
|
||||
z: true,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
|
||||
/*#__PURE__*/
|
||||
_jsx(Component, {
|
||||
y: 2,
|
||||
...x,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, { ...props,
|
||||
sound: "moo"
|
||||
});
|
||||
|
||||
@@ -3,7 +3,7 @@ var foo = function () {
|
||||
var _this = this;
|
||||
|
||||
return function () {
|
||||
return React.createElement(_this, null);
|
||||
return /*#__PURE__*/React.createElement(_this, null);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -11,6 +11,6 @@ var bar = function () {
|
||||
var _this2 = this;
|
||||
|
||||
return function () {
|
||||
return React.createElement(_this2.foo, null);
|
||||
return /*#__PURE__*/React.createElement(_this2.foo, null);
|
||||
};
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
var div = React.createElement(Component, { ...props,
|
||||
var div = /*#__PURE__*/React.createElement(Component, { ...props,
|
||||
foo: "bar"
|
||||
});
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", null, "foo", "bar", "baz", React.createElement("div", null, "buz bang"), "qux", null, "quack");
|
||||
var x = /*#__PURE__*/React.createElement("div", null, "foo", "bar", "baz", /*#__PURE__*/React.createElement("div", null, "buz bang"), "qux", null, "quack");
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Text, null, "To get started, edit index.ios.js!!!", "\n", "Press Cmd+R to reload");
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
var div = React.createElement("div", null, "test");
|
||||
var div = /*#__PURE__*/React.createElement("div", null, "test");
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var div = React.createElement("div", null, "test");
|
||||
var div = /*#__PURE__*/React.createElement("div", null, "test");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @jsxRuntime classic */
|
||||
var es3 = React.createElement(F, {
|
||||
var es3 = /*#__PURE__*/React.createElement(F, {
|
||||
aaa: true,
|
||||
"new": true,
|
||||
"const": true,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, {
|
||||
constructor: "foo"
|
||||
});
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Namespace.DeepNamespace.Component, null);
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", {
|
||||
attr: React.createElement("div", null)
|
||||
attr: /*#__PURE__*/React.createElement("div", null)
|
||||
});
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Namespace.Component, null);
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
React.createElement("div", null, React.createElement(React.Fragment, null, React.createElement(React.Fragment, null, React.createElement("span", null, "Hello"), React.createElement("span", null, "world")), React.createElement(React.Fragment, null, React.createElement("span", null, "Goodbye"), React.createElement("span", null, "world"))));
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Hello"), /*#__PURE__*/React.createElement("span", null, "world")), /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", null, "Goodbye"), /*#__PURE__*/React.createElement("span", null, "world"))));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", null, React.createElement(Component, null));
|
||||
var x = React.createElement("div", null, props.children);
|
||||
var x = React.createElement(Composite, null, props.children);
|
||||
var x = React.createElement(Composite, null, React.createElement(Composite2, null));
|
||||
var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(Component, null));
|
||||
var x = /*#__PURE__*/React.createElement("div", null, props.children);
|
||||
var x = /*#__PURE__*/React.createElement(Composite, null, props.children);
|
||||
var x = /*#__PURE__*/React.createElement(Composite, null, /*#__PURE__*/React.createElement(Composite2, null));
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", null);
|
||||
var x = /*#__PURE__*/React.createElement("div", null);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", null, "text");
|
||||
var x = /*#__PURE__*/React.createElement("div", null, "text");
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", {
|
||||
id: "w\xF4w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", {
|
||||
id: "\\w"
|
||||
});
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", {
|
||||
id: "w < w"
|
||||
});
|
||||
|
||||
@@ -1,10 +1,28 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "wow");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "w\xF4w");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "w & w");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "w & w");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "w \xA0 w");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "this should not parse as unicode: \\u00a0");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "this should parse as nbsp: \xA0 ");
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "this should parse as unicode: ", '\u00a0 ');
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "w < w");
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
var HelloMessage = React.createClass({
|
||||
displayName: "HelloMessage",
|
||||
render: function () {
|
||||
return React.createElement("div", null, "Hello ", this.props.name);
|
||||
return /*#__PURE__*/React.createElement("div", null, "Hello ", this.props.name);
|
||||
}
|
||||
});
|
||||
React.render(React.createElement(HelloMessage, {
|
||||
name: React.createElement("span", null, "Sebastian")
|
||||
React.render( /*#__PURE__*/React.createElement(HelloMessage, {
|
||||
name: /*#__PURE__*/React.createElement("span", null, "Sebastian")
|
||||
}), mountNode);
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("hasOwnProperty", null, "testing");
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", null, React.createElement("div", null, React.createElement("br", null)), React.createElement(Component, null, foo, React.createElement("br", null), bar), React.createElement("br", null));
|
||||
var x = /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("br", null)), /*#__PURE__*/React.createElement(Component, null, foo, /*#__PURE__*/React.createElement("br", null), bar), /*#__PURE__*/React.createElement("br", null));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", {
|
||||
var x = /*#__PURE__*/React.createElement("div", {
|
||||
attr1: "foo" + "bar",
|
||||
attr2: "foo" + "bar" + "baz" + "bug",
|
||||
attr3: "foo" + "bar" + "baz" + "bug",
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/** @jsxRuntime classic */
|
||||
var e = React.createElement(F, {
|
||||
var e = /*#__PURE__*/React.createElement(F, {
|
||||
aaa: true,
|
||||
new: true,
|
||||
const: true,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("button", {
|
||||
"data-value": "a value\n with\nnewlines\n and spaces"
|
||||
}, "Button");
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "\xA0 ");
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null, "\xA0");
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/** @jsxRuntime classic */
|
||||
var x = React.createElement("div", {
|
||||
var x = /*#__PURE__*/React.createElement("div", {
|
||||
/* a multi-line
|
||||
comment */
|
||||
attr1: "foo"
|
||||
}, React.createElement("span", {
|
||||
}, /*#__PURE__*/React.createElement("span", {
|
||||
// a double-slash comment
|
||||
attr2: "bar"
|
||||
}));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("button", {
|
||||
"data-value": "a value"
|
||||
}, "Button");
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement("font-face", null);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
/** @jsxRuntime classic */
|
||||
var div = React.createElement(this.foo, null, "test");
|
||||
var div = /*#__PURE__*/React.createElement(this.foo, null, "test");
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, { ...x,
|
||||
y: 2,
|
||||
z: true
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, {
|
||||
y: 2,
|
||||
z: true,
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
/** @jsxRuntime classic */
|
||||
|
||||
/*#__PURE__*/
|
||||
React.createElement(Component, {
|
||||
y: 2,
|
||||
...x,
|
||||
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div />;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pure": false }]
|
||||
]
|
||||
}
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-default-pragma/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
React.createElement("div", null);
|
||||
3
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js
vendored
Normal file
3
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/* @jsx h */
|
||||
|
||||
<div />;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pure": false }]
|
||||
]
|
||||
}
|
||||
2
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js
vendored
Normal file
2
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-comment/output.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/* @jsx h */
|
||||
h("div", null);
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div />;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pragma": "h", "pure": false }]
|
||||
]
|
||||
}
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/false-pragma-option/output.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
h("div", null);
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div />;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pure": true }]
|
||||
]
|
||||
}
|
||||
2
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js
vendored
Normal file
2
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-default-pragma/output.js
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/*#__PURE__*/
|
||||
React.createElement("div", null);
|
||||
3
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js
vendored
Normal file
3
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/input.js
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/* @jsx h */
|
||||
|
||||
<div />;
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pure": true }]
|
||||
]
|
||||
}
|
||||
4
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js
vendored
Normal file
4
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-comment/output.js
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
/* @jsx h */
|
||||
|
||||
/*#__PURE__*/
|
||||
h("div", null);
|
||||
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js
vendored
Normal file
1
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/input.js
vendored
Normal file
@@ -0,0 +1 @@
|
||||
<div />;
|
||||
5
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json
vendored
Normal file
5
packages/babel-plugin-transform-react-jsx/test/fixtures/pure/true-pragma-option/options.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"plugins": [
|
||||
["transform-react-jsx", { "pragma": "h", "pure": true }]
|
||||
]
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user