Skip to content

Commit

Permalink
Revert the outer module object to an object (#26093)
Browse files Browse the repository at this point in the history
This is because Webpack has a `typeof ... === 'object'` before its esm
compat test.

This is unfortunate because it means we can't have a nice error in CJS
when someone does this:

```
const fn = require('client-fn');
fn();
```

I also fixed some checks in the validator that read off the client ref.
It shouldn't do those checks against a client ref, since those now
throw.

DiffTrain build for [922dd7b](922dd7b)
[View git log for this commit](https://github.com/facebook/react/commits/922dd7ba50f69f1f969c5809eb57104768716c89)
  • Loading branch information
sebmarkbage committed Feb 2, 2023
1 parent 8aff9a7 commit 3209889
Show file tree
Hide file tree
Showing 30 changed files with 98 additions and 60 deletions.
12 changes: 9 additions & 3 deletions compiled/facebook-www/JSXDEVRuntime-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ function jsxDEV(type, config, maybeKey, source, self) {

var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$1(element) {
{
Expand Down Expand Up @@ -1268,11 +1269,12 @@ function validateExplicitKey(element, parentType) {

function validateChildKeys(node, parentType) {
{
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$1);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -1285,7 +1287,7 @@ function validateChildKeys(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -1320,6 +1322,10 @@ function validatePropTypes(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$1) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down
12 changes: 9 additions & 3 deletions compiled/facebook-www/JSXDEVRuntime-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -1109,6 +1109,7 @@ function jsxDEV(type, config, maybeKey, source, self) {

var ReactCurrentOwner$1 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$1 = ReactSharedInternals.ReactDebugCurrentFrame;
var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$1(element) {
{
Expand Down Expand Up @@ -1268,11 +1269,12 @@ function validateExplicitKey(element, parentType) {

function validateChildKeys(node, parentType) {
{
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$1);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -1285,7 +1287,7 @@ function validateChildKeys(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -1320,6 +1322,10 @@ function validatePropTypes(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$1) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d111ffdfbcfee4b348a3d49c16f02cb718c896f
922dd7ba50f69f1f969c5809eb57104768716c89
2 changes: 1 addition & 1 deletion compiled/facebook-www/REVISION_TRANSFORMS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
9d111ffdfbcfee4b348a3d49c16f02cb718c896f
922dd7ba50f69f1f969c5809eb57104768716c89
27 changes: 20 additions & 7 deletions compiled/facebook-www/React-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-classic-922dd7ba5-20230202";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2572,6 +2572,8 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) {
}
}

var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$1(element) {
{
if (element) {
Expand Down Expand Up @@ -2713,11 +2715,12 @@ function validateExplicitKey(element, parentType) {
*/

function validateChildKeys(node, parentType) {
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$1);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -2730,7 +2733,7 @@ function validateChildKeys(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -2764,6 +2767,10 @@ function validatePropTypes(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$1) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down Expand Up @@ -3734,6 +3741,7 @@ function jsxDEV(type, config, maybeKey, source, self) {

var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
var REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$2(element) {
{
Expand Down Expand Up @@ -3893,11 +3901,12 @@ function validateExplicitKey$1(element, parentType) {

function validateChildKeys$1(node, parentType) {
{
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$2);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -3910,7 +3919,7 @@ function validateChildKeys$1(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -3945,6 +3954,10 @@ function validatePropTypes$1(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$2) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down
27 changes: 20 additions & 7 deletions compiled/facebook-www/React-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ if (
}
"use strict";

var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-modern-922dd7ba5-20230202";

// ATTENTION
// When adding new symbols to this file,
Expand Down Expand Up @@ -2572,6 +2572,8 @@ function checkPropTypes(typeSpecs, values, location, componentName, element) {
}
}

var REACT_CLIENT_REFERENCE$1 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$1(element) {
{
if (element) {
Expand Down Expand Up @@ -2713,11 +2715,12 @@ function validateExplicitKey(element, parentType) {
*/

function validateChildKeys(node, parentType) {
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$1);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -2730,7 +2733,7 @@ function validateChildKeys(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -2764,6 +2767,10 @@ function validatePropTypes(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$1) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down Expand Up @@ -3699,6 +3706,7 @@ function jsxDEV(type, config, maybeKey, source, self) {

var ReactCurrentOwner$2 = ReactSharedInternals.ReactCurrentOwner;
var ReactDebugCurrentFrame$2 = ReactSharedInternals.ReactDebugCurrentFrame;
var REACT_CLIENT_REFERENCE$2 = Symbol.for("react.client.reference");

function setCurrentlyValidatingElement$2(element) {
{
Expand Down Expand Up @@ -3858,11 +3866,12 @@ function validateExplicitKey$1(element, parentType) {

function validateChildKeys$1(node, parentType) {
{
if (typeof node !== "object") {
if (typeof node !== "object" || !node) {
return;
}

if (isArray(node)) {
if (node.$$typeof === REACT_CLIENT_REFERENCE$2);
else if (isArray(node)) {
for (var i = 0; i < node.length; i++) {
var child = node[i];

Expand All @@ -3875,7 +3884,7 @@ function validateChildKeys$1(node, parentType) {
if (node._store) {
node._store.validated = true;
}
} else if (node) {
} else {
var iteratorFn = getIteratorFn(node);

if (typeof iteratorFn === "function") {
Expand Down Expand Up @@ -3910,6 +3919,10 @@ function validatePropTypes$1(element) {
return;
}

if (type.$$typeof === REACT_CLIENT_REFERENCE$2) {
return;
}

var propTypes;

if (typeof type === "function") {
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -646,4 +646,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-9d111ffdf-20230201";
exports.version = "18.3.0-www-classic-922dd7ba5-20230202";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -638,4 +638,4 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-9d111ffdf-20230201";
exports.version = "18.3.0-www-modern-922dd7ba5-20230202";
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-classic-9d111ffdf-20230201";
exports.version = "18.3.0-www-classic-922dd7ba5-20230202";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/React-profiling.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,7 +649,7 @@ exports.useSyncExternalStore = function (
);
};
exports.useTransition = useTransition;
exports.version = "18.3.0-www-modern-9d111ffdf-20230201";
exports.version = "18.3.0-www-modern-922dd7ba5-20230202";

/* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */
if (
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-classic-922dd7ba5-20230202";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactART-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ function _assertThisInitialized(self) {
return self;
}

var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-modern-922dd7ba5-20230202";

var LegacyRoot = 0;
var ConcurrentRoot = 1;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -9845,7 +9845,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-classic-9d111ffdf-20230201",
version: "18.3.0-www-classic-922dd7ba5-20230202",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1318 = {
Expand Down Expand Up @@ -9876,7 +9876,7 @@ var internals$jscomp$inline_1318 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9d111ffdf-20230201"
reconcilerVersion: "18.3.0-next-922dd7ba5-20230202"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1319 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
4 changes: 2 additions & 2 deletions compiled/facebook-www/ReactART-prod.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -9510,7 +9510,7 @@ var slice = Array.prototype.slice,
return null;
},
bundleType: 0,
version: "18.3.0-www-modern-9d111ffdf-20230201",
version: "18.3.0-www-modern-922dd7ba5-20230202",
rendererPackageName: "react-art"
};
var internals$jscomp$inline_1309 = {
Expand Down Expand Up @@ -9541,7 +9541,7 @@ var internals$jscomp$inline_1309 = {
scheduleRoot: null,
setRefreshHandler: null,
getCurrentFiber: null,
reconcilerVersion: "18.3.0-next-9d111ffdf-20230201"
reconcilerVersion: "18.3.0-next-922dd7ba5-20230202"
};
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
var hook$jscomp$inline_1310 = __REACT_DEVTOOLS_GLOBAL_HOOK__;
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOM-dev.classic.js
Original file line number Diff line number Diff line change
Expand Up @@ -42695,7 +42695,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-classic-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-classic-922dd7ba5-20230202";

function createPortal(
children,
Expand Down
2 changes: 1 addition & 1 deletion compiled/facebook-www/ReactDOM-dev.modern.js
Original file line number Diff line number Diff line change
Expand Up @@ -42419,7 +42419,7 @@ function createFiberRoot(
return root;
}

var ReactVersion = "18.3.0-www-modern-9d111ffdf-20230201";
var ReactVersion = "18.3.0-www-modern-922dd7ba5-20230202";

function createPortal(
children,
Expand Down
Loading

0 comments on commit 3209889

Please sign in to comment.