mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2025-07-23 06:29:51 +03:00
stash
This commit is contained in:
parent
16cad91ede
commit
702c7e8103
3
packages/redux-devtools-extension/.babelrc
Normal file
3
packages/redux-devtools-extension/.babelrc
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"presets": ["@babel/preset-env", "@babel/preset-typescript"]
|
||||||
|
}
|
1
packages/redux-devtools-extension/.eslintignore
Normal file
1
packages/redux-devtools-extension/.eslintignore
Normal file
|
@ -0,0 +1 @@
|
||||||
|
lib
|
7
packages/redux-devtools-extension/.eslintrc.js
Normal file
7
packages/redux-devtools-extension/.eslintrc.js
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports = {
|
||||||
|
extends: '../../eslintrc.ts.base.json',
|
||||||
|
parserOptions: {
|
||||||
|
tsconfigRootDir: __dirname,
|
||||||
|
project: ['./tsconfig.json'],
|
||||||
|
},
|
||||||
|
};
|
|
@ -7,14 +7,14 @@
|
||||||
Install:
|
Install:
|
||||||
|
|
||||||
```
|
```
|
||||||
npm install --save redux-devtools-extension
|
yarn add @redux-devtools/extension
|
||||||
```
|
```
|
||||||
|
|
||||||
and use like that:
|
and use like that:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { createStore, applyMiddleware } from 'redux';
|
import { createStore, applyMiddleware } from 'redux';
|
||||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
import { composeWithDevTools } from '@redux-devtools/extension';
|
||||||
|
|
||||||
const store = createStore(
|
const store = createStore(
|
||||||
reducer,
|
reducer,
|
||||||
|
@ -25,11 +25,11 @@ const store = createStore(
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
or if needed to apply [extension’s options](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/docs/API/Arguments.md#windowdevtoolsextensionconfig):
|
or if needed to apply [extension’s options](https://github.com/reduxjs/redux-devtools/blob/main/extension/docs/API/Arguments.md):
|
||||||
|
|
||||||
```js
|
```js
|
||||||
import { createStore, applyMiddleware } from 'redux';
|
import { createStore, applyMiddleware } from 'redux';
|
||||||
import { composeWithDevTools } from 'redux-devtools-extension';
|
import { composeWithDevTools } from '@redux-devtools/extension';
|
||||||
|
|
||||||
const composeEnhancers = composeWithDevTools({
|
const composeEnhancers = composeWithDevTools({
|
||||||
// Specify here name, actionsDenylist, actionsCreators and other options
|
// Specify here name, actionsDenylist, actionsCreators and other options
|
||||||
|
@ -43,7 +43,7 @@ const store = createStore(
|
||||||
);
|
);
|
||||||
```
|
```
|
||||||
|
|
||||||
There’re just [few lines of code](https://github.com/zalmoxisus/redux-devtools-extension/blob/master/npm-package/index.js). If you don’t want to allow the extension in production, just use ‘redux-devtools-extension/developmentOnly’ instead of ‘redux-devtools-extension’.
|
There’re just [few lines of code](https://github.com/reduxjs/redux-devtools/blob/main/packages/redux-devtools-extension/src/index.ts). If you don’t want to allow the extension in production, just use ‘@redux-devtools/extension/lib/developmentOnly’ instead of ‘@redux-devtools/extension’.
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
export * from 'redux-devtools-extension';
|
|
|
@ -1,22 +0,0 @@
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var compose = require('redux').compose;
|
|
||||||
|
|
||||||
exports.__esModule = true;
|
|
||||||
exports.composeWithDevTools =
|
|
||||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
||||||
: function () {
|
|
||||||
if (arguments.length === 0) return undefined;
|
|
||||||
if (typeof arguments[0] === 'object') return compose;
|
|
||||||
return compose.apply(null, arguments);
|
|
||||||
};
|
|
||||||
|
|
||||||
exports.devToolsEnhancer =
|
|
||||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
|
||||||
? window.__REDUX_DEVTOOLS_EXTENSION__
|
|
||||||
: function () {
|
|
||||||
return function (noop) {
|
|
||||||
return noop;
|
|
||||||
};
|
|
||||||
};
|
|
|
@ -1 +0,0 @@
|
||||||
export * from 'redux-devtools-extension';
|
|
|
@ -1 +0,0 @@
|
||||||
export * from 'redux-devtools-extension';
|
|
|
@ -1,15 +1,39 @@
|
||||||
{
|
{
|
||||||
"name": "redux-devtools-extension",
|
"name": "@redux-devtools/extension",
|
||||||
"version": "2.13.9",
|
"version": "2.13.9",
|
||||||
"description": "Wrappers for Redux DevTools Extension.",
|
"description": "Wrappers for Redux DevTools Extension.",
|
||||||
"main": "index.js",
|
"homepage": "https://github.com/reduxjs/redux-devtools/tree/master/packages/redux-devtools-extension",
|
||||||
|
"license": "MIT",
|
||||||
|
"author": "Mihail Diordiev <zalmoxisus@gmail.com> (https://github.com/zalmoxisus)",
|
||||||
|
"main": "lib/index.js",
|
||||||
|
"types": "lib/index.d.ts",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/zalmoxisus/redux-devtools-extension"
|
"url": "https://github.com/reduxjs/redux-devtools"
|
||||||
|
},
|
||||||
|
"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",
|
||||||
|
"clean": "rimraf lib",
|
||||||
|
"lint": "eslint . --ext .ts",
|
||||||
|
"type-check": "tsc --noEmit",
|
||||||
|
"prepack": "yarn run clean && yarn run build",
|
||||||
|
"prepublish": "yarn run type-check && yarn run lint"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@babel/cli": "^7.16.0",
|
||||||
|
"@babel/core": "^7.16.0",
|
||||||
|
"@babel/preset-env": "^7.16.0",
|
||||||
|
"@babel/preset-typescript": "^7.16.0",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||||
|
"@typescript-eslint/parser": "^5.2.0",
|
||||||
|
"eslint": "^7.32.0",
|
||||||
|
"eslint-config-prettier": "^8.3.0",
|
||||||
|
"redux": "^4.1.2",
|
||||||
|
"rimraf": "^3.0.2",
|
||||||
|
"typescript": "~4.4.4"
|
||||||
},
|
},
|
||||||
"homepage": "https://github.com/zalmoxisus/redux-devtools-extension",
|
|
||||||
"author": "Mihail Diordiev <zalmoxisus@gmail.com> (https://github.com/zalmoxisus)",
|
|
||||||
"license": "MIT",
|
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"redux": "^3.1.0 || ^4.0.0"
|
"redux": "^3.1.0 || ^4.0.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
'use strict';
|
import { compose, StoreEnhancer } from 'redux';
|
||||||
|
import { EnhancerOptions } from './index';
|
||||||
|
|
||||||
var compose = require('redux').compose;
|
declare const process: any;
|
||||||
|
|
||||||
exports.__esModule = true;
|
export const composeWithDevTools =
|
||||||
exports.composeWithDevTools =
|
|
||||||
process.env.NODE_ENV !== 'production' &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
typeof window !== 'undefined' &&
|
typeof window !== 'undefined' &&
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||||
|
@ -14,7 +14,7 @@ exports.composeWithDevTools =
|
||||||
return compose.apply(null, arguments);
|
return compose.apply(null, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.devToolsEnhancer =
|
export const devToolsEnhancer: (options?: EnhancerOptions) => StoreEnhancer =
|
||||||
process.env.NODE_ENV !== 'production' &&
|
process.env.NODE_ENV !== 'production' &&
|
||||||
typeof window !== 'undefined' &&
|
typeof window !== 'undefined' &&
|
||||||
window.__REDUX_DEVTOOLS_EXTENSION__
|
window.__REDUX_DEVTOOLS_EXTENSION__
|
|
@ -1,4 +1,4 @@
|
||||||
import { Action, ActionCreator, StoreEnhancer, compose } from 'redux';
|
import { Action, ActionCreator, compose, StoreEnhancer } from 'redux';
|
||||||
|
|
||||||
export interface EnhancerOptions {
|
export interface EnhancerOptions {
|
||||||
/**
|
/**
|
||||||
|
@ -43,6 +43,7 @@ export interface EnhancerOptions {
|
||||||
symbol?: boolean;
|
symbol?: boolean;
|
||||||
map?: boolean;
|
map?: boolean;
|
||||||
set?: boolean;
|
set?: boolean;
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
function?: boolean | Function;
|
function?: boolean | Function;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
|
@ -179,8 +180,26 @@ export interface EnhancerOptions {
|
||||||
traceLimit?: number;
|
traceLimit?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function composeWithDevTools<StoreExt, StateExt>(
|
declare global {
|
||||||
...funcs: Array<StoreEnhancer<StoreExt>>
|
interface Window {
|
||||||
): StoreEnhancer<StoreExt>;
|
__REDUX_DEVTOOLS_EXTENSION__?: (options?: EnhancerOptions) => StoreEnhancer;
|
||||||
export function composeWithDevTools(options: EnhancerOptions): typeof compose;
|
}
|
||||||
export function devToolsEnhancer(options: EnhancerOptions): StoreEnhancer<any>;
|
}
|
||||||
|
|
||||||
|
export const composeWithDevTools =
|
||||||
|
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||||
|
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
||||||
|
: function () {
|
||||||
|
if (arguments.length === 0) return undefined;
|
||||||
|
if (typeof arguments[0] === 'object') return compose;
|
||||||
|
return compose.apply(null, arguments);
|
||||||
|
};
|
||||||
|
|
||||||
|
export const devToolsEnhancer: (options?: EnhancerOptions) => StoreEnhancer =
|
||||||
|
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
|
? window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
|
: function () {
|
||||||
|
return function (noop) {
|
||||||
|
return noop;
|
||||||
|
};
|
||||||
|
};
|
|
@ -1,10 +1,9 @@
|
||||||
'use strict';
|
import assign from './utils/assign';
|
||||||
|
import { compose, StoreEnhancer } from 'redux';
|
||||||
var assign = require('./utils/assign');
|
import { EnhancerOptions } from './index';
|
||||||
var compose = require('redux').compose;
|
|
||||||
|
|
||||||
function enhancer() {
|
function enhancer() {
|
||||||
var config = arguments[0] || {};
|
const config = arguments[0] || {};
|
||||||
config.features = { pause: true, export: true, test: true };
|
config.features = { pause: true, export: true, test: true };
|
||||||
config.type = 'redux';
|
config.type = 'redux';
|
||||||
if (config.autoPause === undefined) config.autoPause = true;
|
if (config.autoPause === undefined) config.autoPause = true;
|
||||||
|
@ -12,14 +11,14 @@ function enhancer() {
|
||||||
|
|
||||||
return function (createStore) {
|
return function (createStore) {
|
||||||
return function (reducer, preloadedState, enhancer) {
|
return function (reducer, preloadedState, enhancer) {
|
||||||
var store = createStore(reducer, preloadedState, enhancer);
|
const store = createStore(reducer, preloadedState, enhancer);
|
||||||
var origDispatch = store.dispatch;
|
const origDispatch = store.dispatch;
|
||||||
|
|
||||||
var devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect(config);
|
const devTools = window.__REDUX_DEVTOOLS_EXTENSION__.connect(config);
|
||||||
devTools.init(store.getState());
|
devTools.init(store.getState());
|
||||||
|
|
||||||
var dispatch = function (action) {
|
const dispatch = function (action) {
|
||||||
var r = origDispatch(action);
|
const r = origDispatch(action);
|
||||||
devTools.send(action, store.getState());
|
devTools.send(action, store.getState());
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
|
@ -36,8 +35,7 @@ function composeWithEnhancer(config) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.__esModule = true;
|
export const composeWithDevTools = function () {
|
||||||
exports.composeWithDevTools = function () {
|
|
||||||
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
if (typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__) {
|
||||||
if (arguments.length === 0) return enhancer();
|
if (arguments.length === 0) return enhancer();
|
||||||
if (typeof arguments[0] === 'object')
|
if (typeof arguments[0] === 'object')
|
||||||
|
@ -50,7 +48,7 @@ exports.composeWithDevTools = function () {
|
||||||
return compose.apply(null, arguments);
|
return compose.apply(null, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.devToolsEnhancer =
|
export const devToolsEnhancer: (options?: EnhancerOptions) => StoreEnhancer =
|
||||||
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
||||||
? enhancer
|
? enhancer
|
||||||
: function () {
|
: function () {
|
|
@ -1,10 +1,10 @@
|
||||||
'use strict';
|
import { compose, StoreEnhancer } from 'redux';
|
||||||
|
import * as logOnly from './logOnly';
|
||||||
|
import { EnhancerOptions } from './index';
|
||||||
|
|
||||||
var compose = require('redux').compose;
|
declare const process: any;
|
||||||
var logOnly = require('./logOnly');
|
|
||||||
|
|
||||||
exports.__esModule = true;
|
export const composeWithDevTools =
|
||||||
exports.composeWithDevTools =
|
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
? logOnly.composeWithDevTools
|
? logOnly.composeWithDevTools
|
||||||
: typeof window !== 'undefined' &&
|
: typeof window !== 'undefined' &&
|
||||||
|
@ -16,7 +16,7 @@ exports.composeWithDevTools =
|
||||||
return compose.apply(null, arguments);
|
return compose.apply(null, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.devToolsEnhancer =
|
export const devToolsEnhancer: (options?: EnhancerOptions) => StoreEnhancer =
|
||||||
process.env.NODE_ENV === 'production'
|
process.env.NODE_ENV === 'production'
|
||||||
? logOnly.devToolsEnhancer
|
? logOnly.devToolsEnhancer
|
||||||
: typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
: typeof window !== 'undefined' && window.__REDUX_DEVTOOLS_EXTENSION__
|
22
packages/redux-devtools-extension/src/utils/assign.ts
Normal file
22
packages/redux-devtools-extension/src/utils/assign.ts
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
const objectKeys =
|
||||||
|
Object.keys ||
|
||||||
|
function (obj) {
|
||||||
|
const keys = [];
|
||||||
|
for (const key in obj) {
|
||||||
|
if ({}.hasOwnProperty.call(obj, key)) keys.push(key);
|
||||||
|
}
|
||||||
|
return keys;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function assign(obj: {}, newKey, newValue) {
|
||||||
|
const keys = objectKeys(obj);
|
||||||
|
const copy = {};
|
||||||
|
|
||||||
|
for (let i = 0, l = keys.length; i < l; i++) {
|
||||||
|
const key = keys[i];
|
||||||
|
copy[key] = obj[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
copy[newKey] = newValue;
|
||||||
|
return copy;
|
||||||
|
}
|
7
packages/redux-devtools-extension/tsconfig.json
Normal file
7
packages/redux-devtools-extension/tsconfig.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "../../tsconfig.base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"outDir": "lib"
|
||||||
|
},
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
|
@ -1,24 +0,0 @@
|
||||||
var objectKeys =
|
|
||||||
Object.keys ||
|
|
||||||
function (obj) {
|
|
||||||
var keys = [];
|
|
||||||
for (var key in obj) {
|
|
||||||
if ({}.hasOwnProperty.call(obj, key)) keys.push(key);
|
|
||||||
}
|
|
||||||
return keys;
|
|
||||||
};
|
|
||||||
|
|
||||||
function assign(obj, newKey, newValue) {
|
|
||||||
var keys = objectKeys(obj);
|
|
||||||
var copy = {};
|
|
||||||
|
|
||||||
for (var i = 0, l = keys.length; i < l; i++) {
|
|
||||||
var key = keys[i];
|
|
||||||
copy[key] = obj[key];
|
|
||||||
}
|
|
||||||
|
|
||||||
copy[newKey] = newValue;
|
|
||||||
return copy;
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = assign;
|
|
28
yarn.lock
28
yarn.lock
|
@ -4780,6 +4780,26 @@ __metadata:
|
||||||
languageName: unknown
|
languageName: unknown
|
||||||
linkType: soft
|
linkType: soft
|
||||||
|
|
||||||
|
"@redux-devtools/extension@workspace:packages/redux-devtools-extension":
|
||||||
|
version: 0.0.0-use.local
|
||||||
|
resolution: "@redux-devtools/extension@workspace:packages/redux-devtools-extension"
|
||||||
|
dependencies:
|
||||||
|
"@babel/cli": ^7.16.0
|
||||||
|
"@babel/core": ^7.16.0
|
||||||
|
"@babel/preset-env": ^7.16.0
|
||||||
|
"@babel/preset-typescript": ^7.16.0
|
||||||
|
"@typescript-eslint/eslint-plugin": ^5.2.0
|
||||||
|
"@typescript-eslint/parser": ^5.2.0
|
||||||
|
eslint: ^7.32.0
|
||||||
|
eslint-config-prettier: ^8.3.0
|
||||||
|
redux: ^4.1.2
|
||||||
|
rimraf: ^3.0.2
|
||||||
|
typescript: ~4.4.4
|
||||||
|
peerDependencies:
|
||||||
|
redux: ^3.1.0 || ^4.0.0
|
||||||
|
languageName: unknown
|
||||||
|
linkType: soft
|
||||||
|
|
||||||
"@redux-devtools/inspector-monitor-test-tab@^0.7.2, @redux-devtools/inspector-monitor-test-tab@workspace:packages/redux-devtools-inspector-monitor-test-tab":
|
"@redux-devtools/inspector-monitor-test-tab@^0.7.2, @redux-devtools/inspector-monitor-test-tab@workspace:packages/redux-devtools-inspector-monitor-test-tab":
|
||||||
version: 0.0.0-use.local
|
version: 0.0.0-use.local
|
||||||
resolution: "@redux-devtools/inspector-monitor-test-tab@workspace:packages/redux-devtools-inspector-monitor-test-tab"
|
resolution: "@redux-devtools/inspector-monitor-test-tab@workspace:packages/redux-devtools-inspector-monitor-test-tab"
|
||||||
|
@ -24596,14 +24616,6 @@ fsevents@^1.2.7:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"redux-devtools-extension@workspace:packages/redux-devtools-extension":
|
|
||||||
version: 0.0.0-use.local
|
|
||||||
resolution: "redux-devtools-extension@workspace:packages/redux-devtools-extension"
|
|
||||||
peerDependencies:
|
|
||||||
redux: ^3.1.0 || ^4.0.0
|
|
||||||
languageName: unknown
|
|
||||||
linkType: soft
|
|
||||||
|
|
||||||
"redux-devtools-themes@npm:^1.0.0":
|
"redux-devtools-themes@npm:^1.0.0":
|
||||||
version: 1.0.0
|
version: 1.0.0
|
||||||
resolution: "redux-devtools-themes@npm:1.0.0"
|
resolution: "redux-devtools-themes@npm:1.0.0"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user