From 9c1277810fe634cecb75bee4d5b3c855768cb006 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Thu, 8 Jul 2021 19:04:03 -0400 Subject: [PATCH 1/3] Rename index.ts to exports.ts --- src/{index.ts => exports.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{index.ts => exports.ts} (100%) diff --git a/src/index.ts b/src/exports.ts similarity index 100% rename from src/index.ts rename to src/exports.ts From 445ce8b4d24c433f39864b2527724e2b5201cd6f Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Thu, 8 Jul 2021 19:18:10 -0400 Subject: [PATCH 2/3] Update both entry points to use the same set of exports --- src/alternate-renderers.js | 26 -------------------------- src/alternate-renderers.ts | 9 +++++++++ src/exports.ts | 5 ----- src/index.ts | 10 ++++++++++ 4 files changed, 19 insertions(+), 31 deletions(-) delete mode 100644 src/alternate-renderers.js create mode 100644 src/alternate-renderers.ts create mode 100644 src/index.ts diff --git a/src/alternate-renderers.js b/src/alternate-renderers.js deleted file mode 100644 index a15431fcb..000000000 --- a/src/alternate-renderers.js +++ /dev/null @@ -1,26 +0,0 @@ -import Provider from './components/Provider' -import connectAdvanced from './components/connectAdvanced' -import { ReactReduxContext } from './components/Context' -import connect from './connect/connect' - -import { useDispatch } from './hooks/useDispatch' -import { useSelector } from './hooks/useSelector' -import { useStore } from './hooks/useStore' - -import { getBatch } from './utils/batch' -import shallowEqual from './utils/shallowEqual' - -// For other renderers besides ReactDOM and React Native, use the default noop batch function -const batch = getBatch() - -export { - Provider, - connectAdvanced, - ReactReduxContext, - connect, - batch, - useDispatch, - useSelector, - useStore, - shallowEqual, -} diff --git a/src/alternate-renderers.ts b/src/alternate-renderers.ts new file mode 100644 index 000000000..456c7a23d --- /dev/null +++ b/src/alternate-renderers.ts @@ -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 } diff --git a/src/exports.ts b/src/exports.ts index 1073f81e2..c29bc3bff 100644 --- a/src/exports.ts +++ b/src/exports.ts @@ -26,12 +26,8 @@ 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' -setBatch(batch) - export * from './types' export type { ProviderProps, @@ -55,7 +51,6 @@ export { connectAdvanced, ReactReduxContext, connect, - batch, useDispatch, createDispatchHook, useSelector, diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 000000000..f37b19b31 --- /dev/null +++ b/src/index.ts @@ -0,0 +1,10 @@ +export * from './exports' + +import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates' +import { setBatch } from './utils/batch' + +// Enable batched updates in our subscriptions for use +// with standard React renderers (ReactDOM, React Native) +setBatch(batch) + +export { batch } From 53bba188d66852ee353c45d3e6b0e5a015e111f0 Mon Sep 17 00:00:00 2001 From: Mark Erikson Date: Thu, 8 Jul 2021 19:42:36 -0400 Subject: [PATCH 3/3] Move types output to /es --- package.json | 2 +- tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9ce3dc99f..031361c6e 100644 --- a/package.json +++ b/package.json @@ -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": [ diff --git a/tsconfig.json b/tsconfig.json index e0044ea61..d4a4611a4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,7 +10,7 @@ "jsx": "react", "declaration": true, "emitDeclarationOnly": true, - "outDir": "./lib", + "outDir": "./es", "forceConsistentCasingInFileNames": true }, "include": ["src/**/*", "types"],