Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

next-redux-saga

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

next-redux-saga - npm Package Compare versions

Comparing version 4.1.2 to 5.0.0-0

156

dist/next-redux-saga.es.js
import _regeneratorRuntime from '@babel/runtime/regenerator';
import _asyncToGenerator from '@babel/runtime/helpers/esm/asyncToGenerator';
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck';
import _createClass from '@babel/runtime/helpers/esm/createClass';
import _inherits from '@babel/runtime/helpers/esm/inherits';
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn';
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf';
import _defineProperty from '@babel/runtime/helpers/esm/defineProperty';
import React, { Component } from 'react';
import { END } from 'redux-saga';
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
var __jsx = React.createElement;
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function withReduxSaga(BaseComponent) {
var WrappedComponent =
/*#__PURE__*/
function (_Component) {
var WrappedComponent = /*#__PURE__*/function (_Component) {
_inherits(WrappedComponent, _Component);
var _super = _createSuper(WrappedComponent);
function WrappedComponent() {
_classCallCheck(this, WrappedComponent);
return _possibleConstructorReturn(this, _getPrototypeOf(WrappedComponent).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -140,3 +33,3 @@

value: function render() {
return React.createElement(BaseComponent, this.props);
return __jsx(BaseComponent, this.props);
}

@@ -146,7 +39,4 @@ }], [{

value: function () {
var _getInitialProps = _asyncToGenerator(
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee(props) {
var _props$ctx, isServer, store, pageProps;
var _getInitialProps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
var store, pageProps;
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -156,3 +46,3 @@ while (1) {

case 0:
_props$ctx = props.ctx, isServer = _props$ctx.isServer, store = _props$ctx.store;
store = props.ctx.store;
pageProps = {};

@@ -172,3 +62,3 @@

case 6:
if (!isServer) {
if (!(typeof window === 'undefined')) {
_context.next = 10;

@@ -190,8 +80,10 @@ break;

}
}, _callee, this);
}, _callee);
}));
return function getInitialProps(_x) {
function getInitialProps(_x) {
return _getInitialProps.apply(this, arguments);
};
}
return getInitialProps;
}()

@@ -198,0 +90,0 @@ }]);

(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@babel/runtime/regenerator'), require('react'), require('redux-saga')) :
typeof define === 'function' && define.amd ? define(['@babel/runtime/regenerator', 'react', 'redux-saga'], factory) :
(global = global || self, global['next-redux-saga'] = factory(global._regeneratorRuntime, global.React, global.ReduxSaga));
}(this, function (_regeneratorRuntime, React, reduxSaga) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@babel/runtime/regenerator'), require('@babel/runtime/helpers/esm/asyncToGenerator'), require('@babel/runtime/helpers/esm/classCallCheck'), require('@babel/runtime/helpers/esm/createClass'), require('@babel/runtime/helpers/esm/inherits'), require('@babel/runtime/helpers/esm/possibleConstructorReturn'), require('@babel/runtime/helpers/esm/getPrototypeOf'), require('@babel/runtime/helpers/esm/defineProperty'), require('react'), require('redux-saga')) :
typeof define === 'function' && define.amd ? define(['@babel/runtime/regenerator', '@babel/runtime/helpers/esm/asyncToGenerator', '@babel/runtime/helpers/esm/classCallCheck', '@babel/runtime/helpers/esm/createClass', '@babel/runtime/helpers/esm/inherits', '@babel/runtime/helpers/esm/possibleConstructorReturn', '@babel/runtime/helpers/esm/getPrototypeOf', '@babel/runtime/helpers/esm/defineProperty', 'react', 'redux-saga'], factory) :
(global = global || self, global['next-redux-saga'] = factory(global._regeneratorRuntime, global._asyncToGenerator, global._classCallCheck, global._createClass, global._inherits, global._possibleConstructorReturn, global._getPrototypeOf, global._defineProperty, global.React, global.ReduxSaga));
}(this, (function (_regeneratorRuntime, _asyncToGenerator, _classCallCheck, _createClass, _inherits, _possibleConstructorReturn, _getPrototypeOf, _defineProperty, React, reduxSaga) { 'use strict';
_regeneratorRuntime = _regeneratorRuntime && _regeneratorRuntime.hasOwnProperty('default') ? _regeneratorRuntime['default'] : _regeneratorRuntime;
_regeneratorRuntime = _regeneratorRuntime && Object.prototype.hasOwnProperty.call(_regeneratorRuntime, 'default') ? _regeneratorRuntime['default'] : _regeneratorRuntime;
_asyncToGenerator = _asyncToGenerator && Object.prototype.hasOwnProperty.call(_asyncToGenerator, 'default') ? _asyncToGenerator['default'] : _asyncToGenerator;
_classCallCheck = _classCallCheck && Object.prototype.hasOwnProperty.call(_classCallCheck, 'default') ? _classCallCheck['default'] : _classCallCheck;
_createClass = _createClass && Object.prototype.hasOwnProperty.call(_createClass, 'default') ? _createClass['default'] : _createClass;
_inherits = _inherits && Object.prototype.hasOwnProperty.call(_inherits, 'default') ? _inherits['default'] : _inherits;
_possibleConstructorReturn = _possibleConstructorReturn && Object.prototype.hasOwnProperty.call(_possibleConstructorReturn, 'default') ? _possibleConstructorReturn['default'] : _possibleConstructorReturn;
_getPrototypeOf = _getPrototypeOf && Object.prototype.hasOwnProperty.call(_getPrototypeOf, 'default') ? _getPrototypeOf['default'] : _getPrototypeOf;
_defineProperty = _defineProperty && Object.prototype.hasOwnProperty.call(_defineProperty, 'default') ? _defineProperty['default'] : _defineProperty;
var React__default = 'default' in React ? React['default'] : React;
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
try {
var info = gen[key](arg);
var value = info.value;
} catch (error) {
reject(error);
return;
}
var __jsx = React__default.createElement;
if (info.done) {
resolve(value);
} else {
Promise.resolve(value).then(_next, _throw);
}
}
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
function _asyncToGenerator(fn) {
return function () {
var self = this,
args = arguments;
return new Promise(function (resolve, reject) {
var gen = fn.apply(self, args);
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
function _next(value) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
}
function _throw(err) {
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
}
_next(undefined);
});
};
}
function _classCallCheck(instance, Constructor) {
if (!(instance instanceof Constructor)) {
throw new TypeError("Cannot call a class as a function");
}
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function _inherits(subClass, superClass) {
if (typeof superClass !== "function" && superClass !== null) {
throw new TypeError("Super expression must either be null or a function");
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
writable: true,
configurable: true
}
});
if (superClass) _setPrototypeOf(subClass, superClass);
}
function _getPrototypeOf(o) {
_getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {
return o.__proto__ || Object.getPrototypeOf(o);
};
return _getPrototypeOf(o);
}
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
function _possibleConstructorReturn(self, call) {
if (call && (typeof call === "object" || typeof call === "function")) {
return call;
}
return _assertThisInitialized(self);
}
function withReduxSaga(BaseComponent) {
var WrappedComponent =
/*#__PURE__*/
function (_Component) {
var WrappedComponent = /*#__PURE__*/function (_Component) {
_inherits(WrappedComponent, _Component);
var _super = _createSuper(WrappedComponent);
function WrappedComponent() {
_classCallCheck(this, WrappedComponent);
return _possibleConstructorReturn(this, _getPrototypeOf(WrappedComponent).apply(this, arguments));
return _super.apply(this, arguments);
}

@@ -145,3 +38,3 @@

value: function render() {
return React__default.createElement(BaseComponent, this.props);
return __jsx(BaseComponent, this.props);
}

@@ -151,7 +44,4 @@ }], [{

value: function () {
var _getInitialProps = _asyncToGenerator(
/*#__PURE__*/
_regeneratorRuntime.mark(function _callee(props) {
var _props$ctx, isServer, store, pageProps;
var _getInitialProps = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(props) {
var store, pageProps;
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -161,3 +51,3 @@ while (1) {

case 0:
_props$ctx = props.ctx, isServer = _props$ctx.isServer, store = _props$ctx.store;
store = props.ctx.store;
pageProps = {};

@@ -177,3 +67,3 @@

case 6:
if (!isServer) {
if (!(typeof window === 'undefined')) {
_context.next = 10;

@@ -195,8 +85,10 @@ break;

}
}, _callee, this);
}, _callee);
}));
return function getInitialProps(_x) {
function getInitialProps(_x) {
return _getInitialProps.apply(this, arguments);
};
}
return getInitialProps;
}()

@@ -215,3 +107,3 @@ }]);

}));
})));
//# sourceMappingURL=next-redux-saga.umd.js.map

65

package.json
{
"name": "next-redux-saga",
"version": "4.1.2",
"version": "5.0.0-0",
"description": "redux-saga HOC for Next.js",

@@ -37,2 +37,5 @@ "repository": "https://github.com/bmealhouse/next-redux-saga.git",

"yarn.lock"
],
"transformIgnorePatterns": [
"node_modules/(?!(@babel/runtime)/)"
]

@@ -94,32 +97,34 @@ },

},
"dependencies": {
"@babel/runtime": "7.3.1"
},
"devDependencies": {
"@babel/core": "7.2.2",
"@babel/runtime": "7.3.1",
"babel-core": "7.0.0-bridge.0",
"babel-eslint": "10.0.1",
"babel-jest": "24.1.0",
"enzyme": "3.8.0",
"enzyme-adapter-react-16": "1.9.1",
"enzyme-to-json": "3.3.5",
"eslint": "5.13.0",
"eslint-plugin-prettier": "3.0.1",
"eslint-plugin-react": "7.12.4",
"husky": "1.3.1",
"jest": "24.1.0",
"jest-express": "1.10.1",
"lint-staged": "8.1.3",
"next": "7.0.2",
"next-redux-wrapper": "2.1.0",
"prettier": "1.16.4",
"prop-types": "15.7.1",
"react": "16.8.1",
"react-dom": "16.8.1",
"react-redux": "6.0.0",
"react-test-renderer": "16.8.1",
"redux": "4.0.1",
"redux-saga": "1.0.1",
"release-it": "12.4.3",
"rollup": "1.1.2",
"rollup-plugin-babel": "4.3.2",
"xo": "0.24.0"
"@babel/core": "7.10.2",
"@rollup/plugin-babel": "5.0.3",
"babel-eslint": "10.1.0",
"babel-jest": "26.0.1",
"enzyme": "3.11.0",
"enzyme-adapter-react-16": "1.15.2",
"enzyme-to-json": "3.5.0",
"eslint": "7.2.0",
"eslint-plugin-prettier": "3.1.4",
"eslint-plugin-react": "7.20.0",
"husky": "4.2.5",
"jest": "26.0.1",
"jest-express": "1.12.0",
"lint-staged": "10.2.10",
"next": "9.4.4",
"next-redux-wrapper": "6.0.2",
"prettier": "2.0.5",
"prop-types": "15.7.2",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-redux": "7.2.0",
"react-test-renderer": "16.13.1",
"redux": "4.0.5",
"redux-saga": "1.1.3",
"release-it": "13.6.3",
"rollup": "2.16.1",
"webpack": "4.43.0",
"xo": "0.32.0"
},

@@ -126,0 +131,0 @@ "bugs": {

@@ -10,3 +10,3 @@ # next-redux-saga

> redux-saga HOC for [Next.js](https://github.com/zeit/next.js/)
> `redux-saga` HOC for [Next.js](https://github.com/zeit/next.js/). controlled `redux-saga` execution for server side rendering.

@@ -36,45 +36,28 @@ > **Attention:** Synchronous HOC is no longer supported since version 4.0.0!

### Configure Store
### Configure the Store wrapper
```js
import {createStore, applyMiddleware} from 'redux'
import {applyMiddleware, createStore} from 'redux'
import createSagaMiddleware from 'redux-saga'
import {createWrapper} from 'next-redux-wrapper'
import rootReducer from './root-reducer'
import rootSaga from './root-saga'
function configureStore(preloadedState, {isServer, req = null}) {
/**
* Recreate the stdChannel (saga middleware) with every context.
*/
const makeStore = context => {
const sagaMiddleware = createSagaMiddleware()
/**
* Since Next.js does server-side rendering, you are REQUIRED to pass
* `preloadedState` when creating the store.
*/
const store = createStore(
rootReducer,
preloadedState,
applyMiddleware(sagaMiddleware)
applyMiddleware(sagaMiddleware),
)
/**
* next-redux-saga depends on `sagaTask` being attached to the store during `getInitialProps`.
* It is used to await the rootSaga task before sending results to the client.
* However, next-redux-wrapper creates two server-side stores per request:
* One before `getInitialProps` and one before SSR (see issue #62 for details).
* On the server side, we run rootSaga during `getInitialProps` only:
*/
store.sagaTask = sagaMiddleware.run(rootSaga)
if (req || !isServer) {
store.sagaTask = sagaMiddleware.run(rootSaga)
}
return store
}
export default configureStore
const wrapper = createWrapper(makeStore)
export default wrapper
```

@@ -86,8 +69,7 @@

import React from 'react'
import {Provider} from 'react-redux'
import App, {Container} from 'next/app'
import withRedux from 'next-redux-wrapper'
import App from 'next/app'
import withReduxSaga from 'next-redux-saga'
import configureStore from './configure-store'
import wrapper from './store-wrapper'
class ExampleApp extends App {

@@ -105,9 +87,5 @@ static async getInitialProps({Component, ctx}) {

render() {
const {Component, pageProps, store} = this.props
const {Component, pageProps} = this.props
return (
<Container>
<Provider store={store}>
<Component {...pageProps} />
</Provider>
</Container>
<Component {...pageProps} />
)

@@ -117,3 +95,3 @@ }

export default withRedux(configureStore)(withReduxSaga(ExampleApp))
export default wrapper.withRedux(withReduxSaga(ExampleApp))
```

@@ -120,0 +98,0 @@

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