diff --git a/packages/redux-devtools-log-monitor/package.json b/packages/redux-devtools-log-monitor/package.json index e9e7fc14..240fcea4 100644 --- a/packages/redux-devtools-log-monitor/package.json +++ b/packages/redux-devtools-log-monitor/package.json @@ -66,7 +66,6 @@ "redux": "^4.1.2", "rimraf": "^3.0.2", "rollup": "^2.63.0", - "rollup-plugin-node-polyfills": "^0.2.1", "rollup-plugin-typescript2": "^0.31.1", "tslib": "^2.3.1", "typescript": "~4.5.4" diff --git a/packages/redux-devtools-log-monitor/rollup.config.js b/packages/redux-devtools-log-monitor/rollup.config.js index acb6fe30..f58a343a 100644 --- a/packages/redux-devtools-log-monitor/rollup.config.js +++ b/packages/redux-devtools-log-monitor/rollup.config.js @@ -1,6 +1,5 @@ import typescript from 'rollup-plugin-typescript2'; import babel from '@rollup/plugin-babel'; -import nodePolyfills from 'rollup-plugin-node-polyfills'; const config = [ { @@ -22,7 +21,6 @@ const config = [ extensions: ['.ts', '.tsx'], plugins: ['@babel/plugin-transform-runtime'], }), - nodePolyfills(), ], external: [ /@babel\/runtime/, diff --git a/packages/redux-devtools-remote/.babelrc b/packages/redux-devtools-remote/.babelrc index 3313ff9e..5ed95986 100644 --- a/packages/redux-devtools-remote/.babelrc +++ b/packages/redux-devtools-remote/.babelrc @@ -1,3 +1,7 @@ { - "presets": ["@babel/preset-env", "@babel/preset-typescript"] + "presets": [ + ["@babel/preset-env", { "targets": "defaults" }], + "@babel/preset-typescript" + ], + "plugins": ["@babel/plugin-transform-runtime"] } diff --git a/packages/redux-devtools-remote/.eslintignore b/packages/redux-devtools-remote/.eslintignore index be897dba..4d6880d3 100644 --- a/packages/redux-devtools-remote/.eslintignore +++ b/packages/redux-devtools-remote/.eslintignore @@ -1,2 +1,2 @@ +dist examples -lib diff --git a/packages/redux-devtools-remote/.eslintrc.js b/packages/redux-devtools-remote/.eslintrc.js index 090f9e70..90313a76 100644 --- a/packages/redux-devtools-remote/.eslintrc.js +++ b/packages/redux-devtools-remote/.eslintrc.js @@ -1,7 +1,13 @@ module.exports = { - extends: '../../eslintrc.ts.base.json', - parserOptions: { - tsconfigRootDir: __dirname, - project: ['./tsconfig.json'], - }, + extends: '../../eslintrc.js.base.json', + overrides: [ + { + files: ['*.ts'], + extends: '../../eslintrc.ts.base.json', + parserOptions: { + tsconfigRootDir: __dirname, + project: ['./tsconfig.json'], + }, + }, + ], }; diff --git a/packages/redux-devtools-remote/README.md b/packages/redux-devtools-remote/README.md index 6d4f36ae..277b6e5c 100644 --- a/packages/redux-devtools-remote/README.md +++ b/packages/redux-devtools-remote/README.md @@ -27,7 +27,7 @@ with ```javascript import { createStore } from 'redux'; -import devToolsEnhancer from '@redux-devtools/remote'; +import { devToolsEnhancer } from '@redux-devtools/remote'; const store = createStore(reducer, devToolsEnhancer()); // or const store = createStore(reducer, preloadedState, devToolsEnhancer()); ``` diff --git a/packages/redux-devtools-remote/package.json b/packages/redux-devtools-remote/package.json index 9fd55389..5b755413 100644 --- a/packages/redux-devtools-remote/package.json +++ b/packages/redux-devtools-remote/package.json @@ -21,24 +21,23 @@ "src", "lib" ], - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "dist/redux-devtools-remote.cjs.js", + "module": "dist/redux-devtools-remote.esm.js", + "types": "dist/index.d.ts", "repository": { "type": "git", "url": "https://github.com/reduxjs/redux-devtools.git" }, "scripts": { - "build": "yarn run build:types && yarn run build:js", - "build:types": "tsc --emitDeclarationOnly", - "build:js": "babel src --out-dir lib --extensions \".ts\" --source-maps inline", - "build:examples": "babel-node examples/buildAll.js", - "clean": "rimraf lib", + "build": "rollup -c", + "clean": "rimraf dist", "lint": "eslint . --ext .ts", "type-check": "tsc --noEmit", "prepack": "yarn run clean && yarn run build", "prepublish": "yarn run type-check && yarn run lint" }, "dependencies": { + "@babel/runtime": "^7.16.7", "@redux-devtools/instrument": "^1.11.2", "@redux-devtools/utils": "^1.0.0", "jsan": "^3.1.14", @@ -47,10 +46,13 @@ "socketcluster-client": "^14.3.2" }, "devDependencies": { - "@babel/cli": "^7.16.7", "@babel/core": "^7.16.7", + "@babel/eslint-parser": "^7.16.5", + "@babel/plugin-transform-runtime": "^7.16.7", "@babel/preset-env": "^7.16.7", "@babel/preset-typescript": "^7.16.7", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-commonjs": "^21.0.1", "@types/jsan": "^3.1.2", "@types/socketcluster-client": "^13.0.5", "@typescript-eslint/eslint-plugin": "^5.8.1", @@ -59,6 +61,9 @@ "eslint-config-prettier": "^8.3.0", "redux": "^4.1.2", "rimraf": "^3.0.2", + "rollup": "^2.63.0", + "rollup-plugin-typescript2": "^0.31.1", + "tslib": "^2.3.1", "typescript": "~4.5.4" }, "peerDependencies": { diff --git a/packages/redux-devtools-remote/rollup.config.js b/packages/redux-devtools-remote/rollup.config.js new file mode 100644 index 00000000..b74f092c --- /dev/null +++ b/packages/redux-devtools-remote/rollup.config.js @@ -0,0 +1,36 @@ +import typescript from 'rollup-plugin-typescript2'; +import babel from '@rollup/plugin-babel'; + +const config = [ + { + input: 'src/index.ts', + output: [ + { + file: 'dist/redux-devtools-log-monitor.cjs.js', + format: 'cjs', + }, + { + file: 'dist/redux-devtools-log-monitor.esm.js', + format: 'esm', + }, + ], + plugins: [ + typescript(), + babel({ + babelHelpers: 'runtime', + extensions: ['.ts'], + plugins: ['@babel/plugin-transform-runtime'], + }), + ], + external: [ + /@babel\/runtime/, + 'jsan', + 'socketcluster-client', + '@redux-devtools/utils', + '@redux-devtools/instrument', + 'rn-host-detect', + ], + }, +]; + +export default config; diff --git a/packages/redux-devtools-remote/src/configureStore.ts b/packages/redux-devtools-remote/src/configureStore.ts index b112b6f6..14fd6fc8 100644 --- a/packages/redux-devtools-remote/src/configureStore.ts +++ b/packages/redux-devtools-remote/src/configureStore.ts @@ -1,4 +1,4 @@ -import instrument, { Options } from '@redux-devtools/instrument'; +import { instrument, Options } from '@redux-devtools/instrument'; import { Action, Reducer, StoreEnhancerStoreCreator } from 'redux'; export default function configureStore< diff --git a/packages/redux-devtools-remote/src/devTools.ts b/packages/redux-devtools-remote/src/devTools.ts index 2d5d2e02..08dc7e85 100644 --- a/packages/redux-devtools-remote/src/devTools.ts +++ b/packages/redux-devtools-remote/src/devTools.ts @@ -19,20 +19,17 @@ import { } from '@redux-devtools/instrument'; import { ActionCreatorObject, - evalAction, - getActionsArray, -} from '@redux-devtools/utils'; -import catchErrors, { ErrorAction, -} from '@redux-devtools/utils/lib/catchErrors'; -import { + evalAction, + catchErrors, + getActionsArray, getLocalFilter, isFiltered, filterStagedActions, filterState, LocalFilter, State, -} from '@redux-devtools/utils/lib/filters'; +} from '@redux-devtools/utils'; function async(fn: () => unknown) { setTimeout(fn, 0); diff --git a/packages/redux-devtools-remote/src/index.ts b/packages/redux-devtools-remote/src/index.ts index f56f975b..00a981f0 100644 --- a/packages/redux-devtools-remote/src/index.ts +++ b/packages/redux-devtools-remote/src/index.ts @@ -1,3 +1 @@ -import DevTools from './devTools'; -export default DevTools; -export { composeWithDevTools } from './devTools'; +export { default as devToolsEnhancer, composeWithDevTools } from './devTools'; diff --git a/packages/redux-devtools-utils/src/catchErrors.ts b/packages/redux-devtools-utils/src/catchErrors.ts index 0b32f145..3babc787 100644 --- a/packages/redux-devtools-utils/src/catchErrors.ts +++ b/packages/redux-devtools-utils/src/catchErrors.ts @@ -14,9 +14,7 @@ export interface ErrorAction { column?: number; } -export default function catchErrors( - sendError: (errorAction: ErrorAction) => void -) { +export function catchErrors(sendError: (errorAction: ErrorAction) => void) { if (typeof window === 'object' && typeof window.onerror === 'object') { window.onerror = function (message, url, lineNo, columnNo, error) { const errorAction: ErrorAction = { diff --git a/packages/redux-devtools-utils/src/importState.ts b/packages/redux-devtools-utils/src/importState.ts index a53ba3d7..d0c19e5c 100644 --- a/packages/redux-devtools-utils/src/importState.ts +++ b/packages/redux-devtools-utils/src/importState.ts @@ -10,7 +10,7 @@ interface State { committedState?: unknown; } -export default function importState( +export function importState( state: string, { serialize, diff --git a/packages/redux-devtools-utils/src/index.ts b/packages/redux-devtools-utils/src/index.ts index 9e1f00ee..64203060 100644 --- a/packages/redux-devtools-utils/src/index.ts +++ b/packages/redux-devtools-utils/src/index.ts @@ -253,3 +253,7 @@ export function getStackTrace( } return stack; } + +export * from './catchErrors'; +export * from './filters'; +export * from './importState'; diff --git a/yarn.lock b/yarn.lock index 9e4a6159..cfcfb85c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5056,7 +5056,6 @@ __metadata: redux-devtools-themes: ^1.0.0 rimraf: ^3.0.2 rollup: ^2.63.0 - rollup-plugin-node-polyfills: ^0.2.1 rollup-plugin-typescript2: ^0.31.1 tslib: ^2.3.1 typescript: ~4.5.4 @@ -5072,12 +5071,16 @@ __metadata: version: 0.0.0-use.local resolution: "@redux-devtools/remote@workspace:packages/redux-devtools-remote" dependencies: - "@babel/cli": ^7.16.7 "@babel/core": ^7.16.7 + "@babel/eslint-parser": ^7.16.5 + "@babel/plugin-transform-runtime": ^7.16.7 "@babel/preset-env": ^7.16.7 "@babel/preset-typescript": ^7.16.7 + "@babel/runtime": ^7.16.7 "@redux-devtools/instrument": ^1.11.2 "@redux-devtools/utils": ^1.0.0 + "@rollup/plugin-babel": ^5.3.0 + "@rollup/plugin-commonjs": ^21.0.1 "@types/jsan": ^3.1.2 "@types/socketcluster-client": ^13.0.5 "@typescript-eslint/eslint-plugin": ^5.8.1 @@ -5089,7 +5092,10 @@ __metadata: redux: ^4.1.2 rimraf: ^3.0.2 rn-host-detect: ^1.2.0 + rollup: ^2.63.0 + rollup-plugin-typescript2: ^0.31.1 socketcluster-client: ^14.3.2 + tslib: ^2.3.1 typescript: ~4.5.4 peerDependencies: redux: ^3.5.2 || ^4.0.0