Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source code for for React 16.14.0? #27515

Closed
jrmuizel opened this issue Oct 13, 2023 · 13 comments
Closed

Source code for for React 16.14.0? #27515

jrmuizel opened this issue Oct 13, 2023 · 13 comments
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug

Comments

@jrmuizel
Copy link

It seems like React 16.14.0 was published from a built version checked into the old_majors directory and then tagged with v16.14.0

old_major_packages/16/react/build-info.json references a commit da834083c that doesn't exist in the repo.

In the source code for this version available anywhere? If not, what's the closest approximation?

@jrmuizel jrmuizel added the Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug label Oct 13, 2023
@itsayopapi
Copy link

@jrmuizel is the still issue still available?...can you please assign it to me

@sophiebits
Copy link
Collaborator

Generally we tag the release versions:

https://github.com/facebook/react/commits/v16.14.0

The commit you mentioned also does exist in the repo:

https://github.com/facebook/react/commits/da834083c

@jrmuizel
Copy link
Author

jrmuizel commented Oct 19, 2023

Yeah, I figured out that I wasn't fetching all the tags so that's why I was missing da83408.

However, it seems like v16.13.1 is da834083c

Further, when I build da83408, the artifacts that I get out don't match the package on npm.

--- node_modules/react/umd/react.development.js	1985-10-26 04:15:00.000000000 -0400
+++ package/umd/react.development.js	1985-10-26 04:15:00.000000000 -0400
@@ -1,4 +1,4 @@
-/** @license React vundefined
+/** @license React v16.14.0
  * react.development.js
  *
  * Copyright (c) Facebook, Inc. and its affiliates.
@@ -15,7 +15,7 @@
   (global = global || self, factory(global.React = {}));
 }(this, (function (exports) { 'use strict';
 
-  var ReactVersion = '16.12.0';
+  var ReactVersion = '16.14.0';
 
   // The Symbol used to tag the ReactElement-like types. If there is no native Symbol
   // nor polyfill, then a plain number is used for performance.
@@ -1543,41 +1543,6 @@
     };
   }
 
-  function block(query, render) {
-    {
-      if (typeof query !== 'function') {
-        error('Blocks require a query function but was given %s.', query === null ? 'null' : typeof query);
-      }
-
-      if (render != null && render.$$typeof === REACT_MEMO_TYPE) {
-        error('Blocks require a render function but received a `memo` ' + 'component. Use `memo` on an inner component instead.');
-      } else if (render != null && render.$$typeof === REACT_FORWARD_REF_TYPE) {
-        error('Blocks require a render function but received a `forwardRef` ' + 'component. Use `forwardRef` on an inner component instead.');
-      } else if (typeof render !== 'function') {
-        error('Blocks require a render function but was given %s.', render === null ? 'null' : typeof render);
-      } else if (render.length !== 0 && render.length !== 2) {
-        // Warn if it's not accepting two args.
-        // Do not warn for 0 arguments because it could be due to usage of the 'arguments' object
-        error('Block render functions accept exactly two parameters: props and data. %s', render.length === 1 ? 'Did you forget to use the data parameter?' : 'Any additional parameter will be undefined.');
-      }
-
-      if (render != null && (render.defaultProps != null || render.propTypes != null)) {
-        error('Block render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?');
-      }
-    }
-
-    return function () {
-      var args = arguments;
-      return {
-        $$typeof: REACT_BLOCK_TYPE,
-        query: function () {
-          return query.apply(null, args);
-        },
-        render: render
-      };
-    };
-  }
-
   function resolveDispatcher() {
     var dispatcher = ReactCurrentDispatcher.current;
 
@@ -1651,25 +1616,6 @@
       return dispatcher.useDebugValue(value, formatterFn);
     }
   }
-  function useTransition(config) {
-    var dispatcher = resolveDispatcher();
-    return dispatcher.useTransition(config);
-  }
-  function useDeferredValue(value, config) {
-    var dispatcher = resolveDispatcher();
-    return dispatcher.useDeferredValue(value, config);
-  }
-
-  function withSuspenseConfig(scope, config) {
-    var previousConfig = ReactCurrentBatchConfig.suspense;
-    ReactCurrentBatchConfig.suspense = config === undefined ? null : config;
-
-    try {
-      scope();
-    } finally {
-      ReactCurrentBatchConfig.suspense = previousConfig;
-    }
-  }
 
   /**
    * Copyright (c) 2013-present, Facebook, Inc.
@@ -3347,9 +3293,7 @@
   exports.PureComponent = PureComponent;
   exports.StrictMode = REACT_STRICT_MODE_TYPE;
   exports.Suspense = REACT_SUSPENSE_TYPE;
-  exports.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
   exports.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED = ReactSharedInternals$1;
-  exports.block = block;
   exports.cloneElement = cloneElement$1;
   exports.createContext = createContext;
   exports.createElement = createElement$1;
@@ -3359,11 +3303,9 @@
   exports.isValidElement = isValidElement;
   exports.lazy = lazy;
   exports.memo = memo;
-  exports.unstable_withSuspenseConfig = withSuspenseConfig;
   exports.useCallback = useCallback;
   exports.useContext = useContext;
   exports.useDebugValue = useDebugValue;
-  exports.useDeferredValue = useDeferredValue;
   exports.useEffect = useEffect;
   exports.useImperativeHandle = useImperativeHandle;
   exports.useLayoutEffect = useLayoutEffect;
@@ -3371,7 +3313,6 @@
   exports.useReducer = useReducer;
   exports.useRef = useRef;
   exports.useState = useState;
-  exports.useTransition = useTransition;
   exports.version = ReactVersion;
 
 })));

@jrmuizel
Copy link
Author

Generally we tag the release versions:

https://github.com/facebook/react/commits/v16.14.0

This tag only has the built packages for 16.14.0 and not the source code.
i.e. v16.14.0, v15.7.0, 0.14.10 all point at the same revision: 4337c1c00609ec8d7ae399c736e9d37bb159fac5

@sophiebits
Copy link
Collaborator

I found this PR with a description of what happened: #20024

It sounds like since these were backports we didn't build entirely from source; rather we copied the previous release artifacts, bumped version numbers, and copied in the built JSX runtime from the 17.x branch.

Hope this helps (curious why you're asking).

@markerikson
Copy link
Contributor

Ah. A few weeks ago I was backporting my build pipeline changes for sourcemaps ( #26446 ) to earlier versions. Worked fine for 18.2, 18.1, and 17.0.2, but the build artifact I generated for 16.14.0 was significantly different. That explains why.

@jrmuizel
Copy link
Author

Hope this helps (curious why you're asking).

I was trying to rebuild react 16.14.0 with different minification settings.

@markerikson
Copy link
Contributor

@jrmuizel : okay, now I'm curious :) Why are you trying to rebuild React 16? with what different minification settings? What's the goal?

@jrmuizel
Copy link
Author

jrmuizel commented Nov 23, 2023

React 16 is used by the TodoMVC-React-Redux Speedometer 3 test. I wanted an unminifed version that was a close as possible to the production version to use for profiling.

@markerikson
Copy link
Contributor

Ah, that sounds similar to what I've done with the sourcemap generation process.

Is there a reason why Speedometer is still using React 16 and not a newer version?

@jrmuizel
Copy link
Author

16 is still quite popular so this makes the benchmark more representative. 17 is used in the TodoMVC-React test.

The TodoMVC Evaluation doc has some more context on the version choices.

@markerikson
Copy link
Contributor

FWIW, https://majors.nullvoxpopuli.com/q?packages=react shows that for downloads of React have 17+18 as the majority, although I realize there's a difference between "CI installs" and "total usage of apps that use a specific version".

@sophiebits
Copy link
Collaborator

sophiebits commented Nov 23, 2023

For what it's worth, I would be skeptical of the methodology used by these sites. I don't know how W3Techs counts but the HTTP Archive Almanac 2022 uses Wappalyzer v6.10.26, whose React version detection logic seems to look for (a) a global React.version property or (b) a version number in a script filename that clearly indicates React. Both of these are very uncommon ways to deploy React these days. Even for detecting React as a whole, it uses data attributes no longer used by React or a _reactRootContainer property that is not added when using modern React APIs such as React 18 createRoot (and only looks for that property on divs that are direct children of <body>).

On top of all this, I would expect larger, more popular sites to be generally more diligent about updating React compared to sites that are published once and never revisited, so % of websites using each version is likely a poor proxy for % of pageloads or time spent using each version, which is more relevant for VMs optimizing (not to mention that it is valuable to "skate where the puck is going" rather than optimizing solely for the version that is most popular today).

Distribution of CI installs is likely the best proxy I could point to, even considering its many flaws, and as @markerikson points out, that's 50%+ React 18 and 70%+ React 17+.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Unconfirmed A potential issue that we haven't yet confirmed as a bug
Projects
None yet
Development

No branches or pull requests

5 participants
@sophiebits @jrmuizel @markerikson @itsayopapi and others