Socket
Socket
Sign inDemoInstall

react-isomorphic-tools

Package Overview
Dependencies
Maintainers
1
Versions
124
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-isomorphic-tools - npm Package Compare versions

Comparing version 3.0.0-alpha.5 to 3.0.0-alpha.6

42

dist/Resolver/AbstractResolver.js

@@ -24,19 +24,6 @@ 'use strict';

var AbstractResolver = function AbstractResolver(routes, location, resolved) {
_classCallCheck(this, AbstractResolver);
_initialiseProps.call(this);
this.routes = routes;
this.location = location;
this.resolved = resolved;
this.match = [];
};
var _initialiseProps = function _initialiseProps() {
var AbstractResolver = function AbstractResolver(routes, resolved) {
var _this = this;
this.getLocation = function () {
return _this.location;
};
_classCallCheck(this, AbstractResolver);

@@ -53,4 +40,3 @@ this.getRoutes = function () {

var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(location) {
var matched, _ref2, pathname, components;
var matched, pathname, components;
return regeneratorRuntime.wrap(function _callee$(_context) {

@@ -61,3 +47,3 @@ while (1) {

matched = [];
_ref2 = location || _this.getLocation(), pathname = _ref2.pathname;
pathname = location.pathname;

@@ -94,10 +80,10 @@ (0, _reactRouterConfig.matchRoutes)(_this.routes, pathname).forEach(function (item) {

this.isResolved = function (_ref3, _ref4) {
var _ref3$match = _ref3.match,
params = _ref3$match.params,
path = _ref3$match.path,
_ref3$route$preloadOp = _ref3.route.preloadOptions,
preloadOptions = _ref3$route$preloadOp === undefined ? {} : _ref3$route$preloadOp;
var _ref4$search = _ref4.search,
search = _ref4$search === undefined ? '' : _ref4$search;
this.isResolved = function (_ref2, _ref3) {
var _ref2$match = _ref2.match,
params = _ref2$match.params,
path = _ref2$match.path,
_ref2$route$preloadOp = _ref2.route.preloadOptions,
preloadOptions = _ref2$route$preloadOp === undefined ? {} : _ref2$route$preloadOp;
var _ref3$search = _ref3.search,
search = _ref3$search === undefined ? '' : _ref3$search;
var _preloadOptions$alway = preloadOptions.alwaysReload,

@@ -143,4 +129,8 @@ alwaysReload = _preloadOptions$alway === undefined ? false : _preloadOptions$alway,

};
this.routes = routes;
this.resolved = resolved;
this.match = [];
};
exports.default = AbstractResolver;

@@ -41,118 +41,112 @@ 'use strict';

function ReduxResolver(routes, location) {
var resolved = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
function ReduxResolver(routes) {
var _this2 = this;
var resolved = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
_classCallCheck(this, ReduxResolver);
var _this = _possibleConstructorReturn(this, (ReduxResolver.__proto__ || Object.getPrototypeOf(ReduxResolver)).call(this, routes, location, resolved));
var _this = _possibleConstructorReturn(this, (ReduxResolver.__proto__ || Object.getPrototypeOf(ReduxResolver)).call(this, routes, resolved));
_initialiseProps.call(_this);
_this.setStore = function (store) {
_this.store = store;
};
return _this;
}
_this.resolveData = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(location) {
var _this$store, getState, dispatch, _ref2, _fetchToState, fetcher, pathname, _location$search, search, unResolved, i, _unResolved$i, params, _unResolved$i$route, preload, path;
return ReduxResolver;
}(_AbstractResolver3.default);
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_this$store = _this.store, getState = _this$store.getState, dispatch = _this$store.dispatch;
_ref2 = new _FetchToState2.default(), _fetchToState = _ref2.fetchToState, fetcher = _ref2.fetcher;
pathname = location.pathname, _location$search = location.search, search = _location$search === undefined ? '' : _location$search;
unResolved = (0, _reactRouterConfig.matchRoutes)(_this.routes, pathname).filter(function (item) {
return typeof item.route.preload === 'function' && !_this.isResolved(item, location);
});
var _initialiseProps = function _initialiseProps() {
var _this2 = this;
if (!(unResolved.length === 0)) {
_context.next = 6;
break;
}
this.setStore = function (store) {
_this2.store = store;
};
return _context.abrupt('return');
this.resolveData = function () {
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
var location = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this2.getLocation();
case 6:
var _store, getState, dispatch, _ref2, _fetchToState, fetcher, pathname, _location$search, search, unResolved, i, _unResolved$i, params, _unResolved$i$route, preload, path;
dispatch((0, _preload.start)());
return regeneratorRuntime.wrap(function _callee$(_context) {
while (1) {
switch (_context.prev = _context.next) {
case 0:
_store = _this2.store, getState = _store.getState, dispatch = _store.dispatch;
_ref2 = new _FetchToState2.default(), _fetchToState = _ref2.fetchToState, fetcher = _ref2.fetcher;
pathname = location.pathname, _location$search = location.search, search = _location$search === undefined ? '' : _location$search;
unResolved = (0, _reactRouterConfig.matchRoutes)(_this2.routes, pathname).filter(function (item) {
return typeof item.route.preload === 'function' && !_this2.isResolved(item, location);
});
_context.t0 = regeneratorRuntime.keys(unResolved);
if (!(unResolved.length === 0)) {
_context.next = 6;
break;
}
case 8:
if ((_context.t1 = _context.t0()).done) {
_context.next = 17;
break;
}
return _context.abrupt('return');
i = _context.t1.value;
case 6:
if (!Object.prototype.hasOwnProperty.call(unResolved, i)) {
_context.next = 15;
break;
}
dispatch((0, _preload.start)());
_unResolved$i = unResolved[i], params = _unResolved$i.match.params, _unResolved$i$route = _unResolved$i.route, preload = _unResolved$i$route.preload, path = _unResolved$i$route.path;
_context.next = 14;
return preload({
getState: getState,
dispatch: dispatch,
params: params,
location: _extends({}, location, { query: (0, _.parseQuery)(search) }),
fetcher: fetcher,
fetchToState: function fetchToState() {
return dispatch(_fetchToState.apply(undefined, arguments));
},
redirect: function redirect(props) {
throw new Error({
code: 303,
to: props,
type: 'redirect'
});
}
});
_context.t0 = regeneratorRuntime.keys(unResolved);
case 14:
case 8:
if ((_context.t1 = _context.t0()).done) {
_context.next = 17;
break;
}
_this.push({
params: params,
path: path,
search: search,
isServer: !_isBrowser2.default
});
i = _context.t1.value;
if (!Object.prototype.hasOwnProperty.call(unResolved, i)) {
_context.next = 15;
case 15:
_context.next = 8;
break;
}
_unResolved$i = unResolved[i], params = _unResolved$i.match.params, _unResolved$i$route = _unResolved$i.route, preload = _unResolved$i$route.preload, path = _unResolved$i$route.path;
_context.next = 14;
return preload({
getState: getState,
dispatch: dispatch,
params: params,
location: _extends({}, location, { query: (0, _.parseQuery)(search) }),
fetcher: fetcher,
fetchToState: function fetchToState() {
return dispatch(_fetchToState.apply(undefined, arguments));
},
redirect: function redirect(props) {
throw new Error({
code: 303,
to: props,
type: 'redirect'
});
}
});
case 17:
case 14:
dispatch((0, _preload.success)());
_this2.push({
params: params,
path: path,
search: search,
isServer: !_isBrowser2.default
});
case 18:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
}));
case 15:
_context.next = 8;
break;
return function (_x2) {
return _ref.apply(this, arguments);
};
}();
case 17:
return _this;
}
dispatch((0, _preload.success)());
return ReduxResolver;
}(_AbstractResolver3.default);
case 18:
case 'end':
return _context.stop();
}
}
}, _callee, _this2);
}));
return function () {
return _ref.apply(this, arguments);
};
}();
};
exports.default = ReduxResolver;
{
"name": "react-isomorphic-tools",
"version": "3.0.0-alpha.5",
"version": "3.0.0-alpha.6",
"description": "Authorization, Fetcher, Preload. Tools for ServerSide rendering",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

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