Remove public export for unstable-shared-subset.js (#23261)
The unstable-shared-subset.js file is not a public module — it's a private module that the "react" package maps to when it's accessed from the "react-server" package. We originally added it because it was required to make our Rollup configuration work, because at the time only "public" modules could act as the entry point for a build artifact — that's why it's prefixed with "unstable". We've since updated our Rollup config to support private entry points, so we can remove the extra indirection.
Andrew Clark committed
Feb 22, 2022 at 20:03 UTC
552c067bb18062f6a1bba2fc848033abd2ea8090
7 files changed
+15
-15
packages/react/npm/react.shared-subset.js
new
+7
@@ -0,0 +1,7 @@
1
+'use strict';
2
+
3
+if (process.env.NODE_ENV === 'production') {
4
+ module.exports = require('./cjs/react.shared-subset.production.min.js');
5
+} else {
6
+ module.exports = require('./cjs/react.shared-subset.development.js');
7
+}
packages/react/npm/unstable-shared-subset.js
deleted
-7
@@ -1,7 +0,0 @@
1
-'use strict';
2
-
3
-if (process.env.NODE_ENV === 'production') {
4
- module.exports = require('./cjs/react-unstable-shared-subset.production.min.js');
5
-} else {
6
- module.exports = require('./cjs/react-unstable-shared-subset.development.js');
7
-}
packages/react/package.json
+3
-4
@@ -16,19 +16,18 @@
16
"umd/",
17
"jsx-runtime.js",
18
"jsx-dev-runtime.js",
19
- "unstable-shared-subset.js"
19
+ "react.shared-subset.js"
20
],
21
"main": "index.js",
22
"exports": {
23
".": {
24
- "react-server": "./unstable-shared-subset.js",
24
+ "react-server": "./react.shared-subset.js",
25
"default": "./index.js"
26
},
27
"./package.json": "./package.json",
28
"./jsx-runtime": "./jsx-runtime.js",
29
"./jsx-dev-runtime": "./jsx-dev-runtime.js",
30
- "./unstable-shared-subset": "./unstable-shared-subset.js"
31
-
30
+ "./src/*": "./src/*"
31
},
32
"repository": {
33
"type": "git",
packages/react/src/ReactSharedSubset.experimental.js
renamed
+1
-1
@@ -37,4 +37,4 @@ export {
37
useMutableSource as unstable_useMutableSource,
38
useTransition,
39
version,
40
-} from './src/React';
40
+} from './React';
packages/react/src/ReactSharedSubset.js
renamed
scripts/rollup/bundles.js
+2
-1
@@ -88,7 +88,8 @@ const bundles = [
88
{
89
bundleTypes: [NODE_DEV, NODE_PROD],
90
moduleType: ISOMORPHIC,
91
- entry: 'react/unstable-shared-subset',
91
+ entry: 'react/src/ReactSharedSubset.js',
92
+ name: 'react.shared-subset',
93
global: 'React',
94
minifyWithProdErrorCodes: true,
95
wrapWithModuleBoundaries: false,
scripts/rollup/forks.js
+2
-2
@@ -55,7 +55,7 @@ const forks = Object.freeze({
55
// happens. Other bundles just require('object-assign') anyway.
56
return null;
57
}
58
- if (entry === 'react' || entry === 'react/unstable-shared-subset') {
58
+ if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
59
// Use the forked version that uses ES modules instead of CommonJS.
60
return './packages/shared/forks/object-assign.inline-umd.js';
61
}
@@ -82,7 +82,7 @@ const forks = Object.freeze({
82
entry,
83
dependencies
84
) => {
85
- if (entry === 'react' || entry === 'react/unstable-shared-subset') {
85
+ if (entry === 'react' || entry === 'react/src/ReactSharedSubset.js') {
86
return './packages/react/src/ReactSharedInternals.js';
87
}
88
if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) {