Include $$typeof on inlined React elements

See https://github.com/facebook/react/pull/4832.
This commit is contained in:
Ben Alpert 2015-09-09 23:53:17 -07:00
parent 436ba9b653
commit 1d0e68f5a1
17 changed files with 31 additions and 9 deletions

View File

@ -92,6 +92,7 @@ export default class File {
"temporal-undefined",
"temporal-assert-defined",
"self-global",
"typeof-react-element",
"default-props",
"instanceof",

View File

@ -0,0 +1 @@
(typeof Symbol === "function" && Symbol.for && Symbol.for("react.element")) || 0xeac7

View File

@ -61,6 +61,7 @@ export var visitor = {
}
// metadata
pushElemProp("$$typeof", file.addHelper("typeof-react-element"));
pushElemProp("type", type);
pushElemProp("ref", t.literal(null));

View File

@ -1,6 +1,9 @@
"use strict";
var _typeofReactElement = typeof Symbol === "function" && Symbol["for"] && Symbol["for"]("react.element") || 60103;
var _ref = {
$$typeof: _typeofReactElement,
type: "foo",
ref: null,
props: {},
@ -13,6 +16,7 @@ function render() {
function render() {
var text = getText();
var _ref2 = {
$$typeof: _typeofReactElement,
type: "foo",
ref: null,
props: {
@ -23,4 +27,4 @@ function render() {
return function () {
return _ref2;
};
}
}

View File

@ -1,10 +1,11 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {
foo: "bar"
}),
key: null
});
});

View File

@ -1,8 +1,9 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
key: null
});
});

View File

@ -1,10 +1,11 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "foo",
ref: null,
props: {
bar: "foo"
},
key: null
});
});

View File

@ -1,8 +1,9 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "foo",
ref: null,
props: {},
key: null
});
});

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Foo,
ref: null,
props: babelHelpers.defaultProps(Foo.defaultProps, {}),

View File

@ -1,10 +1,12 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Foo,
ref: null,
props: babelHelpers.defaultProps(Foo.defaultProps, {
children: [bar, {
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
@ -13,4 +15,4 @@
className: "foo"
}),
key: null
});
});

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "div",
ref: null,
props: {
@ -8,4 +9,4 @@
className: "foo"
},
key: null
});
});

View File

@ -1,10 +1,12 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "div",
ref: null,
props: {
children: [bar, {
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {}),
@ -13,4 +15,4 @@
className: "foo"
},
key: null
});
});

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Baz,
ref: null,
props: babelHelpers.defaultProps(Baz.defaultProps, {}),

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "foo",
ref: null,
props: {

View File

@ -1,6 +1,7 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: "foo",
ref: null,
props: {},

View File

@ -1,10 +1,11 @@
"use strict";
({
$$typeof: babelHelpers.typeofReactElement,
type: Foo,
ref: null,
props: babelHelpers.defaultProps(Foo.defaultProps, {
bar: true
}),
key: null
});
});