Skip to content

Commit

Permalink
chore(all): prepare release 0.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 12, 2015
1 parent ccf0958 commit 7bf676b
Show file tree
Hide file tree
Showing 16 changed files with 125 additions and 37 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-dependency-injection",
"version": "0.2.1",
"version": "0.3.0",
"description": "A lightweight, extensible dependency injection container for JavaScript.",
"keywords": [
"aurelia",
Expand Down
20 changes: 20 additions & 0 deletions dist/amd/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,24 @@ define(["exports"], function (exports) {
})();

exports.Optional = Optional;
var Parent = (function () {
var _Resolver4 = Resolver;
var Parent = function Parent(key) {
this.key = key;
};

_inherits(Parent, _Resolver4);

Parent.prototype.get = function (container) {
return container.parent ? container.parent.get(this.key) : null;
};

Parent.of = function (key) {
return new Parent(key);
};

return Parent;
})();

exports.Parent = Parent;
});
6 changes: 0 additions & 6 deletions dist/amd/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,6 @@ define(["exports", "aurelia-metadata", "./annotations", "./util"], function (exp
return childContainer;
};

Container.prototype.createTypedChild = function (childContainerType) {
var childContainer = new childContainerType(this.constructionInfo);
childContainer.parent = this;
return childContainer;
};

Container.prototype.invoke = function (fn) {
var info = this.getOrCreateConstructionInfo(fn), keys = info.keys, args = new Array(keys.length), context, i, ii;

Expand Down
1 change: 1 addition & 0 deletions dist/amd/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ define(["exports", "./annotations", "./container"], function (exports, _annotati
exports.Lazy = _annotations.Lazy;
exports.All = _annotations.All;
exports.Optional = _annotations.Optional;
exports.Parent = _annotations.Parent;
exports.Container = _container.Container;
});
22 changes: 21 additions & 1 deletion dist/commonjs/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,24 @@ var Optional = (function () {
return Optional;
})();

exports.Optional = Optional;
exports.Optional = Optional;
var Parent = (function () {
var _Resolver4 = Resolver;
var Parent = function Parent(key) {
this.key = key;
};

_inherits(Parent, _Resolver4);

Parent.prototype.get = function (container) {
return container.parent ? container.parent.get(this.key) : null;
};

Parent.of = function (key) {
return new Parent(key);
};

return Parent;
})();

exports.Parent = Parent;
6 changes: 0 additions & 6 deletions dist/commonjs/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,6 @@ Container.prototype.createChild = function () {
return childContainer;
};

Container.prototype.createTypedChild = function (childContainerType) {
var childContainer = new childContainerType(this.constructionInfo);
childContainer.parent = this;
return childContainer;
};

Container.prototype.invoke = function (fn) {
var info = this.getOrCreateConstructionInfo(fn), keys = info.keys, args = new Array(keys.length), context, i, ii;

Expand Down
1 change: 1 addition & 0 deletions dist/commonjs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ exports.Resolver = require("./annotations").Resolver;
exports.Lazy = require("./annotations").Lazy;
exports.All = require("./annotations").All;
exports.Optional = require("./annotations").Optional;
exports.Parent = require("./annotations").Parent;
exports.Container = require("./container").Container;
40 changes: 40 additions & 0 deletions dist/es6/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,44 @@ export class Optional extends Resolver {
static of(key, checkParent=false){
return new Optional(key, checkParent);
}
}


/**
* An annotation used to inject the dependency from the parent container instead of the current one.
*
* @class Parent
* @constructor
* @extends Resolver
* @param {Object} key The key to resolve from the parent container.
*/
export class Parent extends Resolver {
constructor(key){
this.key = key;
}

/**
* Called by the container to load the dependency from the parent container
*
* @method get
* @param {Container} container The container to resolve the parent from.
* @return {Function} Returns the matching instance from the parent container
*/
get(container){
return container.parent
? container.parent.get(this.key)
: null;
}

/**
* Creates a Parent Resolver for the supplied key.
*
* @method of
* @static
* @param {Object} key The key to resolve.
* @return {Parent} Returns an insance of Parent for the key.
*/
static of(key){
return new Parent(key);
}
}
13 changes: 0 additions & 13 deletions dist/es6/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,6 @@ export class Container {
return childContainer;
}

/**
* Creates a new dependency injection container using a derived container type whose parent is the current container.
*
* @method createTypedChild
* @param {Function} childContainerType A type derived from Container which will be instantiated as the child.
* @return {Container} Returns a new container instance parented to this.
*/
createTypedChild(childContainerType){
var childContainer = new childContainerType(this.constructionInfo);
childContainer.parent = this;
return childContainer;
}

/**
* Invokes a function, recursively resolving its dependencies.
*
Expand Down
3 changes: 2 additions & 1 deletion dist/es6/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ export {
Resolver,
Lazy,
All,
Optional
Optional,
Parent
} from './annotations';

export {Container} from './container';
22 changes: 21 additions & 1 deletion dist/system/annotations.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use strict";

System.register([], function (_export) {
var _slice, _inherits, Inject, Registration, Transient, Singleton, Resolver, Lazy, All, Optional;
var _slice, _inherits, Inject, Registration, Transient, Singleton, Resolver, Lazy, All, Optional, Parent;
return {
setters: [],
execute: function () {
Expand Down Expand Up @@ -143,6 +143,26 @@ System.register([], function (_export) {
return Optional;
})();
_export("Optional", Optional);

Parent = (function () {
var _Resolver4 = Resolver;
var Parent = function Parent(key) {
this.key = key;
};

_inherits(Parent, _Resolver4);

Parent.prototype.get = function (container) {
return container.parent ? container.parent.get(this.key) : null;
};

Parent.of = function (key) {
return new Parent(key);
};

return Parent;
})();
_export("Parent", Parent);
}
};
});
6 changes: 0 additions & 6 deletions dist/system/container.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ System.register(["aurelia-metadata", "./annotations", "./util"], function (_expo
return childContainer;
};

Container.prototype.createTypedChild = function (childContainerType) {
var childContainer = new childContainerType(this.constructionInfo);
childContainer.parent = this;
return childContainer;
};

Container.prototype.invoke = function (fn) {
var info = this.getOrCreateConstructionInfo(fn), keys = info.keys, args = new Array(keys.length), context, i, ii;

Expand Down
2 changes: 2 additions & 0 deletions dist/system/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ System.register(["./annotations", "./container"], function (_export) {
_export("All", _annotations.All);

_export("Optional", _annotations.Optional);

_export("Parent", _annotations.Parent);
}, function (_container) {
_export("Container", _container.Container);
}],
Expand Down
14 changes: 14 additions & 0 deletions doc/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 0.3.0 (2015-01-12)


#### Bug Fixes

* **container:** remove bogus createTypedChild api ([42b2ae2a](http://github.com/aurelia/dependency-injection/commit/42b2ae2a1507672f95503c0bc9257c755324a520))
* **package:** update Aurelia dependencies ([ccf09589](http://github.com/aurelia/dependency-injection/commit/ccf09589cfdd76ac77df12fad7e4ae6383000f48))


#### Features

* **resolver:** add parent resolver ([f035f1f5](http://github.com/aurelia/dependency-injection/commit/f035f1f5dece5c0316f18500e28ad37bdf9ac066))


### 0.2.1 (2015-01-06)


Expand Down
2 changes: 1 addition & 1 deletion doc/api.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "aurelia-dependency-injection",
"version": "0.2.1",
"version": "0.3.0",
"description": "A lightweight, extensible dependency injection container for JavaScript.",
"keywords": [
"aurelia",
Expand Down

0 comments on commit 7bf676b

Please sign in to comment.