Skip to content

Commit 1c9327e

Browse files
committed
Update Rollup to 3.x (#26442)
<!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. Before submitting a pull request, please make sure the following is done: 1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`. 2. Run `yarn` in the repository root. 3. If you've fixed a bug or added code that should be tested, add tests! 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`. 6. If you need a debugger, run `yarn test --debug --watch TestName`, open `chrome://inspect`, and press "Inspect". 7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`). 8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files. 9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`). 10. If you haven't already, complete the CLA. Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html --> ## Summary This PR: - Updates Rollup from 2.x to latest 3.x, and updates associated plugins - Updates deprecated / altered config settings in the Rollup plugin pipeline - Fixes some file extension and import issues related to use of ESM in `react-dom-webpack-server` - Removes a now-obsolete `strip-unused-imports` Rollup plugin - <s>Fixes an _existing_ bug with the Rollup 2.x plugin pipeline on `main` that was causing parts of `DOMProperty.js` to get left out of the `react-dom-webpack-server` JS bundles, by adding a new plugin to tell Rollup to treat that file as if it as side effects</s> This PR should be functionally identical to the other existing "Rollup 3 upgrade" PR at #26078 . I'm filing this as a near-duplicate because I'm ready to push this change through ASAP so that I can follow it up with a PR that adds sourcemap support, that PR's artifact diffing seems like it's possibly stuck and I want to compare the build results, and I've got this set up against latest `main`. <!-- Explain the **motivation** for making this change. What existing problem does the pull request solve? --> This gets React's build setup updated to the latest Rollup version, which is generally a good practice, but also ensures that any further Rollup config tweaks can be done using the current Rollup docs as a reference. ## How did you test this change? <!-- Demonstrate the code is solid. Example: The exact commands you ran and their output, screenshots / videos if the pull request changes the user interface. How exactly did you verify that your PR solves the issue you wanted to solve? If you leave this empty, your PR will very likely be closed. --> - Made builds from the latest `main` - Updated Rollup package versions and cross-compared the changes I needed to make locally to get successful builds vs #26078 - Diffed the output folders between `main` and this PR, and confirmed that the bundle contents are identical (with the exception of version strings and the `react-dom-webpack-server` bundle fix re-adding missing `DOMProperty.js` content) DiffTrain build for [909c6da](909c6da)
1 parent c6d6bdf commit 1c9327e

9 files changed

+21
-450
lines changed

compiled/facebook-www/REVISION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
9c54b29b44d24f8f8090da9c7ebf569747a444df
1+
909c6dacfde06b87fa22f2e8506c47124cf982b5

compiled/facebook-www/ReactART-prod.modern.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9635,7 +9635,7 @@ var slice = Array.prototype.slice,
96359635
return null;
96369636
},
96379637
bundleType: 0,
9638-
version: "18.3.0-www-modern-1925ba21",
9638+
version: "18.3.0-www-modern-b7692384",
96399639
rendererPackageName: "react-art"
96409640
};
96419641
var internals$jscomp$inline_1323 = {
@@ -9666,7 +9666,7 @@ var internals$jscomp$inline_1323 = {
96669666
scheduleRoot: null,
96679667
setRefreshHandler: null,
96689668
getCurrentFiber: null,
9669-
reconcilerVersion: "18.3.0-www-modern-1925ba21"
9669+
reconcilerVersion: "18.3.0-www-modern-b7692384"
96709670
};
96719671
if ("undefined" !== typeof __REACT_DEVTOOLS_GLOBAL_HOOK__) {
96729672
var hook$jscomp$inline_1324 = __REACT_DEVTOOLS_GLOBAL_HOOK__;

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21994,9 +21994,7 @@ function readContextDuringReconcilation(consumer, context, renderLanes) {
2199421994
}
2199521995

2199621996
function readContextForConsumer(consumer, context) {
21997-
var value = isPrimaryRenderer
21998-
? context._currentValue
21999-
: context._currentValue2;
21997+
var value = context._currentValue;
2200021998

2200121999
if (lastFullyObservedContext === context);
2200222000
else {
@@ -33524,7 +33522,7 @@ function createFiberRoot(
3352433522
return root;
3352533523
}
3352633524

33527-
var ReactVersion = "18.3.0-www-modern-1925ba21";
33525+
var ReactVersion = "18.3.0-www-modern-b7692384";
3352833526

3352933527
function createPortal$1(
3353033528
children,
@@ -42373,7 +42371,6 @@ function getCurrentEventPriority() {
4237342371

4237442372
return getEventPriority(currentEvent.type);
4237542373
}
42376-
var isPrimaryRenderer = true;
4237742374
// if a component just imports ReactDOM (e.g. for findDOMNode).
4237842375
// Some environments might not have setTimeout or clearTimeout.
4237942376

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24823,9 +24823,7 @@ function readContextDuringReconcilation(consumer, context, renderLanes) {
2482324823
}
2482424824

2482524825
function readContextForConsumer(consumer, context) {
24826-
var value = isPrimaryRenderer
24827-
? context._currentValue
24828-
: context._currentValue2;
24826+
var value = context._currentValue;
2482924827

2483024828
if (lastFullyObservedContext === context);
2483124829
else {
@@ -36865,7 +36863,7 @@ function createFiberRoot(
3686536863
return root;
3686636864
}
3686736865

36868-
var ReactVersion = "18.3.0-www-classic-ac60b8a6";
36866+
var ReactVersion = "18.3.0-www-classic-08ca8562";
3686936867

3687036868
function createPortal$1(
3687136869
children,
@@ -40017,7 +40015,6 @@ function getCurrentEventPriority() {
4001740015

4001840016
return getEventPriority(currentEvent.type);
4001940017
}
40020-
var isPrimaryRenderer = true;
4002140018
// if a component just imports ReactDOM (e.g. for findDOMNode).
4002240019
// Some environments might not have setTimeout or clearTimeout.
4002340020

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

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22128,9 +22128,7 @@ function readContextDuringReconcilation(consumer, context, renderLanes) {
2212822128
}
2212922129

2213022130
function readContextForConsumer(consumer, context) {
22131-
var value = isPrimaryRenderer
22132-
? context._currentValue
22133-
: context._currentValue2;
22131+
var value = context._currentValue;
2213422132

2213522133
if (lastFullyObservedContext === context);
2213622134
else {
@@ -34141,7 +34139,7 @@ function createFiberRoot(
3414134139
return root;
3414234140
}
3414334141

34144-
var ReactVersion = "18.3.0-www-modern-c338eadf";
34142+
var ReactVersion = "18.3.0-www-modern-ea61562f";
3414534143

3414634144
function createPortal$1(
3414734145
children,
@@ -42992,7 +42990,6 @@ function getCurrentEventPriority() {
4299242990

4299342991
return getEventPriority(currentEvent.type);
4299442992
}
42995-
var isPrimaryRenderer = true;
4299642993
// if a component just imports ReactDOM (e.g. for findDOMNode).
4299742994
// Some environments might not have setTimeout or clearTimeout.
4299842995

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

Lines changed: 3 additions & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,6 @@ var OVERLOADED_BOOLEAN = 4; // An attribute that must be numeric or parse as a n
215215
// When falsy, it should be removed.
216216

217217
var NUMERIC = 5; // An attribute that must be positive numeric or parse as a positive numeric.
218-
// When falsy, it should be removed.
219-
220-
var POSITIVE_NUMERIC = 6;
221218

222219
function PropertyInfoRecord(
223220
name,
@@ -240,27 +237,6 @@ function PropertyInfoRecord(
240237
this.sanitizeURL = sanitizeURL;
241238
this.removeEmptyString = removeEmptyString;
242239
} // When adding attributes to this list, be sure to also add them to
243-
// This is a mapping from React prop names to the attribute names.
244-
245-
[
246-
["acceptCharset", "accept-charset"],
247-
["className", "class"],
248-
["htmlFor", "for"],
249-
["httpEquiv", "http-equiv"]
250-
].forEach(function (_ref) {
251-
var name = _ref[0],
252-
attributeName = _ref[1];
253-
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
254-
new PropertyInfoRecord(
255-
name,
256-
STRING,
257-
false, // mustUseProperty
258-
attributeName, // attributeName
259-
null, // attributeNamespace
260-
false, // sanitizeURL
261-
false
262-
);
263-
}); // These are "enumerated" HTML attributes that accept "true" and "false".
264240
// In React, we let users pass `true` and `false` even though technically
265241
// these aren't boolean attributes (they are coerced to strings).
266242

@@ -278,27 +254,6 @@ function PropertyInfoRecord(
278254
false
279255
);
280256
}); // These are "enumerated" SVG attributes that accept "true" and "false".
281-
// In React, we let users pass `true` and `false` even though technically
282-
// these aren't boolean attributes (they are coerced to strings).
283-
// Since these are SVG attributes, their attribute names are case-sensitive.
284-
285-
[
286-
"autoReverse",
287-
"externalResourcesRequired",
288-
"focusable",
289-
"preserveAlpha"
290-
].forEach(function (name) {
291-
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
292-
new PropertyInfoRecord(
293-
name,
294-
BOOLEANISH_STRING,
295-
false, // mustUseProperty
296-
name, // attributeName
297-
null, // attributeNamespace
298-
false, // sanitizeURL
299-
false
300-
);
301-
}); // These are HTML boolean attributes.
302257

303258
[
304259
"allowFullScreen",
@@ -337,67 +292,6 @@ function PropertyInfoRecord(
337292
false
338293
);
339294
}); // These are the few React props that we set as DOM properties
340-
// rather than attributes. These are all booleans.
341-
342-
[
343-
"checked", // Note: `option.selected` is not updated if `select.multiple` is
344-
// disabled with `removeAttribute`. We have special logic for handling this.
345-
"multiple",
346-
"muted",
347-
"selected" // NOTE: if you add a camelCased prop to this list,
348-
// you'll need to set attributeName to name.toLowerCase()
349-
// instead in the assignment below.
350-
].forEach(function (name) {
351-
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
352-
new PropertyInfoRecord(
353-
name,
354-
BOOLEAN,
355-
true, // mustUseProperty
356-
name, // attributeName
357-
null, // attributeNamespace
358-
false, // sanitizeURL
359-
false
360-
);
361-
}); // These are HTML attributes that are "overloaded booleans": they behave like
362-
// booleans, but can also accept a string value.
363-
364-
[
365-
"capture",
366-
"download" // NOTE: if you add a camelCased prop to this list,
367-
// you'll need to set attributeName to name.toLowerCase()
368-
// instead in the assignment below.
369-
].forEach(function (name) {
370-
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
371-
new PropertyInfoRecord(
372-
name,
373-
OVERLOADED_BOOLEAN,
374-
false, // mustUseProperty
375-
name, // attributeName
376-
null, // attributeNamespace
377-
false, // sanitizeURL
378-
false
379-
);
380-
}); // These are HTML attributes that must be positive numbers.
381-
382-
[
383-
"cols",
384-
"rows",
385-
"size",
386-
"span" // NOTE: if you add a camelCased prop to this list,
387-
// you'll need to set attributeName to name.toLowerCase()
388-
// instead in the assignment below.
389-
].forEach(function (name) {
390-
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
391-
new PropertyInfoRecord(
392-
name,
393-
POSITIVE_NUMERIC,
394-
false, // mustUseProperty
395-
name, // attributeName
396-
null, // attributeNamespace
397-
false, // sanitizeURL
398-
false
399-
);
400-
}); // These are HTML attributes that must be numbers.
401295

402296
["rowSpan", "start"].forEach(function (name) {
403297
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
@@ -499,17 +393,7 @@ var capitalize = function (token) {
499393
// you'll need to set attributeName to name.toLowerCase()
500394
// instead in the assignment below.
501395
].forEach(function (attributeName) {
502-
var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
503-
504-
new PropertyInfoRecord(
505-
name,
506-
STRING,
507-
false, // mustUseProperty
508-
attributeName,
509-
null, // attributeNamespace
510-
false, // sanitizeURL
511-
false
512-
);
396+
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
513397
}); // String SVG attributes with the xlink namespace.
514398

515399
[
@@ -522,17 +406,7 @@ var capitalize = function (token) {
522406
// you'll need to set attributeName to name.toLowerCase()
523407
// instead in the assignment below.
524408
].forEach(function (attributeName) {
525-
var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
526-
527-
new PropertyInfoRecord(
528-
name,
529-
STRING,
530-
false, // mustUseProperty
531-
attributeName,
532-
"http://www.w3.org/1999/xlink",
533-
false, // sanitizeURL
534-
false
535-
);
409+
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
536410
}); // String SVG attributes with the xml namespace.
537411

538412
[
@@ -542,17 +416,7 @@ var capitalize = function (token) {
542416
// you'll need to set attributeName to name.toLowerCase()
543417
// instead in the assignment below.
544418
].forEach(function (attributeName) {
545-
var name = attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
546-
547-
new PropertyInfoRecord(
548-
name,
549-
STRING,
550-
false, // mustUseProperty
551-
attributeName,
552-
"http://www.w3.org/XML/1998/namespace",
553-
false, // sanitizeURL
554-
false
555-
);
419+
attributeName.replace(CAMELIZE, capitalize); // $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
556420
}); // These attribute exists both in HTML and SVG.
557421
// The attribute name is case-sensitive in SVG so we can't just use
558422
// the React name like we do for attributes that exist only in HTML.
@@ -569,26 +433,6 @@ var capitalize = function (token) {
569433
false
570434
);
571435
}); // These attributes accept URLs. These must not allow javascript: URLS.
572-
573-
new PropertyInfoRecord(
574-
"xlinkHref",
575-
STRING,
576-
false, // mustUseProperty
577-
"xlink:href",
578-
"http://www.w3.org/1999/xlink",
579-
true, // sanitizeURL
580-
false
581-
);
582-
583-
new PropertyInfoRecord(
584-
"formAction",
585-
STRING,
586-
false, // mustUseProperty
587-
"formaction", // attributeName
588-
null, // attributeNamespace
589-
true, // sanitizeURL
590-
false
591-
);
592436
["src", "href", "action"].forEach(function (attributeName) {
593437
// $FlowFixMe[invalid-constructor] Flow no longer supports calling new on functions
594438
new PropertyInfoRecord(

0 commit comments

Comments
 (0)