New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

microcosm

Package Overview
Dependencies
Maintainers
1
Versions
233
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

microcosm - npm Package Compare versions

Comparing version 6.2.2 to 7.0.0-rc1

12

CHANGELOG.md
# Changelog
### 7.0.0
- Internally, Microcosm now uses
[Foliage](https://github.com/vigetlabs/foliage) for state
management.
- `pull` is now `get`, as it is inherited from Microcosm
- Microcosm is actually an extension of Foliage, so it now includes
all Foliage methods.
- Microcosm no longer uses toString() to get the key for Stores. This
was decided upon so that it is easier to reason about what a Store
is responsible for when hooking it into a Microcosm.
### 6.2.1

@@ -4,0 +16,0 @@

2

dist/Microcosm.js

@@ -1,2 +0,2 @@

module.exports=function(t){function e(n){if(r[n])return r[n].exports;var u=r[n]={exports:{},id:n,loaded:!1};return t[n].call(u.exports,u,u.exports,e),u.loaded=!0,u.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}([function(t,e,r){"use strict";e.__esModule=!0;var n=r(11);e.tag=n,e["default"]=r(4)},function(t,e,r){"use strict";function n(t,e){if(!t){var r=new Error(e);throw r.framesToPop=1,r}}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e){var r=void 0===arguments[2]?{}:arguments[2],n=Object.keys(t);return n.reduce(function(r,n){return r[n]=e(t[n],n),r},r)}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}};e.__esModule=!0;var u=r(1),o=n(u);e["default"]={validate:function(t){o["default"]("function"==typeof t,"Action "+t+" is not callable, actions should be functions")}},t.exports=e["default"]},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}},u=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}return t},o=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")};e.__esModule=!0;var i=r(3),a=n(i),s=r(12),f=n(s),c=r(5),l=n(c),d=r(6),p=n(d),h=r(1),_=n(h),v=r(7),g=n(v),m=r(8),y=n(m),x=r(9),M=n(x),b=r(2),S=n(b),w=r(10),z=n(w),O=function(){function t(){o(this,t),f["default"].decorate(this),this._state={},this._stores={},this._plugins=[]}return t.prototype.push=function(t){for(var e=this,r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];a["default"].validate(t);var o=t.apply(void 0,n);return o instanceof Promise?o.then(function(r){return e.dispatch(t,r)}):this.dispatch(t,o)},t.prototype.pull=function(t,e){for(var r=arguments.length,n=Array(r>2?r-2:0),u=2;r>u;u++)n[u-2]=arguments[u];var o=y["default"](this._state,t);return"function"==typeof e?e.call.apply(e,[this,o].concat(n)):o},t.prototype.prepare=function(t){for(var e,r=arguments.length,n=Array(r>1?r-1:0),u=1;r>u;u++)n[u-1]=arguments[u];return a["default"].validate(t),(e=this.push).bind.apply(e,[this,t].concat(n))},t.prototype.replace=function(t){this.commit(this.deserialize(t))},t.prototype.commit=function(t){this._state=t,this.emit()},t.prototype.dispatch=function(t,e){var r=this,n=z["default"](this._stores,function(e){return t in e});return Object.keys(n).length>0&&!function(){var u=g["default"](r._state),o=S["default"](n,function(r){return r[t](u[r],e)},u);r.commit(o)}(),e},t.prototype.addPlugin=function(t,e){l["default"].validate(t),this._plugins.push([t,e])},t.prototype.addStore=function(t){var e=u({},p["default"],t);_["default"](!this._stores[t],'Tried to add "'+t+'" but it is not unique'),this._stores[e]=e},t.prototype.serialize=function(){var t=this;return S["default"](this._stores,function(e){return e.serialize(t.pull(e))})},t.prototype.deserialize=function(){var t=void 0===arguments[0]?{}:arguments[0];return S["default"](this._stores,function(e){return e.deserialize(t[e])})},t.prototype.toJSON=function(){return this.serialize()},t.prototype.toObject=function(){return z["default"](this._state,function(){return!0})},t.prototype.start=function(){for(var t=arguments.length,e=Array(t),r=0;t>r;r++)e[r]=arguments[r];this._state=S["default"](this._stores,function(t){return t.getInitialState()}),M["default"](this._plugins,this,function(){e.forEach(function(t){return t()})})},t}();e["default"]=O,t.exports=e["default"]},function(t,e,r){"use strict";var n=function(t){return t&&t.__esModule?t:{"default":t}};e.__esModule=!0;var u=r(1),o=n(u);e["default"]={validate:function(t){o["default"]("register"in t,"Plugins must have a register method.")}},t.exports=e["default"]},function(t,e,r){"use strict";e.__esModule=!0,e["default"]={getInitialState:function(){return void 0},serialize:function(t){return t},deserialize:function(){var t=void 0===arguments[0]?this.getInitialState():arguments[0];return t},toString:function(){throw new Error("Stores must implement a toString() method")}},t.exports=e["default"]},function(t,e,r){"use strict";e.__esModule=!0,e["default"]=function(t){return Object.create(t)},t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e){for(var r=[].concat(e);r.length;)t=t[""+r.shift()];return t}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,r){"use strict";function n(t,e,r){var u=t[0],o=t.slice(1);if(!u)return r();var i=u[0],a=u[1];i.register(e,a,function(t){if(t)throw t;n(o,e,r)})}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e,r){"use strict";e.__esModule=!0,e["default"]=function(t,e){var r={};for(var n in t)e(t[n])&&(r[n]=t[n]);return r},t.exports=e["default"]},function(t,e,r){"use strict";function n(t){return"function"==typeof t}function u(t,e){var r=t.bind(null),n="_"+e+"_"+s++;return r.toString=function(){return n},r}var o=function(t){return t&&t.__esModule?t:{"default":t}};e.__esModule=!0;var i=r(2),a=o(i),s=0;e["default"]=function(t){return a["default"](t,function(t,e){return n(t)?u(t,e):t})},t.exports=e["default"]},function(t,e,r){t.exports=require("diode")}]);
module.exports=function(t){function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{},id:e,loaded:!1};return t[e].call(o.exports,o,o.exports,r),o.loaded=!0,o.exports}var n={};return r.m=t,r.c=n,r.p="",r(0)}([function(t,r,n){r.__esModule=!0;var e=n(5);r.tag=e,r["default"]=n(2)},function(t,r,n){t.exports=function(t,r){var n=void 0===arguments[2]?{}:arguments[2],e=Object.keys(t);return e.reduce(function(n,e){return n[e]=r(t[e],e),n},n)}},function(t,r,n){var e=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var e in n)Object.prototype.hasOwnProperty.call(n,e)&&(t[e]=n[e])}return t},o=function(t,r){if(!(t instanceof r))throw new TypeError("Cannot call a class as a function")},i=function(t,r){if("function"!=typeof r&&null!==r)throw new TypeError("Super expression must either be null or a function, not "+typeof r);t.prototype=Object.create(r&&r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),r&&(t.__proto__=r)},u=n(6),s=n(7),a=n(3),c=n(4),f=n(1);t.exports=function(t){function r(){o(this,r),t.call(this),u.decorate(this),this._stores={},this._plugins=[]}return i(r,t),r.prototype.push=function(t){for(var r=this,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];var i=t.apply(void 0,e);return i instanceof Promise?i.then(function(n){return r.dispatch(t,n)}):this._root.dispatch(t,i)},r.prototype.prepare=function(t){for(var r,n=arguments.length,e=Array(n>1?n-1:0),o=1;n>o;o++)e[o-1]=arguments[o];return(r=this.push).bind.apply(r,[this,t].concat(e))},r.prototype.replace=function(t){this.commit(this.deserialize(t)),this.emit()},r.prototype.dispatch=function(t,r){var n=!1;for(var e in this._stores){var o=this._stores[e][t];o&&(o(this.refine(e),r),n=!0)}return n&&this.emit(),r},r.prototype.addPlugin=function(t,r){this._plugins.push([t,r])},r.prototype.addStore=function(t,r){this._stores[t]=e({},a,r)},r.prototype.serialize=function(){var t=this;return f(this._stores,function(r,n){return r.serialize(t.get(n))})},r.prototype.deserialize=function(){var t=void 0===arguments[0]?{}:arguments[0];return f(this._stores,function(r,n){return r.deserialize(t[n])})},r.prototype.toJSON=function(){return this.serialize()},r.prototype.start=function(){for(var t=arguments.length,r=Array(t),n=0;t>n;n++)r[n]=arguments[n];this.commit(f(this._stores,function(t){return t.getInitialState()})),c(this._plugins,this,function(){r.forEach(function(t){return t()})})},r}(s)},function(t,r,n){t.exports={getInitialState:function(){return void 0},serialize:function(t){return t},deserialize:function(){var t=void 0===arguments[0]?this.getInitialState():arguments[0];return t}}},function(t,r,n){t.exports=function e(t,r,n){var o=t[0],i=t.slice(1);if(!o)return n();var u=o[0],s=o[1];u.register(r,s,function(t){if(t)throw t;e(i,r,n)})}},function(t,r,n){function e(t){return"function"==typeof t}function o(t,r){var n=t.bind(null),e="_"+r+"_"+a++;return n.toString=function(){return e},n}var i=function(t){return t&&t.__esModule?t:{"default":t}};r.__esModule=!0;var u=n(1),s=i(u),a=0;r["default"]=function(t){return s["default"](t,function(t,r){return e(t)?o(t,r):t})},t.exports=r["default"]},function(t,r,n){t.exports=require("diode")},function(t,r,n){t.exports=require("foliage")}]);
//# sourceMappingURL=Microcosm.js.map

@@ -9,3 +9,3 @@ var Webpack = require('webpack')

browsers: [ isIntegration ? 'Firefox' : 'Chrome' ],
browsers: ['Firefox'],

@@ -28,3 +28,3 @@ singleRun: isIntegration,

reporters: [ 'nyan', 'coverage' ],
reporters: [ 'spec', 'coverage' ],

@@ -31,0 +31,0 @@ coverageReporter: {

{
"name": "microcosm",
"version": "6.2.2",
"version": "7.0.0-rc1",
"description": "A functional flux architecture",

@@ -19,6 +19,7 @@ "main": "dist/Microcosm.js",

"dependencies": {
"diode": "^4.0.0"
"diode": "^4.0.0",
"foliage": "^0.14.2"
},
"devDependencies": {
"autoprefixer-core": "^5.1.7",
"autoprefixer-core": "^5.x.x",
"babel": "^5.x.x",

@@ -30,3 +31,3 @@ "babel-loader": "^5.x.x",

"coveralls": "^2.11.2",
"css-loader": "^0.9.0",
"css-loader": "^0.10.1",
"css-mqpacker": "^3.1.0",

@@ -37,9 +38,8 @@ "csswring": "^3.0.2",

"json-loader": "^0.5.1",
"karma": "^0.12.32",
"karma-chrome-launcher": "^0.1.7",
"karma": "^0.12.31",
"karma-spec-reporter": "0.0.19",
"karma-cli": "0.0.4",
"karma-coverage": "^0.2.7",
"karma-coverage": "^0.3.1",
"karma-firefox-launcher": "^0.1.3",
"karma-mocha": "^0.1.10",
"karma-nyan-reporter": "0.0.60",
"karma-sinon-chai": "^0.3.0",

@@ -49,11 +49,11 @@ "karma-sourcemap-loader": "^0.3.4",

"page": "^1.6.1",
"postcss-loader": "^0.3.0",
"postcss-loader": "^0.4.0",
"raw-loader": "^0.5.1",
"react": ">= 0.13.1",
"react": ">= 0.13.2",
"react-hot-loader": "^1.2.4",
"react-tools": ">= 0.13.1",
"route-recognizer": "^0.1.5",
"sass-loader": "^1.0.0",
"sass-loader": "^0.6.0",
"source-map-loader": "^0.1.3",
"style-loader": "^0.9.0",
"style-loader": "^0.10.2",
"uid": "0.0.2",

@@ -60,0 +60,0 @@ "webpack": "^1.7.2",

@@ -101,5 +101,2 @@ [![NPM](https://nodei.co/npm/microcosm.png?compact=true)](https://npmjs.org/package/microcosm)

return []
},
toString() {
return 'messages'
}

@@ -111,3 +108,3 @@ }

super()
this.addStore(Messages)
this.addStore('messages', Messages)
}

@@ -143,5 +140,2 @@ }

return oldState.concat(parameters)
},
toString() {
return 'messages'
}

@@ -153,3 +147,3 @@ }

super()
this.addStore(Messages)
this.addStore('messages', Messages)
}

@@ -198,5 +192,4 @@ }

Stores are plain objects. They must implement a `getInitialState` and
`toString` method. They listen to actions by providing methods at
the unique signature of an Action, like:
Stores are plain objects. They listen to actions by providing methods
at the unique signature of an Action, like:

@@ -213,6 +206,2 @@ ```javascript

return oldState.concat(message)
},
toString() {
return 'MessageStore'
}

@@ -227,3 +216,3 @@ }

Microcosm will use `getInitialState` to produce the initial value for
the subset a store manages.
the subset a store manages when an instance is started.

@@ -242,6 +231,6 @@ Unlike actions, stores must be registered with the system. There are

// Called first:
this.addStore(Messages)
this.addStore('messages', Messages)
// Called second:
this.addStore(OtherStoreThatDependsOnMessages)
this.addStore('other-store', OtherStoreThatDependsOnMessages)
}

@@ -253,11 +242,9 @@ }

Microcosms implement a `pull` method:
Microcosms implement a `get` method:
```javascript
app.pull(Store)
app.get('messages')
```
This works because the app accesses the internal state object using
`Store` as a key. Since the store implements a `toString` method, it
coerces into the proper key and returns the expected value.
This will pull the `messages` key out of global application state.

@@ -264,0 +251,0 @@ ## Listening to changes

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