GeezerVison is showing github.com — Add flight specific entry point for react package (#20304) · react/react@d93b58a
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: fixtures/flight/package.json +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 67 | 67 | "prebuild": "cp -r ../../build/node_modules/* ./node_modules/", | 68 | 68 | "start": "concurrently \"npm run start:server\" \"npm run start:client\"", | 69 | 69 | "start:client": "node scripts/start.js", | 70 | | - "start:server": "NODE_ENV=development node --experimental-loader ./loader/index.js server", | | 70 | + "start:server": "NODE_ENV=development node --experimental-loader ./loader/index.js --conditions=react-server server", | 71 | 71 | "start:prod": "node scripts/build.js && NODE_ENV=production node server", | 72 | 72 | "build": "node scripts/build.js", | 73 | 73 | "test": "node scripts/test.js --env=jsdom" | |
Collapse file Copy file name to clipboard +7Lines changed: 7 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +'use strict'; | | 2 | + | | 3 | +if (process.env.NODE_ENV === 'production') { | | 4 | + module.exports = require('./cjs/react-unstable-index.server.production.min.js'); | | 5 | +} else { | | 6 | + module.exports = require('./cjs/react-unstable-index.server.development.js'); | | 7 | +} |
Collapse file Copy file name to clipboardExpand all lines: packages/react/package.json +15Lines changed: 15 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 17 | 17 | "umd/", | 18 | 18 | "jsx-runtime.js", | 19 | 19 | "jsx-dev-runtime.js", | | 20 | + "unstable-index.server.js", | 20 | 21 | "unstable-cache.js" | 21 | 22 | ], | 22 | 23 | "main": "index.js", | | 24 | + "exports": { | | 25 | + ".": { | | 26 | + "react-server": "./unstable-index.server.js", | | 27 | + "default": "./index.js" | | 28 | + }, | | 29 | + "./index": { | | 30 | + "react-server": "./unstable-index.server.js", | | 31 | + "default": "./index.js" | | 32 | + }, | | 33 | + "./build-info.json": "./build-info.json", | | 34 | + "./jsx-runtime": "./jsx-runtime.js", | | 35 | + "./jsx-dev-runtime": "./jsx-dev-runtime.js", | | 36 | + "./": "./" | | 37 | + }, | 23 | 38 | "repository": { | 24 | 39 | "type": "git", | 25 | 40 | "url": "https://github.com/facebook/react.git", | |
Collapse file Copy file name to clipboard +37Lines changed: 37 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/** | | 2 | + * Copyright (c) Facebook, Inc. and its affiliates. | | 3 | + * | | 4 | + * This source code is licensed under the MIT license found in the | | 5 | + * LICENSE file in the root directory of this source tree. | | 6 | + * | | 7 | + * @flow | | 8 | + */ | | 9 | + | | 10 | +export { | | 11 | + Children, | | 12 | + createRef, | | 13 | + forwardRef, | | 14 | + lazy, | | 15 | + memo, | | 16 | + useCallback, | | 17 | + useContext, | | 18 | + useDebugValue, | | 19 | + useMemo, | | 20 | + useMutableSource as unstable_useMutableSource, | | 21 | + createMutableSource as unstable_createMutableSource, | | 22 | + Fragment, | | 23 | + Profiler, | | 24 | + StrictMode, | | 25 | + Suspense, | | 26 | + createElement, | | 27 | + cloneElement, | | 28 | + isValidElement, | | 29 | + version, | | 30 | + __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED, | | 31 | + // exposeConcurrentModeAPIs | | 32 | + useDeferredValue as unstable_useDeferredValue, | | 33 | + SuspenseList as unstable_SuspenseList, | | 34 | + unstable_useOpaqueIdentifier, | | 35 | + // enableDebugTracing | | 36 | + unstable_DebugTracingMode, | | 37 | +} from './src/React'; |
Collapse file Copy file name to clipboard +12Lines changed: 12 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +/** | | 2 | + * Copyright (c) Facebook, Inc. and its affiliates. | | 3 | + * | | 4 | + * This source code is licensed under the MIT license found in the | | 5 | + * LICENSE file in the root directory of this source tree. | | 6 | + * | | 7 | + * @flow | | 8 | + */ | | 9 | + | | 10 | +throw new Error( | | 11 | + 'This entry point is not yet supported outside of experimental channels', | | 12 | +); |
Collapse file Copy file name to clipboardExpand all lines: scripts/rollup/bundles.js +9Lines changed: 9 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,6 +90,15 @@ const bundles = [ | 90 | 90 | externals: [], | 91 | 91 | }, | 92 | 92 |
| | 93 | + /******* Isomorphic Server Only *******/ | | 94 | + { | | 95 | + bundleTypes: [NODE_DEV, NODE_PROD], | | 96 | + moduleType: ISOMORPHIC, | | 97 | + entry: 'react/unstable-index.server', | | 98 | + global: 'React', | | 99 | + externals: [], | | 100 | + }, | | 101 | + | 93 | 102 | /******* React JSX Runtime *******/ | 94 | 103 | { | 95 | 104 | bundleTypes: [ | |
Collapse file Copy file name to clipboardExpand all lines: scripts/rollup/forks.js +3-3Lines changed: 3 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -43,7 +43,7 @@ const forks = Object.freeze({ | 43 | 43 | // happens. Other bundles just require('object-assign') anyway. | 44 | 44 | return null; | 45 | 45 | } | 46 | | - if (entry === 'react') { | | 46 | + if (entry === 'react' || entry === 'react/unstable-index.server') { | 47 | 47 | // Use the forked version that uses ES modules instead of CommonJS. | 48 | 48 | return 'shared/forks/object-assign.inline-umd.js'; | 49 | 49 | } | @@ -64,8 +64,8 @@ const forks = Object.freeze({ | 64 | 64 | // Without this fork, importing `shared/ReactSharedInternals` inside | 65 | 65 | // the `react` package itself would not work due to a cyclical dependency. | 66 | 66 | 'shared/ReactSharedInternals': (bundleType, entry, dependencies) => { | 67 | | - if (entry === 'react') { | 68 | | - return 'react/src/ReactSharedInternals'; | | 67 | + if (entry === 'react' || entry === 'react/unstable-index.server') { | | 68 | + return 'react/src/ReactSharedInternals.js'; | 69 | 69 | } | 70 | 70 | if (!entry.startsWith('react/') && dependencies.indexOf('react') === -1) { | 71 | 71 | // React internals are unavailable if we can't reference the package. | |
|