Implements wiring for Flight to have it's own "HostConfig" (#26590)

This reverts commit 9429ec9a83.

DiffTrain build for [cdf4588242e1dc0c9b29f7539d9ae97d216d03d4](https://github.com/facebook/react/commit/cdf4588242e1dc0c9b29f7539d9ae97d216d03d4)
This commit is contained in:
kassens
2023-04-20 15:32:52 +00:00
parent 1f49af93f1
commit 6325f82838
5 changed files with 13 additions and 587 deletions
+1 -1
View File
@@ -1 +1 @@
1d3ffd9d9addb4aa0988b92ee6917c07c3c261ae
cdf4588242e1dc0c9b29f7539d9ae97d216d03d4
@@ -189,246 +189,6 @@ function getIteratorFn(maybeIterable) {
return null;
}
// Re-export dynamic flags from the www version.
require("ReactFeatureFlags");
// A simple string attribute.
// Attributes that aren't in the filter are presumed to have this type.
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
// "enumerated" attributes with "true" and "false" as possible values.
// When true, it should be set to a "true" string.
// When false, it should be set to a "false" string.
var BOOLEANISH_STRING = 2; // A real boolean attribute.
// When true, it should be present (set either to an empty string or its name).
// When false, it should be omitted.
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
// When true, it should be present (set either to an empty string or its name).
// When false, it should be omitted.
// For any other value, should be present with that value.
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
// When falsy, it should be removed.
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
function PropertyInfoRecord(
type,
attributeName,
attributeNamespace,
sanitizeURL,
removeEmptyString
) {
this.acceptsBooleans =
type === BOOLEANISH_STRING ||
type === BOOLEAN ||
type === OVERLOADED_BOOLEAN;
this.attributeName = attributeName;
this.attributeNamespace = attributeNamespace;
this.type = type;
this.sanitizeURL = sanitizeURL;
this.removeEmptyString = removeEmptyString;
} // When adding attributes to this list, be sure to also add them to
// In React, we let users pass `true` and `false` even though technically
// these aren't boolean attributes (they are coerced to strings).
["contentEditable", "draggable", "spellCheck", "value"].forEach(function (
name
) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
BOOLEANISH_STRING,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These are "enumerated" SVG attributes that accept "true" and "false".
[
"allowFullScreen",
"async", // Note: there is a special case that prevents it from being written to the DOM
// on the client side because the browsers are inconsistent. Instead we call focus().
"autoFocus",
"autoPlay",
"controls",
"default",
"defer",
"disabled",
"disablePictureInPicture",
"disableRemotePlayback",
"formNoValidate",
"hidden",
"loop",
"noModule",
"noValidate",
"open",
"playsInline",
"readOnly",
"required",
"reversed",
"scoped",
"seamless", // Microdata
"itemScope"
].forEach(function (name) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
BOOLEAN,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These are HTML attributes that are "overloaded booleans": they behave like
["rowSpan", "start"].forEach(function (name) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
NUMERIC,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
});
var CAMELIZE = /[\-\:]([a-z])/g;
var capitalize = function (token) {
return token[1].toUpperCase();
}; // This is a list of all SVG attributes that need special casing, namespacing,
// or boolean value assignment. Regular attributes that just accept strings
// and have the same names are omitted, just like in the HTML attribute filter.
// Some of these attributes can be hard to find. This list was created by
// scraping the MDN documentation.
[
"accent-height",
"alignment-baseline",
"arabic-form",
"baseline-shift",
"cap-height",
"clip-path",
"clip-rule",
"color-interpolation",
"color-interpolation-filters",
"color-profile",
"color-rendering",
"dominant-baseline",
"enable-background",
"fill-opacity",
"fill-rule",
"flood-color",
"flood-opacity",
"font-family",
"font-size",
"font-size-adjust",
"font-stretch",
"font-style",
"font-variant",
"font-weight",
"glyph-name",
"glyph-orientation-horizontal",
"glyph-orientation-vertical",
"horiz-adv-x",
"horiz-origin-x",
"image-rendering",
"letter-spacing",
"lighting-color",
"marker-end",
"marker-mid",
"marker-start",
"overline-position",
"overline-thickness",
"paint-order",
"panose-1",
"pointer-events",
"rendering-intent",
"shape-rendering",
"stop-color",
"stop-opacity",
"strikethrough-position",
"strikethrough-thickness",
"stroke-dasharray",
"stroke-dashoffset",
"stroke-linecap",
"stroke-linejoin",
"stroke-miterlimit",
"stroke-opacity",
"stroke-width",
"text-anchor",
"text-decoration",
"text-rendering",
"transform-origin",
"underline-position",
"underline-thickness",
"unicode-bidi",
"unicode-range",
"units-per-em",
"v-alphabetic",
"v-hanging",
"v-ideographic",
"v-mathematical",
"vector-effect",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
"word-spacing",
"writing-mode",
"xmlns:xlink",
"x-height" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // String SVG attributes with the xlink namespace.
[
"xlink:actuate",
"xlink:arcrole",
"xlink:role",
"xlink:show",
"xlink:title",
"xlink:type" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // String SVG attributes with the xml namespace.
[
"xml:base",
"xml:lang",
"xml:space" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // These attribute exists both in HTML and SVG.
// The attribute name is case-sensitive in SVG so we can't just use
// the React name like we do for attributes that exist only in HTML.
["tabIndex", "crossOrigin"].forEach(function (attributeName) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
STRING,
attributeName.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These attributes accept URLs. These must not allow javascript: URLS.
["src", "href", "action"].forEach(function (attributeName) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
STRING,
attributeName.toLowerCase(), // attributeName
null, // attributeNamespace
true, // sanitizeURL
true
);
});
var rendererSigil;
{
@@ -637,6 +397,9 @@ function readContext$1(context) {
return value;
}
// Re-export dynamic flags from the www version.
require("ReactFeatureFlags");
// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally,
// changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable"
@@ -189,246 +189,6 @@ function getIteratorFn(maybeIterable) {
return null;
}
// Re-export dynamic flags from the www version.
require("ReactFeatureFlags");
// A simple string attribute.
// Attributes that aren't in the filter are presumed to have this type.
var STRING = 1; // A string attribute that accepts booleans in React. In HTML, these are called
// "enumerated" attributes with "true" and "false" as possible values.
// When true, it should be set to a "true" string.
// When false, it should be set to a "false" string.
var BOOLEANISH_STRING = 2; // A real boolean attribute.
// When true, it should be present (set either to an empty string or its name).
// When false, it should be omitted.
var BOOLEAN = 3; // An attribute that can be used as a flag as well as with a value.
// When true, it should be present (set either to an empty string or its name).
// When false, it should be omitted.
// For any other value, should be present with that value.
var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a numeric.
// When falsy, it should be removed.
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
function PropertyInfoRecord(
type,
attributeName,
attributeNamespace,
sanitizeURL,
removeEmptyString
) {
this.acceptsBooleans =
type === BOOLEANISH_STRING ||
type === BOOLEAN ||
type === OVERLOADED_BOOLEAN;
this.attributeName = attributeName;
this.attributeNamespace = attributeNamespace;
this.type = type;
this.sanitizeURL = sanitizeURL;
this.removeEmptyString = removeEmptyString;
} // When adding attributes to this list, be sure to also add them to
// In React, we let users pass `true` and `false` even though technically
// these aren't boolean attributes (they are coerced to strings).
["contentEditable", "draggable", "spellCheck", "value"].forEach(function (
name
) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
BOOLEANISH_STRING,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These are "enumerated" SVG attributes that accept "true" and "false".
[
"allowFullScreen",
"async", // Note: there is a special case that prevents it from being written to the DOM
// on the client side because the browsers are inconsistent. Instead we call focus().
"autoFocus",
"autoPlay",
"controls",
"default",
"defer",
"disabled",
"disablePictureInPicture",
"disableRemotePlayback",
"formNoValidate",
"hidden",
"loop",
"noModule",
"noValidate",
"open",
"playsInline",
"readOnly",
"required",
"reversed",
"scoped",
"seamless", // Microdata
"itemScope"
].forEach(function (name) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
BOOLEAN,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These are HTML attributes that are "overloaded booleans": they behave like
["rowSpan", "start"].forEach(function (name) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
NUMERIC,
name.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
});
var CAMELIZE = /[\-\:]([a-z])/g;
var capitalize = function (token) {
return token[1].toUpperCase();
}; // This is a list of all SVG attributes that need special casing, namespacing,
// or boolean value assignment. Regular attributes that just accept strings
// and have the same names are omitted, just like in the HTML attribute filter.
// Some of these attributes can be hard to find. This list was created by
// scraping the MDN documentation.
[
"accent-height",
"alignment-baseline",
"arabic-form",
"baseline-shift",
"cap-height",
"clip-path",
"clip-rule",
"color-interpolation",
"color-interpolation-filters",
"color-profile",
"color-rendering",
"dominant-baseline",
"enable-background",
"fill-opacity",
"fill-rule",
"flood-color",
"flood-opacity",
"font-family",
"font-size",
"font-size-adjust",
"font-stretch",
"font-style",
"font-variant",
"font-weight",
"glyph-name",
"glyph-orientation-horizontal",
"glyph-orientation-vertical",
"horiz-adv-x",
"horiz-origin-x",
"image-rendering",
"letter-spacing",
"lighting-color",
"marker-end",
"marker-mid",
"marker-start",
"overline-position",
"overline-thickness",
"paint-order",
"panose-1",
"pointer-events",
"rendering-intent",
"shape-rendering",
"stop-color",
"stop-opacity",
"strikethrough-position",
"strikethrough-thickness",
"stroke-dasharray",
"stroke-dashoffset",
"stroke-linecap",
"stroke-linejoin",
"stroke-miterlimit",
"stroke-opacity",
"stroke-width",
"text-anchor",
"text-decoration",
"text-rendering",
"transform-origin",
"underline-position",
"underline-thickness",
"unicode-bidi",
"unicode-range",
"units-per-em",
"v-alphabetic",
"v-hanging",
"v-ideographic",
"v-mathematical",
"vector-effect",
"vert-adv-y",
"vert-origin-x",
"vert-origin-y",
"word-spacing",
"writing-mode",
"xmlns:xlink",
"x-height" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // String SVG attributes with the xlink namespace.
[
"xlink:actuate",
"xlink:arcrole",
"xlink:role",
"xlink:show",
"xlink:title",
"xlink:type" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // String SVG attributes with the xml namespace.
[
"xml:base",
"xml:lang",
"xml:space" // NOTE: if you add a camelCased prop to this list,
// you'll need to set attributeName to name.toLowerCase()
// instead in the assignment below.
].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
}); // These attribute exists both in HTML and SVG.
// The attribute name is case-sensitive in SVG so we can't just use
// the React name like we do for attributes that exist only in HTML.
["tabIndex", "crossOrigin"].forEach(function (attributeName) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
STRING,
attributeName.toLowerCase(), // attributeName
null, // attributeNamespace
false, // sanitizeURL
false
);
}); // These attributes accept URLs. These must not allow javascript: URLS.
["src", "href", "action"].forEach(function (attributeName) {
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
new PropertyInfoRecord(
STRING,
attributeName.toLowerCase(), // attributeName
null, // attributeNamespace
true, // sanitizeURL
true
);
});
var rendererSigil;
{
@@ -637,6 +397,9 @@ function readContext$1(context) {
return value;
}
// Re-export dynamic flags from the www version.
require("ReactFeatureFlags");
// Corresponds to ReactFiberWakeable and ReactFizzWakeable modules. Generally,
// changes to one module should be reflected in the others.
// TODO: Rename this module and the corresponding Fiber one to "Thenable"
@@ -60,59 +60,8 @@ var REACT_ELEMENT_TYPE = Symbol.for("react.element"),
"react.default_value"
),
REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
require("ReactFeatureFlags");
function PropertyInfoRecord(
type,
attributeName,
attributeNamespace,
sanitizeURL,
removeEmptyString
) {
this.acceptsBooleans = 2 === type || 3 === type || 4 === type;
this.attributeName = attributeName;
this.attributeNamespace = attributeNamespace;
this.type = type;
this.sanitizeURL = sanitizeURL;
this.removeEmptyString = removeEmptyString;
}
["contentEditable", "draggable", "spellCheck", "value"].forEach(function (
name
) {
new PropertyInfoRecord(2, name.toLowerCase(), null, !1, !1);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope"
.split(" ")
.forEach(function (name) {
new PropertyInfoRecord(3, name.toLowerCase(), null, !1, !1);
});
["rowSpan", "start"].forEach(function (name) {
new PropertyInfoRecord(5, name.toLowerCase(), null, !1, !1);
});
var CAMELIZE = /[\-:]([a-z])/g;
function capitalize(token) {
return token[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering transform-origin underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height"
.split(" ")
.forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type"
.split(" ")
.forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
["xml:base", "xml:lang", "xml:space"].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
["tabIndex", "crossOrigin"].forEach(function (attributeName) {
new PropertyInfoRecord(1, attributeName.toLowerCase(), null, !1, !1);
});
["src", "href", "action"].forEach(function (attributeName) {
new PropertyInfoRecord(1, attributeName.toLowerCase(), null, !0, !0);
});
var currentActiveSnapshot = null;
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
currentActiveSnapshot = null;
function popToNearestCommonAncestor(prev, next) {
if (prev !== next) {
prev.context._currentValue = prev.parentValue;
@@ -192,6 +141,7 @@ function pushProvider(context, nextValue) {
value: nextValue
});
}
require("ReactFeatureFlags");
var SuspenseException = Error(
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
);
@@ -60,59 +60,8 @@ var REACT_ELEMENT_TYPE = Symbol.for("react.element"),
"react.default_value"
),
REACT_MEMO_CACHE_SENTINEL = Symbol.for("react.memo_cache_sentinel"),
MAYBE_ITERATOR_SYMBOL = Symbol.iterator;
require("ReactFeatureFlags");
function PropertyInfoRecord(
type,
attributeName,
attributeNamespace,
sanitizeURL,
removeEmptyString
) {
this.acceptsBooleans = 2 === type || 3 === type || 4 === type;
this.attributeName = attributeName;
this.attributeNamespace = attributeNamespace;
this.type = type;
this.sanitizeURL = sanitizeURL;
this.removeEmptyString = removeEmptyString;
}
["contentEditable", "draggable", "spellCheck", "value"].forEach(function (
name
) {
new PropertyInfoRecord(2, name.toLowerCase(), null, !1, !1);
});
"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope"
.split(" ")
.forEach(function (name) {
new PropertyInfoRecord(3, name.toLowerCase(), null, !1, !1);
});
["rowSpan", "start"].forEach(function (name) {
new PropertyInfoRecord(5, name.toLowerCase(), null, !1, !1);
});
var CAMELIZE = /[\-:]([a-z])/g;
function capitalize(token) {
return token[1].toUpperCase();
}
"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering transform-origin underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height"
.split(" ")
.forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type"
.split(" ")
.forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
["xml:base", "xml:lang", "xml:space"].forEach(function (attributeName) {
attributeName.replace(CAMELIZE, capitalize);
});
["tabIndex", "crossOrigin"].forEach(function (attributeName) {
new PropertyInfoRecord(1, attributeName.toLowerCase(), null, !1, !1);
});
["src", "href", "action"].forEach(function (attributeName) {
new PropertyInfoRecord(1, attributeName.toLowerCase(), null, !0, !0);
});
var currentActiveSnapshot = null;
MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
currentActiveSnapshot = null;
function popToNearestCommonAncestor(prev, next) {
if (prev !== next) {
prev.context._currentValue = prev.parentValue;
@@ -192,6 +141,7 @@ function pushProvider(context, nextValue) {
value: nextValue
});
}
require("ReactFeatureFlags");
var SuspenseException = Error(
"Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
);