Skip to content

Commit

Permalink
Consolidate entry points (#1761)
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson authored Jul 8, 2021
1 parent 17ddf9d commit 918e7e9
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 89 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"repository": "github:reduxjs/react-redux",
"bugs": "https://github.com/reduxjs/react-redux/issues",
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"types": "./es/index.d.ts",
"unpkg": "dist/react-redux.js",
"module": "es/index.js",
"files": [
Expand Down
26 changes: 0 additions & 26 deletions src/alternate-renderers.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/alternate-renderers.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export * from './exports'

import { getBatch } from './utils/batch'

// For other renderers besides ReactDOM and React Native,
// use the default noop batch function
const batch = getBatch()

export { batch }
61 changes: 61 additions & 0 deletions src/exports.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import Provider from './components/Provider'
import type { ProviderProps } from './components/Provider'
import connectAdvanced from './components/connectAdvanced'
import type {
ConnectAdvancedOptions,
ConnectProps,
} from './components/connectAdvanced'
import type {
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
} from './connect/selectorFactory'
import { ReactReduxContext } from './components/Context'
import type { ReactReduxContextValue } from './components/Context'
import connect from './connect/connect'

import { useDispatch, createDispatchHook } from './hooks/useDispatch'
import { useSelector, createSelectorHook } from './hooks/useSelector'
import { useStore, createStoreHook } from './hooks/useStore'

import shallowEqual from './utils/shallowEqual'

export * from './types'
export type {
ProviderProps,
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
ConnectProps,
ConnectAdvancedOptions,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
ReactReduxContextValue,
}
export {
Provider,
connectAdvanced,
ReactReduxContext,
connect,
useDispatch,
createDispatchHook,
useSelector,
createSelectorHook,
useStore,
createStoreHook,
shallowEqual,
}
66 changes: 5 additions & 61 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,66 +1,10 @@
import Provider from './components/Provider'
import type { ProviderProps } from './components/Provider'
import connectAdvanced from './components/connectAdvanced'
import type {
ConnectAdvancedOptions,
ConnectProps,
} from './components/connectAdvanced'
import type {
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
} from './connect/selectorFactory'
import { ReactReduxContext } from './components/Context'
import type { ReactReduxContextValue } from './components/Context'
import connect from './connect/connect'
export * from './exports'

import { useDispatch, createDispatchHook } from './hooks/useDispatch'
import { useSelector, createSelectorHook } from './hooks/useSelector'
import { useStore, createStoreHook } from './hooks/useStore'

import { setBatch } from './utils/batch'
import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates'
import shallowEqual from './utils/shallowEqual'
import { setBatch } from './utils/batch'

// Enable batched updates in our subscriptions for use
// with standard React renderers (ReactDOM, React Native)
setBatch(batch)

export * from './types'
export type {
ProviderProps,
SelectorFactory,
Selector,
MapStateToProps,
MapStateToPropsFactory,
MapStateToPropsParam,
ConnectProps,
ConnectAdvancedOptions,
MapDispatchToPropsFunction,
MapDispatchToProps,
MapDispatchToPropsFactory,
MapDispatchToPropsParam,
MapDispatchToPropsNonObject,
MergeProps,
ReactReduxContextValue,
}
export {
Provider,
connectAdvanced,
ReactReduxContext,
connect,
batch,
useDispatch,
createDispatchHook,
useSelector,
createSelectorHook,
useStore,
createStoreHook,
shallowEqual,
}
export { batch }
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"jsx": "react",
"declaration": true,
"emitDeclarationOnly": true,
"outDir": "./lib",
"outDir": "./es",
"forceConsistentCasingInFileNames": true
},
"include": ["src/**/*", "types"],
Expand Down

0 comments on commit 918e7e9

Please sign in to comment.