diff --git a/src/js/__tests__/fixtures/pr.html b/src/js/__tests__/fixtures/pr.html index 67d2ac1..d42de56 100644 --- a/src/js/__tests__/fixtures/pr.html +++ b/src/js/__tests__/fixtures/pr.html @@ -1,13257 +1,11389 @@ - - - - - - - + + + + + + + - - - + + + + + + + - - - - - - Provide new jsx transform target for reactjs/rfcs#107 by rickyvetter · Pull Request #15141 · facebook/react · GitHub + + + Provide new jsx transform target for reactjs/rfcs#107 by rickyvetter · Pull Request #15141 · facebook/react · GitHub - - - + + + - + + + - - - + + + + - + - + - - + + - + + - - + - - - - - - - - + - - + - - + + - + + - + + + + - - - - + - + + + - + - + - + - + + - -
+
Skip to content -
- - - + + + + + -
- + + Sign in + + + Sign up + +
+ + + - + + +
-
-
+
+ -
-
-
+ +
+
+
+ + + - -
-
+
-
+
+
-
+ + +
+
+
+ -
-
-
+ +
+
+ +
-
- + +
+ + + New issue + + + +
+
+ +
- New issue -
- - -
-
- -
+
+

+ Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. +

-
-

- Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community. -

+ +

By clicking “Sign up for GitHub”, you agree to our terms of service and + privacy statement. We’ll occasionally send you account related emails.

- - -

By clicking “Sign up for GitHub”, you agree to our terms of service and - privacy statement. We’ll occasionally send you account related emails.

-

- Already on GitHub? - Sign in - to your account -

-
+

+ Already on GitHub? + Sign in + to your account +

+
-
-
-
-
+
+ + +
-

+

Provide new jsx transform target for reactjs/rfcs#107 - #15141 -

-
- -
-
- - Open - + #15141 + + +
-
-
- +
+
+ + + Merged + + - wants to merge - 3 - commits into +
+
+ + merged 3 commits into - + -
-
- - base: - master - - - - - - -
-
+from - from + - + on 8 Apr 2019 +
+
-
-
-
+
- -
-
-
- - Open +
+
+
+
+ + + Merged + -
- -
- -
- - -
- - Changes from all commits - - - -
- Commits -
- + + +
+ + -
- +
+ File filter... - - - -
- Filter file types -
-
+ + +
+ Filter file types +
+ +
- -
- - - +
+
+ Filter viewed files +
+
+ +
+
+ +
+ + + + -
- - Jump to… - - -
+
+ + Jump to… + + +
Jump to file or symbol -
- -
- Failed to load files and symbols. -
-
- -
-
-
-
- - - - +659 - - - −12 - - - - - +
+ +
+ Failed to load files and symbols. +
+
+ +
+
+
+
+ +
+ + + + +
+
+
+

Always

+
+ + +
-
+

Just for now

+ + + +
+
+
-
-
+
-
-
- - Diff settings - - -
-
-
-

Always

-
- - -
+
+
-

Just for now

- - - -
-
- +
+
+
+
+
-
- +
-
-
+
+ +
+
+
+ -
+ -
-
- -
22 + packages/react/src/React.js + + + + + +
+
+
- show-inline-notes - " data-file-type=".js" data-file-deleted="false"> -
-
- - - - -
- - Copy path - - - View file - -
- - - - - - -
-
- 22 - packages/react/src/React.js + +
+ + View file + -
-
-
- + - - - - - - + - - + - - + + Open in desktop + + + + + + + +
+
+
- - - - @@ -22,6 +22,7 @@ import {
- - createFactory,
- - + + + + + - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - - - + + + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - - - + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - - - +
+ + + + @@ -22,6 +22,7 @@ import {
- - cloneElement,
+ createFactory,
- + cloneElement,
- isValidElement,
+ isValidElement,
- - jsx,
+ jsx,
- - } from './ReactElement';
+ } from './ReactElement';
-
- import {createContext} from './ReactContext';
+ import {createContext} from './ReactContext';
- - import {lazy} from './ReactLazy';
+ import {lazy} from './ReactLazy';
- - - - @@ -43,10 +44,16 @@ import {
+ + + + @@ -43,10 +44,16 @@ import {
- + createElementWithValidation,
- createElementWithValidation,
+ createFactoryWithValidation,
- - createFactoryWithValidation,
+ cloneElementWithValidation,
- - cloneElementWithValidation,
+ jsxWithValidation,
-
- jsxWithValidation,
+ jsxWithValidationStatic,
- - jsxWithValidationStatic,
+ jsxWithValidationDynamic,
- + } from './ReactElementValidator';
- jsxWithValidationDynamic,
+ import ReactSharedInternals from './ReactSharedInternals';
- - } from './ReactElementValidator';
+ import {error, warn} from './withComponentStack';
- - import ReactSharedInternals from './ReactSharedInternals';
+ import {enableStableConcurrentModeAPIs} from 'shared/ReactFeatureFlags';
-
- import {error, warn} from './withComponentStack';
+ import {
- - import {enableStableConcurrentModeAPIs} from 'shared/ReactFeatureFlags';
+ enableStableConcurrentModeAPIs,
- + enableJSXTransformAPI,
- import {
+ } from 'shared/ReactFeatureFlags';
- - enableStableConcurrentModeAPIs,
+
- - enableJSXTransformAPI,
+ const React = {
-
- } from 'shared/ReactFeatureFlags';
+ Children: {
+ + + + + + + @@ -107,4 +114,17 @@ if (enableStableConcurrentModeAPIs) {
-
-
+ React.unstable_ConcurrentMode = undefined;
- - const React = {
+ }
- +
- Children: {
- - - - - - - @@ -107,4 +114,17 @@ if (enableStableConcurrentModeAPIs) {
+ if (enableJSXTransformAPI) {
- - React.unstable_ConcurrentMode = undefined;
+ if (__DEV__) {
-
- }
+ React.jsxDEV = jsxWithValidation;
- -
+ React.jsx = jsxWithValidationDynamic;
- + React.jsxs = jsxWithValidationStatic;
- if (enableJSXTransformAPI) {
+ } else {
- - if (__DEV__) {
+ React.jsx = jsx;
- - React.jsxDEV = jsxWithValidation;
+ // we may want to special case jsxs internally to take advantage of static children.
-
- React.jsx = jsxWithValidationDynamic;
+ // for now we can ship identical prod functions
- - React.jsxs = jsxWithValidationStatic;
+ React.jsxs = jsx;
- + }
- } else {
+ }
- - React.jsx = jsx;
+
- - // we may want to special case jsxs internally to take advantage of static children.
+ export default React;
- - // for now we can ship identical prod functions
+
+
+
- - + +
+
+
+ - - - + - - React.jsxs = jsx; - + 137 - - + packages/react/src/ReactElement.js + + + + - - - + +
- - } - +
+
- - - - - - - } - - - - + - - + +
+
+
+
+
+ -
-
+ + + + + + + + @@ -95,17 +95,17 @@ function defineRefPropWarningGetter(props, displayName) { + -
-
+ + + - -
+ * if something is a React Element. + + + + - show-inline-notes - " data-file-type=".js" data-file-deleted="false"> -
-
- - - - + + * + + + + -
- - Copy path - - - View file - -
+ + * @param {*} type + - - - - - - -
-
- 137 + + - packages/react/src/ReactElement.js + + + * @param {*} props + -
-
-
-
- + + + - - - - + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + + + - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - - - + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + + + - - - +
- - - - @@ -95,17 +95,17 @@ function defineRefPropWarningGetter(props, displayName) {
+ * @param {*} key
-
- * if something is a React Element.
+ * @param {string|object} ref
- - *
+ * @param {*} owner
- + * @param {*} self A *temporary* helper to detect places where `this` is
- * @param {*} type
+ * different from the `owner` when React.createElement is called, so that we
- - * @param {*} props
+ * can warn. We want to get rid of owner and replace string `ref`s with arrow
- - * @param {*} key
+ * functions, and as long as `this` and owner are the same, there will be no
-
- * @param {string|object} ref
+ * change in behavior.
- - * @param {*} owner
+ * @param {*} source An annotation object (added by a transpiler or otherwise)
- + * indicating filename, line number, and/or other information.
- * @param {*} self A *temporary* helper to detect places where `this` is
+ * @param {*} owner
- - * different from the `owner` when React.createElement is called, so that we
+ * @param {*} props
- - * can warn. We want to get rid of owner and replace string `ref`s with arrow
+ * @internal
-
- * functions, and as long as `this` and owner are the same, there will be no
+ */
- - * change in behavior.
+ const ReactElement = function(type, key, ref, self, source, owner, props) {
+ + + + + + + @@ -164,6 +164,139 @@ const ReactElement = function(type, key, ref, self, source, owner, props) {
- - * @param {*} source An annotation object (added by a transpiler or otherwise)
+ return element;
- + };
- * indicating filename, line number, and/or other information.
+
- - * @param {*} owner
+ /**
- - * @param {*} props
+ * https://github.com/reactjs/rfcs/pull/107
-
- * @internal
+ * @param {*} type
- - */
+ * @param {object} props
- + * @param {string} key
- const ReactElement = function(type, key, ref, self, source, owner, props) {
- - - - - - - @@ -164,6 +164,139 @@ const ReactElement = function(type, key, ref, self, source, owner, props) {
+ */
- - return element;
+ export function jsx(type, config, maybeKey) {
-
- };
+ let propName;
- -
+
- + // Reserved names are extracted
- /**
+ const props = {};
- - * https://github.com/reactjs/rfcs/pull/107
+
- - * @param {*} type
+ let key = null;
-
- * @param {object} props
+ let ref = null;
- - * @param {string} key
+
- + if (hasValidRef(config)) {
- */
+ ref = config.ref;
- - export function jsx(type, config, maybeKey) {
+ }
- - let propName;
+
-
-
+ if (hasValidKey(config)) {
- - // Reserved names are extracted
+ key = '' + config.key;
- + }
- const props = {};
+
- -
+ // Remaining properties are added to a new props object
- - let key = null;
+ for (propName in config) {
-
- let ref = null;
+ if (
- -
+ hasOwnProperty.call(config, propName) &&
- + !RESERVED_PROPS.hasOwnProperty(propName)
- if (hasValidRef(config)) {
+ ) {
- - ref = config.ref;
+ props[propName] = config[propName];
- - }
+ }
-
-
+ }
- - if (hasValidKey(config)) {
+
- + // intentionally not checking if key was set above
- key = '' + config.key;
+ // this key is higher priority as it's static
- - }
+ if (maybeKey !== undefined) {
- -
+ key = '' + maybeKey;
-
- // Remaining properties are added to a new props object
+ }
- - for (propName in config) {
+
- + // Resolve default props
- if (
+ if (type && type.defaultProps) {
- - hasOwnProperty.call(config, propName) &&
+ const defaultProps = type.defaultProps;
- - !RESERVED_PROPS.hasOwnProperty(propName)
+ for (propName in defaultProps) {
-
- ) {
+ if (props[propName] === undefined) {
- - props[propName] = config[propName];
+ props[propName] = defaultProps[propName];
- + }
- }
+ }
- - }
+ }
- -
+
-
- // intentionally not checking if key was set above
+ return ReactElement(
- - // this key is higher priority as it's static
+ type,
- + key,
- if (maybeKey !== undefined) {
+ ref,
- - key = '' + maybeKey;
+ undefined,
- - }
+ undefined,
-
-
+ ReactCurrentOwner.current,
- - // Resolve default props
+ props,
- + );
- if (type && type.defaultProps) {
+ }
- - const defaultProps = type.defaultProps;
+
- - for (propName in defaultProps) {
+ /**
-
- if (props[propName] === undefined) {
+ * https://github.com/reactjs/rfcs/pull/107
- - props[propName] = defaultProps[propName];
+ * @param {*} type
- + * @param {object} props
- }
+ * @param {string} key
- - }
+ */
- - }
+ export function jsxDEV(type, config, maybeKey, source, self) {
-
-
+ let propName;
- - return ReactElement(
+
- + // Reserved names are extracted
- type,
+ const props = {};
- - key,
+
- - ref,
+ let key = null;
-
- undefined,
+ let ref = null;
- - undefined,
+
- + if (hasValidRef(config)) {
- ReactCurrentOwner.current,
+ ref = config.ref;
- - props,
+ }
- - );
+
-
- }
+ if (hasValidKey(config)) {
- -
+ key = '' + config.key;
- + }
- /**
+
- - * https://github.com/reactjs/rfcs/pull/107
+ // Remaining properties are added to a new props object
- - * @param {*} type
+ for (propName in config) {
-
- * @param {object} props
+ if (
- - * @param {string} key
+ hasOwnProperty.call(config, propName) &&
- + !RESERVED_PROPS.hasOwnProperty(propName)
- */
+ ) {
- - export function jsxDEV(type, config, maybeKey, source, self) {
+ props[propName] = config[propName];
- - let propName;
+ }
-
-
+ }
- - // Reserved names are extracted
+
- + // intentionally not checking if key was set above
- const props = {};
+ // this key is higher priority as it's static
- -
+ if (maybeKey !== undefined) {
- - let key = null;
+ key = '' + maybeKey;
-
- let ref = null;
+ }
- -
+
- + // Resolve default props
- if (hasValidRef(config)) {
+ if (type && type.defaultProps) {
- - ref = config.ref;
+ const defaultProps = type.defaultProps;
- - }
+ for (propName in defaultProps) {
-
-
+ if (props[propName] === undefined) {
- - if (hasValidKey(config)) {
+ props[propName] = defaultProps[propName];
- + }
- key = '' + config.key;
+ }
- - }
+ }
- -
+
-
- // Remaining properties are added to a new props object
+ if (key || ref) {
- - for (propName in config) {
+ const displayName =
- + typeof type === 'function'
- if (
+ ? type.displayName || type.name || 'Unknown'
- - hasOwnProperty.call(config, propName) &&
+ : type;
- - !RESERVED_PROPS.hasOwnProperty(propName)
+ if (key) {
-
- ) {
+ defineKeyPropWarningGetter(props, displayName);
- - props[propName] = config[propName];
+ }
- + if (ref) {
- }
+ defineRefPropWarningGetter(props, displayName);
- - }
+ }
- -
+ }
-
- // intentionally not checking if key was set above
+
- - // this key is higher priority as it's static
+ return ReactElement(
- + type,
- if (maybeKey !== undefined) {
+ key,
- - key = '' + maybeKey;
+ ref,
- - }
+ self,
-
-
+ source,
- - // Resolve default props
+ ReactCurrentOwner.current,
- + props,
- if (type && type.defaultProps) {
+ );
- - const defaultProps = type.defaultProps;
+ }
- - for (propName in defaultProps) {
+
-
- if (props[propName] === undefined) {
+ /**
- - props[propName] = defaultProps[propName];
+ * Create and return a new ReactElement of the given type.
- + * See https://reactjs.org/docs/react-api.html#createelement
- }
+ + + +
+
- - +
+
- - } - + +
+
+
+ + - - - - - + 136 - - } - + packages/react/src/ReactElementValidator.js + + + + + +
- - +
+
- - - - -
- - - - - - - - if (key || ref) { - + + +
+
+
+
+
+ + + + + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - -
+ + + + @@ -27,7 +27,12 @@ import warning from 'shared/warning';
- + import warningWithoutStack from 'shared/warningWithoutStack';
- ? type.displayName || type.name || 'Unknown'
+
- - : type;
+ import ReactCurrentOwner from './ReactCurrentOwner';
- - if (key) {
+ import {isValidElement, createElement, cloneElement} from './ReactElement';
-
- defineKeyPropWarningGetter(props, displayName);
+ import {
- - }
+ isValidElement,
- + createElement,
- if (ref) {
+ cloneElement,
- - defineRefPropWarningGetter(props, displayName);
+ jsxDEV,
- - }
+ } from './ReactElement';
-
- }
+ import ReactDebugCurrentFrame, {
- -
+ setCurrentlyValidatingElement,
- + } from './ReactDebugCurrentFrame';
- return ReactElement(
+ + + + @@ -48,20 +53,22 @@ function getDeclarationErrorAddendum() {
- + return '';
- type,
+ }
- - key,
+
- - ref,
+ function getSourceInfoErrorAddendum(elementProps) {
-
- self,
+ if (
- - source,
+ elementProps !== null &&
- + elementProps !== undefined &&
- ReactCurrentOwner.current,
+ elementProps.__source !== undefined
- - props,
+ ) {
- - );
+ const source = elementProps.__source;
-
- }
+ function getSourceInfoErrorAddendum(source) {
- -
+ if (source !== undefined) {
- + const fileName = source.fileName.replace(/^.*[\\\/]/, '');
- /**
+ const lineNumber = source.lineNumber;
- - * Create and return a new ReactElement of the given type.
+ return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
- - * See https://reactjs.org/docs/react-api.html#createelement
+ }
- - - -
-
+ + -
-
+ + + return ''; + - -
+ + + + } + - show-inline-notes - " data-file-type=".js" data-file-deleted="false"> -
-
- - - - + + + + +
+ -
- - Copy path - - - View file - -
- - - + + - - - -
-
- 136 + - packages/react/src/ReactElementValidator.js + + function getSourceInfoErrorAddendumForProps(elementProps) { + -
+ + -
-
-
- + + + - - - - - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - - - + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - - - + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + + + - - +
+ if (elementProps !== null && elementProps !== undefined) {
- - - - @@ -27,7 +27,12 @@ import warning from 'shared/warning';
- - import warningWithoutStack from 'shared/warningWithoutStack';
+ return getSourceInfoErrorAddendum(elementProps.__source);
- + }
-
+ return '';
- - import ReactCurrentOwner from './ReactCurrentOwner';
+ }
- - import {isValidElement, createElement, cloneElement} from './ReactElement';
+
-
- import {
+ /**
- - isValidElement,
+ * Warn if there's no key explicitly set on dynamic arrays of children or
- + * object keys are not valid. This allows us to keep track of children between
- createElement,
+ + + + + + + @@ -259,6 +266,117 @@ function validateFragmentProps(fragment) {
- + setCurrentlyValidatingElement(null);
- cloneElement,
+ }
- - jsxDEV,
+
- - } from './ReactElement';
+ export function jsxWithValidation(
-
- import ReactDebugCurrentFrame, {
+ type,
- - setCurrentlyValidatingElement,
+ props,
- + key,
- } from './ReactDebugCurrentFrame';
- - - - @@ -48,20 +53,22 @@ function getDeclarationErrorAddendum() {
+ isStaticChildren,
- - return '';
+ source,
-
- }
+ self,
- -
+ ) {
- + const validType = isValidElementType(type);
- function getSourceInfoErrorAddendum(elementProps) {
+
- - if (
+ // We warn in this case but don't throw. We expect the element creation to
- - elementProps !== null &&
+ // succeed and there will likely be errors in render.
-
- elementProps !== undefined &&
+ if (!validType) {
- - elementProps.__source !== undefined
+ let info = '';
- + if (
- ) {
+ type === undefined ||
- - const source = elementProps.__source;
+ (typeof type === 'object' &&
- - function getSourceInfoErrorAddendum(source) {
+ type !== null &&
-
- if (source !== undefined) {
+ Object.keys(type).length === 0)
- - const fileName = source.fileName.replace(/^.*[\\\/]/, '');
+ ) {
- + info +=
- const lineNumber = source.lineNumber;
+ ' You likely forgot to export your component from the file ' +
- - return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';
+ "it's defined in, or you might have mixed up default and named imports.";
- - }
+ }
-
- return '';
+
- - }
+ const sourceInfo = getSourceInfoErrorAddendum(source);
- + if (sourceInfo) {
-
+ info += sourceInfo;
- - function getSourceInfoErrorAddendumForProps(elementProps) {
+ } else {
- - if (elementProps !== null && elementProps !== undefined) {
+ info += getDeclarationErrorAddendum();
-
- return getSourceInfoErrorAddendum(elementProps.__source);
+ }
- - }
+
- + let typeString;
- return '';
+ if (type === null) {
- - }
+ typeString = 'null';
- -
+ } else if (Array.isArray(type)) {
-
- /**
+ typeString = 'array';
- - * Warn if there's no key explicitly set on dynamic arrays of children or
+ } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
- + typeString = `<${getComponentName(type.type) || 'Unknown'} />`;
- * object keys are not valid. This allows us to keep track of children between
- - - - - - - @@ -259,6 +266,117 @@ function validateFragmentProps(fragment) {
+ info =
- - setCurrentlyValidatingElement(null);
+ ' Did you accidentally export a JSX literal instead of a component?';
-
- }
+ } else {
- -
+ typeString = typeof type;
- + }
- export function jsxWithValidation(
+
- - type,
+ warning(
- - props,
+ false,
-
- key,
+ 'React.jsx: type is invalid -- expected a string (for ' +
- - isStaticChildren,
+ 'built-in components) or a class/function (for composite ' +
- + 'components) but got: %s.%s',
- source,
+ typeString,
- - self,
+ info,
- - ) {
+ );
-
- const validType = isValidElementType(type);
+ }
- -
+
- + const element = jsxDEV(type, props, key, source, self);
- // We warn in this case but don't throw. We expect the element creation to
+
- - // succeed and there will likely be errors in render.
+ // The result can be nullish if a mock or a custom function is used.
- - if (!validType) {
+ // TODO: Drop this when these are no longer allowed as the type argument.
-
- let info = '';
+ if (element == null) {
- - if (
+ return element;
- + }
- type === undefined ||
+
- - (typeof type === 'object' &&
+ // Skip key warning if the type isn't valid since our key validation logic
- - type !== null &&
+ // doesn't expect a non-string/function type and can throw confusing errors.
-
- Object.keys(type).length === 0)
+ // We don't want exception behavior to differ between dev and prod.
- - ) {
+ // (Rendering will throw with a helpful message and as soon as the type is
- + // fixed, the key warnings will appear.)
- info +=
+ if (validType) {
- - ' You likely forgot to export your component from the file ' +
+ const children = props.children;
- - "it's defined in, or you might have mixed up default and named imports.";
+ if (children !== undefined) {
-
- }
+ if (isStaticChildren) {
- -
+ for (let i = 0; i < children.length; i++) {
- + validateChildKeys(children[i], type);
- const sourceInfo = getSourceInfoErrorAddendum(source);
+ }
- - if (sourceInfo) {
+ } else {
- - info += sourceInfo;
+ validateChildKeys(children, type);
-
- } else {
+ }
- - info += getDeclarationErrorAddendum();
+ }
- + }
- }
+
- -
+ if (props.key !== undefined) {
- - let typeString;
+ warning(
-
- if (type === null) {
+ false,
- - typeString = 'null';
+ 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' +
- + 'Explicitly pass a key after spreading props in your JSX call. ' +
- } else if (Array.isArray(type)) {
+ 'E.g. <ComponentName {...props} key={key} />',
- - typeString = 'array';
+ );
- - } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {
+ }
-
- typeString = `<${getComponentName(type.type) || 'Unknown'} />`;
+
- - info =
+ if (type === REACT_FRAGMENT_TYPE) {
- + validateFragmentProps(element);
- ' Did you accidentally export a JSX literal instead of a component?';
+ } else {
- - } else {
+ validatePropTypes(element);
- - typeString = typeof type;
+ }
-
- }
+
- -
+ return element;
- + }
- warning(
+
- - false,
+ // These two functions exist to still get child warnings in dev
- - 'React.jsx: type is invalid -- expected a string (for ' +
+ // even with the prod transform. This means that jsxDEV is purely
-
- 'built-in components) or a class/function (for composite ' +
+ // opt-in behavior for better messages but that we won't stop
- - 'components) but got: %s.%s',
+ // giving you warnings if you use production apis.
- + export function jsxWithValidationStatic(type, props, key) {
- typeString,
+ return jsxWithValidation(type, props, key, true);
- - info,
+ }
- - );
+
-
- }
+ export function jsxWithValidationDynamic(type, props, key) {
- -
+ return jsxWithValidation(type, props, key, false);
- + }
- const element = jsxDEV(type, props, key, source, self);
+
- -
+ export function createElementWithValidation(type, props, children) {
- - // The result can be nullish if a mock or a custom function is used.
+ const validType = isValidElementType(type);
-
- // TODO: Drop this when these are no longer allowed as the type argument.
+
+ + + + @@ -277,7 +395,7 @@ export function createElementWithValidation(type, props, children) {
-
- if (element == null) {
+ "it's defined in, or you might have mixed up default and named imports.";
- - return element;
+ }
- +
- }
+ const sourceInfo = getSourceInfoErrorAddendum(props);
- -
+ const sourceInfo = getSourceInfoErrorAddendumForProps(props);
- - // Skip key warning if the type isn't valid since our key validation logic
+ if (sourceInfo) {
-
- // doesn't expect a non-string/function type and can throw confusing errors.
+ info += sourceInfo;
- - // We don't want exception behavior to differ between dev and prod.
+ } else {
+ + + +
-
+
- - // (Rendering will throw with a helpful message and as soon as the type is - +
+
+
+
+ + +
+
+
+ - - - + - - - - // fixed, the key warnings will appear.) - + 364 + packages/react/src/__tests__/ReactElementJSX-test.internal.js + + + + - - - + +
- - +
+
- - if (validType) { - - - - - - - - const children = props.children; - - - + - + +
+
+
+
+
+ - + + + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - - + + -
@@ -0,0 +1,364 @@
-
- for (let i = 0; i < children.length; i++) {
+ /**
- - validateChildKeys(children[i], type);
+ * Copyright (c) Facebook, Inc. and its affiliates.
- + *
- }
+ * This source code is licensed under the MIT license found in the
- - } else {
+ * LICENSE file in the root directory of this source tree.
- - validateChildKeys(children, type);
+ *
-
- }
+ * @emails react-core
- - }
+ */
- +
- }
+ 'use strict';
- -
+
- - if (props.key !== undefined) {
+ let React;
-
- warning(
+ let ReactDOM;
- - false,
+ let ReactFeatureFlags;
- + let ReactTestUtils;
- 'React.jsx: Spreading a key to JSX is a deprecated pattern. ' +
+
- - 'Explicitly pass a key after spreading props in your JSX call. ' +
+ // NOTE: We're explicitly not using JSX here. This is intended to test
- - 'E.g. <ComponentName {...props} key={key} />',
+ // a new React.jsx api which does not have a JSX transformer yet.
-
- );
+ // A lot of these tests are pulled from ReactElement-test because
- - }
+ // this api is meant to be backwards compatible.
- + describe('ReactElement.jsx', () => {
-
+ let originalSymbol;
- - if (type === REACT_FRAGMENT_TYPE) {
+
- - validateFragmentProps(element);
+ beforeEach(() => {
-
- } else {
+ jest.resetModules();
- - validatePropTypes(element);
+
- + // Delete the native Symbol if we have one to ensure we test the
- }
+ // unpolyfilled environment.
- -
+ originalSymbol = global.Symbol;
- - return element;
+ global.Symbol = undefined;
-
- }
+
- -
+ ReactFeatureFlags = require('shared/ReactFeatureFlags');
- + ReactFeatureFlags.enableJSXTransformAPI = true;
- // These two functions exist to still get child warnings in dev
+
- - // even with the prod transform. This means that jsxDEV is purely
+ React = require('react');
- - // opt-in behavior for better messages but that we won't stop
+ ReactDOM = require('react-dom');
-
- // giving you warnings if you use production apis.
+ ReactTestUtils = require('react-dom/test-utils');
- - export function jsxWithValidationStatic(type, props, key) {
+ });
- +
- return jsxWithValidation(type, props, key, true);
+ afterEach(() => {
- - }
+ global.Symbol = originalSymbol;
- -
+ });
-
- export function jsxWithValidationDynamic(type, props, key) {
+
- - return jsxWithValidation(type, props, key, false);
+ it('allows static methods to be called using the type property', () => {
- + class StaticMethodComponentClass extends React.Component {
- }
+ render() {
- -
+ return React.jsx('div', {});
- - export function createElementWithValidation(type, props, children) {
+ }
-
- const validType = isValidElementType(type);
+ }
- -
+ StaticMethodComponentClass.someStaticMethod = () => 'someReturnValue';
- - - - @@ -277,7 +395,7 @@ export function createElementWithValidation(type, props, children) {
+
- - "it's defined in, or you might have mixed up default and named imports.";
+ const element = React.jsx(StaticMethodComponentClass, {});
- - }
+ expect(element.type.someStaticMethod()).toBe('someReturnValue');
-
-
+ });
- - const sourceInfo = getSourceInfoErrorAddendum(props);
+
- + it('identifies valid elements', () => {
- const sourceInfo = getSourceInfoErrorAddendumForProps(props);
+ class Component extends React.Component {
- - if (sourceInfo) {
+ render() {
- - info += sourceInfo;
+ return React.jsx('div', {});
-
- } else {
+ }
- - - -
-
+ -
-
+ + } + -
-
- -
+ + + +
+ - show-inline-notes - " data-file-type=".js" data-file-deleted="false"> -
-
- - - - + + + + + expect(React.isValidElement(React.jsx('div', {}))).toEqual(true); + -
- - Copy path - - - View file - -
+ + + - - - + + expect(React.isValidElement(React.jsx(Component, {}))).toEqual(true); + - - - -
- + +
+ -
-
-
- - - - - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - - - +
@@ -0,0 +1,364 @@
+ expect(React.isValidElement(null)).toEqual(false);
- - /**
+ expect(React.isValidElement(true)).toEqual(false);
- - * Copyright (c) Facebook, Inc. and its affiliates.
+ expect(React.isValidElement({})).toEqual(false);
-
- *
+ expect(React.isValidElement('string')).toEqual(false);
- - * This source code is licensed under the MIT license found in the
+ expect(React.isValidElement(React.createFactory('div'))).toEqual(false);
- + expect(React.isValidElement(Component)).toEqual(false);
- * LICENSE file in the root directory of this source tree.
+ expect(React.isValidElement({type: 'div', props: {}})).toEqual(false);
- - *
+
- - * @emails react-core
+ const jsonElement = JSON.stringify(React.jsx('div', {}));
-
- */
+ expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true);
- -
+ });
- +
- 'use strict';
+ it('is indistinguishable from a plain object', () => {
- -
+ const element = React.jsx('div', {className: 'foo'});
- - let React;
+ const object = {};
-
- let ReactDOM;
+ expect(element.constructor).toBe(object.constructor);
- - let ReactFeatureFlags;
+ });
- +
- let ReactTestUtils;
+ it('should use default prop value when removing a prop', () => {
- -
+ class Component extends React.Component {
- - // NOTE: We're explicitly not using JSX here. This is intended to test
+ render() {
-
- // a new React.jsx api which does not have a JSX transformer yet.
+ return React.jsx('span', {});
- - // A lot of these tests are pulled from ReactElement-test because
+ }
- + }
- // this api is meant to be backwards compatible.
+ Component.defaultProps = {fruit: 'persimmon'};
- - describe('ReactElement.jsx', () => {
+
- - let originalSymbol;
+ const container = document.createElement('div');
-
-
+ const instance = ReactDOM.render(
- - beforeEach(() => {
+ React.jsx(Component, {fruit: 'mango'}),
- + container,
- jest.resetModules();
+ );
- -
+ expect(instance.props.fruit).toBe('mango');
- - // Delete the native Symbol if we have one to ensure we test the
+
-
- // unpolyfilled environment.
+ ReactDOM.render(React.jsx(Component, {}), container);
- - originalSymbol = global.Symbol;
+ expect(instance.props.fruit).toBe('persimmon');
- + });
- global.Symbol = undefined;
+
- -
+ it('should normalize props with default values', () => {
- - ReactFeatureFlags = require('shared/ReactFeatureFlags');
+ class Component extends React.Component {
-
- ReactFeatureFlags.enableJSXTransformAPI = true;
+ render() {
- -
+ return React.jsx('span', {children: this.props.prop});
- + }
- React = require('react');
+ }
- - ReactDOM = require('react-dom');
+ Component.defaultProps = {prop: 'testKey'};
- - ReactTestUtils = require('react-dom/test-utils');
+
-
- });
+ const instance = ReactTestUtils.renderIntoDocument(
- -
+ React.jsx(Component, {}),
- + );
- afterEach(() => {
+ expect(instance.props.prop).toBe('testKey');
- - global.Symbol = originalSymbol;
+
- - });
+ const inst2 = ReactTestUtils.renderIntoDocument(
-
-
+ React.jsx(Component, {prop: null}),
- - it('allows static methods to be called using the type property', () => {
+ );
- + expect(inst2.props.prop).toBe(null);
- class StaticMethodComponentClass extends React.Component {
+ });
- - render() {
+
- - return React.jsx('div', {});
+ it('throws when changing a prop (in dev) after element creation', () => {
-
- }
+ class Outer extends React.Component {
- - }
+ render() {
- + const el = React.jsx('div', {className: 'moo'});
- StaticMethodComponentClass.someStaticMethod = () => 'someReturnValue';
+
- -
+ if (__DEV__) {
- - const element = React.jsx(StaticMethodComponentClass, {});
+ expect(function() {
-
- expect(element.type.someStaticMethod()).toBe('someReturnValue');
+ el.props.className = 'quack';
- - });
+ }).toThrow();
- + expect(el.props.className).toBe('moo');
-
+ } else {
- - it('identifies valid elements', () => {
+ el.props.className = 'quack';
- - class Component extends React.Component {
+ expect(el.props.className).toBe('quack');
-
- render() {
+ }
- - return React.jsx('div', {});
+
- + return el;
- }
+ }
- - }
+ }
- -
+ const outer = ReactTestUtils.renderIntoDocument(
-
- expect(React.isValidElement(React.jsx('div', {}))).toEqual(true);
+ React.jsx(Outer, {color: 'orange'}),
- - expect(React.isValidElement(React.jsx(Component, {}))).toEqual(true);
+ );
- + if (__DEV__) {
-
+ expect(ReactDOM.findDOMNode(outer).className).toBe('moo');
- - expect(React.isValidElement(null)).toEqual(false);
+ } else {
- - expect(React.isValidElement(true)).toEqual(false);
+ expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
-
- expect(React.isValidElement({})).toEqual(false);
+ }
- - expect(React.isValidElement('string')).toEqual(false);
+ });
- +
- expect(React.isValidElement(React.createFactory('div'))).toEqual(false);
+ it('throws when adding a prop (in dev) after element creation', () => {
- - expect(React.isValidElement(Component)).toEqual(false);
+ const container = document.createElement('div');
- - expect(React.isValidElement({type: 'div', props: {}})).toEqual(false);
+ class Outer extends React.Component {
-
-
+ render() {
- - const jsonElement = JSON.stringify(React.jsx('div', {}));
+ const el = React.jsx('div', {children: this.props.sound});
- +
- expect(React.isValidElement(JSON.parse(jsonElement))).toBe(true);
+ if (__DEV__) {
- - });
+ expect(function() {
- -
+ el.props.className = 'quack';
-
- it('is indistinguishable from a plain object', () => {
+ }).toThrow();
- - const element = React.jsx('div', {className: 'foo'});
+ expect(el.props.className).toBe(undefined);
- + } else {
- const object = {};
+ el.props.className = 'quack';
- - expect(element.constructor).toBe(object.constructor);
+ expect(el.props.className).toBe('quack');
- - });
+ }
-
-
+
- - it('should use default prop value when removing a prop', () => {
+ return el;
- + }
- class Component extends React.Component {
+ }
- - render() {
+ Outer.defaultProps = {sound: 'meow'};
- - return React.jsx('span', {});
+ const outer = ReactDOM.render(React.jsx(Outer, {}), container);
-
- }
+ expect(ReactDOM.findDOMNode(outer).textContent).toBe('meow');
- - }
+ if (__DEV__) {
- + expect(ReactDOM.findDOMNode(outer).className).toBe('');
- Component.defaultProps = {fruit: 'persimmon'};
+ } else {
- -
+ expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
- - const container = document.createElement('div');
+ }
-
- const instance = ReactDOM.render(
+ });
- - React.jsx(Component, {fruit: 'mango'}),
+
- + it('does not warn for NaN props', () => {
- container,
+ class Test extends React.Component {
- - );
+ render() {
- - expect(instance.props.fruit).toBe('mango');
+ return React.jsx('div', {});
-
-
+ }
- - ReactDOM.render(React.jsx(Component, {}), container);
+ }
- + const test = ReactTestUtils.renderIntoDocument(
- expect(instance.props.fruit).toBe('persimmon');
+ React.jsx(Test, {value: +undefined}),
- - });
+ );
- -
+ expect(test.props.value).toBeNaN();
-
- it('should normalize props with default values', () => {
+ });
- - class Component extends React.Component {
+
- + it('should warn when `key` is being accessed on composite element', () => {
- render() {
+ const container = document.createElement('div');
- - return React.jsx('span', {children: this.props.prop});
+ class Child extends React.Component {
- - }
+ render() {
-
- }
+ return React.jsx('div', {children: this.props.key});
- - Component.defaultProps = {prop: 'testKey'};
+ }
- + }
-
+ class Parent extends React.Component {
- - const instance = ReactTestUtils.renderIntoDocument(
+ render() {
- - React.jsx(Component, {}),
+ return React.jsxs('div', {
-
- );
+ children: [
- - expect(instance.props.prop).toBe('testKey');
+ React.jsx(Child, {}, '0'),
- + React.jsx(Child, {}, '1'),
-
+ React.jsx(Child, {}, '2'),
- - const inst2 = ReactTestUtils.renderIntoDocument(
+ ],
- - React.jsx(Component, {prop: null}),
+ });
-
- );
+ }
- - expect(inst2.props.prop).toBe(null);
+ }
- + expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
- });
+ 'Child: `key` is not a prop. Trying to access it will result ' +
- -
+ 'in `undefined` being returned. If you need to access the same ' +
- - it('throws when changing a prop (in dev) after element creation', () => {
+ 'value within the child component, you should pass it as a different ' +
-
- class Outer extends React.Component {
+ 'prop. (https://fb.me/react-special-props)',
- - render() {
+ {withoutStack: true},
- + );
- const el = React.jsx('div', {className: 'moo'});
+ });
- -
+
- - if (__DEV__) {
+ it('should warn when `key` is being accessed on a host element', () => {
-
- expect(function() {
+ const element = React.jsxs('div', {}, '3');
- - el.props.className = 'quack';
+ expect(() => void element.props.key).toWarnDev(
- + 'div: `key` is not a prop. Trying to access it will result ' +
- }).toThrow();
+ 'in `undefined` being returned. If you need to access the same ' +
- - expect(el.props.className).toBe('moo');
+ 'value within the child component, you should pass it as a different ' +
- - } else {
+ 'prop. (https://fb.me/react-special-props)',
-
- el.props.className = 'quack';
+ {withoutStack: true},
- - expect(el.props.className).toBe('quack');
+ );
- + });
- }
+
- -
+ it('should warn when `ref` is being accessed', () => {
- - return el;
+ const container = document.createElement('div');
-
- }
+ class Child extends React.Component {
- - }
+ render() {
- + return React.jsx('div', {children: this.props.ref});
- const outer = ReactTestUtils.renderIntoDocument(
+ }
- - React.jsx(Outer, {color: 'orange'}),
+ }
- - );
+ class Parent extends React.Component {
-
- if (__DEV__) {
+ render() {
- - expect(ReactDOM.findDOMNode(outer).className).toBe('moo');
+ return React.jsx('div', {
- + children: React.jsx(Child, {ref: 'childElement'}),
- } else {
+ });
- - expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
+ }
- - }
+ }
-
- });
+ expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
- -
+ 'Child: `ref` is not a prop. Trying to access it will result ' +
- + 'in `undefined` being returned. If you need to access the same ' +
- it('throws when adding a prop (in dev) after element creation', () => {
+ 'value within the child component, you should pass it as a different ' +
- - const container = document.createElement('div');
+ 'prop. (https://fb.me/react-special-props)',
- - class Outer extends React.Component {
+ {withoutStack: true},
-
- render() {
+ );
- - const el = React.jsx('div', {children: this.props.sound});
+ });
- +
-
+ it('identifies elements, but not JSON, if Symbols are supported', () => {
- - if (__DEV__) {
+ // Rudimentary polyfill
- - expect(function() {
+ // Once all jest engines support Symbols natively we can swap this to test
-
- el.props.className = 'quack';
+ // WITH native Symbols by default.
- - }).toThrow();
+ const REACT_ELEMENT_TYPE = function() {}; // fake Symbol
- + const OTHER_SYMBOL = function() {}; // another fake Symbol
- expect(el.props.className).toBe(undefined);
+ global.Symbol = function(name) {
- - } else {
+ return OTHER_SYMBOL;
- - el.props.className = 'quack';
+ };
-
- expect(el.props.className).toBe('quack');
+ global.Symbol.for = function(key) {
- - }
+ if (key === 'react.element') {
- + return REACT_ELEMENT_TYPE;
-
+ }
- - return el;
+ return OTHER_SYMBOL;
- - }
+ };
-
- }
+
- - Outer.defaultProps = {sound: 'meow'};
+ jest.resetModules();
- +
- const outer = ReactDOM.render(React.jsx(Outer, {}), container);
+ ReactFeatureFlags = require('shared/ReactFeatureFlags');
- - expect(ReactDOM.findDOMNode(outer).textContent).toBe('meow');
+ ReactFeatureFlags.enableJSXTransformAPI = true;
- - if (__DEV__) {
+
-
- expect(ReactDOM.findDOMNode(outer).className).toBe('');
+ React = require('react');
- - } else {
+
- + class Component extends React.Component {
- expect(ReactDOM.findDOMNode(outer).className).toBe('quack');
+ render() {
- - }
+ return React.jsx('div');
- - });
+ }
-
-
+ }
- - it('does not warn for NaN props', () => {
+
- + expect(React.isValidElement(React.jsx('div', {}))).toEqual(true);
- class Test extends React.Component {
+ expect(React.isValidElement(React.jsx(Component, {}))).toEqual(true);
- - render() {
+
- - return React.jsx('div', {});
+ expect(React.isValidElement(null)).toEqual(false);
-
- }
+ expect(React.isValidElement(true)).toEqual(false);
- - }
+ expect(React.isValidElement({})).toEqual(false);
- + expect(React.isValidElement('string')).toEqual(false);
- const test = ReactTestUtils.renderIntoDocument(
+ expect(React.isValidElement(React.createFactory('div'))).toEqual(false);
- - React.jsx(Test, {value: +undefined}),
+ expect(React.isValidElement(Component)).toEqual(false);
- - );
+ expect(React.isValidElement({type: 'div', props: {}})).toEqual(false);
-
- expect(test.props.value).toBeNaN();
+
- - });
+ const jsonElement = JSON.stringify(React.jsx('div', {}));
- + expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false);
-
+ });
- - it('should warn when `key` is being accessed on composite element', () => {
+
- - const container = document.createElement('div');
+ it('should warn when unkeyed children are passed to jsx', () => {
-
- class Child extends React.Component {
+ const container = document.createElement('div');
- - render() {
+ class Child extends React.Component {
- + render() {
- return React.jsx('div', {children: this.props.key});
+ return React.jsx('div', {});
- - }
+ }
- - }
+ }
-
- class Parent extends React.Component {
+ class Parent extends React.Component {
- - render() {
+ render() {
- + return React.jsx('div', {
- return React.jsxs('div', {
+ children: [
- - children: [
+ React.jsx(Child, {}),
- - React.jsx(Child, {}, '0'),
+ React.jsx(Child, {}),
-
- React.jsx(Child, {}, '1'),
+ React.jsx(Child, {}),
- - React.jsx(Child, {}, '2'),
+ ],
- + });
- ],
+ }
- - });
+ }
- - }
+ expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
-
- }
+ 'Warning: Each child in a list should have a unique "key" prop.\n\n' +
- - expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
+ 'Check the render method of `Parent`. See https://fb.me/react-warning-keys for more information.\n' +
- + ' in Child (created by Parent)\n' +
- 'Child: `key` is not a prop. Trying to access it will result ' +
+ ' in Parent',
- - 'in `undefined` being returned. If you need to access the same ' +
+ );
- - 'value within the child component, you should pass it as a different ' +
+ });
-
- 'prop. (https://fb.me/react-special-props)',
+
- - {withoutStack: true},
+ it('should warn when keys are passed as part of props', () => {
- + const container = document.createElement('div');
- );
+ class Child extends React.Component {
- - });
+ render() {
- -
+ return React.jsx('div', {});
-
- it('should warn when `key` is being accessed on a host element', () => {
+ }
- - const element = React.jsxs('div', {}, '3');
+ }
- + class Parent extends React.Component {
- expect(() => void element.props.key).toWarnDev(
+ render() {
- - 'div: `key` is not a prop. Trying to access it will result ' +
+ return React.jsx('div', {
- - 'in `undefined` being returned. If you need to access the same ' +
+ children: [React.jsx(Child, {key: '0'})],
-
- 'value within the child component, you should pass it as a different ' +
+ });
- - 'prop. (https://fb.me/react-special-props)',
+ }
- + }
- {withoutStack: true},
+ expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
- - );
+ 'Warning: React.jsx: Spreading a key to JSX is a deprecated pattern. ' +
- - });
+ 'Explicitly pass a key after spreading props in your JSX call. ' +
-
-
+ 'E.g. <ComponentName {...props} key={key} />',
- - it('should warn when `ref` is being accessed', () => {
+ );
- + });
- const container = document.createElement('div');
+
- - class Child extends React.Component {
+ it('should not warn when unkeyed children are passed to jsxs', () => {
- - render() {
+ const container = document.createElement('div');
-
- return React.jsx('div', {children: this.props.ref});
+ class Child extends React.Component {
- - }
+ render() {
- + return React.jsx('div', {});
- }
+ }
- - class Parent extends React.Component {
+ }
- - render() {
+ class Parent extends React.Component {
-
- return React.jsx('div', {
+ render() {
- - children: React.jsx(Child, {ref: 'childElement'}),
+ return React.jsxs('div', {
- + children: [
- });
+ React.jsx(Child, {}),
- - }
+ React.jsx(Child, {}),
- - }
+ React.jsx(Child, {}),
-
- expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
+ ],
- - 'Child: `ref` is not a prop. Trying to access it will result ' +
+ });
- + }
- 'in `undefined` being returned. If you need to access the same ' +
+ }
- - 'value within the child component, you should pass it as a different ' +
+ // TODO: an explicit expect for no warning?
- - 'prop. (https://fb.me/react-special-props)',
+ ReactDOM.render(React.jsx(Parent, {}), container);
-
- {withoutStack: true},
+ });
- - );
+ });
-
+
- - }); - +
+
+ +
+
+
+ - - + - - - - -
- + 3 + packages/shared/ReactFeatureFlags.js + + + + - - + +
- +
+
- - - - it('identifies elements, but not JSON, if Symbols are supported', () => { - - - - - - - - // Rudimentary polyfill - + - - + +
+
+
+
+
+ - - + + + + + - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - - - - +
+ + + + @@ -68,3 +68,6 @@ export const enableEventAPI = false;
- - const REACT_ELEMENT_TYPE = function() {}; // fake Symbol
+ // Enables rewritten version of ReactFiberScheduler. Added in case we need to
- + // quickly revert it.
- const OTHER_SYMBOL = function() {}; // another fake Symbol
+ export const enableNewScheduler = false;
- - global.Symbol = function(name) {
+
- - return OTHER_SYMBOL;
+ // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
-
- };
+ export const enableJSXTransformAPI = false;
- - global.Symbol.for = function(key) {
+
+
+
+ +
+
+
+ - - - + - - - - if (key === 'react.element') { - + 1 + packages/shared/forks/ReactFeatureFlags.native-fb.js + + + + - - - + +
- - +
+
- - return REACT_ELEMENT_TYPE; - - - - - - - - } - - - + - + +
+
+
+
+
+ - + + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + + + - - - +
+ + + + @@ -32,6 +32,7 @@ export const warnAboutDeprecatedLifecycles = true;
-
-
+ export const warnAboutDeprecatedSetNativeProps = true;
- - jest.resetModules();
+ export const enableEventAPI = false;
- + export const enableNewScheduler = false;
-
+ export const enableJSXTransformAPI = false;
- - ReactFeatureFlags = require('shared/ReactFeatureFlags');
+
- - ReactFeatureFlags.enableJSXTransformAPI = true;
+ // Only used in www builds.
-
-
+ export function addUserTimingListener() {
+ + + +
- - React = require('react');
+
+
+
+ +
+
+
+ - - - + - - - -
- + 1 + packages/shared/forks/ReactFeatureFlags.native-oss.js + + + + - - - + +
- - +
+
- - class Component extends React.Component { - - - - - - - - render() { - - - + - + +
+
+
+
+
+ - + + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - + + + + - - - +
+ + + + @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
-
- }
+ export const warnAboutDeprecatedSetNativeProps = false;
- -
+ export const enableEventAPI = false;
- + export const enableNewScheduler = false;
- expect(React.isValidElement(React.jsx('div', {}))).toEqual(true);
+ export const enableJSXTransformAPI = false;
- - expect(React.isValidElement(React.jsx(Component, {}))).toEqual(true);
+
- -
+ // Only used in www builds.
-
- expect(React.isValidElement(null)).toEqual(false);
+ export function addUserTimingListener() {
+ + + +
- - expect(React.isValidElement(true)).toEqual(false);
+
+
+
+ +
+
+
+ - - - + - - - - expect(React.isValidElement({})).toEqual(false); - + 1 + packages/shared/forks/ReactFeatureFlags.new-scheduler.js + + + + - - - + +
- - +
+
- - expect(React.isValidElement('string')).toEqual(false); - - - - - - - - expect(React.isValidElement(React.createFactory('div'))).toEqual(false); - - - + - + +
+
+
+
+
+ - + + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - - - +
+ + + + @@ -26,5 +26,6 @@ export const enableStableConcurrentModeAPIs = false;
-
-
+ export const warnAboutShorthandPropertyCollision = false;
- - const jsonElement = JSON.stringify(React.jsx('div', {}));
+ export const warnAboutDeprecatedSetNativeProps = false;
- + export const enableEventAPI = false;
- expect(React.isValidElement(JSON.parse(jsonElement))).toBe(false);
+ export const enableJSXTransformAPI = false;
- - });
+
- -
+ export const enableNewScheduler = true;
- - it('should warn when unkeyed children are passed to jsx', () => {
+
+
+
- - + +
+
+
+ - - - + - - const container = document.createElement('div'); - + 1 - - + packages/shared/forks/ReactFeatureFlags.persistent.js + + + + - - - + +
- - class Child extends React.Component { - +
+
- - - - - - - render() { - - - - + - - + +
+
+
+
+
+ - + + + + + - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + + + - - +
-
+ + + + @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
- }
+ export const warnAboutDeprecatedSetNativeProps = false;
-
- class Parent extends React.Component {
+ export const enableEventAPI = false;
- - render() {
+ export const enableNewScheduler = false;
- + export const enableJSXTransformAPI = false;
- return React.jsx('div', {
+
- - children: [
+ // Only used in www builds.
- - React.jsx(Child, {}),
+ export function addUserTimingListener() {
-
+ + + +
- React.jsx(Child, {}),
+
+
+
- - + +
+
+
+ - - - + - - React.jsx(Child, {}), - + 1 - - + packages/shared/forks/ReactFeatureFlags.test-renderer.js + + + + - - - + +
- - ], - +
+
- - - - - - - }); - - - - + - - + +
+
+
+
+
+ - + + + + + - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + + + - - +
-
+ + + + @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
- expect(() => ReactDOM.render(React.jsx(Parent, {}), container)).toWarnDev(
+ export const warnAboutDeprecatedSetNativeProps = false;
-
- 'Warning: Each child in a list should have a unique "key" prop.\n\n' +
+ export const enableEventAPI = false;
- - 'Check the render method of `Parent`. See https://fb.me/react-warning-keys for more information.\n' +
+ export const enableNewScheduler = false;
- + export const enableJSXTransformAPI = false;
- ' in Child (created by Parent)\n' +
+
- - ' in Parent',
+ // Only used in www builds.
- - );
+ export function addUserTimingListener() {
-
+ + + +
- });
+
+
+
- - + +
+
+
+ - - - + - -
- + 1 - - + packages/shared/forks/ReactFeatureFlags.test-renderer.www.js + + + + - - - + +
- - it('should warn when keys are passed as part of props', () => { - +
+
- - - - - - - const container = document.createElement('div'); - - - - + - - + +
+
+
+
+
+ - + + + + + - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + + + - - +
-
+ + + + @@ -27,6 +27,7 @@ export const disableJavaScriptURLs = false;
- return React.jsx('div', {});
+ export const disableYielding = false;
-
- }
+ export const enableEventAPI = true;
- - }
+ export const enableNewScheduler = false;
- + export const enableJSXTransformAPI = true;
- class Parent extends React.Component {
+
- - render() {
+ // Only used in www builds.
- - return React.jsx('div', {
+ export function addUserTimingListener() {
-
+ + + +
- children: [React.jsx(Child, {key: '0'})],
+
+
+
- - + +
+
+
+ - - - + - - }); - + 1 - - + packages/shared/forks/ReactFeatureFlags.www-new-scheduler.js + + + + - - - + +
- - } - +
+
- - - - - - - } - - - - + - - + +
+
+
+
+
+ - + + + + + - - + + + + + - - - - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + + + - - +
-
+ + + + @@ -31,6 +31,7 @@ export {
- 'Explicitly pass a key after spreading props in your JSX call. ' +
+ } from './ReactFeatureFlags.www';
-
- 'E.g. <ComponentName {...props} key={key} />',
+
- - );
+ export const enableNewScheduler = true;
- + export const enableJSXTransformAPI = true;
- });
+
- -
+ // Flow magic to verify the exports of this file match the original version.
- - it('should not warn when unkeyed children are passed to jsxs', () => {
+ // eslint-disable-next-line no-unused-vars
-
+ + + +
- const container = document.createElement('div');
+
+
+
- - + +
+
+
+ - - - + - - class Child extends React.Component { - + 2 - - + packages/shared/forks/ReactFeatureFlags.www.js + + + + - - - + +
- - render() { - +
+
- - - - - - - return React.jsx('div', {}); - - - - + - - +
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -68,3 +68,6 @@ export const enableEventAPI = false;
- - // Enables rewritten version of ReactFiberScheduler. Added in case we need to
- - // quickly revert it.
- - export const enableNewScheduler = false;
- -
- - // New API for JSX transforms to target - https://github.com/reactjs/rfcs/pull/107
- - export const enableJSXTransformAPI = false;
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -32,6 +32,7 @@ export const warnAboutDeprecatedLifecycles = true;
- - export const warnAboutDeprecatedSetNativeProps = true;
- - export const enableEventAPI = false;
- - export const enableNewScheduler = false;
- - export const enableJSXTransformAPI = false;
- -
- - // Only used in www builds.
- - export function addUserTimingListener() {
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
- - export const warnAboutDeprecatedSetNativeProps = false;
- - export const enableEventAPI = false;
- - export const enableNewScheduler = false;
- - export const enableJSXTransformAPI = false;
- -
- - // Only used in www builds.
- - export function addUserTimingListener() {
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -26,5 +26,6 @@ export const enableStableConcurrentModeAPIs = false;
- - export const warnAboutShorthandPropertyCollision = false;
- - export const warnAboutDeprecatedSetNativeProps = false;
- - export const enableEventAPI = false;
- - export const enableJSXTransformAPI = false;
- -
- - export const enableNewScheduler = true;
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
- - export const warnAboutDeprecatedSetNativeProps = false;
- - export const enableEventAPI = false;
- - export const enableNewScheduler = false;
- - export const enableJSXTransformAPI = false;
- -
- - // Only used in www builds.
- - export function addUserTimingListener() {
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -29,6 +29,7 @@ export const enableSchedulerDebugging = false;
- - export const warnAboutDeprecatedSetNativeProps = false;
- - export const enableEventAPI = false;
- - export const enableNewScheduler = false;
- - export const enableJSXTransformAPI = false;
- -
- - // Only used in www builds.
- - export function addUserTimingListener() {
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -27,6 +27,7 @@ export const disableJavaScriptURLs = false;
- - export const disableYielding = false;
- - export const enableEventAPI = true;
- - export const enableNewScheduler = false;
- - export const enableJSXTransformAPI = true;
- -
- - // Only used in www builds.
- - export function addUserTimingListener() {
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - @@ -31,6 +31,7 @@ export {
- - } from './ReactFeatureFlags.www';
- -
- - export const enableNewScheduler = true;
- - export const enableJSXTransformAPI = true;
- -
- - // Flow magic to verify the exports of this file match the original version.
- - // eslint-disable-next-line no-unused-vars
- - - -
-
- -
-
- - - -
-
-
- - - - - - - - - -
- - Copy path - - - View file - -
- - - - - - - - - -
- - -
-
-
- - - - - - - - - - - - - - - - - - - + - - - + - - - + + + Open in desktop + - - + + + + + + +
+
+
- - - - @@ -74,6 +74,8 @@ function updateFlagOutsideOfReactCallStack() {
- -
- - export const enableEventAPI = true;
- + + + + + - + + - - + + + - - - + + - + - - + + - - + + - + - + + - - + + - - + - + + - - - + + + - - + + - - - - + + + + + - - - - + + - - + + + - - - - + + -
+ + + + @@ -74,6 +74,8 @@ function updateFlagOutsideOfReactCallStack() {
-
-
+
- - export const enableJSXTransformAPI = true;
+ export const enableEventAPI = true;
- +
-
+ export const enableJSXTransformAPI = true;
- - // Flow magic to verify the exports of this file match the original version.
+
- - // eslint-disable-next-line no-unused-vars
+ // Flow magic to verify the exports of this file match the original version.
-
- type Check<_X, Y: _X, X: Y = _X> = null;
+ // eslint-disable-next-line no-unused-vars
- - - -
-
+ -
-
+ + type Check<_X, Y: _X, X: Y = _X> = null; + -
+ + + + + + + + -
- + +
-
+
- - - - - - - - - - - +
-
- - ProTip! - Use n and p to navigate between commits in a pull request. -
+
-
-
-
- + + + + + + + +
+ + ProTip! + Use n and p to navigate between commits in a pull request. +
+
+
+
+ -
- -
-
-
+
+
- + + + + + -
- +
+ You can’t perform that action at this time. -
- - - - - - - - - - -