@cycle/run
Advanced tools
Comparing version 4.0.0-rc.3 to 4.0.0-rc.4
@@ -0,1 +1,16 @@ | ||
<a name="3.4.0"></a> | ||
# 3.4.0 (2017-10-24) | ||
<a name="3.3.0"></a> | ||
# 3.3.0 (2017-10-04) | ||
### Bug Fixes | ||
* **run:** allow xstream v11 (not just v10) as a dependency ([0734dfd](https://github.com/cyclejs/cyclejs/commit/0734dfd)) | ||
<a name="3.2.0"></a> | ||
@@ -2,0 +17,0 @@ # 3.2.0 (2017-08-12) |
(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){ | ||
// shim for using process in browser | ||
var process = module.exports = {}; | ||
// cached from whatever global is present so that test runners that stub it | ||
// don't break things. But we need to wrap it in a try catch in case it is | ||
// wrapped in strict mode code which doesn't define any globals. It's inside a | ||
// function because try/catches deoptimize in certain engines. | ||
var cachedSetTimeout; | ||
var cachedClearTimeout; | ||
function defaultSetTimout() { | ||
throw new Error('setTimeout has not been defined'); | ||
} | ||
function defaultClearTimeout () { | ||
throw new Error('clearTimeout has not been defined'); | ||
} | ||
(function () { | ||
try { | ||
if (typeof setTimeout === 'function') { | ||
cachedSetTimeout = setTimeout; | ||
} else { | ||
cachedSetTimeout = defaultSetTimout; | ||
} | ||
} catch (e) { | ||
cachedSetTimeout = defaultSetTimout; | ||
(function (global){ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function getGlobal() { | ||
var globalObj; | ||
if (typeof window !== 'undefined') { | ||
globalObj = window; | ||
} | ||
try { | ||
if (typeof clearTimeout === 'function') { | ||
cachedClearTimeout = clearTimeout; | ||
} else { | ||
cachedClearTimeout = defaultClearTimeout; | ||
} | ||
} catch (e) { | ||
cachedClearTimeout = defaultClearTimeout; | ||
else if (typeof global !== 'undefined') { | ||
globalObj = global; | ||
} | ||
} ()) | ||
function runTimeout(fun) { | ||
if (cachedSetTimeout === setTimeout) { | ||
//normal enviroments in sane situations | ||
return setTimeout(fun, 0); | ||
else { | ||
globalObj = this; | ||
} | ||
// if setTimeout wasn't available but was latter defined | ||
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | ||
cachedSetTimeout = setTimeout; | ||
return setTimeout(fun, 0); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedSetTimeout(fun, 0); | ||
} catch(e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedSetTimeout.call(null, fun, 0); | ||
} catch(e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | ||
return cachedSetTimeout.call(this, fun, 0); | ||
} | ||
} | ||
globalObj.Cyclejs = globalObj.Cyclejs || {}; | ||
globalObj = globalObj.Cyclejs; | ||
globalObj.adaptStream = globalObj.adaptStream || (function (x) { return x; }); | ||
return globalObj; | ||
} | ||
function runClearTimeout(marker) { | ||
if (cachedClearTimeout === clearTimeout) { | ||
//normal enviroments in sane situations | ||
return clearTimeout(marker); | ||
} | ||
// if clearTimeout wasn't available but was latter defined | ||
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | ||
cachedClearTimeout = clearTimeout; | ||
return clearTimeout(marker); | ||
} | ||
try { | ||
// when when somebody has screwed with setTimeout but no I.E. maddness | ||
return cachedClearTimeout(marker); | ||
} catch (e){ | ||
try { | ||
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | ||
return cachedClearTimeout.call(null, marker); | ||
} catch (e){ | ||
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | ||
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | ||
return cachedClearTimeout.call(this, marker); | ||
} | ||
} | ||
} | ||
var queue = []; | ||
var draining = false; | ||
var currentQueue; | ||
var queueIndex = -1; | ||
function cleanUpNextTick() { | ||
if (!draining || !currentQueue) { | ||
return; | ||
} | ||
draining = false; | ||
if (currentQueue.length) { | ||
queue = currentQueue.concat(queue); | ||
} else { | ||
queueIndex = -1; | ||
} | ||
if (queue.length) { | ||
drainQueue(); | ||
} | ||
} | ||
function drainQueue() { | ||
if (draining) { | ||
return; | ||
} | ||
var timeout = runTimeout(cleanUpNextTick); | ||
draining = true; | ||
var len = queue.length; | ||
while(len) { | ||
currentQueue = queue; | ||
queue = []; | ||
while (++queueIndex < len) { | ||
if (currentQueue) { | ||
currentQueue[queueIndex].run(); | ||
} | ||
} | ||
queueIndex = -1; | ||
len = queue.length; | ||
} | ||
currentQueue = null; | ||
draining = false; | ||
runClearTimeout(timeout); | ||
} | ||
process.nextTick = function (fun) { | ||
var args = new Array(arguments.length - 1); | ||
if (arguments.length > 1) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
args[i - 1] = arguments[i]; | ||
} | ||
} | ||
queue.push(new Item(fun, args)); | ||
if (queue.length === 1 && !draining) { | ||
runTimeout(drainQueue); | ||
} | ||
}; | ||
// v8 likes predictible objects | ||
function Item(fun, array) { | ||
this.fun = fun; | ||
this.array = array; | ||
} | ||
Item.prototype.run = function () { | ||
this.fun.apply(null, this.array); | ||
}; | ||
process.title = 'browser'; | ||
process.browser = true; | ||
process.env = {}; | ||
process.argv = []; | ||
process.version = ''; // empty string to avoid regexp issues | ||
process.versions = {}; | ||
function noop() {} | ||
process.on = noop; | ||
process.addListener = noop; | ||
process.once = noop; | ||
process.off = noop; | ||
process.removeListener = noop; | ||
process.removeAllListeners = noop; | ||
process.emit = noop; | ||
process.binding = function (name) { | ||
throw new Error('process.binding is not supported'); | ||
}; | ||
process.cwd = function () { return '/' }; | ||
process.chdir = function (dir) { | ||
throw new Error('process.chdir is not supported'); | ||
}; | ||
process.umask = function() { return 0; }; | ||
},{}],2:[function(require,module,exports){ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var adaptStream = function (x) { return x; }; | ||
function setAdapt(f) { | ||
adaptStream = f; | ||
getGlobal().adaptStream = f; | ||
} | ||
exports.setAdapt = setAdapt; | ||
function adapt(stream) { | ||
return adaptStream(stream); | ||
return getGlobal().adaptStream(stream); | ||
} | ||
exports.adapt = adapt; | ||
},{}],3:[function(require,module,exports){ | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{}],2:[function(require,module,exports){ | ||
(function (global){ | ||
@@ -202,4 +37,2 @@ "use strict"; | ||
var adapt_1 = require("./adapt"); | ||
var microtask_1 = require("./microtask"); | ||
var scheduleMicrotask = microtask_1.default(); | ||
function logToConsoleError(err) { | ||
@@ -218,3 +51,3 @@ var target = err.stack || err; | ||
if (drivers.hasOwnProperty(name_1)) { | ||
sinkProxies[name_1] = xstream_1.default.create(); | ||
sinkProxies[name_1] = xstream_1.default.createWithMemory(); | ||
} | ||
@@ -265,9 +98,7 @@ } | ||
var next = function (x) { | ||
scheduleMicrotask(function () { return listener._n(x); }); | ||
listener._n(x); | ||
}; | ||
var error = function (err) { | ||
scheduleMicrotask(function () { | ||
logToConsoleError(err); | ||
listener._e(err); | ||
}); | ||
logToConsoleError(err); | ||
listener._e(err); | ||
}; | ||
@@ -398,43 +229,3 @@ buffers[name]._n.forEach(next); | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./adapt":2,"./microtask":4}],4:[function(require,module,exports){ | ||
(function (process){ | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
/** | ||
* Inspired by https://github.com/yoshuawuyts/nanotask, this function manages | ||
* a queue of microtasks. It returns a "scheduleMicrotask" helper. | ||
* | ||
* Uses MutationObserver in the browser, supported by many browsers, including | ||
* IE11. | ||
* | ||
* Uses process.nextTick in Node.js. | ||
* | ||
* Uses setTimeout otherwise. | ||
*/ | ||
function microtask() { | ||
if (typeof MutationObserver !== 'undefined') { | ||
var node_1 = document.createTextNode(''); | ||
var queue_1 = []; | ||
var i_1 = 0; | ||
new MutationObserver(function () { | ||
while (queue_1.length) { | ||
queue_1.shift()(); | ||
} | ||
}).observe(node_1, { characterData: true }); | ||
return function (fn) { | ||
queue_1.push(fn); | ||
node_1.data = i_1 = 1 - i_1; | ||
}; | ||
} | ||
else if (typeof process !== 'undefined') { | ||
return process.nextTick; | ||
} | ||
else { | ||
return setTimeout; | ||
} | ||
} | ||
exports.default = microtask; | ||
}).call(this,require('_process')) | ||
},{"_process":1}]},{},[3])(3) | ||
},{"./adapt":1}]},{},[2])(2) | ||
}); |
@@ -1,11 +0,7 @@ | ||
(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(l,c,e){function r(f,h){if(!c[f]){if(!l[f]){var k="function"==typeof require&&require;if(!h&&k)return k(f,!0);if(t)return t(f,!0);h=Error("Cannot find module '"+f+"'");throw h.code="MODULE_NOT_FOUND",h;}h=c[f]={exports:{}}; | ||
l[f][0].call(h.exports,function(a){var c=l[f][1][a];return r(c?c:a)},h,h.exports,a,l,c,e)}return c[f].exports}for(var t="function"==typeof require&&require,k=0;k<e.length;k++)r(e[k]);return r}({1:[function(a,l,c){function e(){throw Error("setTimeout has not been defined");}function r(){throw Error("clearTimeout has not been defined");}function t(b){if(q===setTimeout)return setTimeout(b,0);if((q===e||!q)&&setTimeout)return q=setTimeout,setTimeout(b,0);try{return q(b,0)}catch(y){try{return q.call(null, | ||
b,0)}catch(u){return q.call(this,b,0)}}}function k(b){if(m===clearTimeout)return clearTimeout(b);if((m===r||!m)&&clearTimeout)return m=clearTimeout,clearTimeout(b);try{return m(b)}catch(y){try{return m.call(null,b)}catch(u){return m.call(this,b)}}}function f(){g&&n&&(g=!1,n.length?b=n.concat(b):d=-1,b.length&&h())}function h(){if(!g){var a=t(f);g=!0;for(var c=b.length;c;){n=b;for(b=[];++d<c;)n&&n[d].run();d=-1;c=b.length}n=null;g=!1;k(a)}}function w(b,a){this.fun=b;this.array=a}function p(){}a=l.exports= | ||
{};try{var q="function"===typeof setTimeout?setTimeout:e}catch(x){q=e}try{var m="function"===typeof clearTimeout?clearTimeout:r}catch(x){m=r}var b=[],g=!1,n,d=-1;a.nextTick=function(a){var d=Array(arguments.length-1);if(1<arguments.length)for(var u=1;u<arguments.length;u++)d[u-1]=arguments[u];b.push(new w(a,d));1!==b.length||g||t(h)};w.prototype.run=function(){this.fun.apply(null,this.array)};a.title="browser";a.browser=!0;a.env={};a.argv=[];a.version="";a.versions={};a.on=p;a.addListener=p;a.once= | ||
p;a.off=p;a.removeListener=p;a.removeAllListeners=p;a.emit=p;a.binding=function(b){throw Error("process.binding is not supported");};a.cwd=function(){return"/"};a.chdir=function(b){throw Error("process.chdir is not supported");};a.umask=function(){return 0}},{}],2:[function(a,l,c){Object.defineProperty(c,"__esModule",{value:!0});var e=function(a){return a};c.setAdapt=function(a){e=a};c.adapt=function(a){return e(a)}},{}],3:[function(a,l,c){(function(e){function r(b){var a={},n;for(n in b)b.hasOwnProperty(n)&& | ||
(a[n]=p.default.create());return a}function t(b,a){var g={},d;for(d in b)b.hasOwnProperty(d)&&(g[d]=b[d](a[d],d),g[d]&&"object"===typeof g[d]&&(g[d]._isCycleSource=d));return g}function k(b){for(var a in b)b.hasOwnProperty(a)&&b[a]&&"function"===typeof b[a].shamefullySendNext&&(b[a]=q.adapt(b[a]));return b}function f(a,g){var b=Object.keys(a).filter(function(a){return!!g[a]}),d={},c={};b.forEach(function(a){d[a]={_n:[],_e:[]};c[a]={next:function(b){return d[a]._n.push(b)},error:function(b){return d[a]._e.push(b)}, | ||
complete:function(){}}});var e=b.map(function(b){return p.default.fromObservable(a[b]).subscribe(c[b])});b.forEach(function(a){var b=g[a],e=function(a){m(function(){return b._n(a)})},f=function(a){m(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(e);d[a]._e.forEach(f);c[a].next=e;c[a].error=f;c[a]._n=e;c[a]._e=f});d=null;return function(){e.forEach(function(a){return a.unsubscribe()});b.forEach(function(a){return g[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=r(c),d=t(c,b);c=k(d);var e=a(c);"undefined"!==typeof window&&(window.Cyclejs=window.Cyclejs||{}, | ||
window.Cyclejs.sinks=e);return{sinks:e,sources:d,run:function(){var a=f(e,b);return function(){for(var b in d)d.hasOwnProperty(b)&&d[b]&&d[b].dispose&&d[b].dispose();a()}}}}function l(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 p="undefined"!==typeof window?window.xstream:"undefined"!==typeof e?e.xstream:null,q=a("./adapt"),m=a("./microtask").default(); | ||
c.setup=h;c.run=l;c.default=l}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./adapt":2,"./microtask":4}],4:[function(a,l,c){(function(a){Object.defineProperty(c,"__esModule",{value:!0});c.default=function(){if("undefined"!==typeof MutationObserver){var c=document.createTextNode(""),e=[],k=0;(new MutationObserver(function(){for(;e.length;)e.shift()()})).observe(c,{characterData:!0});return function(a){e.push(a);c.data=k=1-k}}return"undefined"!== | ||
typeof a?a.nextTick:setTimeout}}).call(this,a("_process"))},{_process:1}]},{},[3])(3)}); | ||
(function(p){"object"===typeof exports&&"undefined"!==typeof module?module.exports=p():"function"===typeof define&&define.amd?define([],p):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).Cycle=p()})(function(){return function n(h,c,k){function l(g,e){if(!c[g]){if(!h[g]){var m="function"==typeof require&&require;if(!e&&m)return m(g,!0);if(a)return a(g,!0);e=Error("Cannot find module '"+g+"'");throw e.code="MODULE_NOT_FOUND",e;}e=c[g]={exports:{}}; | ||
h[g][0].call(e.exports,function(a){var c=h[g][1][a];return l(c?c:a)},e,e.exports,n,h,c,k)}return c[g].exports}for(var a="function"==typeof require&&require,m=0;m<k.length;m++)l(k[m]);return l}({1:[function(n,h,c){(function(k){function l(){var a="undefined"!==typeof window?window:"undefined"!==typeof k?k:this;a.Cyclejs=a.Cyclejs||{};a=a.Cyclejs;a.adaptStream=a.adaptStream||function(a){return a};return a}Object.defineProperty(c,"__esModule",{value:!0});c.setAdapt=function(a){l().adaptStream=a};c.adapt= | ||
function(a){return l().adaptStream(a)}}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],2:[function(n,h,c){(function(k){function l(f){var b={},a;for(a in f)f.hasOwnProperty(a)&&(b[a]=q.default.createWithMemory());return b}function a(a,b){var f={},d;for(d in a)a.hasOwnProperty(d)&&(f[d]=a[d](b[d],d),f[d]&&"object"===typeof f[d]&&(f[d]._isCycleSource=d));return f}function m(a){for(var b in a)a.hasOwnProperty(b)&&a[b]&&"function"=== | ||
typeof a[b].shamefullySendNext&&(a[b]=r.adapt(a[b]));return a}function g(a,b){var c=Object.keys(a).filter(function(a){return!!b[a]}),d={},f={};c.forEach(function(a){d[a]={_n:[],_e:[]};f[a]={next:function(b){return d[a]._n.push(b)},error:function(b){return d[a]._e.push(b)},complete:function(){}}});var g=c.map(function(b){return q.default.fromObservable(a[b]).subscribe(f[b])});c.forEach(function(a){var c=b[a],g=function(a){c._n(a)},e=function(a){var b=a.stack||a;console&&console.error?console.error(b): | ||
console&&console.log&&console.log(b);c._e(a)};d[a]._n.forEach(g);d[a]._e.forEach(e);f[a].next=g;f[a].error=e;f[a]._n=g;f[a]._e=e});d=null;return function(){g.forEach(function(a){return a.unsubscribe()});c.forEach(function(a){return b[a]._c()})}}function e(c,b){if("function"!==typeof c)throw Error("First argument given to Cycle must be the 'main' function.");if("object"!==typeof b||null===b)throw Error("Second argument given to Cycle must be an object with driver functions as properties.");if(0=== | ||
Object.keys(b).length)throw Error("Second argument given to Cycle must be an object with at least one driver function declared as a property.");var f=l(b),d=a(b,f);b=m(d);var e=c(b);"undefined"!==typeof window&&(window.Cyclejs=window.Cyclejs||{},window.Cyclejs.sinks=e);return{sinks:e,sources:d,run:function(){var a=g(e,f);return function(){for(var b in d)d.hasOwnProperty(b)&&d[b]&&d[b].dispose&&d[b].dispose();a()}}}}function h(a,b){a=e(a,b);"undefined"!==typeof window&&window.CyclejsDevTool_startGraphSerializer&& | ||
window.CyclejsDevTool_startGraphSerializer(a.sinks);return a.run()}Object.defineProperty(c,"__esModule",{value:!0});var q="undefined"!==typeof window?window.xstream:"undefined"!==typeof k?k.xstream:null,r=n("./adapt");c.setup=e;c.run=h;c.default=h}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{"./adapt":1}]},{},[2])(2)}); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var adaptStream = function (x) { return x; }; | ||
function getGlobal() { | ||
var globalObj; | ||
if (typeof window !== 'undefined') { | ||
globalObj = window; | ||
} | ||
else if (typeof global !== 'undefined') { | ||
globalObj = global; | ||
} | ||
else { | ||
globalObj = this; | ||
} | ||
globalObj.Cyclejs = globalObj.Cyclejs || {}; | ||
globalObj = globalObj.Cyclejs; | ||
globalObj.adaptStream = globalObj.adaptStream || (function (x) { return x; }); | ||
return globalObj; | ||
} | ||
function setAdapt(f) { | ||
adaptStream = f; | ||
getGlobal().adaptStream = f; | ||
} | ||
exports.setAdapt = setAdapt; | ||
function adapt(stream) { | ||
return adaptStream(stream); | ||
return getGlobal().adaptStream(stream); | ||
} | ||
exports.adapt = adapt; | ||
//# sourceMappingURL=adapt.js.map |
@@ -1,8 +0,23 @@ | ||
var adaptStream = function (x) { return x; }; | ||
function getGlobal() { | ||
var globalObj; | ||
if (typeof window !== 'undefined') { | ||
globalObj = window; | ||
} | ||
else if (typeof global !== 'undefined') { | ||
globalObj = global; | ||
} | ||
else { | ||
globalObj = this; | ||
} | ||
globalObj.Cyclejs = globalObj.Cyclejs || {}; | ||
globalObj = globalObj.Cyclejs; | ||
globalObj.adaptStream = globalObj.adaptStream || (function (x) { return x; }); | ||
return globalObj; | ||
} | ||
export function setAdapt(f) { | ||
adaptStream = f; | ||
getGlobal().adaptStream = f; | ||
} | ||
export function adapt(stream) { | ||
return adaptStream(stream); | ||
return getGlobal().adaptStream(stream); | ||
} | ||
//# sourceMappingURL=adapt.js.map |
{ | ||
"name": "@cycle/run", | ||
"version": "4.0.0-rc.3", | ||
"version": "4.0.0-rc.4", | ||
"description": "The Cycle.js run() function to use with xstream", | ||
@@ -28,8 +28,8 @@ "license": "MIT", | ||
], | ||
"main": "lib/index.js", | ||
"main": "lib/cjs/index.js", | ||
"module": "lib/es6/index.js", | ||
"typings": "lib/index.d.ts", | ||
"types": "lib/index.d.ts", | ||
"typings": "lib/cjs/index.d.ts", | ||
"types": "lib/cjs/index.d.ts", | ||
"dependencies": { | ||
"xstream": "10.x" | ||
"xstream": "10.x || 11.x" | ||
}, | ||
@@ -40,3 +40,4 @@ "devDependencies": { | ||
"@types/node": "7.0.x", | ||
"@types/sinon": "1.16.x" | ||
"@types/sinon": "1.16.x", | ||
"xstream": "11.x" | ||
}, | ||
@@ -50,7 +51,8 @@ "engines": { | ||
"scripts": { | ||
"mocha": "../node_modules/.bin/mocha test/*.ts --require ts-node/register", | ||
"mocha": "../node_modules/.bin/mocha test/*.ts --require ts-node/register --exit", | ||
"test": "npm run mocha", | ||
"test-ci": "npm run test", | ||
"browserify": "../node_modules/.bin/browserify lib/index.js --global-transform=browserify-shim --standalone Cycle --exclude xstream -o dist/cycle-run.js", | ||
"minify": "node ../.scripts/minify.js dist/cycle-run.js dist/cycle-run.min.js" | ||
"browserify": "../node_modules/.bin/browserify lib/cjs/index.js --global-transform=browserify-shim --standalone Cycle --exclude xstream -o dist/cycle-run.js", | ||
"minify": "node ../.scripts/minify.js dist/cycle-run.js dist/cycle-run.min.js", | ||
"postlib": "cp lib/cjs/adapt.* lib/" | ||
}, | ||
@@ -57,0 +59,0 @@ "publishConfig": { |
import {Stream} from 'xstream'; | ||
declare var window: any; | ||
function getGlobal(): any { | ||
let globalObj: any; | ||
if (typeof window !== 'undefined') { | ||
globalObj = window; | ||
} else if (typeof global !== 'undefined') { | ||
globalObj = global; | ||
} else { | ||
globalObj = this; | ||
} | ||
globalObj.Cyclejs = globalObj.Cyclejs || {}; | ||
globalObj = globalObj.Cyclejs; | ||
globalObj.adaptStream = globalObj.adaptStream || ((x => x) as AdaptStream); | ||
return globalObj; | ||
} | ||
export interface AdaptStream { | ||
@@ -7,10 +24,8 @@ (s: Stream<any>): any; | ||
let adaptStream: AdaptStream = x => x; | ||
export function setAdapt(f: AdaptStream): void { | ||
adaptStream = f; | ||
getGlobal().adaptStream = f; | ||
} | ||
export function adapt(stream: Stream<any>): any { | ||
return adaptStream(stream); | ||
return getGlobal().adaptStream(stream); | ||
} |
import 'mocha'; | ||
import * as assert from 'assert'; | ||
import * as sinon from 'sinon'; | ||
import {run, setup, Sources, Sinks, Driver} from '../lib'; | ||
import {run, setup, Sources, Sinks, Driver} from '../lib/cjs/index'; | ||
import {setAdapt} from '../lib/adapt'; | ||
@@ -184,3 +184,6 @@ import xs, {Stream} from 'xstream'; | ||
other: concat( | ||
sources.other.take(6).map(x => String(x)).startWith('a'), | ||
sources.other | ||
.take(6) | ||
.map(x => String(x)) | ||
.startWith('a'), | ||
xs.never(), | ||
@@ -520,5 +523,8 @@ ), | ||
return { | ||
other: sources.other.take(1).startWith('a').map(() => { | ||
throw new Error('malfunction'); | ||
}), | ||
other: sources.other | ||
.take(1) | ||
.startWith('a') | ||
.map(() => { | ||
throw new Error('malfunction'); | ||
}), | ||
}; | ||
@@ -525,0 +531,0 @@ } |
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
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
39
5
86586
5
1852
+ Addeddefine-data-property@1.1.4(transitive)
+ Addeddefine-properties@1.2.1(transitive)
+ Addedes-define-property@1.0.1(transitive)
+ Addedes-errors@1.3.0(transitive)
+ Addedglobalthis@1.0.4(transitive)
+ Addedgopd@1.2.0(transitive)
+ Addedhas-property-descriptors@1.0.2(transitive)
+ Addedobject-keys@1.1.1(transitive)
+ Addedsymbol-observable@2.0.3(transitive)
+ Addedxstream@11.14.0(transitive)
- Removedsymbol-observable@1.2.0(transitive)
- Removedxstream@10.9.0(transitive)
Updatedxstream@10.x || 11.x