@cycle/run
Advanced tools
Comparing version 4.0.0 to 4.1.0
@@ -0,1 +1,11 @@ | ||
<a name="4.1.0"></a> | ||
# 4.1.0 (2017-12-08) | ||
### Bug Fixes | ||
* **run:** make exception reporting less opinionated ([b124fff](https://github.com/cyclejs/cyclejs/commit/b124fff)) | ||
<a name="4.0.0"></a> | ||
@@ -2,0 +12,0 @@ # 4.0.0 (2017-11-10) |
@@ -221,11 +221,2 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Cycle = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
var scheduleMicrotask = microtask_1.default(); | ||
function logToConsoleError(err) { | ||
var target = err.stack || err; | ||
if (console && console.error) { | ||
console.error(target); | ||
} | ||
else if (console && console.log) { | ||
console.log(target); | ||
} | ||
} | ||
function makeSinkProxies(drivers) { | ||
@@ -285,3 +276,3 @@ var sinkProxies = {}; | ||
scheduleMicrotask(function () { | ||
logToConsoleError(err); | ||
(console.error || console.log)(err); | ||
listener._e(err); | ||
@@ -288,0 +279,0 @@ }); |
@@ -7,6 +7,6 @@ (function(v){"object"===typeof exports&&"undefined"!==typeof module?module.exports=v():"function"===typeof define&&define.amd?define([],v):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).Cycle=v()})(function(){return function a(m,c,q){function g(k,h){if(!c[k]){if(!m[k]){var l="function"==typeof require&&require;if(!h&&l)return l(k,!0);if(e)return e(k,!0);h=Error("Cannot find module '"+k+"'");throw h.code="MODULE_NOT_FOUND",h;}h=c[k]={exports:{}}; | ||
{value:!0});c.setAdapt=function(a){g().adaptStream=a};c.adapt=function(a){return g().adaptStream(a)}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],3:[function(a,m,c){(function(q){function g(b){var a={},p;for(p in b)b.hasOwnProperty(p)&&(a[p]=r.default.create());return a}function e(b,a){var f={},d;for(d in b)b.hasOwnProperty(d)&&(f[d]=b[d](a[d],d),f[d]&&"object"===typeof f[d]&&(f[d]._isCycleSource=d));return f}function l(b){for(var a in b)b.hasOwnProperty(a)&& | ||
b[a]&&"function"===typeof b[a].shamefullySendNext&&(b[a]=t.adapt(b[a]));return b}function k(a,f){var b=Object.keys(a).filter(function(a){return!!f[a]}),d={},e={};b.forEach(function(a){d[a]={_n:[],_e:[]};e[a]={next:function(b){return d[a]._n.push(b)},error:function(b){return d[a]._e.push(b)},complete:function(){}}});var c=b.map(function(b){return r.default.fromObservable(a[b]).subscribe(e[b])});b.forEach(function(a){var b=f[a],c=function(a){n(function(){return b._n(a)})},g=function(a){n(function(){var d= | ||
a.stack||a;console&&console.error?console.error(d):console&&console.log&&console.log(d);b._e(a)})};d[a]._n.forEach(c);d[a]._e.forEach(g);e[a].next=c;e[a].error=g;e[a]._n=c;e[a]._e=g});d=null;return function(){c.forEach(function(a){return a.unsubscribe()});b.forEach(function(a){return f[a]._c()})}}function h(a,c){if("function"!==typeof a)throw Error("First argument given to Cycle must be the 'main' function.");if("object"!==typeof c||null===c)throw Error("Second argument given to Cycle must be an object with driver functions as properties."); | ||
if(0===Object.keys(c).length)throw Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");var b=g(c),d=e(c,b);c=l(d);var f=a(c);"undefined"!==typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=f);return{sinks:f,sources:d,run:function(){var a=k(f,b);return function(){for(var b in d)d.hasOwnProperty(b)&&d[b]&&d[b].dispose&&d[b].dispose();a()}}}}function m(a,c){a=h(a,c);"undefined"!==typeof window&&window.CyclejsDevTool_startGraphSerializer&& | ||
window.CyclejsDevTool_startGraphSerializer(a.sinks);return a.run()}Object.defineProperty(c,"__esModule",{value:!0});var r="undefined"!==typeof window?window.xstream:"undefined"!==typeof q?q.xstream:null,t=a("./adapt"),n=a("./microtask").default();c.setup=h;c.run=m;c.default=m}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./adapt":2,"./microtask":4}],4:[function(a,m,c){(function(a){Object.defineProperty(c,"__esModule",{value:!0}); | ||
c.default=function(){if("undefined"!==typeof MutationObserver){var c=document.createTextNode(""),e=[],l=0;(new MutationObserver(function(){for(;e.length;)e.shift()()})).observe(c,{characterData:!0});return function(a){e.push(a);c.data=l=1-l}}return"undefined"!==typeof a?a.nextTick:setTimeout}}).call(this,a("_process"))},{_process:1}]},{},[3])(3)}); | ||
b[a]&&"function"===typeof b[a].shamefullySendNext&&(b[a]=t.adapt(b[a]));return b}function k(a,f){var b=Object.keys(a).filter(function(a){return!!f[a]}),d={},e={};b.forEach(function(a){d[a]={_n:[],_e:[]};e[a]={next:function(b){return d[a]._n.push(b)},error:function(b){return d[a]._e.push(b)},complete:function(){}}});var c=b.map(function(b){return r.default.fromObservable(a[b]).subscribe(e[b])});b.forEach(function(a){var b=f[a],c=function(a){n(function(){return b._n(a)})},g=function(a){n(function(){(console.error|| | ||
console.log)(a);b._e(a)})};d[a]._n.forEach(c);d[a]._e.forEach(g);e[a].next=c;e[a].error=g;e[a]._n=c;e[a]._e=g});d=null;return function(){c.forEach(function(a){return a.unsubscribe()});b.forEach(function(a){return f[a]._c()})}}function h(a,c){if("function"!==typeof a)throw Error("First argument given to Cycle must be the 'main' function.");if("object"!==typeof c||null===c)throw Error("Second argument given to Cycle must be an object with driver functions as properties.");if(0===Object.keys(c).length)throw Error("Second argument given to Cycle must be an object with at least one driver function declared as a property."); | ||
var b=g(c),d=e(c,b);c=l(d);var f=a(c);"undefined"!==typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=f);return{sinks:f,sources:d,run:function(){var a=k(f,b);return function(){for(var b in d)d.hasOwnProperty(b)&&d[b]&&d[b].dispose&&d[b].dispose();a()}}}}function m(a,c){a=h(a,c);"undefined"!==typeof window&&window.CyclejsDevTool_startGraphSerializer&&window.CyclejsDevTool_startGraphSerializer(a.sinks);return a.run()}Object.defineProperty(c,"__esModule",{value:!0});var r="undefined"!== | ||
typeof window?window.xstream:"undefined"!==typeof q?q.xstream:null,t=a("./adapt"),n=a("./microtask").default();c.setup=h;c.run=m;c.default=m}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./adapt":2,"./microtask":4}],4:[function(a,m,c){(function(a){Object.defineProperty(c,"__esModule",{value:!0});c.default=function(){if("undefined"!==typeof MutationObserver){var c=document.createTextNode(""),e=[],l=0;(new MutationObserver(function(){for(;e.length;)e.shift()()})).observe(c, | ||
{characterData:!0});return function(a){e.push(a);c.data=l=1-l}}return"undefined"!==typeof a?a.nextTick:setTimeout}}).call(this,a("_process"))},{_process:1}]},{},[3])(3)}); |
@@ -7,11 +7,2 @@ "use strict"; | ||
var scheduleMicrotask = microtask_1.default(); | ||
function logToConsoleError(err) { | ||
var target = err.stack || err; | ||
if (console && console.error) { | ||
console.error(target); | ||
} | ||
else if (console && console.log) { | ||
console.log(target); | ||
} | ||
} | ||
function makeSinkProxies(drivers) { | ||
@@ -71,3 +62,3 @@ var sinkProxies = {}; | ||
scheduleMicrotask(function () { | ||
logToConsoleError(err); | ||
(console.error || console.log)(err); | ||
listener._e(err); | ||
@@ -74,0 +65,0 @@ }); |
@@ -5,11 +5,2 @@ import xs from 'xstream'; | ||
var scheduleMicrotask = microtask(); | ||
function logToConsoleError(err) { | ||
var target = err.stack || err; | ||
if (console && console.error) { | ||
console.error(target); | ||
} | ||
else if (console && console.log) { | ||
console.log(target); | ||
} | ||
} | ||
function makeSinkProxies(drivers) { | ||
@@ -69,3 +60,3 @@ var sinkProxies = {}; | ||
scheduleMicrotask(function () { | ||
logToConsoleError(err); | ||
(console.error || console.log)(err); | ||
listener._e(err); | ||
@@ -72,0 +63,0 @@ }); |
{ | ||
"name": "@cycle/run", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "The Cycle.js run() function to use with xstream", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
@@ -32,11 +32,2 @@ import xs, {Stream} from 'xstream'; | ||
function logToConsoleError(err: any) { | ||
const target = err.stack || err; | ||
if (console && console.error) { | ||
console.error(target); | ||
} else if (console && console.log) { | ||
console.log(target); | ||
} | ||
} | ||
function makeSinkProxies<So extends Sources, Si extends Sinks>( | ||
@@ -137,3 +128,3 @@ drivers: Drivers<So, Si>, | ||
scheduleMicrotask(() => { | ||
logToConsoleError(err); | ||
(console.error || console.log)(err); | ||
listener._e(err); | ||
@@ -140,0 +131,0 @@ }); |
@@ -410,8 +410,9 @@ import 'mocha'; | ||
const request$ = num === 1 | ||
? xs.of({ | ||
category: 'cat', | ||
url: 'http://jsonplaceholder.typicode.com/users/1', | ||
}) | ||
: xs.never(); | ||
const request$ = | ||
num === 1 | ||
? xs.of({ | ||
category: 'cat', | ||
url: 'http://jsonplaceholder.typicode.com/users/1', | ||
}) | ||
: xs.never(); | ||
@@ -425,12 +426,15 @@ return { | ||
function mainHTTPThenDOM(sources: any) { | ||
const sinks$ = xs.periodic(100).take(6).map(i => { | ||
if (i % 2 === 1) { | ||
return child(sources, i); | ||
} else { | ||
return { | ||
HTTP: xs.empty(), | ||
DOM: xs.of(''), | ||
}; | ||
} | ||
}); | ||
const sinks$ = xs | ||
.periodic(100) | ||
.take(6) | ||
.map(i => { | ||
if (i % 2 === 1) { | ||
return child(sources, i); | ||
} else { | ||
return { | ||
HTTP: xs.empty(), | ||
DOM: xs.of(''), | ||
}; | ||
} | ||
}); | ||
@@ -445,12 +449,15 @@ // order of sinks is important to reproduce the bug | ||
function mainDOMThenHTTP(sources: any) { | ||
const sinks$ = xs.periodic(100).take(6).map(i => { | ||
if (i % 2 === 1) { | ||
return child(sources, i); | ||
} else { | ||
return { | ||
HTTP: xs.empty(), | ||
DOM: xs.of(''), | ||
}; | ||
} | ||
}); | ||
const sinks$ = xs | ||
.periodic(100) | ||
.take(6) | ||
.map(i => { | ||
if (i % 2 === 1) { | ||
return child(sources, i); | ||
} else { | ||
return { | ||
HTTP: xs.empty(), | ||
DOM: xs.of(''), | ||
}; | ||
} | ||
}); | ||
@@ -520,3 +527,3 @@ // order of sinks is important to reproduce the bug | ||
it('should report errors from main() in the console', function(done) { | ||
let sandbox = sinon.sandbox.create(); | ||
const sandbox = sinon.sandbox.create(); | ||
sandbox.stub(console, 'error'); | ||
@@ -546,3 +553,2 @@ | ||
} catch (e) { | ||
assert.strictEqual(e.message, 'malfunction'); | ||
caught = true; | ||
@@ -554,3 +560,3 @@ } | ||
console.error as any, | ||
sinon.match('malfunction'), | ||
sinon.match((err: any) => err.message === 'malfunction'), | ||
); | ||
@@ -557,0 +563,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95224
2041