node-dependency-injection 3.0.0-alpha.7 → 3.0.0-alpha.8

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.
@@ -157,10 +157,13 @@ var Autowire = /*#__PURE__*/function () {
157
157
 
158
158
  if (Class && classDeclaration) {
159
159
  definition = this._getDefinition(classDeclaration, body, parsedFile, Class);
160
- serviceId = this._getServiceIdFromPath(filePath, Class.name);
161
- this.container.setDefinition(serviceId, definition);
162
160
 
163
- this._interfaceImplementations(classDeclaration, body, parsedFile, serviceId);
161
+ if (definition) {
162
+ serviceId = this._getServiceIdFromPath(filePath, Class.name);
163
+ this.container.setDefinition(serviceId, definition);
164
+
165
+ this._interfaceImplementations(classDeclaration, body, parsedFile, serviceId);
166
+ }
164
167
  }
165
168
  }
166
169
  }
@@ -201,34 +204,33 @@ var Autowire = /*#__PURE__*/function () {
201
204
  }, {
202
205
  key: "_getDefinition",
203
206
  value: function _getDefinition(classDeclaration, body, parsedFile, ServiceClass) {
204
- var definition = new _Definition["default"](ServiceClass);
205
- var constructorDeclaration = classDeclaration.declaration.body.body.find(function (method) {
206
- return method.key.name === 'constructor';
207
- });
207
+ try {
208
+ var definition = new _Definition["default"](ServiceClass);
209
+ var constructorDeclaration = classDeclaration.declaration.body.body.find(function (method) {
210
+ return method.key.name === 'constructor';
211
+ });
208
212
 
209
- if (classDeclaration.declaration["abstract"]) {
210
- definition["abstract"] = true;
211
- }
213
+ if (classDeclaration.declaration["abstract"]) {
214
+ definition["abstract"] = true;
215
+ }
212
216
 
213
- if (classDeclaration.declaration.superClass) {
214
- var typeParent = classDeclaration.declaration.superClass.name;
217
+ if (classDeclaration.declaration.superClass) {
218
+ var typeParent = classDeclaration.declaration.superClass.name;
215
219
 
216
- var parentId = this._getIdentifierFromImports(typeParent, body, parsedFile);
220
+ var parentId = this._getIdentifierFromImports(typeParent, body, parsedFile);
217
221
 
218
- if (parentId) {
219
- definition.parent = parentId;
222
+ if (parentId) {
223
+ definition.parent = parentId;
224
+ }
220
225
  }
221
- }
222
-
223
- if (constructorDeclaration) {
224
- var _iterator3 = _createForOfIteratorHelper(constructorDeclaration.value.params),
225
- _step3;
226
226
 
227
- try {
228
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
229
- var parameterDeclaration = _step3.value;
227
+ if (constructorDeclaration) {
228
+ var _iterator3 = _createForOfIteratorHelper(constructorDeclaration.value.params),
229
+ _step3;
230
230
 
231
- try {
231
+ try {
232
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
233
+ var parameterDeclaration = _step3.value;
232
234
  var typeNameForArgument = parameterDeclaration.parameter.typeAnnotation.typeAnnotation.typeName.name;
233
235
 
234
236
  var argumentId = this._getIdentifierFromImports(typeNameForArgument, body, parsedFile);
@@ -236,16 +238,18 @@ var Autowire = /*#__PURE__*/function () {
236
238
  if (argumentId) {
237
239
  definition.addArgument(new _Reference["default"](argumentId), definition["abstract"]);
238
240
  }
239
- } catch (e) {}
241
+ }
242
+ } catch (err) {
243
+ _iterator3.e(err);
244
+ } finally {
245
+ _iterator3.f();
240
246
  }
241
- } catch (err) {
242
- _iterator3.e(err);
243
- } finally {
244
- _iterator3.f();
245
247
  }
246
- }
247
248
 
248
- return definition;
249
+ return definition;
250
+ } catch (e) {
251
+ return null;
252
+ }
249
253
  }
250
254
  }, {
251
255
  key: "_interfaceImplementations",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "node-dependency-injection",
3
- "version": "3.0.0-alpha.7",
3
+ "version": "3.0.0-alpha.8",
4
4
  "description": "The NodeDependencyInjection component allows you to standardize and centralize the way objects are constructed in your application.",
5
5
  "main": "dist/lib/index.js",
6
6
  "directories": {