Skip to content

Commit 7068c9b

Browse files
committed
Remove runtime dep on prop-types
1 parent 8d7535e commit 7068c9b

File tree

16 files changed

+96
-110
lines changed

16 files changed

+96
-110
lines changed

packages/react-art/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
"create-react-class": "^15.6.2",
2727
"loose-envify": "^1.1.0",
2828
"object-assign": "^4.1.1",
29-
"prop-types": "^15.6.2",
3029
"scheduler": "^0.18.0"
3130
},
3231
"peerDependencies": {

packages/react-dom/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"dependencies": {
2020
"loose-envify": "^1.1.0",
2121
"object-assign": "^4.1.1",
22-
"prop-types": "^15.6.2",
2322
"scheduler": "^0.18.0"
2423
},
2524
"peerDependencies": {

packages/react-dom/src/server/ReactPartialRendererContext.js

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,11 @@ import type {ReactContext} from 'shared/ReactTypes';
1212

1313
import {disableLegacyContext} from 'shared/ReactFeatureFlags';
1414
import {REACT_CONTEXT_TYPE, REACT_PROVIDER_TYPE} from 'shared/ReactSymbols';
15-
import ReactSharedInternals from 'shared/ReactSharedInternals';
1615
import getComponentName from 'shared/getComponentName';
17-
import checkPropTypes from 'prop-types/checkPropTypes';
16+
import checkPropTypes from 'shared/checkPropTypes';
1817

19-
let ReactDebugCurrentFrame;
2018
let didWarnAboutInvalidateContextType;
2119
if (__DEV__) {
22-
ReactDebugCurrentFrame = ReactSharedInternals.ReactDebugCurrentFrame;
2320
didWarnAboutInvalidateContextType = new Set();
2421
}
2522

@@ -42,13 +39,7 @@ function maskContext(type, context) {
4239

4340
function checkContextTypes(typeSpecs, values, location: string) {
4441
if (__DEV__) {
45-
checkPropTypes(
46-
typeSpecs,
47-
values,
48-
location,
49-
'Component',
50-
ReactDebugCurrentFrame.getCurrentStack,
51-
);
42+
checkPropTypes(typeSpecs, values, location, 'Component');
5243
}
5344
}
5445

packages/react-dom/src/shared/ReactControlledValuePropTypes.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import checkPropTypes from 'prop-types/checkPropTypes';
8+
import checkPropTypes from 'shared/checkPropTypes';
99
import ReactSharedInternals from 'shared/ReactSharedInternals';
1010
import {enableDeprecatedFlareAPI} from 'shared/ReactFeatureFlags';
1111

packages/react-flight/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@
2929
},
3030
"dependencies": {
3131
"loose-envify": "^1.1.0",
32-
"object-assign": "^4.1.1",
33-
"prop-types": "^15.6.2"
32+
"object-assign": "^4.1.1"
3433
},
3534
"browserify": {
3635
"transform": [

packages/react-native-renderer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
},
1010
"dependencies": {
1111
"object-assign": "^4.1.1",
12-
"prop-types": "^15.6.2",
1312
"scheduler": "^0.11.0"
1413
},
1514
"peerDependencies": {

packages/react-noop-renderer/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"license": "MIT",
1313
"dependencies": {
1414
"object-assign": "^4.1.1",
15-
"prop-types": "^15.6.2",
1615
"regenerator-runtime": "^0.11.0",
1716
"react-reconciler": "*",
1817
"react-flight": "*",

packages/react-reconciler/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
"dependencies": {
3333
"loose-envify": "^1.1.0",
3434
"object-assign": "^4.1.1",
35-
"prop-types": "^15.6.2",
3635
"scheduler": "^0.18.0"
3736
},
3837
"browserify": {

packages/react-reconciler/src/ReactFiberBeginWork.js

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import type {
1818
} from './ReactFiberSuspenseComponent';
1919
import type {SuspenseContext} from './ReactFiberSuspenseContext';
2020

21-
import checkPropTypes from 'prop-types/checkPropTypes';
21+
import checkPropTypes from 'shared/checkPropTypes';
2222

2323
import {
2424
IndeterminateComponent,
@@ -76,7 +76,6 @@ import {REACT_LAZY_TYPE, getIteratorFn} from 'shared/ReactSymbols';
7676
import {
7777
setCurrentPhase,
7878
getCurrentFiberOwnerNameInDevOrNull,
79-
getCurrentFiberStackInDev,
8079
} from './ReactCurrentFiber';
8180
import {startWorkTimer, cancelWorkTimer} from './ReactDebugFiberPerf';
8281
import {
@@ -298,7 +297,6 @@ function updateForwardRef(
298297
nextProps, // Resolved props
299298
'prop',
300299
getComponentName(Component),
301-
getCurrentFiberStackInDev,
302300
);
303301
}
304302
}
@@ -416,7 +414,6 @@ function updateMemoComponent(
416414
nextProps, // Resolved props
417415
'prop',
418416
getComponentName(type),
419-
getCurrentFiberStackInDev,
420417
);
421418
}
422419
}
@@ -444,7 +441,6 @@ function updateMemoComponent(
444441
nextProps, // Resolved props
445442
'prop',
446443
getComponentName(type),
447-
getCurrentFiberStackInDev,
448444
);
449445
}
450446
}
@@ -503,7 +499,6 @@ function updateSimpleMemoComponent(
503499
nextProps, // Resolved (SimpleMemoComponent has no defaultProps)
504500
'prop',
505501
getComponentName(outerMemoType),
506-
getCurrentFiberStackInDev,
507502
);
508503
}
509504
// Inner propTypes will be validated in the function component path.
@@ -628,7 +623,6 @@ function updateFunctionComponent(
628623
nextProps, // Resolved props
629624
'prop',
630625
getComponentName(Component),
631-
getCurrentFiberStackInDev,
632626
);
633627
}
634628
}
@@ -795,7 +789,6 @@ function updateClassComponent(
795789
nextProps, // Resolved props
796790
'prop',
797791
getComponentName(Component),
798-
getCurrentFiberStackInDev,
799792
);
800793
}
801794
}
@@ -1200,7 +1193,6 @@ function mountLazyComponent(
12001193
resolvedProps, // Resolved for outer only
12011194
'prop',
12021195
getComponentName(Component),
1203-
getCurrentFiberStackInDev,
12041196
);
12051197
}
12061198
}
@@ -2636,13 +2628,7 @@ function updateContextProvider(
26362628
const providerPropTypes = workInProgress.type.propTypes;
26372629

26382630
if (providerPropTypes) {
2639-
checkPropTypes(
2640-
providerPropTypes,
2641-
newProps,
2642-
'prop',
2643-
'Context.Provider',
2644-
getCurrentFiberStackInDev,
2645-
);
2631+
checkPropTypes(providerPropTypes, newProps, 'prop', 'Context.Provider');
26462632
}
26472633
}
26482634

@@ -3222,7 +3208,6 @@ function beginWork(
32223208
resolvedProps, // Resolved for outer only
32233209
'prop',
32243210
getComponentName(type),
3225-
getCurrentFiberStackInDev,
32263211
);
32273212
}
32283213
}

packages/react-reconciler/src/ReactFiberContext.js

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import {disableLegacyContext} from 'shared/ReactFeatureFlags';
1515
import {ClassComponent, HostRoot} from 'shared/ReactWorkTags';
1616
import getComponentName from 'shared/getComponentName';
1717
import invariant from 'shared/invariant';
18-
import checkPropTypes from 'prop-types/checkPropTypes';
18+
import checkPropTypes from 'shared/checkPropTypes';
1919

20-
import {setCurrentPhase, getCurrentFiberStackInDev} from './ReactCurrentFiber';
20+
import {setCurrentPhase} from './ReactCurrentFiber';
2121
import {startPhaseTimer, stopPhaseTimer} from './ReactDebugFiberPerf';
2222
import {createCursor, push, pop} from './ReactFiberStack';
2323

@@ -105,13 +105,7 @@ function getMaskedContext(
105105

106106
if (__DEV__) {
107107
const name = getComponentName(type) || 'Unknown';
108-
checkPropTypes(
109-
contextTypes,
110-
context,
111-
'context',
112-
name,
113-
getCurrentFiberStackInDev,
114-
);
108+
checkPropTypes(contextTypes, context, 'context', name);
115109
}
116110

117111
// Cache unmasked context so we can avoid recreating masked context unless necessary.
@@ -229,18 +223,7 @@ function processChildContext(
229223
}
230224
if (__DEV__) {
231225
const name = getComponentName(type) || 'Unknown';
232-
checkPropTypes(
233-
childContextTypes,
234-
childContext,
235-
'child context',
236-
name,
237-
// In practice, there is one case in which we won't get a stack. It's when
238-
// somebody calls unstable_renderSubtreeIntoContainer() and we process
239-
// context from the parent component instance. The stack will be missing
240-
// because it's outside of the reconciliation, and so the pointer has not
241-
// been set. This is rare and doesn't matter. We'll also remove that API.
242-
getCurrentFiberStackInDev,
243-
);
226+
checkPropTypes(childContextTypes, childContext, 'child context', name);
244227
}
245228

246229
return {...parentContext, ...childContext};

0 commit comments

Comments
 (0)