inversify 4.13.0 → 4.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/.auditignore +2 -0
  2. package/CODE_OF_CONDUCT.md +46 -46
  3. package/LICENSE +22 -22
  4. package/README.md +306 -306
  5. package/amd/annotation/decorator_utils.js +1 -1
  6. package/amd/bindings/binding.js +2 -2
  7. package/amd/container/container.js +7 -8
  8. package/amd/container/container_module.js +3 -3
  9. package/amd/inversify.js +2 -2
  10. package/amd/planning/context.js +2 -2
  11. package/amd/planning/request.js +2 -2
  12. package/amd/planning/target.js +2 -2
  13. package/amd/resolution/resolver.js +4 -4
  14. package/amd/utils/id.js +9 -0
  15. package/appveyor.yml +34 -34
  16. package/dts/bindings/binding.d.ts +1 -1
  17. package/dts/container/container.d.ts +1 -1
  18. package/dts/container/container_module.d.ts +2 -2
  19. package/dts/interfaces/interfaces.d.ts +7 -7
  20. package/dts/inversify.d.ts +1 -1
  21. package/dts/planning/context.d.ts +1 -1
  22. package/dts/planning/request.d.ts +1 -1
  23. package/dts/planning/target.d.ts +1 -1
  24. package/dts/utils/id.d.ts +2 -0
  25. package/dts/utils/template.d.ts +1 -0
  26. package/es/annotation/decorator_utils.js +1 -1
  27. package/es/bindings/binding.js +2 -2
  28. package/es/container/container.js +7 -8
  29. package/es/container/container_module.js +3 -3
  30. package/es/inversify.js +1 -1
  31. package/es/planning/context.js +2 -2
  32. package/es/planning/request.js +2 -2
  33. package/es/planning/target.js +2 -2
  34. package/es/resolution/resolver.js +4 -4
  35. package/es/utils/id.js +5 -0
  36. package/lib/annotation/decorator_utils.js +1 -1
  37. package/lib/bindings/binding.js +2 -2
  38. package/lib/container/container.js +7 -8
  39. package/lib/container/container_module.js +3 -3
  40. package/lib/inversify.js +2 -2
  41. package/lib/planning/context.js +2 -2
  42. package/lib/planning/request.js +2 -2
  43. package/lib/planning/target.js +2 -2
  44. package/lib/resolution/resolver.js +4 -4
  45. package/lib/utils/id.js +7 -0
  46. package/package.json +80 -80
  47. package/amd/utils/guid.js +0 -14
  48. package/es/utils/guid.js +0 -10
  49. package/lib/utils/guid.js +0 -12
@@ -43,7 +43,7 @@ var metadata_reader_1 = require("../planning/metadata_reader");
43
43
  var planner_1 = require("../planning/planner");
44
44
  var resolver_1 = require("../resolution/resolver");
45
45
  var binding_to_syntax_1 = require("../syntax/binding_to_syntax");
46
- var guid_1 = require("../utils/guid");
46
+ var id_1 = require("../utils/id");
47
47
  var serialization_1 = require("../utils/serialization");
48
48
  var container_snapshot_1 = require("./container_snapshot");
49
49
  var lookup_1 = require("./lookup");
@@ -78,7 +78,7 @@ var Container = (function () {
78
78
  defaultScope: options.defaultScope,
79
79
  skipBaseClassChecks: options.skipBaseClassChecks
80
80
  };
81
- this.guid = guid_1.guid();
81
+ this.id = id_1.id();
82
82
  this._bindingDictionary = new lookup_1.Lookup();
83
83
  this._snapshots = [];
84
84
  this._middleware = null;
@@ -109,7 +109,7 @@ var Container = (function () {
109
109
  var getHelpers = this._getContainerModuleHelpersFactory();
110
110
  for (var _a = 0, modules_1 = modules; _a < modules_1.length; _a++) {
111
111
  var currentModule = modules_1[_a];
112
- var containerModuleHelpers = getHelpers(currentModule.guid);
112
+ var containerModuleHelpers = getHelpers(currentModule.id);
113
113
  currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction);
114
114
  }
115
115
  };
@@ -129,7 +129,7 @@ var Container = (function () {
129
129
  case 1:
130
130
  if (!(_a < modules_2.length)) return [3, 4];
131
131
  currentModule = modules_2[_a];
132
- containerModuleHelpers = getHelpers(currentModule.guid);
132
+ containerModuleHelpers = getHelpers(currentModule.id);
133
133
  return [4, currentModule.registry(containerModuleHelpers.bindFunction, containerModuleHelpers.unbindFunction, containerModuleHelpers.isboundFunction, containerModuleHelpers.rebindFunction)];
134
134
  case 2:
135
135
  _b.sent();
@@ -152,7 +152,7 @@ var Container = (function () {
152
152
  return item.moduleId === expected;
153
153
  }; };
154
154
  modules.forEach(function (module) {
155
- var condition = conditionFactory(module.guid);
155
+ var condition = conditionFactory(module.id);
156
156
  _this._bindingDictionary.removeByCondition(condition);
157
157
  });
158
158
  };
@@ -211,7 +211,7 @@ var Container = (function () {
211
211
  this._middleware = snapshot.middleware;
212
212
  };
213
213
  Container.prototype.createChild = function (containerOptions) {
214
- var child = new Container(containerOptions);
214
+ var child = new Container(containerOptions || this.options);
215
215
  child.parent = this;
216
216
  return child;
217
217
  };
@@ -245,9 +245,8 @@ var Container = (function () {
245
245
  return this.getAllTagged(serviceIdentifier, METADATA_KEY.NAMED_TAG, named);
246
246
  };
247
247
  Container.prototype.resolve = function (constructorFunction) {
248
- var tempContainer = new Container();
248
+ var tempContainer = this.createChild();
249
249
  tempContainer.bind(constructorFunction).toSelf();
250
- tempContainer.parent = this;
251
250
  return tempContainer.get(constructorFunction);
252
251
  };
253
252
  Container.prototype._getContainerModuleHelpersFactory = function () {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var guid_1 = require("../utils/guid");
3
+ var id_1 = require("../utils/id");
4
4
  var ContainerModule = (function () {
5
5
  function ContainerModule(registry) {
6
- this.guid = guid_1.guid();
6
+ this.id = id_1.id();
7
7
  this.registry = registry;
8
8
  }
9
9
  return ContainerModule;
@@ -11,7 +11,7 @@ var ContainerModule = (function () {
11
11
  exports.ContainerModule = ContainerModule;
12
12
  var AsyncContainerModule = (function () {
13
13
  function AsyncContainerModule(registry) {
14
- this.guid = guid_1.guid();
14
+ this.id = id_1.id();
15
15
  this.registry = registry;
16
16
  }
17
17
  return AsyncContainerModule;
package/lib/inversify.js CHANGED
@@ -32,8 +32,8 @@ var post_construct_1 = require("./annotation/post_construct");
32
32
  exports.postConstruct = post_construct_1.postConstruct;
33
33
  var metadata_reader_1 = require("./planning/metadata_reader");
34
34
  exports.MetadataReader = metadata_reader_1.MetadataReader;
35
- var guid_1 = require("./utils/guid");
36
- exports.guid = guid_1.guid;
35
+ var id_1 = require("./utils/id");
36
+ exports.id = id_1.id;
37
37
  var decorator_utils_1 = require("./annotation/decorator_utils");
38
38
  exports.decorate = decorator_utils_1.decorate;
39
39
  var constraint_helpers_1 = require("./syntax/constraint_helpers");
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var guid_1 = require("../utils/guid");
3
+ var id_1 = require("../utils/id");
4
4
  var Context = (function () {
5
5
  function Context(container) {
6
- this.guid = guid_1.guid();
6
+ this.id = id_1.id();
7
7
  this.container = container;
8
8
  }
9
9
  Context.prototype.addPlan = function (plan) {
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- var guid_1 = require("../utils/guid");
3
+ var id_1 = require("../utils/id");
4
4
  var Request = (function () {
5
5
  function Request(serviceIdentifier, parentContext, parentRequest, bindings, target) {
6
- this.guid = guid_1.guid();
6
+ this.id = id_1.id();
7
7
  this.serviceIdentifier = serviceIdentifier;
8
8
  this.parentContext = parentContext;
9
9
  this.parentRequest = parentRequest;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var METADATA_KEY = require("../constants/metadata_keys");
4
- var guid_1 = require("../utils/guid");
4
+ var id_1 = require("../utils/id");
5
5
  var metadata_1 = require("./metadata");
6
6
  var queryable_string_1 = require("./queryable_string");
7
7
  var Target = (function () {
8
8
  function Target(type, name, serviceIdentifier, namedOrTagged) {
9
- this.guid = guid_1.guid();
9
+ this.id = id_1.id();
10
10
  this.type = type;
11
11
  this.serviceIdentifier = serviceIdentifier;
12
12
  this.name = new queryable_string_1.QueryableString(name || "");
@@ -47,8 +47,8 @@ var _resolveRequest = function (requestScope) {
47
47
  }
48
48
  if (isRequestSingleton &&
49
49
  requestScope !== null &&
50
- requestScope.has(binding_1.guid)) {
51
- return requestScope.get(binding_1.guid);
50
+ requestScope.has(binding_1.id)) {
51
+ return requestScope.get(binding_1.id);
52
52
  }
53
53
  if (binding_1.type === literal_types_1.BindingTypeEnum.ConstantValue) {
54
54
  result = binding_1.cache;
@@ -84,8 +84,8 @@ var _resolveRequest = function (requestScope) {
84
84
  }
85
85
  if (isRequestSingleton &&
86
86
  requestScope !== null &&
87
- !requestScope.has(binding_1.guid)) {
88
- requestScope.set(binding_1.guid, result);
87
+ !requestScope.has(binding_1.id)) {
88
+ requestScope.set(binding_1.id, result);
89
89
  }
90
90
  return result;
91
91
  }
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var idCounter = 0;
4
+ function id() {
5
+ return idCounter++;
6
+ }
7
+ exports.id = id;
package/package.json CHANGED
@@ -1,80 +1,80 @@
1
- {
2
- "name": "inversify",
3
- "version": "4.13.0",
4
- "description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",
5
- "main": "lib/inversify.js",
6
- "jsnext:main": "es/inversify.js",
7
- "types": "./dts/inversify.d.ts",
8
- "directories": {
9
- "test": "gulp"
10
- },
11
- "scripts": {
12
- "test": "gulp",
13
- "publish-please": "publish-please",
14
- "prepublish": "publish-please guard"
15
- },
16
- "repository": {
17
- "type": "git",
18
- "url": "https://github.com/inversify/InversifyJS.git"
19
- },
20
- "keywords": [
21
- "ioc",
22
- "di",
23
- "javascript",
24
- "typescript",
25
- "node",
26
- "dependency injection",
27
- "dependency inversion",
28
- "inversion of control container"
29
- ],
30
- "author": "Remo H. Jansen",
31
- "license": "MIT",
32
- "bugs": {
33
- "url": "https://github.com/inversify/InversifyJS/issues"
34
- },
35
- "homepage": "http://inversify.io",
36
- "engines": {},
37
- "devDependencies": {
38
- "@types/chai": "4.1.2",
39
- "@types/harmony-proxy": "1.0.29",
40
- "@types/mocha": "5.0.0",
41
- "@types/sinon": "4.3.1",
42
- "bluebird": "3.5.1",
43
- "browserify": "16.2.0",
44
- "chai": "4.1.2",
45
- "del": "3.0.0",
46
- "es6-symbol": "3.1.1",
47
- "gulp": "3.9.1",
48
- "gulp-istanbul": "1.1.3",
49
- "gulp-mocha": "5.0.0",
50
- "gulp-rename": "1.2.2",
51
- "gulp-sourcemaps": "2.6.3",
52
- "gulp-tslint": "8.1.3",
53
- "gulp-typescript": "4.0.2",
54
- "gulp-uglify": "3.0.0",
55
- "harmonize": "2.0.0",
56
- "harmony-proxy": "1.0.1",
57
- "istanbul": "0.4.5",
58
- "karma": "2.0.0",
59
- "karma-chai": "0.1.0",
60
- "karma-chrome-launcher": "2.2.0",
61
- "karma-commonjs": "1.0.0",
62
- "karma-es6-shim": "1.0.0",
63
- "karma-firefox-launcher": "1.1.0",
64
- "karma-ie-launcher": "1.0.0",
65
- "karma-mocha": "1.3.0",
66
- "karma-mocha-reporter": "2.2.5",
67
- "karma-phantomjs-launcher": "1.0.4",
68
- "karma-sinon": "1.0.5",
69
- "mocha": "5.1.0",
70
- "performance-now": "2.1.0",
71
- "publish-please": "2.4.1",
72
- "reflect-metadata": "0.1.12",
73
- "run-sequence": "2.2.1",
74
- "sinon": "5.0.0",
75
- "tslint": "5.9.1",
76
- "typescript": "2.6.2",
77
- "vinyl-source-stream": "2.0.0",
78
- "vinyl-buffer": "1.0.1"
79
- }
80
- }
1
+ {
2
+ "name": "inversify",
3
+ "version": "4.14.0",
4
+ "description": "A powerful and lightweight inversion of control container for JavaScript and Node.js apps powered by TypeScript.",
5
+ "main": "lib/inversify.js",
6
+ "jsnext:main": "es/inversify.js",
7
+ "types": "./dts/inversify.d.ts",
8
+ "directories": {
9
+ "test": "gulp"
10
+ },
11
+ "scripts": {
12
+ "test": "gulp",
13
+ "publish-please": "publish-please",
14
+ "prepublish": "publish-please guard"
15
+ },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/inversify/InversifyJS.git"
19
+ },
20
+ "keywords": [
21
+ "ioc",
22
+ "di",
23
+ "javascript",
24
+ "typescript",
25
+ "node",
26
+ "dependency injection",
27
+ "dependency inversion",
28
+ "inversion of control container"
29
+ ],
30
+ "author": "Remo H. Jansen",
31
+ "license": "MIT",
32
+ "bugs": {
33
+ "url": "https://github.com/inversify/InversifyJS/issues"
34
+ },
35
+ "homepage": "http://inversify.io",
36
+ "engines": {},
37
+ "devDependencies": {
38
+ "@types/chai": "4.1.4",
39
+ "@types/harmony-proxy": "1.0.29",
40
+ "@types/mocha": "5.2.3",
41
+ "@types/sinon": "5.0.3",
42
+ "bluebird": "3.5.2",
43
+ "browserify": "16.2.3",
44
+ "chai": "4.1.2",
45
+ "del": "3.0.0",
46
+ "es6-symbol": "3.1.1",
47
+ "gulp": "3.9.1",
48
+ "gulp-istanbul": "1.1.3",
49
+ "gulp-mocha": "6.0.0",
50
+ "gulp-rename": "1.4.0",
51
+ "gulp-sourcemaps": "2.6.3",
52
+ "gulp-tslint": "8.1.3",
53
+ "gulp-typescript": "4.0.2",
54
+ "gulp-uglify": "3.0.1",
55
+ "harmonize": "2.0.0",
56
+ "harmony-proxy": "1.0.1",
57
+ "istanbul": "0.4.5",
58
+ "karma": "3.0.0",
59
+ "karma-chai": "0.1.0",
60
+ "karma-chrome-launcher": "2.2.0",
61
+ "karma-commonjs": "1.0.0",
62
+ "karma-es6-shim": "1.0.0",
63
+ "karma-firefox-launcher": "1.1.0",
64
+ "karma-ie-launcher": "1.0.0",
65
+ "karma-mocha": "1.3.0",
66
+ "karma-mocha-reporter": "2.2.5",
67
+ "karma-phantomjs-launcher": "1.0.4",
68
+ "karma-sinon": "1.0.5",
69
+ "mocha": "5.2.0",
70
+ "performance-now": "2.1.0",
71
+ "publish-please": "4.0.1",
72
+ "reflect-metadata": "0.1.12",
73
+ "run-sequence": "2.2.1",
74
+ "sinon": "6.0.1",
75
+ "tslint": "5.9.1",
76
+ "typescript": "^2.8.3",
77
+ "vinyl-buffer": "1.0.1",
78
+ "vinyl-source-stream": "2.0.0"
79
+ }
80
+ }
package/amd/utils/guid.js DELETED
@@ -1,14 +0,0 @@
1
- define(["require", "exports"], function (require, exports) {
2
- "use strict";
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- function guid() {
5
- function s4() {
6
- return Math.floor((Math.random() + 1) * 0x10000)
7
- .toString(16)
8
- .substring(1);
9
- }
10
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" +
11
- s4() + "-" + s4() + s4() + s4();
12
- }
13
- exports.guid = guid;
14
- });
package/es/utils/guid.js DELETED
@@ -1,10 +0,0 @@
1
- function guid() {
2
- function s4() {
3
- return Math.floor((Math.random() + 1) * 0x10000)
4
- .toString(16)
5
- .substring(1);
6
- }
7
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" +
8
- s4() + "-" + s4() + s4() + s4();
9
- }
10
- export { guid };
package/lib/utils/guid.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- function guid() {
4
- function s4() {
5
- return Math.floor((Math.random() + 1) * 0x10000)
6
- .toString(16)
7
- .substring(1);
8
- }
9
- return s4() + s4() + "-" + s4() + "-" + s4() + "-" +
10
- s4() + "-" + s4() + s4() + s4();
11
- }
12
- exports.guid = guid;