react/scripts/shared/inlinedHostConfigs.js
Andrew Clark 9b5e0517b4
Remove deprecated wildcard folder mapping (#23256)
* Remove deprecated folder mapping

Node v16 deprecated the use of trailing "/" to define subpath folder
mappings in the "exports" field of package.json.

The recommendation is to explicitly list all our exports. We already do
that for all our public modules. I believe the only reason we have a
wildcard pattern is because our package.json files are also used at
build time (by Rollup) to resolve internal source modules that don't
appear in the final npm artifact.

Changing trailing "/" to "/*" fixes the warnings. See
https://nodejs.org/api/packages.html#subpath-patterns for more info.

Since the wildcard pattern only exists so our build script has access to
internal at build time, I've scoped the wildcard to "/src/*". Because
our public modules are located outside the "src" directory, this means
deep imports of our modules will no longer work: only packages that are
listed in the "exports" field.

The only two affected packages are react-dom and react. We need to be
sure that all our public modules are still reachable. I audited the
exports by comparing the entries to the "files" field in package.json,
which represents a complete list of the files that are included in the
final release artifact.

At some point, we should add an e2e packaging test to prevent
regressions; for now, we should have decent coverage because in CI we
run our Jest test suite against the release artifacts.

* Remove umd from exports

Our expectation is that if you're using the UMD builds, you're not
loading them through a normal module system like require or import.
Instead you're probably copying the files directly or loading them from
a CDN like unpkg.
2022-02-09 11:37:17 -08:00

141 lines
4.2 KiB
JavaScript

/**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
module.exports = [
{
shortName: 'dom',
entryPoints: [
'react-dom',
'react-dom/unstable_testing',
'react-dom/src/server/ReactDOMFizzServerNode.js',
'react-server-dom-webpack/writer.node.server',
'react-server-dom-webpack',
],
paths: [
'react-dom',
'react-dom/src/server/ReactDOMFizzServerNode.js', // react-dom/server.node
'react-server-dom-webpack',
'react-server-dom-webpack/writer',
'react-server-dom-webpack/writer.node.server',
'react-server-dom-webpack/src/ReactFlightDOMServerNode.js', // react-server-dom-webpack/writer.node.server
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
'react-interactions',
],
isFlowTyped: true,
isServerSupported: true,
},
{
shortName: 'dom-browser',
entryPoints: [
'react-dom',
'react-dom/unstable_testing',
'react-dom/src/server/ReactDOMFizzServerBrowser.js',
'react-server-dom-webpack/writer.browser.server',
'react-server-dom-webpack',
],
paths: [
'react-dom',
'react-dom/unstable_testing',
'react-dom/src/server/ReactDOMFizzServerBrowser.js', // react-dom/server.browser
'react-server-dom-webpack',
'react-server-dom-webpack/writer.browser.server',
'react-server-dom-webpack/src/ReactFlightDOMServerBrowser.js', // react-server-dom-webpack/writer.browser.server
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
],
isFlowTyped: true,
isServerSupported: true,
},
{
shortName: 'dom-legacy',
entryPoints: [
'react-dom/src/server/ReactDOMLegacyServerBrowser.js', // react-dom/server.browser
'react-dom/src/server/ReactDOMLegacyServerNode.js', // react-dom/server.node
],
paths: [
'react-dom',
'react-server-dom-webpack',
'react-dom/src/server/ReactDOMLegacyServerBrowser.js', // react-dom/server.browser
'react-dom/src/server/ReactDOMLegacyServerNode.js', // react-dom/server.node
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
],
isFlowTyped: true,
isServerSupported: true,
},
{
shortName: 'art',
entryPoints: ['react-art'],
paths: ['react-art'],
isFlowTyped: false, // TODO: type it.
isServerSupported: false,
},
{
shortName: 'native',
entryPoints: ['react-native-renderer'],
paths: ['react-native-renderer'],
isFlowTyped: true,
isServerSupported: false,
},
{
shortName: 'fabric',
entryPoints: ['react-native-renderer/fabric'],
paths: ['react-native-renderer'],
isFlowTyped: true,
isServerSupported: false,
},
{
shortName: 'test',
entryPoints: ['react-test-renderer'],
paths: ['react-test-renderer'],
isFlowTyped: true,
isServerSupported: false,
},
{
shortName: 'dom-relay',
entryPoints: [
'react-server-dom-relay',
'react-server-dom-relay/server',
'react-server-dom-relay/src/ReactDOMServerFB.js',
],
paths: ['react-dom', 'react-server-dom-relay'],
isFlowTyped: true,
isServerSupported: true,
},
{
shortName: 'native-relay',
entryPoints: [
'react-server-native-relay',
'react-server-native-relay/server',
],
paths: [
'react-native-renderer',
'react-server-native-relay',
// this is included here so that it's not included in the main native check
// remove this when it's added to the main native renderer.
'react-native-renderer/src/server',
],
isFlowTyped: true,
isServerSupported: true,
},
{
shortName: 'custom',
entryPoints: [
'react-reconciler',
'react-client/flight',
'react-server',
'react-server/flight',
],
paths: [
'react-client/flight',
'react-server/flight',
'react-client/src/ReactFlightClientStream.js', // We can only type check this in streaming configurations.
],
isFlowTyped: true,
isServerSupported: true,
},
];