@cycle/core
Advanced tools
Comparing version 7.0.0-rc1 to 7.0.0-rc2
(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){ | ||
'use strict'; | ||
"use strict"; | ||
@@ -72,3 +72,3 @@ var base_1 = require('@cycle/base'); | ||
},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){ | ||
"use strict"; | ||
'use strict'; | ||
@@ -116,2 +116,9 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
} | ||
function disposeSources(sources) { | ||
for (var k in sources) { | ||
if (sources.hasOwnProperty(k) && typeof sources[k].dispose === 'function') { | ||
sources[k].dispose(); | ||
} | ||
} | ||
} | ||
var isObjectEmpty = function isObjectEmpty(obj) { | ||
@@ -124,3 +131,3 @@ return Object.keys(obj).length === 0; | ||
} | ||
if ((typeof drivers === "undefined" ? "undefined" : _typeof(drivers)) !== "object" || drivers === null) { | ||
if ((typeof drivers === 'undefined' ? 'undefined' : _typeof(drivers)) !== "object" || drivers === null) { | ||
throw new Error("Second argument given to Cycle must be an object " + "with driver functions as properties."); | ||
@@ -142,2 +149,3 @@ } | ||
streamAdapter.dispose(sinks, sinkProxies, sources); | ||
disposeSources(sources); | ||
disposeReplication(); | ||
@@ -144,0 +152,0 @@ }; |
@@ -1,1 +0,1 @@ | ||
(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){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeHoldSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){sources[name_2]=drivers[name_2](sinkProxies[name_2].stream,streamAdapter.adapt,name_2)}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){var rx_1=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=new rx_1.ReplaySubject(1);var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribe==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)}); | ||
(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){"use strict";var base_1=require("@cycle/base");var rx_adapter_1=require("@cycle/rx-adapter");var Cycle=function Cycle(main,drivers){return base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default})};function run(main,drivers){var run=base_1.default(main,drivers,{streamAdapter:rx_adapter_1.default}).run;return run()}Cycle.run=run;Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{"@cycle/base":2,"@cycle/rx-adapter":3}],2:[function(require,module,exports){"use strict";var _typeof=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(obj){return typeof obj}:function(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol?"symbol":typeof obj};function makeSinkProxies(drivers,streamAdapter){var sinkProxies={};for(var name_1 in drivers){if(drivers.hasOwnProperty(name_1)){var holdSubject=streamAdapter.makeHoldSubject();var driverStreamAdapter=drivers[name_1].streamAdapter||streamAdapter;var stream=driverStreamAdapter.adapt(holdSubject.stream,streamAdapter.streamSubscribe);sinkProxies[name_1]={stream:stream,observer:holdSubject.observer}}}return sinkProxies}function callDrivers(drivers,sinkProxies,streamAdapter){var sources={};for(var name_2 in drivers){if(drivers.hasOwnProperty(name_2)){sources[name_2]=drivers[name_2](sinkProxies[name_2].stream,streamAdapter.adapt,name_2)}}return sources}function replicateMany(sinks,sinkProxies,streamAdapter){var results=Object.keys(sinks).filter(function(name){return!!sinkProxies[name]}).map(function(name){return streamAdapter.streamSubscribe(sinks[name],sinkProxies[name].observer)});var disposeFunctions=results.filter(function(dispose){return typeof dispose==="function"});return function(){disposeFunctions.forEach(function(dispose){return dispose()})}}function disposeSources(sources){for(var k in sources){if(sources.hasOwnProperty(k)&&typeof sources[k].dispose==="function"){sources[k].dispose()}}}var isObjectEmpty=function isObjectEmpty(obj){return Object.keys(obj).length===0};function Cycle(main,drivers,options){if(typeof main!=="function"){throw new Error("First argument given to Cycle must be the 'main' "+"function.")}if((typeof drivers==="undefined"?"undefined":_typeof(drivers))!=="object"||drivers===null){throw new Error("Second argument given to Cycle must be an object "+"with driver functions as properties.")}if(isObjectEmpty(drivers)){throw new Error("Second argument given to Cycle must be an object "+"with at least one driver function declared as a property.")}var streamAdapter=options.streamAdapter;if(!streamAdapter||isObjectEmpty(streamAdapter)){throw new Error("Third argument given to Cycle must be an options object "+"with the streamAdapter key supplied with a valid stream adapter.")}var sinkProxies=makeSinkProxies(drivers,streamAdapter);var sources=callDrivers(drivers,sinkProxies,streamAdapter);var sinks=main(sources);var run=function run(){var disposeReplication=replicateMany(sinks,sinkProxies,streamAdapter);return function(){streamAdapter.dispose(sinks,sinkProxies,sources);disposeSources(sources);disposeReplication()}};return{sinks:sinks,sources:sources,run:run}}Object.defineProperty(exports,"__esModule",{value:true});exports.default=Cycle},{}],3:[function(require,module,exports){var rx_1=require("rx");function logToConsoleError(err){var target=err.stack||err;if(console&&console.error){console.error(target)}else if(console&&console.log){console.log(target)}}var RxJSAdapter={adapt:function(originStream,originStreamSubscribe){if(this.isValidStream(originStream)){return originStream}return rx_1.Observable.create(function(destinationObserver){var originObserver={next:function(x){return destinationObserver.onNext(x)},error:function(e){return destinationObserver.onError(e)},complete:function(){return destinationObserver.onCompleted()}};var dispose=originStreamSubscribe(originStream,originObserver);return function(){if(typeof dispose==="function"){dispose.call(null)}}})},dispose:function(sinks,sinkProxies,sources){Object.keys(sources).forEach(function(k){if(typeof sources[k].dispose==="function"){sources[k].dispose()}});Object.keys(sinkProxies).forEach(function(k){sinkProxies[k].observer.complete()})},makeHoldSubject:function(){var stream=new rx_1.ReplaySubject(1);var observer={next:function(x){stream.onNext(x)},error:function(err){logToConsoleError(err);stream.onError(err)},complete:function(x){stream.onCompleted()}};return{stream:stream,observer:observer}},isValidStream:function(stream){return typeof stream.subscribe==="function"&&typeof stream.onValue!=="function"},streamSubscribe:function(stream,observer){var subscription=stream.subscribe(function(x){return observer.next(x)},function(e){return observer.error(e)},function(){return observer.complete()});return function(){subscription.dispose()}}};Object.defineProperty(exports,"__esModule",{value:true});exports.default=RxJSAdapter},{rx:undefined}]},{},[1])(1)}); |
@@ -1,6 +0,2 @@ | ||
import { DriversDefinition, CycleExecution, DisposeFunction } from '@cycle/base'; | ||
export interface CycleSetup { | ||
(main: (sources: any) => any, drivers: DriversDefinition): CycleExecution<any, any>; | ||
run: (main: (sources: any) => any, drivers: DriversDefinition) => DisposeFunction; | ||
} | ||
import { CycleSetup } from '@cycle/base'; | ||
/** | ||
@@ -7,0 +3,0 @@ * A function that prepares the Cycle application to be executed. Takes a `main` |
@@ -0,1 +1,2 @@ | ||
"use strict"; | ||
var base_1 = require('@cycle/base'); | ||
@@ -2,0 +3,0 @@ var rx_adapter_1 = require('@cycle/rx-adapter'); |
{ | ||
"name": "@cycle/core", | ||
"version": "7.0.0-rc1", | ||
"version": "7.0.0-rc2", | ||
"author": "Andre Staltz", | ||
@@ -22,5 +22,6 @@ "description": "The Cycle run() function meant to be used with RxJS v4", | ||
], | ||
"main": "lib/cycle.js", | ||
"main": "lib/index.js", | ||
"typings": "lib/index.d.ts", | ||
"dependencies": { | ||
"@cycle/base": "^1.2.1", | ||
"@cycle/base": "^2.0.1", | ||
"@cycle/rx-adapter": "^1.0.1" | ||
@@ -37,14 +38,10 @@ }, | ||
"browserify-shim": "3.8.11", | ||
"eslint": "1.0.0", | ||
"eslint-config-cycle": "3.0.0", | ||
"eslint-plugin-cycle": "1.0.1", | ||
"eslint-plugin-no-class": "0.1.0", | ||
"markdox": "0.1.10", | ||
"mocha": "2.3.3", | ||
"rx": "4.0.6", | ||
"rx": "4.0.7", | ||
"sinon": "1.17.2", | ||
"testem": "0.9.11", | ||
"tslint": "^3.3.0", | ||
"typescript": "^1.7.5", | ||
"typings": "^0.6.3", | ||
"tslint": "3.6.0", | ||
"typescript": "^1.8.9", | ||
"typings": "^0.7.12", | ||
"uglify-js": "2.5.0" | ||
@@ -66,3 +63,3 @@ }, | ||
"posttest-browser": "rm test/browser/tests-bundle.js", | ||
"predist": "rm -rf dist/ && mkdirp dist/ && npm run lib", | ||
"predist": "rm -rf dist/ && mkdirp dist/ && npm run lib && npm run docs", | ||
"postdist": "uglifyjs dist/cycle.js -o dist/cycle.min.js", | ||
@@ -78,4 +75,4 @@ "dist": "browserify lib/index.js -t babelify -t browserify-shim --standalone Cycle --exclude rx -o dist/cycle.js", | ||
"version-major": "npm version major --message 'chore(version): %s'", | ||
"postversion": "npm publish --access=public" | ||
"postversion": "npm publish --access=public && node scripts/publish-package-rx-run.js" | ||
} | ||
} |
import { | ||
DriversDefinition, | ||
CycleExecution, | ||
CycleSetup, | ||
DisposeFunction | ||
@@ -9,7 +10,2 @@ } from '@cycle/base'; | ||
export interface CycleSetup { | ||
(main: (sources: any) => any, drivers: DriversDefinition): CycleExecution<any, any>; | ||
run: (main: (sources: any) => any, drivers: DriversDefinition) => DisposeFunction; | ||
} | ||
/** | ||
@@ -16,0 +12,0 @@ * A function that prepares the Cycle application to be executed. Takes a `main` |
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
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
14
45650
26
667
6
+ Added@cycle/base@2.1.2(transitive)
- Removed@cycle/base@1.3.1(transitive)
Updated@cycle/base@^2.0.1