GeezerVison is showing github.com — Set up use-sync-external-store package (#22202) · react/react@46a0f05
File treeExpand file treeCollapse file tree Open diff view settings packages/use-sync-external-store
Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: ReactVersions.js +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -47,6 +47,7 @@ const experimentalPackages = [ | 47 | 47 | 'react-fs', | 48 | 48 | 'react-pg', | 49 | 49 | 'react-server-dom-webpack', | | 50 | + 'use-sync-external-store', | 50 | 51 | ]; | 51 | 52 |
| 52 | 53 | module.exports = { | |
Collapse file Copy file name to clipboard +5Lines changed: 5 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +# use-sync-external-store | | 2 | + | | 3 | +Backwards compatible shim for React's `useSyncExternalStore`. Works with any React that supports hooks. | | 4 | + | | 5 | +Until `useSyncExternalStore` is documented, refer to https://github.com/reactwg/react-18/discussions/86 |
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 | +'use strict'; | | 11 | + | | 12 | +export * from './src/useSyncExternalStore'; |
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/use-sync-external-store.production.min.js'); | | 5 | +} else { | | 6 | + module.exports = require('./cjs/use-sync-external-store.development.js'); | | 7 | +} |
Collapse file Copy file name to clipboard +21Lines changed: 21 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +{ | | 2 | + "name": "use-sync-external-store", | | 3 | + "description": "Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.", | | 4 | + "version": "0.0.1", | | 5 | + "repository": { | | 6 | + "type": "git", | | 7 | + "url": "https://github.com/facebook/react.git", | | 8 | + "directory": "packages/use-sync-external-store" | | 9 | + }, | | 10 | + "files": [ | | 11 | + "LICENSE", | | 12 | + "README.md", | | 13 | + "build-info.json", | | 14 | + "index.js", | | 15 | + "cjs/" | | 16 | + ], | | 17 | + "license": "MIT", | | 18 | + "peerDependencies": { | | 19 | + "react": "^16.8.0 || ^17.0.0" | | 20 | + } | | 21 | +} |
Collapse file Copy file name to clipboard +14Lines changed: 14 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 | + * @emails react-core | | 8 | + */ | | 9 | + | | 10 | +'use strict'; | | 11 | + | | 12 | +describe('useSyncExternalStore', () => { | | 13 | + test('TODO', () => {}); | | 14 | +}); |
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 | +export function useSyncExternalStore() { | | 11 | + throw new Error('Not yet implemented'); | | 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 |
|---|
@@ -684,6 +684,15 @@ const bundles = [ | 684 | 684 | externals: ['react'], | 685 | 685 | }, | 686 | 686 |
| | 687 | + /******* Shim for useSyncExternalState *******/ | | 688 | + { | | 689 | + bundleTypes: [NODE_DEV, NODE_PROD], | | 690 | + moduleType: ISOMORPHIC, | | 691 | + entry: 'use-sync-external-store', | | 692 | + global: 'useSyncExternalStore', | | 693 | + externals: ['react'], | | 694 | + }, | | 695 | + | 687 | 696 | /******* React Scheduler (experimental) *******/ | 688 | 697 | { | 689 | 698 | bundleTypes: [ | |
|