Skip to content

Commit

Permalink
chore(all): prepare release 1.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Nov 20, 2019
1 parent efa8bad commit 191d7d6
Show file tree
Hide file tree
Showing 14 changed files with 144 additions and 66 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": "1.5.1",
"version": "1.5.2",
"description": "A lightweight, extensible dependency injection container for JavaScript.",
"keywords": [
"aurelia",
Expand Down
22 changes: 15 additions & 7 deletions dist/amd/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ define('aurelia-dependency-injection', ['exports', 'aurelia-metadata', 'aurelia-
}
return true;
});
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(exports.Strategy || (exports.Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -84,25 +92,25 @@ define('aurelia-dependency-injection', ['exports', 'aurelia-metadata', 'aurelia-
this.state = state;
}
StrategyResolver.prototype.get = function (container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.singleton, this.state)) {
var singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -200,7 +208,7 @@ define('aurelia-dependency-injection', ['exports', 'aurelia-metadata', 'aurelia-
Factory.prototype.get = function (container) {
var fn = this._key;
var resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === exports.Strategy.function) {
fn = resolver.state;
}
return function () {
Expand Down
6 changes: 3 additions & 3 deletions dist/aurelia-dependency-injection.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export declare const resolver: {
export interface Resolver {
get(container: Container, key: any): any;
}
export declare const enum Strategy {
export declare enum Strategy {
instance = 0,
singleton = 1,
transient = 2,
Expand All @@ -62,9 +62,9 @@ export interface StrategyState<TBase, TImpl extends Impl<TBase> = Impl<TBase>, T
[Strategy.singleton]: DependencyCtorOrFunctor<TBase, TImpl, TArgs>;
[Strategy.transient]: DependencyCtorOrFunctor<TBase, TImpl, TArgs>;
[Strategy.function]: StrategyFunctor<TBase, TImpl, TArgs>;
[Strategy.array]: [{
[Strategy.array]: ({
get: (container: Container, key: PrimitiveOrDependencyCtor<TBase, TImpl, TArgs>) => TImpl;
}, ...TImpl[]];
} | TImpl)[];
[Strategy.alias]: any;
}
export declare class StrategyResolver<TBase, TImpl extends Impl<TBase>, TArgs extends Args<TBase>, TStrategyKey extends keyof StrategyState<TBase, TImpl, TArgs>> {
Expand Down
22 changes: 15 additions & 7 deletions dist/commonjs/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,14 @@ var resolver = aureliaMetadata.protocol.create('aurelia:resolver', function (tar
}
return true;
});
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(exports.Strategy || (exports.Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -89,25 +97,25 @@ var StrategyResolver = (function () {
this.state = state;
}
StrategyResolver.prototype.get = function (container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.singleton, this.state)) {
var singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, exports.Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -205,7 +213,7 @@ var Factory = (function () {
Factory.prototype.get = function (container) {
var fn = this._key;
var resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === exports.Strategy.function) {
fn = resolver.state;
}
return function () {
Expand Down
25 changes: 17 additions & 8 deletions dist/es2015/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ const resolver = protocol.create('aurelia:resolver', (target) => {
}
return true;
});
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -82,25 +91,25 @@ let StrategyResolver = class StrategyResolver {
this.state = state;
}
get(container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, Strategy.singleton, this.state)) {
const singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -181,7 +190,7 @@ let Factory = Factory_1 = class Factory {
get(container) {
let fn = this._key;
const resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === Strategy.function) {
fn = resolver.state;
}
return (...rest) => container.invoke(fn, rest);
Expand Down Expand Up @@ -586,4 +595,4 @@ class SingletonRegistration {
}
}

export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, Strategy, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
25 changes: 17 additions & 8 deletions dist/es2017/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ const resolver = protocol.create('aurelia:resolver', (target) => {
}
return true;
});
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -82,25 +91,25 @@ let StrategyResolver = class StrategyResolver {
this.state = state;
}
get(container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, Strategy.singleton, this.state)) {
const singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -181,7 +190,7 @@ let Factory = Factory_1 = class Factory {
get(container) {
let fn = this._key;
const resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === Strategy.function) {
fn = resolver.state;
}
return (...rest) => container.invoke(fn, rest);
Expand Down Expand Up @@ -586,4 +595,4 @@ class SingletonRegistration {
}
}

export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, Strategy, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
25 changes: 17 additions & 8 deletions dist/native-modules/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ var resolver = protocol.create('aurelia:resolver', function (target) {
}
return true;
});
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = {}));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -85,25 +94,25 @@ var StrategyResolver = (function () {
this.state = state;
}
StrategyResolver.prototype.get = function (container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, Strategy.singleton, this.state)) {
var singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -201,7 +210,7 @@ var Factory = (function () {
Factory.prototype.get = function (container) {
var fn = this._key;
var resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === Strategy.function) {
fn = resolver.state;
}
return function () {
Expand Down Expand Up @@ -642,4 +651,4 @@ var SingletonRegistration = (function () {
return SingletonRegistration;
}());

export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
export { _emptyParameters, InvocationHandler, Container, autoinject, inject, invoker, invokeAsFactory, FactoryInvoker, registration, transient, singleton, TransientRegistration, SingletonRegistration, resolver, Strategy, StrategyResolver, Lazy, All, Optional, Parent, Factory, NewInstance, getDecoratorDependencies, lazy, all, optional, parent, factory, newInstance };
24 changes: 17 additions & 7 deletions dist/system/aurelia-dependency-injection.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ System.register(['aurelia-metadata', 'aurelia-pal'], function (exports, module)
registration: registration,
transient: transient,
singleton: singleton,
Strategy: void 0,
getDecoratorDependencies: getDecoratorDependencies,
lazy: lazy,
all: all,
Expand Down Expand Up @@ -102,6 +103,15 @@ System.register(['aurelia-metadata', 'aurelia-pal'], function (exports, module)
}
return true;
}));
var Strategy;
(function (Strategy) {
Strategy[Strategy["instance"] = 0] = "instance";
Strategy[Strategy["singleton"] = 1] = "singleton";
Strategy[Strategy["transient"] = 2] = "transient";
Strategy[Strategy["function"] = 3] = "function";
Strategy[Strategy["array"] = 4] = "array";
Strategy[Strategy["alias"] = 5] = "alias";
})(Strategy || (Strategy = exports('Strategy', {})));
function isStrategy(actual, expected, state) {
return actual === expected;
}
Expand All @@ -111,25 +121,25 @@ System.register(['aurelia-metadata', 'aurelia-pal'], function (exports, module)
this.state = state;
}
StrategyResolver.prototype.get = function (container, key) {
if (isStrategy(this.strategy, 0, this.state)) {
if (isStrategy(this.strategy, Strategy.instance, this.state)) {
return this.state;
}
if (isStrategy(this.strategy, 1, this.state)) {
if (isStrategy(this.strategy, Strategy.singleton, this.state)) {
var singleton = container.invoke(this.state);
this.state = singleton;
this.strategy = 0;
return singleton;
}
if (isStrategy(this.strategy, 2, this.state)) {
if (isStrategy(this.strategy, Strategy.transient, this.state)) {
return container.invoke(this.state);
}
if (isStrategy(this.strategy, 3, this.state)) {
if (isStrategy(this.strategy, Strategy.function, this.state)) {
return this.state(container, key, this);
}
if (isStrategy(this.strategy, 4, this.state)) {
if (isStrategy(this.strategy, Strategy.array, this.state)) {
return this.state[0].get(container, key);
}
if (isStrategy(this.strategy, 5, this.state)) {
if (isStrategy(this.strategy, Strategy.alias, this.state)) {
return container.get(this.state);
}
throw new Error('Invalid strategy: ' + this.strategy);
Expand Down Expand Up @@ -227,7 +237,7 @@ System.register(['aurelia-metadata', 'aurelia-pal'], function (exports, module)
Factory.prototype.get = function (container) {
var fn = this._key;
var resolver = container.getResolver(fn);
if (resolver && resolver.strategy === 3) {
if (resolver && resolver.strategy === Strategy.function) {
fn = resolver.state;
}
return function () {
Expand Down
Loading

0 comments on commit 191d7d6

Please sign in to comment.