From da322b704a6589a779d75b5629d2cbfb5266e8ee Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 10 Dec 2020 00:15:51 +0000 Subject: [PATCH] [Flight] Rename the shared entry point --- packages/react/npm/unstable-index.server.js | 7 ------- packages/react/npm/unstable-shared-subset.js | 7 +++++++ packages/react/package.json | 6 +++--- ...erimental.js => unstable-shared-subset.experimental.js} | 0 ...{unstable-index.server.js => unstable-shared-subset.js} | 0 scripts/rollup/bundles.js | 4 ++-- scripts/rollup/forks.js | 6 +++--- 7 files changed, 15 insertions(+), 15 deletions(-) delete mode 100644 packages/react/npm/unstable-index.server.js create mode 100644 packages/react/npm/unstable-shared-subset.js rename packages/react/{unstable-index.server.experimental.js => unstable-shared-subset.experimental.js} (100%) rename packages/react/{unstable-index.server.js => unstable-shared-subset.js} (100%) diff --git a/packages/react/npm/unstable-index.server.js b/packages/react/npm/unstable-index.server.js deleted file mode 100644 index c84b65bf312f1..0000000000000 --- a/packages/react/npm/unstable-index.server.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./cjs/react-unstable-index.production.min.server.js'); -} else { - module.exports = require('./cjs/react-unstable-index.development.server.js'); -} diff --git a/packages/react/npm/unstable-shared-subset.js b/packages/react/npm/unstable-shared-subset.js new file mode 100644 index 0000000000000..e56831a36a54c --- /dev/null +++ b/packages/react/npm/unstable-shared-subset.js @@ -0,0 +1,7 @@ +'use strict'; + +if (process.env.NODE_ENV === 'production') { + module.exports = require('./cjs/react-unstable-shared-subset.production.min.js'); +} else { + module.exports = require('./cjs/react-unstable-shared-subset.development.js'); +} diff --git a/packages/react/package.json b/packages/react/package.json index 87e5a806a21dd..311982f5c3544 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -17,16 +17,16 @@ "umd/", "jsx-runtime.js", "jsx-dev-runtime.js", - "unstable-index.server.js" + "unstable-shared-subset.js" ], "main": "index.js", "exports": { ".": { - "react-server": "./unstable-index.server.js", + "react-server": "./unstable-shared-subset.js", "default": "./index.js" }, "./index": { - "react-server": "./unstable-index.server.js", + "react-server": "./unstable-shared-subset.js", "default": "./index.js" }, "./build-info.json": "./build-info.json", diff --git a/packages/react/unstable-index.server.experimental.js b/packages/react/unstable-shared-subset.experimental.js similarity index 100% rename from packages/react/unstable-index.server.experimental.js rename to packages/react/unstable-shared-subset.experimental.js diff --git a/packages/react/unstable-index.server.js b/packages/react/unstable-shared-subset.js similarity index 100% rename from packages/react/unstable-index.server.js rename to packages/react/unstable-shared-subset.js diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js index 90f1f50e3ef65..46af927e3f64a 100644 --- a/scripts/rollup/bundles.js +++ b/scripts/rollup/bundles.js @@ -90,11 +90,11 @@ const bundles = [ externals: [], }, - /******* Isomorphic Server Only *******/ + /******* Isomorphic Shared Subset *******/ { bundleTypes: [NODE_DEV, NODE_PROD], moduleType: ISOMORPHIC, - entry: 'react/unstable-index.server', + entry: 'react/unstable-shared-subset', global: 'React', externals: [], }, diff --git a/scripts/rollup/forks.js b/scripts/rollup/forks.js index 4651b3fa86af9..53a278605541f 100644 --- a/scripts/rollup/forks.js +++ b/scripts/rollup/forks.js @@ -43,7 +43,7 @@ const forks = Object.freeze({ // happens. Other bundles just require('object-assign') anyway. return null; } - if (entry === 'react' || entry === 'react/unstable-index.server') { + if (entry === 'react' || entry.startsWith('react/')) { // Use the forked version that uses ES modules instead of CommonJS. return 'shared/forks/object-assign.inline-umd.js'; } @@ -64,10 +64,10 @@ const forks = Object.freeze({ // Without this fork, importing `shared/ReactSharedInternals` inside // the `react` package itself would not work due to a cyclical dependency. 'shared/ReactSharedInternals': (bundleType, entry, dependencies) => { - if (entry === 'react' || entry === 'react/unstable-index.server') { + if (entry === 'react' || entry.startsWith('react/')) { return 'react/src/ReactSharedInternals.js'; } - if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) { + if (dependencies.indexOf('react') === -1) { // React internals are unavailable if we can't reference the package. // We return an error because we only want to throw if this module gets used. return new Error(