fixtures/legacy-jsx-runtimes/react-15/cjs/react-jsx-dev-runtime.development.js JAVASCRIPT 867 lines View on github.com → Search inside
1/** @license React v15.7.02 * react-jsx-dev-runtime.development.js3 *4 * Copyright (c) Meta Platforms, Inc. and affiliates.5 *6 * This source code is licensed under the MIT license found in the7 * LICENSE file in the root directory of this source tree.8 */910'use strict';1112if (process.env.NODE_ENV !== "production") {13  (function() {14'use strict';1516var React = require('react');17var ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');1819// ATTENTION20// When adding new symbols to this file,21// Please consider also adding to 'react-devtools-shared/src/backend/ReactSymbols'22// The Symbol used to tag the ReactElement-like types. If there is no native Symbol23// nor polyfill, then a plain number is used for performance.24var REACT_ELEMENT_TYPE = 0xeac7;25var REACT_PORTAL_TYPE = 0xeaca;26exports.Fragment = 0xeacb;27var REACT_STRICT_MODE_TYPE = 0xeacc;28var REACT_PROFILER_TYPE = 0xead2;29var REACT_PROVIDER_TYPE = 0xeacd;30var REACT_CONTEXT_TYPE = 0xeace;31var REACT_FORWARD_REF_TYPE = 0xead0;32var REACT_SUSPENSE_TYPE = 0xead1;33var REACT_SUSPENSE_LIST_TYPE = 0xead8;34var REACT_MEMO_TYPE = 0xead3;35var REACT_LAZY_TYPE = 0xead4;36var REACT_BLOCK_TYPE = 0xead9;37var REACT_SERVER_BLOCK_TYPE = 0xeada;38var REACT_FUNDAMENTAL_TYPE = 0xead5;39var REACT_SCOPE_TYPE = 0xead7;40var REACT_OPAQUE_ID_TYPE = 0xeae0;41var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;42var REACT_OFFSCREEN_TYPE = 0xeae2;43var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;4445if (typeof Symbol === 'function' && Symbol.for) {46  var symbolFor = Symbol.for;47  REACT_ELEMENT_TYPE = symbolFor('react.element');48  REACT_PORTAL_TYPE = symbolFor('react.portal');49  exports.Fragment = symbolFor('react.fragment');50  REACT_STRICT_MODE_TYPE = symbolFor('react.strict_mode');51  REACT_PROFILER_TYPE = symbolFor('react.profiler');52  REACT_PROVIDER_TYPE = symbolFor('react.provider');53  REACT_CONTEXT_TYPE = symbolFor('react.context');54  REACT_FORWARD_REF_TYPE = symbolFor('react.forward_ref');55  REACT_SUSPENSE_TYPE = symbolFor('react.suspense');56  REACT_SUSPENSE_LIST_TYPE = symbolFor('react.suspense_list');57  REACT_MEMO_TYPE = symbolFor('react.memo');58  REACT_LAZY_TYPE = symbolFor('react.lazy');59  REACT_BLOCK_TYPE = symbolFor('react.block');60  REACT_SERVER_BLOCK_TYPE = symbolFor('react.server.block');61  REACT_FUNDAMENTAL_TYPE = symbolFor('react.fundamental');62  REACT_SCOPE_TYPE = symbolFor('react.scope');63  REACT_OPAQUE_ID_TYPE = symbolFor('react.opaque.id');64  REACT_DEBUG_TRACING_MODE_TYPE = symbolFor('react.debug_trace_mode');65  REACT_OFFSCREEN_TYPE = symbolFor('react.offscreen');66  REACT_LEGACY_HIDDEN_TYPE = symbolFor('react.legacy_hidden');67}6869var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;70var FAUX_ITERATOR_SYMBOL = '@@iterator';71function getIteratorFn(maybeIterable) {72  if (maybeIterable === null || typeof maybeIterable !== 'object') {73    return null;74  }7576  var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];7778  if (typeof maybeIterator === 'function') {79    return maybeIterator;80  }8182  return null;83}8485function error(format) {86  {87    for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {88      args[_key2 - 1] = arguments[_key2];89    }9091    printWarning('error', format, args);92  }93}9495function printWarning(level, format, args) {96  // When changing this logic, you might want to also97  // update consoleWithStackDev.www.js as well.98  {99    var stack = '';100101    if (currentlyValidatingElement) {102      stack += ReactComponentTreeHook.getCurrentStackAddendum(currentlyValidatingElement)103    }104105106    if (stack !== '') {107      format += '%s';108      args = args.concat([stack]);109    }110111    var argsWithFormat = args.map(function (item) {112      return '' + item;113    }); // Careful: RN currently depends on this prefix114115    argsWithFormat.unshift('Warning: ' + format); // We intentionally don't use spread (or .apply) directly because it116    // breaks IE9: https://github.com/facebook/react/issues/13610117    // eslint-disable-next-line react-internal/no-production-logging118119    Function.prototype.apply.call(console[level], console, argsWithFormat);120  }121}122123// Filter certain DOM attributes (e.g. src, href) if their values are empty strings.124125var enableScopeAPI = false; // Experimental Create Event Handle API.126127function isValidElementType(type) {128  if (typeof type === 'string' || typeof type === 'function') {129    return true;130  } // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).131132133  if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {134    return true;135  }136137  if (typeof type === 'object' && type !== null) {138    if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {139      return true;140    }141  }142143  return false;144}145var BEFORE_SLASH_RE = /^(.*)[\\\/]/;146function describeComponentFrame (name, source, ownerName) {147  var sourceInfo = '';148149  if (source) {150    var path = source.fileName;151    var fileName = path.replace(BEFORE_SLASH_RE, '');152153    {154      // In DEV, include code for a common special case:155      // prefer "folder/index.js" instead of just "index.js".156      if (/^index\./.test(fileName)) {157        var match = path.match(BEFORE_SLASH_RE);158159        if (match) {160          var pathBeforeSlash = match[1];161162          if (pathBeforeSlash) {163            var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');164            fileName = folderName + '/' + fileName;165          }166        }167      }168    }169170    sourceInfo = ' (at ' + fileName + ':' + source.lineNumber + ')';171  } else if (ownerName) {172    sourceInfo = ' (created by ' + ownerName + ')';173  }174175  return '\n    in ' + (name || 'Unknown') + sourceInfo;176}177178var Resolved = 1;179function refineResolvedLazyComponent(lazyComponent) {180  return lazyComponent._status === Resolved ? lazyComponent._result : null;181}182183function getWrappedName(outerType, innerType, wrapperName) {184  var functionName = innerType.displayName || innerType.name || '';185  return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);186}187188function getComponentName(type) {189  if (type == null) {190    // Host root, text node or just invalid type.191    return null;192  }193194  {195    if (typeof type.tag === 'number') {196      error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.');197    }198  }199200  if (typeof type === 'function') {201    return type.displayName || type.name || null;202  }203204  if (typeof type === 'string') {205    return type;206  }207208  switch (type) {209    case exports.Fragment:210      return 'Fragment';211212    case REACT_PORTAL_TYPE:213      return 'Portal';214215    case REACT_PROFILER_TYPE:216      return "Profiler";217218    case REACT_STRICT_MODE_TYPE:219      return 'StrictMode';220221    case REACT_SUSPENSE_TYPE:222      return 'Suspense';223224    case REACT_SUSPENSE_LIST_TYPE:225      return 'SuspenseList';226  }227228  if (typeof type === 'object') {229    switch (type.$$typeof) {230      case REACT_CONTEXT_TYPE:231        return 'Context.Consumer';232233      case REACT_PROVIDER_TYPE:234        return 'Context.Provider';235236      case REACT_FORWARD_REF_TYPE:237        return getWrappedName(type, type.render, 'ForwardRef');238239      case REACT_MEMO_TYPE:240        return getComponentName(type.type);241242      case REACT_BLOCK_TYPE:243        return getComponentName(type.render);244245      case REACT_LAZY_TYPE:246        {247          var thenable = type;248          var resolvedThenable = refineResolvedLazyComponent(thenable);249250          if (resolvedThenable) {251            return getComponentName(resolvedThenable);252          }253254          break;255        }256    }257  }258259  return null;260}261var loggedTypeFailures = {};262var currentlyValidatingElement = null;263264function setCurrentlyValidatingElement(element) {265  currentlyValidatingElement = element;266}267268function checkPropTypes(typeSpecs, values, location, componentName, element) {269  {270    // $FlowFixMe This is okay but Flow doesn't know it.271    var has = Function.call.bind(Object.prototype.hasOwnProperty);272273    for (var typeSpecName in typeSpecs) {274      if (has(typeSpecs, typeSpecName)) {275        var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to276        // fail the render phase where it didn't fail before. So we log it.277        // After these have been cleaned up, we'll let them throw.278279        try {280          // This is intentionally an invariant that gets caught. It's the same281          // behavior as without this statement except with a better message.282          if (typeof typeSpecs[typeSpecName] !== 'function') {283            var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');284            err.name = 'Invariant Violation';285            throw err;286          }287288          error$1 = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED');289        } catch (ex) {290          error$1 = ex;291        }292293        if (error$1 && !(error$1 instanceof Error)) {294          setCurrentlyValidatingElement(element);295296          error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);297298          setCurrentlyValidatingElement(null);299        }300301        if (error$1 instanceof Error && !(error$1.message in loggedTypeFailures)) {302          // Only monitor this failure once because there tends to be a lot of the303          // same error.304          loggedTypeFailures[error$1.message] = true;305          setCurrentlyValidatingElement(element);306307          error('Failed %s type: %s', location, error$1.message);308309          setCurrentlyValidatingElement(null);310        }311      }312    }313  }314}315316var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');317var hasOwnProperty = Object.prototype.hasOwnProperty;318var RESERVED_PROPS = {319  key: true,320  ref: true,321  __self: true,322  __source: true323};324var specialPropKeyWarningShown;325var specialPropRefWarningShown;326var didWarnAboutStringRefs;327328{329  didWarnAboutStringRefs = {};330}331332function hasValidRef(config) {333  {334    if (hasOwnProperty.call(config, 'ref')) {335      var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;336337      if (getter && getter.isReactWarning) {338        return false;339      }340    }341  }342343  return config.ref !== undefined;344}345346function hasValidKey(config) {347  {348    if (hasOwnProperty.call(config, 'key')) {349      var getter = Object.getOwnPropertyDescriptor(config, 'key').get;350351      if (getter && getter.isReactWarning) {352        return false;353      }354    }355  }356357  return config.key !== undefined;358}359360function defineKeyPropWarningGetter(props, displayName) {361  {362    var warnAboutAccessingKey = function () {363      if (!specialPropKeyWarningShown) {364        specialPropKeyWarningShown = true;365366        error('%s: `key` 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 ' + 'prop. (https://reactjs.org/link/special-props)', displayName);367      }368    };369370    warnAboutAccessingKey.isReactWarning = true;371    Object.defineProperty(props, 'key', {372      get: warnAboutAccessingKey,373      configurable: true374    });375  }376}377378function defineRefPropWarningGetter(props, displayName) {379  {380    var warnAboutAccessingRef = function () {381      if (!specialPropRefWarningShown) {382        specialPropRefWarningShown = true;383384        error('%s: `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 ' + 'prop. (https://reactjs.org/link/special-props)', displayName);385      }386    };387388    warnAboutAccessingRef.isReactWarning = true;389    Object.defineProperty(props, 'ref', {390      get: warnAboutAccessingRef,391      configurable: true392    });393  }394}395/**396 * Factory method to create a new React element. This no longer adheres to397 * the class pattern, so do not use new to call it. Also, instanceof check398 * will not work. Instead test $$typeof field against Symbol.for('react.element') to check399 * if something is a React Element.400 *401 * @param {*} type402 * @param {*} props403 * @param {*} key404 * @param {string|object} ref405 * @param {*} owner406 * @param {*} self A *temporary* helper to detect places where `this` is407 * different from the `owner` when React.createElement is called, so that we408 * can warn. We want to get rid of owner and replace string `ref`s with arrow409 * functions, and as long as `this` and owner are the same, there will be no410 * change in behavior.411 * @param {*} source An annotation object (added by a transpiler or otherwise)412 * indicating filename, line number, and/or other information.413 * @internal414 */415416417var ReactElement = function (type, key, ref, self, source, owner, props) {418  var element = {419    // This tag allows us to uniquely identify this as a React Element420    $$typeof: REACT_ELEMENT_TYPE,421    // Built-in properties that belong on the element422    type: type,423    key: key,424    ref: ref,425    props: props,426    // Record the component responsible for creating this element.427    _owner: owner428  };429430  {431    // The validation flag is currently mutative. We put it on432    // an external backing store so that we can freeze the whole object.433    // This can be replaced with a WeakMap once they are implemented in434    // commonly used development environments.435    element._store = {}; // To make comparing ReactElements easier for testing purposes, we make436    // the validation flag non-enumerable (where possible, which should437    // include every environment we run tests in), so the test framework438    // ignores it.439440    Object.defineProperty(element._store, 'validated', {441      configurable: false,442      enumerable: false,443      writable: true,444      value: false445    }); // self and source are DEV only properties.446447    Object.defineProperty(element, '_self', {448      configurable: false,449      enumerable: false,450      writable: false,451      value: self452    }); // Two elements created in two different places should be considered453    // equal for testing purposes and therefore we hide it from enumeration.454455    Object.defineProperty(element, '_source', {456      configurable: false,457      enumerable: false,458      writable: false,459      value: source460    });461462    if (Object.freeze) {463      Object.freeze(element.props);464      Object.freeze(element);465    }466  }467468  return element;469};470/**471 * https://github.com/reactjs/rfcs/pull/107472 * @param {*} type473 * @param {object} props474 * @param {string} key475 */476477function jsxDEV(type, config, maybeKey, source, self) {478  {479    var propName; // Reserved names are extracted480481    var props = {};482    var key = null;483    var ref = null; // Currently, key can be spread in as a prop. This causes a potential484    // issue if key is also explicitly declared (ie. <div {...props} key="Hi" />485    // or <div key="Hi" {...props} /> ). We want to deprecate key spread,486    // but as an intermediary step, we will use jsxDEV for everything except487    // <div {...props} key="Hi" />, because we aren't currently able to tell if488    // key is explicitly declared to be undefined or not.489490    if (maybeKey !== undefined) {491      key = '' + maybeKey;492    }493494    if (hasValidKey(config)) {495      key = '' + config.key;496    }497498    if (hasValidRef(config)) {499      ref = config.ref;500    } // Remaining properties are added to a new props object501502503    for (propName in config) {504      if (hasOwnProperty.call(config, propName) && !RESERVED_PROPS.hasOwnProperty(propName)) {505        props[propName] = config[propName];506      }507    } // Resolve default props508509510    if (type && type.defaultProps) {511      var defaultProps = type.defaultProps;512513      for (propName in defaultProps) {514        if (props[propName] === undefined) {515          props[propName] = defaultProps[propName];516        }517      }518    }519520    if (key || ref) {521      var displayName = typeof type === 'function' ? type.displayName || type.name || 'Unknown' : type;522523      if (key) {524        defineKeyPropWarningGetter(props, displayName);525      }526527      if (ref) {528        defineRefPropWarningGetter(props, displayName);529      }530    }531532    return ReactElement(type, key, ref, self, source, ReactCurrentOwner.current, props);533  }534}535536var ReactCurrentOwner$1 = require('react/lib/ReactCurrentOwner');537538function setCurrentlyValidatingElement$1(element) {539  currentlyValidatingElement = element;540}541542var propTypesMisspellWarningShown;543544{545  propTypesMisspellWarningShown = false;546}547/**548 * Verifies the object is a ReactElement.549 * See https://reactjs.org/docs/react-api.html#isvalidelement550 * @param {?object} object551 * @return {boolean} True if `object` is a ReactElement.552 * @final553 */554555function isValidElement(object) {556  {557    return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;558  }559}560561function getDeclarationErrorAddendum() {562  {563    if (ReactCurrentOwner$1.current) {564      var name = ReactCurrentOwner$1.current.getName();565566      if (name) {567        return '\n\nCheck the render method of `' + name + '`.';568      }569    }570571    return '';572  }573}574575function getSourceInfoErrorAddendum(source) {576  {577    if (source !== undefined) {578      var fileName = source.fileName.replace(/^.*[\\\/]/, '');579      var lineNumber = source.lineNumber;580      return '\n\nCheck your code at ' + fileName + ':' + lineNumber + '.';581    }582583    return '';584  }585}586/**587 * Warn if there's no key explicitly set on dynamic arrays of children or588 * object keys are not valid. This allows us to keep track of children between589 * updates.590 */591592593var ownerHasKeyUseWarning = {};594595function getCurrentComponentErrorInfo(parentType) {596  {597    var info = getDeclarationErrorAddendum();598599    if (!info) {600      var parentName = typeof parentType === 'string' ? parentType : parentType.displayName || parentType.name;601602      if (parentName) {603        info = "\n\nCheck the top-level render call using <" + parentName + ">.";604      }605    }606607    return info;608  }609}610/**611 * Warn if the element doesn't have an explicit key assigned to it.612 * This element is in an array. The array could grow and shrink or be613 * reordered. All children that haven't already been validated are required to614 * have a "key" property assigned to it. Error statuses are cached so a warning615 * will only be shown once.616 *617 * @internal618 * @param {ReactElement} element Element that requires a key.619 * @param {*} parentType element's parent's type.620 */621622623function validateExplicitKey(element, parentType) {624  {625    if (!element._store || element._store.validated || element.key != null) {626      return;627    }628629    element._store.validated = true;630    var currentComponentErrorInfo = getCurrentComponentErrorInfo(parentType);631632    if (ownerHasKeyUseWarning[currentComponentErrorInfo]) {633      return;634    }635636    ownerHasKeyUseWarning[currentComponentErrorInfo] = true; // Usually the current owner is the offender, but if it accepts children as a637    // property, it may be the creator of the child that's responsible for638    // assigning it a key.639640    var childOwner = '';641642    if (element && element._owner && element._owner !== ReactCurrentOwner$1.current) {643      // Give the component that originally created this child.644      childOwner = " It was passed a child from " + element._owner.getName() + ".";645    }646647    setCurrentlyValidatingElement$1(element);648649    error('Each child in a list should have a unique "key" prop.' + '%s%s See https://reactjs.org/link/warning-keys for more information.', currentComponentErrorInfo, childOwner);650651    setCurrentlyValidatingElement$1(null);652  }653}654/**655 * Ensure that every element either is passed in a static location, in an656 * array with an explicit keys property defined, or in an object literal657 * with valid key property.658 *659 * @internal660 * @param {ReactNode} node Statically passed child of any type.661 * @param {*} parentType node's parent's type.662 */663664665function validateChildKeys(node, parentType) {666  {667    if (typeof node !== 'object') {668      return;669    }670671    if (Array.isArray(node)) {672      for (var i = 0; i < node.length; i++) {673        var child = node[i];674675        if (isValidElement(child)) {676          validateExplicitKey(child, parentType);677        }678      }679    } else if (isValidElement(node)) {680      // This element was passed in a valid location.681      if (node._store) {682        node._store.validated = true;683      }684    } else if (node) {685      var iteratorFn = getIteratorFn(node);686687      if (typeof iteratorFn === 'function') {688        // Entry iterators used to provide implicit keys,689        // but now we print a separate warning for them later.690        if (iteratorFn !== node.entries) {691          var iterator = iteratorFn.call(node);692          var step;693694          while (!(step = iterator.next()).done) {695            if (isValidElement(step.value)) {696              validateExplicitKey(step.value, parentType);697            }698          }699        }700      }701    }702  }703}704/**705 * Given an element, validate that its props follow the propTypes definition,706 * provided by the type.707 *708 * @param {ReactElement} element709 */710711712function validatePropTypes(element) {713  {714    var type = element.type;715716    if (type === null || type === undefined || typeof type === 'string') {717      return;718    }719720    var propTypes;721722    if (typeof type === 'function') {723      propTypes = type.propTypes;724    } else if (typeof type === 'object' && (type.$$typeof === REACT_FORWARD_REF_TYPE || // Note: Memo only checks outer props here.725    // Inner props are checked in the reconciler.726    type.$$typeof === REACT_MEMO_TYPE)) {727      propTypes = type.propTypes;728    } else {729      return;730    }731732    if (propTypes) {733      // Intentionally inside to avoid triggering lazy initializers:734      var name = getComponentName(type);735      checkPropTypes(propTypes, element.props, 'prop', name, element);736    } else if (type.PropTypes !== undefined && !propTypesMisspellWarningShown) {737      propTypesMisspellWarningShown = true; // Intentionally inside to avoid triggering lazy initializers:738739      var _name = getComponentName(type);740741      error('Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?', _name || 'Unknown');742    }743744    if (typeof type.getDefaultProps === 'function' && !type.getDefaultProps.isReactClassApproved) {745      error('getDefaultProps is only used on classic React.createClass ' + 'definitions. Use a static property named `defaultProps` instead.');746    }747  }748}749/**750 * Given a fragment, validate that it can only be provided with fragment props751 * @param {ReactElement} fragment752 */753754755function validateFragmentProps(fragment) {756  {757    var keys = Object.keys(fragment.props);758759    for (var i = 0; i < keys.length; i++) {760      var key = keys[i];761762      if (key !== 'children' && key !== 'key') {763        setCurrentlyValidatingElement$1(fragment);764765        error('Invalid prop `%s` supplied to `React.Fragment`. ' + 'React.Fragment can only have `key` and `children` props.', key);766767        setCurrentlyValidatingElement$1(null);768        break;769      }770    }771772    if (fragment.ref !== null) {773      setCurrentlyValidatingElement$1(fragment);774775      error('Invalid attribute `ref` supplied to `React.Fragment`.');776777      setCurrentlyValidatingElement$1(null);778    }779  }780}781782function jsxWithValidation(type, props, key, isStaticChildren, source, self) {783  {784    var validType = isValidElementType(type); // We warn in this case but don't throw. We expect the element creation to785    // succeed and there will likely be errors in render.786787    if (!validType) {788      var info = '';789790      if (type === undefined || typeof type === 'object' && type !== null && Object.keys(type).length === 0) {791        info += ' You likely forgot to export your component from the file ' + "it's defined in, or you might have mixed up default and named imports.";792      }793794      var sourceInfo = getSourceInfoErrorAddendum(source);795796      if (sourceInfo) {797        info += sourceInfo;798      } else {799        info += getDeclarationErrorAddendum();800      }801802      var typeString;803804      if (type === null) {805        typeString = 'null';806      } else if (Array.isArray(type)) {807        typeString = 'array';808      } else if (type !== undefined && type.$$typeof === REACT_ELEMENT_TYPE) {809        typeString = "<" + (getComponentName(type.type) || 'Unknown') + " />";810        info = ' Did you accidentally export a JSX literal instead of a component?';811      } else {812        typeString = typeof type;813      }814815      error('React.jsx: type is invalid -- expected a string (for ' + 'built-in components) or a class/function (for composite ' + 'components) but got: %s.%s', typeString, info);816    }817818    var element = jsxDEV(type, props, key, source, self); // The result can be nullish if a mock or a custom function is used.819    // TODO: Drop this when these are no longer allowed as the type argument.820821    if (element == null) {822      return element;823    } // Skip key warning if the type isn't valid since our key validation logic824    // doesn't expect a non-string/function type and can throw confusing errors.825    // We don't want exception behavior to differ between dev and prod.826    // (Rendering will throw with a helpful message and as soon as the type is827    // fixed, the key warnings will appear.)828829830    if (validType) {831      var children = props.children;832833      if (children !== undefined) {834        if (isStaticChildren) {835          if (Array.isArray(children)) {836            for (var i = 0; i < children.length; i++) {837              validateChildKeys(children[i], type);838            }839840            if (Object.freeze) {841              Object.freeze(children);842            }843          } else {844            error('React.jsx: Static children should always be an array. ' + 'You are likely explicitly calling React.jsxs or React.jsxDEV. ' + 'Use the Babel transform instead.');845          }846        } else {847          validateChildKeys(children, type);848        }849      }850    }851852    if (type === exports.Fragment) {853      validateFragmentProps(element);854    } else {855      validatePropTypes(element);856    }857858    return element;859  }860} // These two functions exist to still get child warnings in dev861862var jsxDEV$1 =  jsxWithValidation ;863864exports.jsxDEV = jsxDEV$1;865  })();866}

Code quality findings 100

Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (process.env.NODE_ENV !== "production") {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var React = require('react');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactComponentTreeHook = require('react/lib/ReactComponentTreeHook');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_ELEMENT_TYPE = 0xeac7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PORTAL_TYPE = 0xeaca;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_STRICT_MODE_TYPE = 0xeacc;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROFILER_TYPE = 0xead2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_PROVIDER_TYPE = 0xeacd;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_CONTEXT_TYPE = 0xeace;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FORWARD_REF_TYPE = 0xead0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_TYPE = 0xead1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SUSPENSE_LIST_TYPE = 0xead8;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_MEMO_TYPE = 0xead3;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LAZY_TYPE = 0xead4;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_BLOCK_TYPE = 0xead9;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SERVER_BLOCK_TYPE = 0xeada;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_FUNDAMENTAL_TYPE = 0xead5;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_SCOPE_TYPE = 0xead7;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OPAQUE_ID_TYPE = 0xeae0;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_DEBUG_TRACING_MODE_TYPE = 0xeae1;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_OFFSCREEN_TYPE = 0xeae2;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var REACT_LEGACY_HIDDEN_TYPE = 0xeae3;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof Symbol === 'function' && Symbol.for) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof Symbol === 'function' && Symbol.for) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var symbolFor = Symbol.for;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var MAYBE_ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var FAUX_ITERATOR_SYMBOL = '@@iterator';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (maybeIterable === null || typeof maybeIterable !== 'object') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var maybeIterator = MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL];
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof maybeIterator === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof maybeIterator === 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var stack = '';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (stack !== '') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var argsWithFormat = args.map(function (item) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var enableScopeAPI = false; // Experimental Create Event Handle API.
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string' || typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
} // Note: typeof might be other than 'symbol' or 'number' (e.g. if it's a polyfill).
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type === exports.Fragment || type === REACT_PROFILER_TYPE || type === REACT_DEBUG_TRACING_MODE_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || type === REACT_LEGACY_HIDDEN_TYPE || enableScopeAPI ) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object' && type !== null) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object' && type !== null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_BLOCK_TYPE || type[0] === REACT_SERVER_BLOCK_TYPE) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var BEFORE_SLASH_RE = /^(.*)[\\\/]/;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var sourceInfo = '';
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var path = source.fileName;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var fileName = path.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var match = path.match(BEFORE_SLASH_RE);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var pathBeforeSlash = match[1];
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var folderName = pathBeforeSlash.replace(BEFORE_SLASH_RE, '');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var Resolved = 1;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return lazyComponent._status === Resolved ? lazyComponent._result : null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var functionName = innerType.displayName || innerType.name || '';
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return outerType.displayName || (functionName !== '' ? wrapperName + "(" + functionName + ")" : wrapperName);
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (type == null) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type.tag === 'number') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type.tag === 'number') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'function') {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'string') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'string') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type) {
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof type === 'object') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof type === 'object') {
Ensure all cases are handled or a default case is present
info correctness switch-without-default
switch (type.$$typeof) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var thenable = type;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var resolvedThenable = refineResolvedLazyComponent(thenable);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var loggedTypeFailures = {};
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var currentlyValidatingElement = null;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var has = Function.call.bind(Object.prototype.hasOwnProperty);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
for (var typeSpecName in typeSpecs) {
Use let instead of var in loops to avoid scope issues
info correctness var-in-loop
for (var typeSpecName in typeSpecs) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var error$1 = void 0; // Prop type validation may throw. In case they do, we don't want to
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
if (typeof typeSpecs[typeSpecName] !== 'function') {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
if (typeof typeSpecs[typeSpecName] !== 'function') {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
var err = Error((componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' + 'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' + 'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.');
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
error('%s: type specification of %s' + ' `%s` is invalid; the type checker ' + 'function must return `null` or an `Error` but returned a %s. ' + 'You may have forgotten to pass an argument to the type checker ' + 'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' + 'shape all require an argument).', componentName || 'React class', location, typeSpecName, typeof error$1);
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactCurrentOwner = require('react/lib/ReactCurrentOwner');
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var hasOwnProperty = Object.prototype.hasOwnProperty;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var RESERVED_PROPS = {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropKeyWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var specialPropRefWarningShown;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var didWarnAboutStringRefs;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'ref').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.ref !== undefined;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var getter = Object.getOwnPropertyDescriptor(config, 'key').get;
Use strict equality (===) to prevent type coercion bugs
info correctness loose-equality
return config.key !== undefined;
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var warnAboutAccessingKey = function () {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var warnAboutAccessingRef = function () {
Be cautious with typeof; it has limitations (e.g., typeof null === 'object')
info correctness typeof-pitfall
* will not work. Instead test $$typeof field against Symbol.for('react.element') to check
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var ReactElement = function (type, key, ref, self, source, owner, props) {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var element = {
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var propName; // Reserved names are extracted
Use let or const to avoid scope issues and hoisting
info correctness var-declaration
var props = {};

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.