Skip to content

Commit

Permalink
Merge remote-tracking branch 'camflan/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
Andarist committed Jul 14, 2017
2 parents 4e6d20f + f98f9f4 commit 64e96f4
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 29 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
language: node_js

after_script:
- npm run check:bundlesize
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

# redux-saga

[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga) [![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)
[![Build Status](https://travis-ci.org/camflan/redux-saga.svg?branch=master)](https://travis-ci.org/camflan/redux-saga)
[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
[![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)
[![OpenCollective](https://opencollective.com/redux-saga/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/redux-saga/sponsors/badge.svg)](#sponsors)

Expand Down
5 changes: 4 additions & 1 deletion README_ja.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# redux-saga

[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga) [![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)
[![Build Status](https://travis-ci.org/camflan/redux-saga.svg?branch=master)](https://travis-ci.org/camflan/redux-saga)
[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
[![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)

`redux-saga` は React/Redux アプリケーションにおける副作用(データ通信などの非同期処理、ブラウザキャッシュへのアクセスのようなピュアではない処理)をより簡単で優れたものにするためのライブラリです。

Expand Down
2 changes: 1 addition & 1 deletion README_ru.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# redux-saga

[![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga) [![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)
[![Build Status](https://travis-ci.org/camflan/redux-saga.svg?branch=master)](https://travis-ci.org/camflan/redux-saga) [![Join the chat at https://gitter.im/yelouafi/redux-saga](https://badges.gitter.im/yelouafi/redux-saga.svg)](https://gitter.im/yelouafi/redux-saga?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga) [![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)
[![OpenCollective](https://opencollective.com/redux-saga/backers/badge.svg)](#backers)
[![OpenCollective](https://opencollective.com/redux-saga/sponsors/badge.svg)](#sponsors)

Expand Down
1 change: 1 addition & 0 deletions README_zh-cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# redux-saga

[![Build Status](https://travis-ci.org/camflan/redux-saga.svg?branch=master)](https://travis-ci.org/camflan/redux-saga)
[![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
[![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)

Expand Down
1 change: 1 addition & 0 deletions README_zh-hant.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# redux-saga

[![Build Status](https://travis-ci.org/camflan/redux-saga.svg?branch=master)](https://travis-ci.org/camflan/redux-saga)
[![npm version](https://img.shields.io/npm/v/redux-saga.svg?style=flat-square)](https://www.npmjs.com/package/redux-saga)
[![CDNJS](https://img.shields.io/cdnjs/v/redux-saga.svg?style=flat-square)](https://cdnjs.com/libraries/redux-saga)

Expand Down
49 changes: 23 additions & 26 deletions dist/redux-saga.js
Original file line number Diff line number Diff line change
Expand Up @@ -608,8 +608,8 @@ function channel() {
}

function flush$$1(cb) {
checkForbiddenStates // TODO: check if some new state should be forbidden now
();check(cb, is.func, "channel.flush' callback must be a function");
checkForbiddenStates(); // TODO: check if some new state should be forbidden now
check(cb, is.func, "channel.flush' callback must be a function");
if (closed && buffer.isEmpty()) {
cb(END);
return;
Expand Down Expand Up @@ -1327,26 +1327,26 @@ function proc(iterator) {

var log$$1 = logger || log;
var stdChannel$$1 = stdChannel(subscribe);
var taskContext = Object.create(parentContext
var taskContext = Object.create(parentContext);
/**
Tracks the current effect cancellation
Each time the generator progresses. calling runEffect will set a new value
on it. It allows propagating cancellation to child effects
**/
);next.cancel = noop;
next.cancel = noop;

/**
Creates a new task descriptor for this generator, We'll also create a main task
to track the main flow (besides other forked tasks)
**/
var task = newTask(parentEffectId, name, iterator, cont);
var mainTask = { name: name, cancel: cancelMain, isRunning: true };
var taskQueue = forkQueue(name, mainTask, end
var taskQueue = forkQueue(name, mainTask, end);

/**
cancellation of the main task. We'll simply resume the Generator with a Cancel
**/
);function cancelMain() {
function cancelMain() {
if (mainTask.isRunning && !mainTask.isCancelled) {
mainTask.isCancelled = true;
next(TASK_CANCEL);
Expand All @@ -1367,11 +1367,11 @@ function proc(iterator) {
**/
if (iterator._isRunning && !iterator._isCancelled) {
iterator._isCancelled = true;
taskQueue.cancelAll
taskQueue.cancelAll();
/**
Ending with a Never result will propagate the Cancellation to all joiners
**/
();end(TASK_CANCEL);
end(TASK_CANCEL);
}
}
/**
Expand All @@ -1384,10 +1384,10 @@ function proc(iterator) {
iterator._isRunning = true;

// kicks up the generator
next
next();

// then return the task descriptor to the caller
();return task;
return task;

/**
This is the generator driver
Expand Down Expand Up @@ -1415,12 +1415,12 @@ function proc(iterator) {
/**
Cancels the current effect; this will propagate the cancellation down to any called tasks
**/
next.cancel
next.cancel();
/**
If this Generator has a `return` method then invokes it
This will jump to the finally block
**/
();result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
result = is.func(iterator.return) ? iterator.return(TASK_CANCEL) : { done: true, value: TASK_CANCEL };
} else if (arg === CHANNEL_END) {
// We get CHANNEL_END by taking from a channel that ended using `take` (and not `takem` used to trap End of channels)
result = is.func(iterator.return) ? iterator.return() : { done: true };
Expand Down Expand Up @@ -1481,14 +1481,14 @@ function proc(iterator) {
var cb = arguments[3];

var effectId = uid();
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect }
sagaMonitor && sagaMonitor.effectTriggered({ effectId: effectId, parentEffectId: parentEffectId, label: label, effect: effect });

/**
completion callback and cancel callback are mutually exclusive
We can't cancel an already completed effect
And We can't complete an already cancelled effectId
**/
);var effectSettled = void 0;
var effectSettled = void 0;

// Completion callback passed to the appropriate effect runner
function currCb(res, isErr) {
Expand Down Expand Up @@ -1545,10 +1545,10 @@ function proc(iterator) {
// prettier-ignore
return (
// Non declarative effect
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb
is.promise(effect) ? resolvePromise(effect, currCb) : is.helper(effect) ? runForkEffect(wrapHelper(effect), effectId, currCb) : is.iterator(effect) ? resolveIterator(effect, effectId, name, currCb)

// declarative effects
) : is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
: is.array(effect) ? runParallelEffect(effect, effectId, currCb) : (data = asEffect.take(effect)) ? runTakeEffect(data, currCb) : (data = asEffect.put(effect)) ? runPutEffect(data, currCb) : (data = asEffect.all(effect)) ? runAllEffect(data, effectId, currCb) : (data = asEffect.race(effect)) ? runRaceEffect(data, effectId, currCb) : (data = asEffect.call(effect)) ? runCallEffect(data, effectId, currCb) : (data = asEffect.cps(effect)) ? runCPSEffect(data, currCb) : (data = asEffect.fork(effect)) ? runForkEffect(data, effectId, currCb) : (data = asEffect.join(effect)) ? runJoinEffect(data, currCb) : (data = asEffect.cancel(effect)) ? runCancelEffect(data, currCb) : (data = asEffect.select(effect)) ? runSelectEffect(data, currCb) : (data = asEffect.actionChannel(effect)) ? runChannelEffect(data, currCb) : (data = asEffect.flush(effect)) ? runFlushEffect(data, currCb) : (data = asEffect.cancelled(effect)) ? runCancelledEffect(data, currCb) : (data = asEffect.getContext(effect)) ? runGetContextEffect(data, currCb) : (data = asEffect.setContext(effect)) ? runSetContextEffect(data, currCb) : /* anything else returned as is */currCb(effect)
);
}

Expand All @@ -1558,11 +1558,10 @@ function proc(iterator) {
cb.cancel = cancelPromise;
} else if (is.func(promise.abort)) {
cb.cancel = function () {
return promise.abort
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
();
return promise.abort();
};
// TODO: add support for the fetch API, whenever they get around to
// adding cancel support
}
promise.then(cb, function (error) {
return cb(error, true);
Expand Down Expand Up @@ -1615,9 +1614,8 @@ function proc(iterator) {
} else {
return cb(result);
}
}
});
// Put effects are non cancellables
);
}

function runCallEffect(_ref4, effectId, cb) {
Expand Down Expand Up @@ -1708,9 +1706,8 @@ function proc(iterator) {
if (taskToCancel.isRunning()) {
taskToCancel.cancel();
}
cb
cb();
// cancel effects are non cancellables
();
}

function runAllEffect(effects, effectId, cb) {
Expand Down Expand Up @@ -1987,8 +1984,8 @@ function sagaMiddlewareFactory() {
if (sagaMonitor && sagaMonitor.actionDispatched) {
sagaMonitor.actionDispatched(action);
}
var result = next(action // hit reducers
);sagaEmitter.emit(action);
var result = next(action); // hit reducers
sagaEmitter.emit(action);
return result;
};
};
Expand Down
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "eslint src",
"test": "cross-env BABEL_ENV=cjs babel-node test/index.js | tap-spec",
"check": "npm run lint && npm run test",
"check:bundlesize": "cross-env BABEL_ENV=es ./node_modules/.bin/bundlesize",
"clean": "rimraf dist es lib",
"build:umd:dev": "cross-env BABEL_ENV=es NODE_ENV=development rollup -c -i src/index.js -o dist/redux-saga.js",
"build:umd:prod": "cross-env BABEL_ENV=es NODE_ENV=production rollup -c -i src/index.js -o dist/redux-saga.min.js",
Expand Down Expand Up @@ -48,6 +49,12 @@
"effects",
"side effects"
],
"bundlesize": [
{
"path": "./dist/redux-saga.min.js",
"maxSize": "8 Kb"
}
],
"author": "Yassine ELOUAFI <[email protected]>",
"contributors": [
"Mateusz Burzyński <[email protected]> (https://github.com/Andarist)"
Expand All @@ -68,6 +75,7 @@
"babel-preset-es2015": "^6.14.0",
"babel-preset-react": "^6.11.1",
"babel-preset-stage-2": "^6.13.0",
"bundlesize": "^0.11.0",
"cross-env": "^1.0.8",
"eslint": "^2.8.0",
"express": "^4.13.3",
Expand Down

0 comments on commit 64e96f4

Please sign in to comment.