New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redux-first-history

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redux-first-history - npm Package Compare versions

Comparing version 5.0.0-beta.2 to 5.0.0

0

build/es5/actions.d.ts

@@ -0,0 +0,0 @@ import { Location, Action, History } from 'history';

22

build/es5/actions.js

@@ -11,12 +11,14 @@ "use strict";

exports.locationChangeAction = locationChangeAction;
var updateLocation = function (method) { return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return ({
type: exports.CALL_HISTORY_METHOD,
payload: { method: method, args: args },
});
}; };
function updateLocation(method) {
return function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return ({
type: exports.CALL_HISTORY_METHOD,
payload: { method: method, args: args },
});
};
}
exports.push = updateLocation('push');

@@ -23,0 +25,0 @@ exports.replace = updateLocation('replace');

@@ -1,4 +0,4 @@

import { History } from 'history';
import { History as ReachHistory } from '@reach/router';
import { Middleware, Reducer, Store } from 'redux';
import type { History } from 'history';
import type { History as ReachHistory } from '@reach/router';
import type { Middleware, Reducer, Store } from 'redux';
import { RouterState } from './reducer';

@@ -5,0 +5,0 @@ export interface IHistoryContextOptions {

@@ -23,4 +23,4 @@ "use strict";

}
var routerReducer = reducer_1.createRouterReducer({ savePreviousLocations: savePreviousLocations });
var routerMiddleware = middleware_1.createRouterMiddleware({ history: history, showHistoryAction: showHistoryAction });
var routerReducer = (0, reducer_1.createRouterReducer)({ savePreviousLocations: savePreviousLocations });
var routerMiddleware = (0, middleware_1.createRouterMiddleware)({ history: history, showHistoryAction: showHistoryAction });
/** ****************************************** REDUX TRAVELLING ************************************************** */

@@ -46,3 +46,3 @@ var isReduxTravelling = false;

// init location store
store.dispatch(actions_1.locationChangeAction(history.location, history.action));
store.dispatch((0, actions_1.locationChangeAction)(history.location, history.action));
if (reduxTravelling) {

@@ -74,3 +74,3 @@ handleReduxTravelling(store);

batch(function () {
store.dispatch(actions_1.locationChangeAction(location, action));
store.dispatch((0, actions_1.locationChangeAction)(location, action));
// @ts-ignore

@@ -97,3 +97,3 @@ var routerState = selectRouterState(store.getState());

batch(function () {
store.dispatch(actions_1.locationChangeAction(loc_1, action));
store.dispatch((0, actions_1.locationChangeAction)(loc_1, action));
// @ts-ignore

@@ -108,2 +108,16 @@ var routerState = selectRouterState(store.getState());

}
var back = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return store.dispatch(actions_1.goBack.apply(void 0, args));
};
var forward = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return store.dispatch(actions_1.goForward.apply(void 0, args));
};
// @ts-ignore

@@ -134,16 +148,6 @@ return {

},
goBack: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return store.dispatch(actions_1.goBack.apply(void 0, args));
},
goForward: function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return store.dispatch(actions_1.goForward.apply(void 0, args));
},
goBack: back,
goForward: forward,
back: back,
forward: forward,
listen: function (callback) {

@@ -150,0 +154,0 @@ if (registeredCallback.indexOf(callback) < 0) {

@@ -0,0 +0,0 @@ export { push, replace, go, goBack, goForward, CALL_HISTORY_METHOD, LOCATION_CHANGE, } from './actions';

@@ -0,0 +0,0 @@ "use strict";

@@ -7,3 +7,3 @@ import { History } from 'history';

};
export declare const createRouterMiddleware: ({ history, showHistoryAction, }: CreateRouterMiddlewareArgs) => Middleware;
export declare const createRouterMiddleware: ({ history, showHistoryAction }: CreateRouterMiddlewareArgs) => Middleware;
export {};

@@ -7,35 +7,39 @@ "use strict";

var history = _a.history, showHistoryAction = _a.showHistoryAction;
return function () { return function (next) { return function (action) {
if (action.type !== actions_1.CALL_HISTORY_METHOD) {
return next(action);
}
var method = action.payload.method;
var args = action.payload.args;
// eslint-disable-next-line default-case
switch (method) {
case 'push':
history.push.apply(history, args);
break;
case 'replace':
history.replace.apply(history, args);
break;
case 'go':
history.go.apply(history, args);
break;
case 'goBack':
history.goBack && history.goBack.apply(history, args);
//@ts-ignore //support history 5.x
history.back && history.back.apply(history, args);
break;
case 'goForward':
history.goForward && history.goForward.apply(history, args);
//@ts-ignore //support history 5.x
history.forward && history.forward.apply(history, args);
break;
}
if (showHistoryAction)
return next(action);
}; }; };
return function () {
return function (next) {
return function (action) {
if (action.type !== actions_1.CALL_HISTORY_METHOD) {
return next(action);
}
var method = action.payload.method;
var args = action.payload.args;
// eslint-disable-next-line default-case
switch (method) {
case 'push':
history.push.apply(history, args);
break;
case 'replace':
history.replace.apply(history, args);
break;
case 'go':
history.go.apply(history, args);
break;
case 'goBack':
history.goBack && history.goBack.apply(history, args);
//@ts-ignore //support history 5.x
history.back && history.back.apply(history, args);
break;
case 'goForward':
history.goForward && history.goForward.apply(history, args);
//@ts-ignore //support history 5.x
history.forward && history.forward.apply(history, args);
break;
}
if (showHistoryAction)
return next(action);
};
};
};
};
exports.createRouterMiddleware = createRouterMiddleware;
//# sourceMappingURL=middleware.js.map

@@ -0,0 +0,0 @@ import { History as ReachHistory } from '@reach/router';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Action, Location } from 'history';

@@ -13,6 +13,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -38,3 +42,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var previousLocations = numLocationToTrack // @ts-ignore
? __spreadArray([{ location: location_1, action: action }], state.previousLocations.slice(0, numLocationToTrack)) : undefined;
? __spreadArray([{ location: location_1, action: action }], state.previousLocations.slice(0, numLocationToTrack), true) : undefined;
return __assign(__assign({}, state), { location: location_1, action: action, previousLocations: previousLocations });

@@ -41,0 +45,0 @@ }

@@ -0,0 +0,0 @@ import { Location, Action, History } from 'history';

@@ -7,6 +7,8 @@ export const CALL_HISTORY_METHOD = '@@router/CALL_HISTORY_METHOD';

});
const updateLocation = (method) => (...args) => ({
type: CALL_HISTORY_METHOD,
payload: { method, args },
});
function updateLocation(method) {
return (...args) => ({
type: CALL_HISTORY_METHOD,
payload: { method, args },
});
}
export const push = updateLocation('push');

@@ -13,0 +15,0 @@ export const replace = updateLocation('replace');

@@ -1,4 +0,4 @@

import { History } from 'history';
import { History as ReachHistory } from '@reach/router';
import { Middleware, Reducer, Store } from 'redux';
import type { History } from 'history';
import type { History as ReachHistory } from '@reach/router';
import type { Middleware, Reducer, Store } from 'redux';
import { RouterState } from './reducer';

@@ -5,0 +5,0 @@ export interface IHistoryContextOptions {

@@ -89,2 +89,4 @@ import { go, goBack, goForward, push, replace, locationChangeAction } from './actions';

}
const back = (...args) => store.dispatch(goBack(...args));
const forward = (...args) => store.dispatch(goForward(...args));
// @ts-ignore

@@ -97,4 +99,6 @@ return {

go: (...args) => store.dispatch(go(...args)),
goBack: (...args) => store.dispatch(goBack(...args)),
goForward: (...args) => store.dispatch(goForward(...args)),
goBack: back,
goForward: forward,
back,
forward,
listen: callback => {

@@ -101,0 +105,0 @@ if (registeredCallback.indexOf(callback) < 0) {

@@ -0,0 +0,0 @@ export { push, replace, go, goBack, goForward, CALL_HISTORY_METHOD, LOCATION_CHANGE, } from './actions';

@@ -0,0 +0,0 @@ export { push, replace, go, goBack, goForward, CALL_HISTORY_METHOD, LOCATION_CHANGE, } from './actions';

@@ -7,3 +7,3 @@ import { History } from 'history';

};
export declare const createRouterMiddleware: ({ history, showHistoryAction, }: CreateRouterMiddlewareArgs) => Middleware;
export declare const createRouterMiddleware: ({ history, showHistoryAction }: CreateRouterMiddlewareArgs) => Middleware;
export {};
import { CALL_HISTORY_METHOD } from './actions';
export const createRouterMiddleware = ({ history, showHistoryAction, }) => () => (next) => (action) => {
export const createRouterMiddleware = ({ history, showHistoryAction }) => () => (next) => (action) => {
if (action.type !== CALL_HISTORY_METHOD) {

@@ -4,0 +4,0 @@ return next(action);

@@ -0,0 +0,0 @@ import { History as ReachHistory } from '@reach/router';

@@ -0,0 +0,0 @@ export const reachify = (reduxHistory) => {

@@ -0,0 +0,0 @@ import { Action, Location } from 'history';

@@ -0,0 +0,0 @@ import { LOCATION_CHANGE } from './actions';

{
"name": "redux-first-history",
"version": "5.0.0-beta.2",
"version": "5.0.0",
"description": "Redux First History - Redux history binding support react-router - @reach/router - wouter",

@@ -50,28 +50,28 @@ "main": "build/es5/index.js",

"@reach/router": "^1.3.4",
"@testing-library/react": "^11.2.6",
"@types/history": "^4.7.8",
"@types/jest": "^26.0.23",
"@types/reach__router": "^1.3.7",
"@types/react": "^17.0.4",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"eslint": "^7.17.0",
"@testing-library/react": "^12.1.0",
"@types/history": "^4.7.9",
"@types/jest": "^27.0.2",
"@types/reach__router": "^1.3.9",
"@types/react": "^17.0.24",
"@typescript-eslint/eslint-plugin": "^4.31.2",
"@typescript-eslint/parser": "^4.31.2",
"eslint": "^7.32.0",
"eslint-config-airbnb": "^18.2.1",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-import": "^2.22.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.24.2",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-react": "^7.26.0",
"eslint-plugin-react-hooks": "^4.2.0",
"history": "^4.10.1",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"jest": "^27.2.1",
"prettier": "^2.4.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"redux": "^4.1.0",
"redux": "^4.1.1",
"rimraf": "^3.0.2",
"ts-jest": "^26.5.5",
"ts-node": "^9.1.1",
"typescript": "^4.1.3"
"ts-jest": "^27.0.5",
"ts-node": "^10.2.1",
"typescript": "^4.3.5"
}
}

@@ -0,1 +1,2 @@

/* eslint-disable prefer-object-spread, import/no-unresolved*/
import React from 'react';

@@ -2,0 +3,0 @@ import { Router } from 'react-router';

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc