aurelia-dependency-injection
Advanced tools
Comparing version 1.4.1 to 1.4.2
{ | ||
"name": "aurelia-dependency-injection", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A lightweight, extensible dependency injection container for JavaScript.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -721,2 +721,6 @@ define(['exports', 'aurelia-metadata', 'aurelia-pal'], function (exports, _aureliaMetadata, _aureliaPal) { | ||
target.inject = (_aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target) || _emptyParameters).slice(); | ||
if (target.inject.length > 0 && target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -723,0 +727,0 @@ }; |
@@ -1105,2 +1105,8 @@ import {protocol,metadata} from 'aurelia-metadata'; | ||
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice(); | ||
// TypeScript 3.0 metadata for "...rest" gives type "Object" | ||
// if last parameter is "Object", assume it's a ...rest and remove that metadata. | ||
if (target.inject.length > 0 && | ||
target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -1107,0 +1113,0 @@ }; |
@@ -725,2 +725,6 @@ 'use strict'; | ||
target.inject = (_aureliaMetadata.metadata.getOwn(_aureliaMetadata.metadata.paramTypes, target) || _emptyParameters).slice(); | ||
if (target.inject.length > 0 && target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -727,0 +731,0 @@ }; |
@@ -620,2 +620,6 @@ var _dec, _class, _dec2, _class2, _dec3, _class3, _dec4, _class4, _dec5, _class5, _dec6, _class6, _dec7, _class7; | ||
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice(); | ||
if (target.inject.length > 0 && target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -622,0 +626,0 @@ }; |
@@ -709,2 +709,6 @@ var _dec, _class, _dec2, _class2, _dec3, _class3, _dec4, _class4, _dec5, _class5, _dec6, _class6, _dec7, _class7, _classInvokers; | ||
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice(); | ||
if (target.inject.length > 0 && target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -711,0 +715,0 @@ }; |
@@ -176,2 +176,6 @@ 'use strict'; | ||
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice(); | ||
if (target.inject.length > 0 && target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -178,0 +182,0 @@ }; |
@@ -0,1 +1,13 @@ | ||
<a name="1.4.2"></a> | ||
## [1.4.2](https://github.com/aurelia/dependency-injection/compare/1.4.1...1.4.2) (2018-12-18) | ||
### Bug Fixes | ||
* **dependency-injection:** add more tests using cases suggested by [@fkleuver](https://github.com/fkleuver) ([ac4e6f9](https://github.com/aurelia/dependency-injection/commit/ac4e6f9)), closes [#171](https://github.com/aurelia/dependency-injection/issues/171) | ||
* **dependency-injection:** adjust based on review ([dc756f4](https://github.com/aurelia/dependency-injection/commit/dc756f4)), closes [#171](https://github.com/aurelia/dependency-injection/issues/171) | ||
* **dependency-injection:** ignore ...rest TypeScript metadata ([c093756](https://github.com/aurelia/dependency-injection/commit/c093756)), closes [#171](https://github.com/aurelia/dependency-injection/issues/171) | ||
<a name="1.4.0"></a> | ||
@@ -2,0 +14,0 @@ # [1.4.0](https://github.com/aurelia/dependency-injection/compare/1.3.2...1.4.0) (2018-06-18) |
{ | ||
"name": "aurelia-dependency-injection", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "A lightweight, extensible dependency injection container for JavaScript.", | ||
@@ -18,2 +18,3 @@ "keywords": [ | ||
"main": "dist/commonjs/aurelia-dependency-injection.js", | ||
"module": "dist/es2015/aurelia-dependency-injection.js", | ||
"typings": "dist/aurelia-dependency-injection.d.ts", | ||
@@ -20,0 +21,0 @@ "repository": { |
@@ -11,2 +11,8 @@ import {metadata} from 'aurelia-metadata'; | ||
target.inject = (metadata.getOwn(metadata.paramTypes, target) || _emptyParameters).slice(); | ||
// TypeScript 3.0 metadata for "...rest" gives type "Object" | ||
// if last parameter is "Object", assume it's a ...rest and remove that metadata. | ||
if (target.inject.length > 0 && | ||
target.inject[target.inject.length - 1] === Object) { | ||
target.inject.pop(); | ||
} | ||
} | ||
@@ -13,0 +19,0 @@ }; |
@@ -279,2 +279,219 @@ import './setup'; | ||
}); | ||
it('test variadic arguments (TypeScript metadata)', function() { | ||
const container = new Container(); | ||
const VariadicArg = Object; // TypeScript emits "Object" type for "...rest" param | ||
class Dep$1 {} | ||
class Dep$2 {} | ||
class Dep$3 {} | ||
class Dep$4 {} | ||
class Dep$5 {} | ||
const ParentOneDep = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$1])).on( | ||
class ParentOneDep { | ||
constructor(dep1: Dep$1) { | ||
this.dep1 = dep1; | ||
} | ||
} | ||
) | ||
const ParentTwoDeps = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$1, Dep$2])).on( | ||
class ParentTwoDeps { | ||
constructor(dep1: Dep$1, dep2: Dep$2) { | ||
this.dep1 = dep1; | ||
this.dep2 = dep2; | ||
} | ||
} | ||
) | ||
class ChildZeroDeps$1 extends ParentOneDep {} | ||
class ChildZeroDeps$2 extends ParentTwoDeps {} | ||
const ChildOneDep$1 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$3, VariadicArg])).on( | ||
class ChildOneDep$1 extends ParentOneDep { | ||
constructor(dep3: Dep$3, ...rest) { | ||
super(...rest); | ||
this.dep3 = dep3; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(ChildOneDep$1); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
} | ||
const ChildOneDep$2 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$3, VariadicArg])).on( | ||
class ChildOneDep$2 extends ParentTwoDeps { | ||
constructor(dep3: Dep$3, ...rest) { | ||
super(...rest); | ||
this.dep3 = dep3; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(ChildOneDep$2); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
} | ||
const ChildTwoDeps$1 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$3, Dep$4, VariadicArg])).on( | ||
class ChildTwoDeps$1 extends ParentOneDep { | ||
constructor(dep3: Dep$3, dep4: Dep$4, ...rest) { | ||
super(...rest); | ||
this.dep3 = dep3; | ||
this.dep4 = dep4; | ||
} | ||
} | ||
) | ||
const ChildTwoDeps$2 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$3, Dep$4, VariadicArg])).on( | ||
class ChildTwoDeps$2 extends ParentTwoDeps { | ||
constructor(dep3: Dep$3, dep4: Dep$4, ...rest) { | ||
super(...rest); | ||
this.dep3 = dep3; | ||
this.dep4 = dep4; | ||
} | ||
} | ||
) | ||
class GrandChildZeroDeps$01 extends ChildZeroDeps$1 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$01); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
} | ||
class GrandChildZeroDeps$02 extends ChildZeroDeps$2 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$02); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
} | ||
class GrandChildZeroDeps$11 extends ChildOneDep$1 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$11); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
} | ||
class GrandChildZeroDeps$12 extends ChildOneDep$2 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$12); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
} | ||
class GrandChildZeroDeps$21 extends ChildTwoDeps$1 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$21); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep4).toEqual(jasmine.any(Dep$4)); | ||
} | ||
class GrandChildZeroDeps$22 extends ChildTwoDeps$2 {} | ||
{ | ||
const a = container.get(GrandChildZeroDeps$22); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep4).toEqual(jasmine.any(Dep$4)); | ||
} | ||
const GrandChildOneDep$01 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$01 extends ChildZeroDeps$1 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$01); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
const GrandChildOneDep$02 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$02 extends ChildZeroDeps$2 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$02); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
const GrandChildOneDep$11 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$11 extends ChildOneDep$1 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$11); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
const GrandChildOneDep$12 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$12 extends ChildOneDep$2 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$12); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
const GrandChildOneDep$21 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$21 extends ChildTwoDeps$1 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$21); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep4).toEqual(jasmine.any(Dep$4)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
const GrandChildOneDep$22 = decorators(autoinject(), Reflect.metadata('design:paramtypes', [Dep$5, VariadicArg])).on( | ||
class GrandChildOneDep$22 extends ChildTwoDeps$2 { | ||
constructor(dep5: Dep$5, ...rest) { | ||
super(...rest); | ||
this.dep5 = dep5; | ||
} | ||
} | ||
) | ||
{ | ||
const a = container.get(GrandChildOneDep$22); | ||
expect(a.dep1).toEqual(jasmine.any(Dep$1)); | ||
expect(a.dep2).toEqual(jasmine.any(Dep$2)); | ||
expect(a.dep3).toEqual(jasmine.any(Dep$3)); | ||
expect(a.dep4).toEqual(jasmine.any(Dep$4)); | ||
expect(a.dep5).toEqual(jasmine.any(Dep$5)); | ||
} | ||
}); | ||
}); | ||
@@ -281,0 +498,0 @@ }); |
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
0
378482
50
7364