GeezerVison is showing github.com — Remove runtime dependency on prop-types (#18127) · react/react@d72700f
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: packages/react-art/package.json -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 26 | 26 | "create-react-class": "^15.6.2", | 27 | 27 | "loose-envify": "^1.1.0", | 28 | 28 | "object-assign": "^4.1.1", | 29 | | - "prop-types": "^15.6.2", | 30 | 29 | "scheduler": "^0.19.0" | 31 | 30 | }, | 32 | 31 | "peerDependencies": { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/package.json -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 19 | 19 | "dependencies": { | 20 | 20 | "loose-envify": "^1.1.0", | 21 | 21 | "object-assign": "^4.1.1", | 22 | | - "prop-types": "^15.6.2", | 23 | 22 | "scheduler": "^0.19.0" | 24 | 23 | }, | 25 | 24 | "peerDependencies": { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/server/ReactPartialRendererContext.js +2-11Lines changed: 2 additions & 11 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -12,14 +12,11 @@ import type {ReactContext} from 'shared/ReactTypes'; | 12 | 12 |
| 13 | 13 | import {disableLegacyContext} from 'shared/ReactFeatureFlags'; | 14 | 14 | import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols'; | 15 | | -import ReactSharedInternals from 'shared/ReactSharedInternals'; | 16 | 15 | import getComponentName from 'shared/getComponentName'; | 17 | | -import checkPropTypes from 'prop-types/checkPropTypes'; | | 16 | +import checkPropTypes from 'shared/checkPropTypes'; | 18 | 17 |
| 19 | | -let ReactDebugCurrentFrame; | 20 | 18 | let didWarnAboutInvalidateContextType; | 21 | 19 | if (__DEV__) { | 22 | | - ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame; | 23 | 20 | didWarnAboutInvalidateContextType = new Set(); | 24 | 21 | } | 25 | 22 |
| @@ -42,13 +39,7 @@ function maskContext(type, context) { | 42 | 39 |
| 43 | 40 | function checkContextTypes(typeSpecs, values, location: string) { | 44 | 41 | if (__DEV__) { | 45 | | - checkPropTypes( | 46 | | - typeSpecs, | 47 | | - values, | 48 | | - location, | 49 | | - 'Component', | 50 | | - ReactDebugCurrentFrame.getCurrentStack, | 51 | | - ); | | 42 | + checkPropTypes(typeSpecs, values, location, 'Component'); | 52 | 43 | } | 53 | 44 | } | 54 | 45 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-dom/src/shared/ReactControlledValuePropTypes.js +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 5 | 5 | * LICENSE file in the root directory of this source tree. | 6 | 6 | */ | 7 | 7 |
| 8 | | -import checkPropTypes from 'prop-types/checkPropTypes'; | | 8 | +import checkPropTypes from 'shared/checkPropTypes'; | 9 | 9 | import ReactSharedInternals from 'shared/ReactSharedInternals'; | 10 | 10 | import {enableDeprecatedFlareAPI} from 'shared/ReactFeatureFlags'; | 11 | 11 |
| |
Collapse file Copy file name to clipboardExpand all lines: packages/react-flight/package.json +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 29 | 29 | }, | 30 | 30 | "dependencies": { | 31 | 31 | "loose-envify": "^1.1.0", | 32 | | - "object-assign": "^4.1.1", | 33 | | - "prop-types": "^15.6.2" | | 32 | + "object-assign": "^4.1.1" | 34 | 33 | }, | 35 | 34 | "browserify": { | 36 | 35 | "transform": [ | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-native-renderer/package.json -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 9 | 9 | }, | 10 | 10 | "dependencies": { | 11 | 11 | "object-assign": "^4.1.1", | 12 | | - "prop-types": "^15.6.2", | 13 | 12 | "scheduler": "^0.11.0" | 14 | 13 | }, | 15 | 14 | "peerDependencies": { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-noop-renderer/package.json -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 12 | 12 | "license": "MIT", | 13 | 13 | "dependencies": { | 14 | 14 | "object-assign": "^4.1.1", | 15 | | - "prop-types": "^15.6.2", | 16 | 15 | "regenerator-runtime": "^0.11.0", | 17 | 16 | "react-reconciler": "*", | 18 | 17 | "react-flight": "*", | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/package.json -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 32 | 32 | "dependencies": { | 33 | 33 | "loose-envify": "^1.1.0", | 34 | 34 | "object-assign": "^4.1.1", | 35 | | - "prop-types": "^15.6.2", | 36 | 35 | "scheduler": "^0.19.0" | 37 | 36 | }, | 38 | 37 | "browserify": { | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberBeginWork.js +2-17Lines changed: 2 additions & 17 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -18,7 +18,7 @@ import type { | 18 | 18 | } from './ReactFiberSuspenseComponent'; | 19 | 19 | import type {SuspenseContext} from './ReactFiberSuspenseContext'; | 20 | 20 |
| 21 | | -import checkPropTypes from 'prop-types/checkPropTypes'; | | 21 | +import checkPropTypes from 'shared/checkPropTypes'; | 22 | 22 |
| 23 | 23 | import { | 24 | 24 | IndeterminateComponent, | @@ -75,7 +75,6 @@ import {refineResolvedLazyComponent} from 'shared/ReactLazyComponent'; | 75 | 75 | import {REACT_LAZY_TYPE, getIteratorFn} from 'shared/ReactSymbols'; | 76 | 76 | import { | 77 | 77 | getCurrentFiberOwnerNameInDevOrNull, | 78 | | - getCurrentFiberStackInDev, | 79 | 78 | setIsRendering, | 80 | 79 | } from './ReactCurrentFiber'; | 81 | 80 | import {startWorkTimer, cancelWorkTimer} from './ReactDebugFiberPerf'; | @@ -296,7 +295,6 @@ function updateForwardRef( | 296 | 295 | nextProps, // Resolved props | 297 | 296 | 'prop', | 298 | 297 | getComponentName(Component), | 299 | | - getCurrentFiberStackInDev, | 300 | 298 | ); | 301 | 299 | } | 302 | 300 | } | @@ -414,7 +412,6 @@ function updateMemoComponent( | 414 | 412 | nextProps, // Resolved props | 415 | 413 | 'prop', | 416 | 414 | getComponentName(type), | 417 | | - getCurrentFiberStackInDev, | 418 | 415 | ); | 419 | 416 | } | 420 | 417 | } | @@ -442,7 +439,6 @@ function updateMemoComponent( | 442 | 439 | nextProps, // Resolved props | 443 | 440 | 'prop', | 444 | 441 | getComponentName(type), | 445 | | - getCurrentFiberStackInDev, | 446 | 442 | ); | 447 | 443 | } | 448 | 444 | } | @@ -501,7 +497,6 @@ function updateSimpleMemoComponent( | 501 | 497 | nextProps, // Resolved (SimpleMemoComponent has no defaultProps) | 502 | 498 | 'prop', | 503 | 499 | getComponentName(outerMemoType), | 504 | | - getCurrentFiberStackInDev, | 505 | 500 | ); | 506 | 501 | } | 507 | 502 | // Inner propTypes will be validated in the function component path. | @@ -626,7 +621,6 @@ function updateFunctionComponent( | 626 | 621 | nextProps, // Resolved props | 627 | 622 | 'prop', | 628 | 623 | getComponentName(Component), | 629 | | - getCurrentFiberStackInDev, | 630 | 624 | ); | 631 | 625 | } | 632 | 626 | } | @@ -793,7 +787,6 @@ function updateClassComponent( | 793 | 787 | nextProps, // Resolved props | 794 | 788 | 'prop', | 795 | 789 | getComponentName(Component), | 796 | | - getCurrentFiberStackInDev, | 797 | 790 | ); | 798 | 791 | } | 799 | 792 | } | @@ -1198,7 +1191,6 @@ function mountLazyComponent( | 1198 | 1191 | resolvedProps, // Resolved for outer only | 1199 | 1192 | 'prop', | 1200 | 1193 | getComponentName(Component), | 1201 | | - getCurrentFiberStackInDev, | 1202 | 1194 | ); | 1203 | 1195 | } | 1204 | 1196 | } | @@ -2622,13 +2614,7 @@ function updateContextProvider( | 2622 | 2614 | const providerPropTypes = workInProgress.type.propTypes; | 2623 | 2615 |
| 2624 | 2616 | if (providerPropTypes) { | 2625 | | - checkPropTypes( | 2626 | | - providerPropTypes, | 2627 | | - newProps, | 2628 | | - 'prop', | 2629 | | - 'Context.Provider', | 2630 | | - getCurrentFiberStackInDev, | 2631 | | - ); | | 2617 | + checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider'); | 2632 | 2618 | } | 2633 | 2619 | } | 2634 | 2620 |
| @@ -3208,7 +3194,6 @@ function beginWork( | 3208 | 3194 | resolvedProps, // Resolved for outer only | 3209 | 3195 | 'prop', | 3210 | 3196 | getComponentName(type), | 3211 | | - getCurrentFiberStackInDev, | 3212 | 3197 | ); | 3213 | 3198 | } | 3214 | 3199 | } | |
Collapse file Copy file name to clipboardExpand all lines: packages/react-reconciler/src/ReactFiberContext.js +3-21Lines changed: 3 additions & 21 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -15,9 +15,8 @@ import {disableLegacyContext} from 'shared/ReactFeatureFlags'; | 15 | 15 | import {ClassComponent, HostRoot} from 'shared/ReactWorkTags'; | 16 | 16 | import getComponentName from 'shared/getComponentName'; | 17 | 17 | import invariant from 'shared/invariant'; | 18 | | -import checkPropTypes from 'prop-types/checkPropTypes'; | | 18 | +import checkPropTypes from 'shared/checkPropTypes'; | 19 | 19 |
| 20 | | -import {getCurrentFiberStackInDev} from './ReactCurrentFiber'; | 21 | 20 | import {startPhaseTimer, stopPhaseTimer} from './ReactDebugFiberPerf'; | 22 | 21 | import {createCursor, push, pop} from './ReactFiberStack'; | 23 | 22 |
| @@ -105,13 +104,7 @@ function getMaskedContext( | 105 | 104 |
| 106 | 105 | if (__DEV__) { | 107 | 106 | const name = getComponentName(type) || 'Unknown'; | 108 | | - checkPropTypes( | 109 | | - contextTypes, | 110 | | - context, | 111 | | - 'context', | 112 | | - name, | 113 | | - getCurrentFiberStackInDev, | 114 | | - ); | | 107 | + checkPropTypes(contextTypes, context, 'context', name); | 115 | 108 | } | 116 | 109 |
| 117 | 110 | // Cache unmasked context so we can avoid recreating masked context unless necessary. | @@ -223,18 +216,7 @@ function processChildContext( | 223 | 216 | } | 224 | 217 | if (__DEV__) { | 225 | 218 | const name = getComponentName(type) || 'Unknown'; | 226 | | - checkPropTypes( | 227 | | - childContextTypes, | 228 | | - childContext, | 229 | | - 'child context', | 230 | | - name, | 231 | | - // In practice, there is one case in which we won't get a stack. It's when | 232 | | - // somebody calls unstable_renderSubtreeIntoContainer() and we process | 233 | | - // context from the parent component instance. The stack will be missing | 234 | | - // because it's outside of the reconciliation, and so the pointer has not | 235 | | - // been set. This is rare and doesn't matter. We'll also remove that API. | 236 | | - getCurrentFiberStackInDev, | 237 | | - ); | | 219 | + checkPropTypes(childContextTypes, childContext, 'child context', name); | 238 | 220 | } | 239 | 221 |
| 240 | 222 | return {...parentContext, ...childContext}; | |
|