Changelog
January 6, 2017 · View on GitHub
4.1.4
- Removes deprecated
grigio:babel@0.1.3meteor dependency. It was causing errors related to long or failed builds (like:Cannot enlarge memory arrays)
4.1.3
- Fixes the BDD test helper on
Space.ModuleandSpace.Applicationto actually accept a second param that can be a existing app instance.
4.1.2
- Fixes superClass method for classes that are not directly extending Space.Object
4.1.1
-
Improves the way mixins are applied to classes and ensures that:
- Sub classes always inherit all mixins applied to parent classes, even when this happens "later on"
- All sub classes inherit the static mixin properties, even after extending the base class
-
Adds the following helpers are added to
Space.Objectfor convenience:- static
MyClass.hasSuperClass()MyClass.superClass([key])- either returns the super class constructor or static property/methodMyClass.subClasses()- returns flat array of all sub classes
- prototype
myInstance.hasSuperClass()myInstance.superClass([key])- same as static version but returns prototype props/methods
- static
4.1.0
- Adds
hasMixin()instance method to Space.Object to check if the class has applied or inherited a specific mixin
4.0.2
Space.Structwere previously not calling their super constructor which caused a bug with the newonConstructionhooks
4.0.1
- Improves
Space.Object.extend()implementations - Fixes bug in
Space.Error - Adds tests for mixin callbacks
4.0.0 :tada:
This is a big major release with many new features and improvements:
- Adds extensible
Space.Errorclass that has the same api asSpace.Objectbut can be used for better custom error classes.
// When throwing this: "MyError: The default message for this error"
let MyError = Space.Error.extend('MyError', {
message: 'The default message for this error'
});
// When throwing this: "MyParamError: Custom message with <param>"
let MyError = Space.Error.extend('MyParamError', {
Constructor: (param) {
Space.Error.call(this, `Custom message with ${param}`);
}
});
- Improves mixins for
Space.Objectby makingonDependenciesReadyhooks available. All mixins can now define their ownonDependenciesReadymethods which all get called by the host class correctly. This way mixins can do setup work on host classes.
My.CustomMixin = {
onDependenciesReady() { // Do some setup work }
};
My.CustomClass.mixin(My.CustomMixin);
// Of course normally you dont have to call `onDependenciesReady` yourself
new My.CustomClass().onDependenciesReady() // Mixin hook is called!
- You can now add mixins to any subclass of
Space.Objectlike this:
Space.Object.extend('CustomClass', { mixin: [FirstMixin, SecondMixin] });
-
Mixin methods now override methods on the host class!
-
Many bugfixes and improvements related to
Space.Modulelifecycle hooks. Previous hooks likeonStartandonConfigurehave been replaced with a complete lifecycle split into three main phases:initialize,start,reset. Each withon,beforeandafterhooks likeonInitialize/afterStartetc. -
Refactored all core api properties like
Dependencies,RequiredModules,Singletonsetc. to lowercase pendants: e.gdependencies,requiredModules -
Added
Space.Logger, an extensible logger based on winston available in your application asdependencies: { log: 'log' } -
You can now do static setup work on classes like this:
Space.Object.extend('CustomClass', {
onExtending() {
// <this> is the class itself here!
}
});
-
Adds static
Space.Object.isSubclassOfmethod that is available for all sub classes automatically. So you can askMyFirstClass.isSubclassOf(OtherClass) -
Improved error handling and messages of
Space.Injector(DI System) -
Space.Structcan now be serializedtoDataandSpace.Struct.fromDatawhich has some benefits over EJSON: all fields are plain and accessible for queries! -
New recommended way to define classes with full class path for improved debugging and automatic type registration (EJSON / toData):
// Instead of:
Space.Object.extend(My.namespace, 'MyCustomClass');
// Do this now:
Space.Object.extend('My.namespace.MyCustomClass');
-
Added proper MIT license
-
Added BDD test helper
Space.Module.registerBddApi
Thanks to all the new people on the team who made this awesome release possible:
:clap:
3.2.1
- Bug fixes relating to package configuration
3.2.0
Module/Application state and lifecycle improvements
- Formalizes state to better manage module lifecycle
- States include: Constructed -> Initialized -> Stopped -> Running
- Accessor method
app.is(expectedState) // eg 'running' - Calling .reset() on a running Application or Module now calls .stop() on it first, then start() again after it's been reset.
Configuration API Support
Space.getenvhelper wraps getenv to provide support for ENV typecasting, particularly for merging with runtime config
Other Changes
- Default Meteor mappings have been moved down to Module from Application
MongoInternalsis now mapped on the server
Bugfixes
- Minor injector fixes, with better error handling.
3.1.1
- Fixes bug with recently updated injector code
3.1.0
- Fixed bug with module lifecycle hooks
- Improved
Space.Objectmixin api to make it possible to mixin static class properties via the specialStaticproperty and to do static setup when the mixin is applied by providing aonMixinAppliedmethod in the mixin definition. Both properties are not added to the prototype of course. TheonMixinAppliedmethod is called with the host class asthiscontext.
3.0.0
Several breaking changes and API improvements have been made:
ReactiveVaris now mapped statically instead ofinstancesOf, so you can use it like the "normal"- The module/app lifecycle has been harmonized into a simple system:
There are 4 lifecycle phases:
initialize,start,resetandstop. For each phase there arebefore,on, andafterhooks that are called in the logical order -> deepest nested module first. Theinitializemethod is the only one that should not be called from outside but is automatically called when constructing a module/app. - The configuration API slightly changed again: The
configuremethod is only defined onSpace.Applicationand allows to override the default config of the app / modules. - The previous
configurehooks does not exist anymore. You should useonInitializeinstead.
2.5.1
- Thanks @sanjo for a patch that fixes dependency injection if two components depend on each other.
2.5.0
Several improvements and bug fixes have been made:
- Keep the required min version of Meteor down to 1.0
- Added
afterApplicationStarthook for modules and apps that is called after everything has been configured and started. - Improved configuration api to allow overriding of arbitrarily nested configuration values. This is super awesome for overriding configs of modules.
- Added
Space.Object#typeapi for adding debug info about class types. - Added
stophook for modules and apps that is similar toresetbut should be used for really drastic cleanup (like stopping observers etc.)
2.4.2
Fixes some bugs with the new Meteor dependency tracker and the default dependency injections in Space applications.
2.4.1
Introduces better way to configure modules and applications. Now you can
define a default Configuration property on the prototype and override
specific values of it when creating the application instance like this:
new TestApp({
Configuration: {
propertyToOverride: 'customValue',
}
});
All configurations are merged into a single Configuration object available
via the application injector like this: injector.get('Configuration').
2.4.0
Introduces dynamic overriding of injected dependencies in the running system.
Now you can call injector.override('Test').to('newValue') and all objects
that had the previous value of Test injected will be updated with the new
value dynamically. This makes it possible to swap out complete sub-systems
while the application is running. Of course it also comes with the potential
of memory leaks, because now the injection mappings have to hold references
to each and every object that dependencies are injected to. That's where the
new Space.Injector::release API comes to play. If you have an object that
should be garbage collected but has dependencies injected you need to release
it from the Injector to let the mappings remove the references. In reality you
rarely have to manage this yourself because other packages like space:ui will
handle this transparently in the background.
2.3.1
Only updated the Github repository links after moving it to the new https://github.com/meteor-space organization.
2.3.0
- Adds
Space.namespace('MyNamespace')which simplifies working with Meteor package scopes. Up until now Space could not resolve exported variables from packages in your app because Meteor is hiding them from thespace:basepackage.
2.2.0
- Improves
Space.Object.extendcapabilities to work smoothly with Javascript and provide multiple ways to extend core classes. - Improves general debugging experience by throwing errors when values can
not be resolved with
Space.resolvePath Space.resolvePathnow also takes into account published space modules, which solves the problem of Meteor package scoping.- adds
Space.Module.defineandSpace.Application.definewhich makes it easier to flesh out modules and apps in Javascript (without having to callpublish)
2.1.0
Introduces lazy auto-mapping of singletons and static values if they are
requested by other parts via the Dependencies property. For the first request
it looks up the dependency on the global context and maps functions as singletons
and other values as static. Be aware that some part of the system has to require
your singleton before it ever exists. In some cases this is not what you want
(e.g event handling)
2.0.1
@Sanjo fixed an issue with weak-dependencies injection in Space.Application.
2.0.0
Breaking Changes:
- Unified the API for starting
Space.ModuleandSpace.Application. This means you have to callyourApp.start()instead ofyourApp.run()now. - Renamed the
runhook for modules and applications tostartup, so instead of definingrun: function() { … }you needstartup: function() { … }inside your modules and apps now.
1.4.2
Make it possible to declare Singletons: [] on any module with paths to classes
that should be mapped and created as singletons automatically.
1.4.1
Fixes some package dependency issues
1.4.0
Adds basic mixin capabilities to Space.Object that allows to extend the prototype of a given class without direct inheritance
1.3.2
Fixes bug with running dependent modules in correct order.
1.3.1
Throw error when trying to map undefined or null value.
1.3.0
Adds helpers specs and fixes edge case bug with resolve path helper
1.2.9
Introduces general purpose helpers on the Space namespace
1.2.8
Adds global value lookup for injection mapping support: e.g:
@injector.map('my.awesome.Class').asSingleton()
1.2.7
Support old js engines that without Object.defineProperty support.
1.2.6
Fixes bug where onDependenciesReady was only called once per prototype
1.2.5
Fixes bug where onDependenciesReady was called more than once
1.2.4
Fixes bug where injected values were overwritten
1.2.4
Fixes bug where injected values were overwritten
1.2.3
Fixes regression bug where injector didn't inject into values
1.2.2
Renames Space.Class to Space.Object
1.2.1
Features:
- Adds support for static constructor functions while extending classes
- Completes API compatibility to dependance injector
Bugfixes:
- Providers are now added to the
Mappingprototype, not to every instance.
1.2.0
Features:
- Adds
Space.Objectfor better Javascript inheritance support - Replaces Dependance with brand new (but compatible)
Space.Injector
1.1.0
Added mappings to core Meteor packages
1.0.0
Publish first version to Meteor package system
0.1.0
Initial release of Space