Skip to content

Commit

Permalink
Update vendored React packages to next-41110021f (#46636)
Browse files Browse the repository at this point in the history
Notable changes:

- facebook/react#26275
- facebook/react#26232
- facebook/react#26239
- facebook/react#26237

<!--
Thanks for opening a PR! Your contribution is much appreciated.
To make sure your PR is handled as smoothly as possible we request that
you follow the checklist sections below.
Choose the right checklist for the change(s) that you're making:
-->

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the
feature request has been accepted for implementation before opening a
PR.
- [ ] Related issues linked using `fixes #number`
- [ ]
[e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs)
tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see
[`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing
doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
  • Loading branch information
acdlite and kodiakhq[bot] committed Mar 1, 2023
1 parent 68a1d54 commit 5c18e9a
Show file tree
Hide file tree
Showing 31 changed files with 1,978 additions and 1,321 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@
"random-seed": "0.3.0",
"react": "18.2.0",
"react-17": "npm:react@17.0.2",
"react-builtin": "npm:react@18.3.0-next-bfb9cbd8c-20230223",
"react-builtin": "npm:react@18.3.0-next-41110021f-20230301",
"react-dom": "18.2.0",
"react-dom-17": "npm:react-dom@17.0.2",
"react-dom-builtin": "npm:react-dom@18.3.0-next-bfb9cbd8c-20230223",
"react-server-dom-webpack": "18.3.0-next-bfb9cbd8c-20230223",
"react-dom-builtin": "npm:react-dom@18.3.0-next-41110021f-20230301",
"react-server-dom-webpack": "18.3.0-next-41110021f-20230301",
"react-ssr-prepass": "1.0.8",
"react-virtualized": "9.22.3",
"relay-compiler": "13.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/next/src/compiled/babel-packages/packages-bundle.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if (process.env.NODE_ENV !== "production") {
var React = require('react');
var ReactDOM = require('react-dom');

var ReactVersion = '18.3.0-next-bfb9cbd8c-20230223';
var ReactVersion = '18.3.0-next-41110021f-20230301';

var ReactSharedInternals = React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;

Expand Down Expand Up @@ -2007,6 +2007,8 @@ var ReactDOMSharedInternals = ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL

var ReactDOMCurrentDispatcher = ReactDOMSharedInternals.Dispatcher;
var ReactDOMServerDispatcher = {
prefetchDNS: prefetchDNS,
preconnect: preconnect,
preload: preload,
preinit: preinit
} ;
Expand Down Expand Up @@ -4551,7 +4553,10 @@ function writePreamble(destination, resources, responseState, willFlushAllSegmen
writeChunk(destination, charsetChunks[i]);
}

charsetChunks.length = 0;
charsetChunks.length = 0; // emit preconnect resources

resources.preconnects.forEach(flushResourceInPreamble, destination);
resources.preconnects.clear();
var preconnectChunks = responseState.preconnectChunks;

for (i = 0; i < preconnectChunks.length; i++) {
Expand Down Expand Up @@ -4624,6 +4629,8 @@ function writeHoistables(destination, resources, responseState) {
// We omit charsetChunks because we have already sent the shell and if it wasn't
// already sent it is too late now.

resources.preconnects.forEach(flushResourceLate, destination);
resources.preconnects.clear();
var preconnectChunks = responseState.preconnectChunks;

for (i = 0; i < preconnectChunks.length; i++) {
Expand Down Expand Up @@ -4911,9 +4918,11 @@ function createResources() {
return {
// persistent
preloadsMap: new Map(),
preconnectsMap: new Map(),
stylesMap: new Map(),
scriptsMap: new Map(),
// cleared on flush
preconnects: new Set(),
fontPreloads: new Set(),
// usedImagePreloads: new Set(),
precedences: new Map(),
Expand All @@ -4939,6 +4948,98 @@ function getResourceKey(as, href) {
return "[" + as + "]" + href;
}

function prefetchDNS(href, options) {
if (!currentResources) {
// While we expect that preconnect calls are primarily going to be observed
// during render because effects and events don't run on the server it is
// still possible that these get called in module scope. This is valid on
// the client since there is still a document to interact with but on the
// server we need a request to associate the call to. Because of this we
// simply return and do not warn.
return;
}

var resources = currentResources;

{
if (typeof href !== 'string' || !href) {
error('ReactDOM.prefetchDNS(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
} else if (options != null) {
if (typeof options === 'object' && options.hasOwnProperty('crossOrigin')) {
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. It looks like the you are attempting to set a crossOrigin property for this DNS lookup hint. Browsers do not perform DNS queries using CORS and setting this attribute on the resource hint has no effect. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
} else {
error('ReactDOM.prefetchDNS(): Expected only one argument, `href`, but encountered %s as a second argument instead. This argument is reserved for future options and is currently disallowed. Try calling ReactDOM.prefetchDNS() with just a single string argument, `href`.', getValueDescriptorExpectingEnumForWarning(options));
}
}
}

if (typeof href === 'string' && href) {
var key = getResourceKey('prefetchDNS', href);
var resource = resources.preconnectsMap.get(key);

if (!resource) {
resource = {
type: 'preconnect',
chunks: [],
state: NoState,
props: null
};
resources.preconnectsMap.set(key, resource);
pushLinkImpl(resource.chunks, {
href: href,
rel: 'dns-prefetch'
});
}

resources.preconnects.add(resource);
}
}
function preconnect(href, options) {
if (!currentResources) {
// While we expect that preconnect calls are primarily going to be observed
// during render because effects and events don't run on the server it is
// still possible that these get called in module scope. This is valid on
// the client since there is still a document to interact with but on the
// server we need a request to associate the call to. Because of this we
// simply return and do not warn.
return;
}

var resources = currentResources;

{
if (typeof href !== 'string' || !href) {
error('ReactDOM.preconnect(): Expected the `href` argument (first) to be a non-empty string but encountered %s instead.', getValueDescriptorExpectingObjectForWarning(href));
} else if (options != null && typeof options !== 'object') {
error('ReactDOM.preconnect(): Expected the `options` argument (second) to be an object but encountered %s instead. The only supported option at this time is `crossOrigin` which accepts a string.', getValueDescriptorExpectingEnumForWarning(options));
} else if (options != null && typeof options.crossOrigin !== 'string') {
error('ReactDOM.preconnect(): Expected the `crossOrigin` option (second argument) to be a string but encountered %s instead. Try removing this option or passing a string value instead.', getValueDescriptorExpectingObjectForWarning(options.crossOrigin));
}
}

if (typeof href === 'string' && href) {
var crossOrigin = options == null || typeof options.crossOrigin !== 'string' ? null : options.crossOrigin === 'use-credentials' ? 'use-credentials' : '';
var key = "[preconnect][" + (crossOrigin === null ? 'null' : crossOrigin) + "]" + href;
var resource = resources.preconnectsMap.get(key);

if (!resource) {
resource = {
type: 'preconnect',
chunks: [],
state: NoState,
props: null
};
resources.preconnectsMap.set(key, resource);
pushLinkImpl(resource.chunks, {
rel: 'preconnect',
href: href,
crossOrigin: crossOrigin
});
}

resources.preconnects.add(resource);
}
}
function preload(href, options) {
if (!currentResources) {
// While we expect that preload calls are primarily going to be observed
Expand Down Expand Up @@ -5219,7 +5320,8 @@ function preloadPropsFromPreloadOptions(href, as, options) {
as: as,
href: href,
crossOrigin: as === 'font' ? '' : options.crossOrigin,
integrity: options.integrity
integrity: options.integrity,
type: options.type
};
}

Expand Down

0 comments on commit 5c18e9a

Please sign in to comment.