Comparing version 4.9.0 to 4.10.0
@@ -1,6 +0,19 @@ | ||
define(["require", "exports", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, METADATA_KEY, metadata_1, decorator_utils_1) { | ||
define(["require", "exports", "../constants/error_msgs", "../constants/metadata_keys", "../planning/metadata", "./decorator_utils"], function (require, exports, error_msgs_1, METADATA_KEY, metadata_1, decorator_utils_1) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var LazyServiceIdentifer = (function () { | ||
function LazyServiceIdentifer(cb) { | ||
this._cb = cb; | ||
} | ||
LazyServiceIdentifer.prototype.unwrap = function () { | ||
return this._cb(); | ||
}; | ||
return LazyServiceIdentifer; | ||
}()); | ||
exports.LazyServiceIdentifer = LazyServiceIdentifer; | ||
function inject(serviceIdentifier) { | ||
return function (target, targetKey, index) { | ||
if (serviceIdentifier === undefined) { | ||
throw new Error(error_msgs_1.UNDEFINED_INJECT_ANNOTATION(target.name)); | ||
} | ||
var metadata = new metadata_1.Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier); | ||
@@ -7,0 +20,0 @@ if (typeof index === "number") { |
@@ -13,2 +13,7 @@ define(["require", "exports"], function (require, exports) { | ||
exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; | ||
exports.UNDEFINED_INJECT_ANNOTATION = function (name) { | ||
return "@inject called with undefined this could mean that the class " + name + " has " + | ||
"a circular dependency problem. You can use a LazyServiceIdentifer to " + | ||
"overcome this limitation."; | ||
}; | ||
exports.CIRCULAR_DEPENDENCY = "Circular dependency found:"; | ||
@@ -15,0 +20,0 @@ exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; |
@@ -14,2 +14,3 @@ define(["require", "exports", "./constants/metadata_keys", "./container/container", "./constants/literal_types", "./container/container_module", "./annotation/injectable", "./annotation/tagged", "./annotation/named", "./annotation/inject", "./annotation/optional", "./annotation/unmanaged", "./annotation/multi_inject", "./annotation/target_name", "./annotation/post_construct", "./planning/metadata_reader", "./utils/guid", "./annotation/decorator_utils", "./syntax/constraint_helpers", "./utils/serialization", "./utils/binding_utils"], function (require, exports, keys, container_1, literal_types_1, container_module_1, injectable_1, tagged_1, named_1, inject_1, optional_1, unmanaged_1, multi_inject_1, target_name_1, post_construct_1, metadata_reader_1, guid_1, decorator_utils_1, constraint_helpers_1, serialization_1, binding_utils_1) { | ||
exports.inject = inject_1.inject; | ||
exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer; | ||
exports.optional = optional_1.optional; | ||
@@ -16,0 +17,0 @@ exports.unmanaged = unmanaged_1.unmanaged; |
@@ -1,2 +0,2 @@ | ||
define(["require", "exports", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../utils/serialization", "./target"], function (require, exports, ERROR_MSGS, literal_types_1, METADATA_KEY, serialization_1, target_1) { | ||
define(["require", "exports", "../annotation/inject", "../constants/error_msgs", "../constants/literal_types", "../constants/metadata_keys", "../utils/serialization", "./target"], function (require, exports, inject_1, ERROR_MSGS, literal_types_1, METADATA_KEY, serialization_1, target_1) { | ||
"use strict"; | ||
@@ -39,2 +39,5 @@ Object.defineProperty(exports, "__esModule", { value: true }); | ||
serviceIdentifier = (injectIdentifier) ? (injectIdentifier) : serviceIdentifier; | ||
if (serviceIdentifier instanceof inject_1.LazyServiceIdentifer) { | ||
serviceIdentifier = serviceIdentifier.unwrap(); | ||
} | ||
if (isManaged) { | ||
@@ -41,0 +44,0 @@ var isObject = serviceIdentifier === Object; |
import { interfaces } from "../interfaces/interfaces"; | ||
declare function inject(serviceIdentifier: interfaces.ServiceIdentifier<any>): (target: any, targetKey: string, index?: number | undefined) => void; | ||
export declare type ServiceIdentifierOrFunc = interfaces.ServiceIdentifier<any> | LazyServiceIdentifer; | ||
export declare class LazyServiceIdentifer<T = any> { | ||
private _cb; | ||
constructor(cb: () => interfaces.ServiceIdentifier<T>); | ||
unwrap(): string | symbol | interfaces.Newable<T> | interfaces.Abstract<T>; | ||
} | ||
declare function inject(serviceIdentifier: ServiceIdentifierOrFunc): (target: any, targetKey: string, index?: number | undefined) => void; | ||
export { inject }; |
@@ -10,2 +10,3 @@ export declare const DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; | ||
export declare const MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; | ||
export declare const UNDEFINED_INJECT_ANNOTATION: (name: string) => string; | ||
export declare const CIRCULAR_DEPENDENCY = "Circular dependency found:"; | ||
@@ -12,0 +13,0 @@ export declare const NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; |
@@ -9,3 +9,3 @@ import * as keys from "./constants/metadata_keys"; | ||
export { named } from "./annotation/named"; | ||
export { inject } from "./annotation/inject"; | ||
export { inject, LazyServiceIdentifer } from "./annotation/inject"; | ||
export { optional } from "./annotation/optional"; | ||
@@ -12,0 +12,0 @@ export { unmanaged } from "./annotation/unmanaged"; |
@@ -0,6 +1,20 @@ | ||
import { UNDEFINED_INJECT_ANNOTATION } from "../constants/error_msgs"; | ||
import * as METADATA_KEY from "../constants/metadata_keys"; | ||
import { Metadata } from "../planning/metadata"; | ||
import { tagParameter, tagProperty } from "./decorator_utils"; | ||
var LazyServiceIdentifer = (function () { | ||
function LazyServiceIdentifer(cb) { | ||
this._cb = cb; | ||
} | ||
LazyServiceIdentifer.prototype.unwrap = function () { | ||
return this._cb(); | ||
}; | ||
return LazyServiceIdentifer; | ||
}()); | ||
export { LazyServiceIdentifer }; | ||
function inject(serviceIdentifier) { | ||
return function (target, targetKey, index) { | ||
if (serviceIdentifier === undefined) { | ||
throw new Error(UNDEFINED_INJECT_ANNOTATION(target.name)); | ||
} | ||
var metadata = new Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier); | ||
@@ -7,0 +21,0 @@ if (typeof index === "number") { |
@@ -10,2 +10,7 @@ export var DUPLICATED_INJECTABLE_DECORATOR = "Cannot apply @injectable decorator multiple times."; | ||
export var MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; | ||
export var UNDEFINED_INJECT_ANNOTATION = function (name) { | ||
return "@inject called with undefined this could mean that the class " + name + " has " + | ||
"a circular dependency problem. You can use a LazyServiceIdentifer to " + | ||
"overcome this limitation."; | ||
}; | ||
export var CIRCULAR_DEPENDENCY = "Circular dependency found:"; | ||
@@ -12,0 +17,0 @@ export var NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; |
@@ -9,3 +9,3 @@ import * as keys from "./constants/metadata_keys"; | ||
export { named } from "./annotation/named"; | ||
export { inject } from "./annotation/inject"; | ||
export { inject, LazyServiceIdentifer } from "./annotation/inject"; | ||
export { optional } from "./annotation/optional"; | ||
@@ -12,0 +12,0 @@ export { unmanaged } from "./annotation/unmanaged"; |
@@ -0,1 +1,2 @@ | ||
import { LazyServiceIdentifer } from "../annotation/inject"; | ||
import * as ERROR_MSGS from "../constants/error_msgs"; | ||
@@ -40,2 +41,5 @@ import { TargetTypeEnum } from "../constants/literal_types"; | ||
serviceIdentifier = (injectIdentifier) ? (injectIdentifier) : serviceIdentifier; | ||
if (serviceIdentifier instanceof LazyServiceIdentifer) { | ||
serviceIdentifier = serviceIdentifier.unwrap(); | ||
} | ||
if (isManaged) { | ||
@@ -42,0 +46,0 @@ var isObject = serviceIdentifier === Object; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var error_msgs_1 = require("../constants/error_msgs"); | ||
var METADATA_KEY = require("../constants/metadata_keys"); | ||
var metadata_1 = require("../planning/metadata"); | ||
var decorator_utils_1 = require("./decorator_utils"); | ||
var LazyServiceIdentifer = (function () { | ||
function LazyServiceIdentifer(cb) { | ||
this._cb = cb; | ||
} | ||
LazyServiceIdentifer.prototype.unwrap = function () { | ||
return this._cb(); | ||
}; | ||
return LazyServiceIdentifer; | ||
}()); | ||
exports.LazyServiceIdentifer = LazyServiceIdentifer; | ||
function inject(serviceIdentifier) { | ||
return function (target, targetKey, index) { | ||
if (serviceIdentifier === undefined) { | ||
throw new Error(error_msgs_1.UNDEFINED_INJECT_ANNOTATION(target.name)); | ||
} | ||
var metadata = new metadata_1.Metadata(METADATA_KEY.INJECT_TAG, serviceIdentifier); | ||
@@ -9,0 +23,0 @@ if (typeof index === "number") { |
@@ -12,2 +12,7 @@ "use strict"; | ||
exports.MISSING_INJECT_ANNOTATION = "Missing required @inject or @multiInject annotation in:"; | ||
exports.UNDEFINED_INJECT_ANNOTATION = function (name) { | ||
return "@inject called with undefined this could mean that the class " + name + " has " + | ||
"a circular dependency problem. You can use a LazyServiceIdentifer to " + | ||
"overcome this limitation."; | ||
}; | ||
exports.CIRCULAR_DEPENDENCY = "Circular dependency found:"; | ||
@@ -14,0 +19,0 @@ exports.NOT_IMPLEMENTED = "Sorry, this feature is not fully implemented yet."; |
@@ -21,2 +21,3 @@ "use strict"; | ||
exports.inject = inject_1.inject; | ||
exports.LazyServiceIdentifer = inject_1.LazyServiceIdentifer; | ||
var optional_1 = require("./annotation/optional"); | ||
@@ -23,0 +24,0 @@ exports.optional = optional_1.optional; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var inject_1 = require("../annotation/inject"); | ||
var ERROR_MSGS = require("../constants/error_msgs"); | ||
@@ -43,2 +44,5 @@ var literal_types_1 = require("../constants/literal_types"); | ||
serviceIdentifier = (injectIdentifier) ? (injectIdentifier) : serviceIdentifier; | ||
if (serviceIdentifier instanceof inject_1.LazyServiceIdentifer) { | ||
serviceIdentifier = serviceIdentifier.unwrap(); | ||
} | ||
if (isManaged) { | ||
@@ -45,0 +49,0 @@ var isObject = serviceIdentifier === Object; |
{ | ||
"name": "inversify", | ||
"version": "4.9.0", | ||
"version": "4.10.0", | ||
"description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.", | ||
@@ -38,8 +38,8 @@ "main": "lib/inversify.js", | ||
"devDependencies": { | ||
"@types/chai": "4.0.10", | ||
"@types/chai": "4.1.2", | ||
"@types/harmony-proxy": "1.0.29", | ||
"@types/mocha": " 2.2.44", | ||
"@types/sinon": "4.1.2", | ||
"@types/mocha": "2.2.47", | ||
"@types/sinon": "4.1.3", | ||
"bluebird": "3.5.1", | ||
"browserify": "14.5.0", | ||
"browserify": "15.2.0", | ||
"chai": "4.1.2", | ||
@@ -49,8 +49,8 @@ "del": "3.0.0", | ||
"gulp": "3.9.1", | ||
"gulp-istanbul": "1.1.2", | ||
"gulp-mocha": "3.0.1", | ||
"gulp-istanbul": "1.1.3", | ||
"gulp-mocha": "5.0.0", | ||
"gulp-rename": "1.2.2", | ||
"gulp-sourcemaps": "2.6.1", | ||
"gulp-sourcemaps": "2.6.3", | ||
"gulp-tslint": "8.1.2", | ||
"gulp-typescript": "3.2.3", | ||
"gulp-typescript": "4.0.0-alpha.2", | ||
"gulp-uglify": "3.0.0", | ||
@@ -60,3 +60,3 @@ "harmonize": "2.0.0", | ||
"istanbul": "0.4.5", | ||
"karma": "1.7.1", | ||
"karma": "2.0.0", | ||
"karma-chai": "0.1.0", | ||
@@ -72,13 +72,13 @@ "karma-chrome-launcher": "2.2.0", | ||
"karma-sinon": "1.0.5", | ||
"mocha": "4.0.1", | ||
"mocha": "5.0.0", | ||
"performance-now": "2.1.0", | ||
"publish-please": "2.3.1", | ||
"reflect-metadata": "0.1.10", | ||
"run-sequence": "2.2.0", | ||
"sinon": "4.1.3", | ||
"reflect-metadata": "0.1.12", | ||
"run-sequence": "2.2.1", | ||
"sinon": "4.2.2", | ||
"tslint": "5.8.0", | ||
"typescript": "2.6.2", | ||
"vinyl-buffer": "1.0.0", | ||
"vinyl-source-stream": "1.1.0" | ||
"vinyl-source-stream": "2.0.0", | ||
"vinyl-buffer": "1.0.1" | ||
} | ||
} |
@@ -57,3 +57,3 @@ # InversifyJS | ||
[<img src="https://avatars0.githubusercontent.com/u/6154722?s=200&v=4" width="100" />](https://opensource.microsoft.com/) [<img src="https://pbs.twimg.com/profile_images/827249559046909954/SyaBPcH8_400x400.jpg" width="100" />](http://acia.aon.com/index.php/home/) [<img src="https://avatars3.githubusercontent.com/u/114767?s=200&v=4" width="100" />](https://www.lonelyplanet.com/) [<img src="https://avatars0.githubusercontent.com/u/25283328?s=200&v=4" width="100" />](https://jincor.com/) [<img src="https://avatars1.githubusercontent.com/u/1957282?s=200&v=4" width="100" />](https://www.web-computing.de/) [<img src="https://avatars1.githubusercontent.com/u/17648048?s=200&v=4" width="100" />](https://dcos.io/) [<img src="https://avatars0.githubusercontent.com/u/16970371?s=200&v=4" width="100" />](https://typefox.io/) [<img src="https://avatars0.githubusercontent.com/u/18010308?s=200&v=4" width="100" />](https://code4.ro/) [<img src="https://user-images.githubusercontent.com/10656223/33888109-fae0852e-df43-11e7-97f6-9db543da0bde.png" width="100">](http://www.baidu.com/) [<img src="https://avatars2.githubusercontent.com/u/8085382?s=200&v=4" width="100" />](https://www.imdada.cn/) [<img src="https://avatars2.githubusercontent.com/u/29682426?s=200&v=4" width="100" />](https://www.ato.gov.au/) [<img src="https://avatars1.githubusercontent.com/u/14963540?s=200&v=4" width="100" />](https://www.kaneoh.com/) [<img src="https://avatars0.githubusercontent.com/u/26021686?s=200&v=4" width="100" />](https://particl.io/) [<img src="https://avatars2.githubusercontent.com/u/24523195?s=200&v=4" width="100" />](https://slackmap.com/) [<img src="https://avatars3.githubusercontent.com/u/16556899?s=200&v=4" width="100" />](https://www.go1.com/) [<img src="https://avatars3.githubusercontent.com/u/23475730?s=200&v=4" width="100" />](http://www.stellwagengroup.com/stellwagen-technology/) [<img src="https://avatars1.githubusercontent.com/u/15262567?s=200&v=4" width="100" />](https://www.edrlab.org/) [<img src="https://avatars1.githubusercontent.com/u/10072104?s=200&v=4" width="100" />](https://www.goodgamestudios.com/) [<img src="https://avatars2.githubusercontent.com/u/13613760?s=200&v=4" width="100" />](https://freshfox.at/) [<img src="https://avatars1.githubusercontent.com/u/864482?s=200&v=4" width="100" />](https://schubergphilis.com/) | ||
[<img src="https://avatars0.githubusercontent.com/u/6154722?s=200&v=4" width="100" />](https://opensource.microsoft.com/) [<img src="https://pbs.twimg.com/profile_images/827249559046909954/SyaBPcH8_400x400.jpg" width="100" />](http://acia.aon.com/index.php/home/) [<img src="https://avatars3.githubusercontent.com/u/114767?s=200&v=4" width="100" />](https://www.lonelyplanet.com/) [<img src="https://avatars0.githubusercontent.com/u/25283328?s=200&v=4" width="100" />](https://jincor.com/) [<img src="https://avatars1.githubusercontent.com/u/1957282?s=200&v=4" width="100" />](https://www.web-computing.de/) [<img src="https://avatars1.githubusercontent.com/u/17648048?s=200&v=4" width="100" />](https://dcos.io/) [<img src="https://avatars0.githubusercontent.com/u/16970371?s=200&v=4" width="100" />](https://typefox.io/) [<img src="https://avatars0.githubusercontent.com/u/18010308?s=200&v=4" width="100" />](https://code4.ro/) [<img src="https://user-images.githubusercontent.com/10656223/33888109-fae0852e-df43-11e7-97f6-9db543da0bde.png" width="100">](http://www.baidu.com/) [<img src="https://avatars2.githubusercontent.com/u/8085382?s=200&v=4" width="100" />](https://www.imdada.cn/) [<img src="https://avatars2.githubusercontent.com/u/17041151?s=200&v=4" width="100" />](https://www.ato.gov.au/) [<img src="https://avatars1.githubusercontent.com/u/14963540?s=200&v=4" width="100" />](https://www.kaneoh.com/) [<img src="https://avatars0.githubusercontent.com/u/26021686?s=200&v=4" width="100" />](https://particl.io/) [<img src="https://avatars2.githubusercontent.com/u/24523195?s=200&v=4" width="100" />](https://slackmap.com/) [<img src="https://avatars3.githubusercontent.com/u/16556899?s=200&v=4" width="100" />](https://www.go1.com/) [<img src="https://avatars3.githubusercontent.com/u/23475730?s=200&v=4" width="100" />](http://www.stellwagengroup.com/stellwagen-technology/) [<img src="https://avatars1.githubusercontent.com/u/15262567?s=200&v=4" width="100" />](https://www.edrlab.org/) [<img src="https://avatars1.githubusercontent.com/u/10072104?s=200&v=4" width="100" />](https://www.goodgamestudios.com/) [<img src="https://avatars2.githubusercontent.com/u/13613760?s=200&v=4" width="100" />](https://freshfox.at/) [<img src="https://avatars1.githubusercontent.com/u/864482?s=200&v=4" width="100" />](https://schubergphilis.com/) | ||
@@ -60,0 +60,0 @@ ## Installation |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
310840
6175