Skip to content

Commit b45dfde

Browse files
committed
Remove ReactTestUtils from ReactJSXElementValidator (#28335)
DiffTrain build for [e7849b5](e7849b5)
1 parent d76cf6b commit b45dfde

36 files changed

+3733
-2702
lines changed

compiled/facebook-www/JSXDEVRuntime-dev.classic.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ if (__DEV__) {
109109

110110
var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
111111
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
112+
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
112113
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
113114
// On WWW, false is used for a new modern build.
114-
var enableRenderableContext = true;
115115

116116
function getWrappedName(outerType, innerType, wrapperName) {
117117
var displayName = outerType.displayName;
@@ -193,21 +193,30 @@ if (__DEV__) {
193193
}
194194

195195
switch (type.$$typeof) {
196-
case REACT_PROVIDER_TYPE: {
197-
return null;
198-
}
196+
case REACT_PROVIDER_TYPE:
197+
if (enableRenderableContext) {
198+
return null;
199+
} else {
200+
var provider = type;
201+
return getContextName(provider._context) + ".Provider";
202+
}
199203

200204
case REACT_CONTEXT_TYPE:
201205
var context = type;
202206

203-
{
207+
if (enableRenderableContext) {
204208
return getContextName(context) + ".Provider";
209+
} else {
210+
return getContextName(context) + ".Consumer";
205211
}
206212

207-
case REACT_CONSUMER_TYPE: {
208-
var consumer = type;
209-
return getContextName(consumer._context) + ".Consumer";
210-
}
213+
case REACT_CONSUMER_TYPE:
214+
if (enableRenderableContext) {
215+
var consumer = type;
216+
return getContextName(consumer._context) + ".Consumer";
217+
} else {
218+
return null;
219+
}
211220

212221
case REACT_FORWARD_REF_TYPE:
213222
return getWrappedName(type, type.render, "ForwardRef");
@@ -347,8 +356,8 @@ if (__DEV__) {
347356
type.$$typeof === REACT_LAZY_TYPE ||
348357
type.$$typeof === REACT_MEMO_TYPE ||
349358
type.$$typeof === REACT_CONTEXT_TYPE ||
350-
!enableRenderableContext ||
351-
type.$$typeof === REACT_CONSUMER_TYPE ||
359+
(!enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE) ||
360+
(enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE) ||
352361
type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
353362
// types supported by any Flight configuration anywhere since
354363
// we don't know which Flight build this will end up being used

compiled/facebook-www/JSXDEVRuntime-dev.modern.js

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,9 @@ if (__DEV__) {
109109

110110
var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
111111
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
112+
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
112113
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
113114
// On WWW, true is used for a new modern build.
114-
var enableRenderableContext = true;
115115

116116
function getWrappedName(outerType, innerType, wrapperName) {
117117
var displayName = outerType.displayName;
@@ -193,21 +193,30 @@ if (__DEV__) {
193193
}
194194

195195
switch (type.$$typeof) {
196-
case REACT_PROVIDER_TYPE: {
197-
return null;
198-
}
196+
case REACT_PROVIDER_TYPE:
197+
if (enableRenderableContext) {
198+
return null;
199+
} else {
200+
var provider = type;
201+
return getContextName(provider._context) + ".Provider";
202+
}
199203

200204
case REACT_CONTEXT_TYPE:
201205
var context = type;
202206

203-
{
207+
if (enableRenderableContext) {
204208
return getContextName(context) + ".Provider";
209+
} else {
210+
return getContextName(context) + ".Consumer";
205211
}
206212

207-
case REACT_CONSUMER_TYPE: {
208-
var consumer = type;
209-
return getContextName(consumer._context) + ".Consumer";
210-
}
213+
case REACT_CONSUMER_TYPE:
214+
if (enableRenderableContext) {
215+
var consumer = type;
216+
return getContextName(consumer._context) + ".Consumer";
217+
} else {
218+
return null;
219+
}
211220

212221
case REACT_FORWARD_REF_TYPE:
213222
return getWrappedName(type, type.render, "ForwardRef");
@@ -347,8 +356,8 @@ if (__DEV__) {
347356
type.$$typeof === REACT_LAZY_TYPE ||
348357
type.$$typeof === REACT_MEMO_TYPE ||
349358
type.$$typeof === REACT_CONTEXT_TYPE ||
350-
!enableRenderableContext ||
351-
type.$$typeof === REACT_CONSUMER_TYPE ||
359+
(!enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE) ||
360+
(enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE) ||
352361
type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
353362
// types supported by any Flight configuration anywhere since
354363
// we don't know which Flight build this will end up being used

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
c9798954e26a2354a951cc65607f2901a45bf035
1+
e7849b50bcefc0742ca342d70284d82cfcf990e5

compiled/facebook-www/React-dev.classic.js

Lines changed: 80 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ if (__DEV__) {
2424
) {
2525
__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error());
2626
}
27-
var ReactVersion = "18.3.0-www-classic-e2cea41c";
27+
var ReactVersion = "18.3.0-www-classic-7829c2f7";
2828

2929
// ATTENTION
3030
// When adding new symbols to this file,
@@ -401,9 +401,9 @@ if (__DEV__) {
401401

402402
var enableDebugTracing = dynamicFeatureFlags.enableDebugTracing,
403403
enableTransitionTracing = dynamicFeatureFlags.enableTransitionTracing,
404+
enableRenderableContext = dynamicFeatureFlags.enableRenderableContext,
404405
enableRefAsProp = dynamicFeatureFlags.enableRefAsProp;
405406
// On WWW, false is used for a new modern build.
406-
var enableRenderableContext = true;
407407

408408
/*
409409
* The `'' + value` pattern (used in perf-sensitive code) throws for Symbol
@@ -559,21 +559,30 @@ if (__DEV__) {
559559
}
560560

561561
switch (type.$$typeof) {
562-
case REACT_PROVIDER_TYPE: {
563-
return null;
564-
}
562+
case REACT_PROVIDER_TYPE:
563+
if (enableRenderableContext) {
564+
return null;
565+
} else {
566+
var provider = type;
567+
return getContextName(provider._context) + ".Provider";
568+
}
565569

566570
case REACT_CONTEXT_TYPE:
567571
var context = type;
568572

569-
{
573+
if (enableRenderableContext) {
570574
return getContextName(context) + ".Provider";
575+
} else {
576+
return getContextName(context) + ".Consumer";
571577
}
572578

573-
case REACT_CONSUMER_TYPE: {
574-
var consumer = type;
575-
return getContextName(consumer._context) + ".Consumer";
576-
}
579+
case REACT_CONSUMER_TYPE:
580+
if (enableRenderableContext) {
581+
var consumer = type;
582+
return getContextName(consumer._context) + ".Consumer";
583+
} else {
584+
return null;
585+
}
577586

578587
case REACT_FORWARD_REF_TYPE:
579588
return getWrappedName(type, type.render, "ForwardRef");
@@ -722,8 +731,8 @@ if (__DEV__) {
722731
type.$$typeof === REACT_LAZY_TYPE ||
723732
type.$$typeof === REACT_MEMO_TYPE ||
724733
type.$$typeof === REACT_CONTEXT_TYPE ||
725-
!enableRenderableContext ||
726-
type.$$typeof === REACT_CONSUMER_TYPE ||
734+
(!enableRenderableContext && type.$$typeof === REACT_PROVIDER_TYPE) ||
735+
(enableRenderableContext && type.$$typeof === REACT_CONSUMER_TYPE) ||
727736
type.$$typeof === REACT_FORWARD_REF_TYPE || // This needs to include all possible module reference object
728737
// types supported by any Flight configuration anywhere since
729738
// we don't know which Flight build this will end up being used
@@ -2639,12 +2648,70 @@ if (__DEV__) {
26392648
Consumer: null
26402649
};
26412650

2642-
{
2651+
if (enableRenderableContext) {
26432652
context.Provider = context;
26442653
context.Consumer = {
26452654
$$typeof: REACT_CONSUMER_TYPE,
26462655
_context: context
26472656
};
2657+
} else {
2658+
context.Provider = {
2659+
$$typeof: REACT_PROVIDER_TYPE,
2660+
_context: context
2661+
};
2662+
2663+
{
2664+
var Consumer = {
2665+
$$typeof: REACT_CONTEXT_TYPE,
2666+
_context: context
2667+
};
2668+
Object.defineProperties(Consumer, {
2669+
Provider: {
2670+
get: function () {
2671+
return context.Provider;
2672+
},
2673+
set: function (_Provider) {
2674+
context.Provider = _Provider;
2675+
}
2676+
},
2677+
_currentValue: {
2678+
get: function () {
2679+
return context._currentValue;
2680+
},
2681+
set: function (_currentValue) {
2682+
context._currentValue = _currentValue;
2683+
}
2684+
},
2685+
_currentValue2: {
2686+
get: function () {
2687+
return context._currentValue2;
2688+
},
2689+
set: function (_currentValue2) {
2690+
context._currentValue2 = _currentValue2;
2691+
}
2692+
},
2693+
_threadCount: {
2694+
get: function () {
2695+
return context._threadCount;
2696+
},
2697+
set: function (_threadCount) {
2698+
context._threadCount = _threadCount;
2699+
}
2700+
},
2701+
Consumer: {
2702+
get: function () {
2703+
return context.Consumer;
2704+
}
2705+
},
2706+
displayName: {
2707+
get: function () {
2708+
return context.displayName;
2709+
},
2710+
set: function (displayName) {}
2711+
}
2712+
});
2713+
context.Consumer = Consumer;
2714+
}
26482715
}
26492716

26502717
{

0 commit comments

Comments
 (0)