node-dependency-injection 3.0.0-alpha.8 → 3.0.0-beta.1

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.
@@ -19,6 +19,8 @@ var _path = _interopRequireDefault(require("path"));
19
19
 
20
20
  var _fs = _interopRequireDefault(require("fs"));
21
21
 
22
+ var _json = _interopRequireDefault(require("json5"));
23
+
22
24
  var _typescriptEstree = require("@typescript-eslint/typescript-estree");
23
25
 
24
26
  var _Definition = _interopRequireDefault(require("./Definition"));
@@ -41,7 +43,7 @@ var Autowire = /*#__PURE__*/function () {
41
43
 
42
44
  try {
43
45
  this._tsConfigFullPath = tsConfigFullPath || _path["default"].join(process.cwd(), 'tsconfig.json');
44
- this._tsConfigPaths = require(this._tsConfigFullPath).compilerOptions.paths;
46
+ this._tsConfigPaths = _json["default"].parse(_fs["default"].readFileSync(this._tsConfigFullPath, 'utf-8')).compilerOptions.paths;
45
47
  } catch (e) {
46
48
  this._tsConfigPaths = null;
47
49
  }
@@ -126,46 +128,48 @@ var Autowire = /*#__PURE__*/function () {
126
128
  })
127
129
  }, {
128
130
  key: "_getServiceIdFromPath",
129
- value: function _getServiceIdFromPath(path, type) {
130
- var extension = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '.ts';
131
- return path.replace(/\//g, '_').replace(extension, '').replace('@', '_').concat("_".concat(type));
132
- }
133
- /**
134
- * @returns {void}
135
- */
131
+ value: function () {
132
+ var _getServiceIdFromPath2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(path, type) {
133
+ var extension,
134
+ _args2 = arguments;
135
+ return _regenerator["default"].wrap(function _callee$(_context2) {
136
+ while (1) {
137
+ switch (_context2.prev = _context2.next) {
138
+ case 0:
139
+ extension = _args2.length > 2 && _args2[2] !== undefined ? _args2[2] : '.ts';
140
+ return _context2.abrupt("return", path.replace(/\//g, '_').replace(extension, '').replace('@', '_').concat("_".concat(type)));
141
+
142
+ case 2:
143
+ case "end":
144
+ return _context2.stop();
145
+ }
146
+ }
147
+ }, _callee);
148
+ }));
149
+
150
+ function _getServiceIdFromPath(_x, _x2) {
151
+ return _getServiceIdFromPath2.apply(this, arguments);
152
+ }
136
153
 
154
+ return _getServiceIdFromPath;
155
+ }()
137
156
  }, {
138
157
  key: "process",
139
158
  value: function () {
140
- var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
141
- var _iterator2, _step2, filePath, parsedFile, _this$_getClassDeclar, classDeclaration, body, Class, definition, serviceId;
159
+ var _process = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
160
+ var promises, _iterator2, _step2, filePath;
142
161
 
143
- return _regenerator["default"].wrap(function _callee$(_context2) {
162
+ return _regenerator["default"].wrap(function _callee2$(_context3) {
144
163
  while (1) {
145
- switch (_context2.prev = _context2.next) {
164
+ switch (_context3.prev = _context3.next) {
146
165
  case 0:
166
+ promises = [];
147
167
  _iterator2 = _createForOfIteratorHelper(this._walkSync(this._rootDirectory));
148
168
 
149
169
  try {
150
170
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
151
171
  filePath = _step2.value;
152
- parsedFile = _path["default"].parse(filePath);
153
-
154
- if (parsedFile.ext === '.ts') {
155
- _this$_getClassDeclar = this._getClassDeclaration(filePath), classDeclaration = _this$_getClassDeclar.classDeclaration, body = _this$_getClassDeclar.body;
156
- Class = require(filePath)["default"];
157
-
158
- if (Class && classDeclaration) {
159
- definition = this._getDefinition(classDeclaration, body, parsedFile, Class);
160
-
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
- }
167
- }
168
- }
172
+ promises.push(this._executeFilePath(filePath));
169
173
  }
170
174
  } catch (err) {
171
175
  _iterator2.e(err);
@@ -173,12 +177,15 @@ var Autowire = /*#__PURE__*/function () {
173
177
  _iterator2.f();
174
178
  }
175
179
 
176
- case 2:
180
+ _context3.next = 5;
181
+ return Promise.all(promises);
182
+
183
+ case 5:
177
184
  case "end":
178
- return _context2.stop();
185
+ return _context3.stop();
179
186
  }
180
187
  }
181
- }, _callee, this);
188
+ }, _callee2, this);
182
189
  }));
183
190
 
184
191
  function process() {
@@ -187,133 +194,469 @@ var Autowire = /*#__PURE__*/function () {
187
194
 
188
195
  return process;
189
196
  }()
197
+ }, {
198
+ key: "_executeFilePath",
199
+ value: function () {
200
+ var _executeFilePath2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(filePath) {
201
+ var parsedFile, _yield$this$_getClass, classDeclaration, body, Class, definition, serviceId;
202
+
203
+ return _regenerator["default"].wrap(function _callee3$(_context4) {
204
+ while (1) {
205
+ switch (_context4.prev = _context4.next) {
206
+ case 0:
207
+ parsedFile = _path["default"].parse(filePath);
208
+
209
+ if (!(parsedFile.ext !== '.ts')) {
210
+ _context4.next = 3;
211
+ break;
212
+ }
213
+
214
+ return _context4.abrupt("return");
215
+
216
+ case 3:
217
+ _context4.next = 5;
218
+ return this._getClassDeclaration(filePath);
219
+
220
+ case 5:
221
+ _yield$this$_getClass = _context4.sent;
222
+ classDeclaration = _yield$this$_getClass.classDeclaration;
223
+ body = _yield$this$_getClass.body;
224
+
225
+ if (classDeclaration) {
226
+ _context4.next = 10;
227
+ break;
228
+ }
229
+
230
+ return _context4.abrupt("return");
231
+
232
+ case 10:
233
+ Class = require(filePath)["default"];
234
+
235
+ if (Class) {
236
+ _context4.next = 13;
237
+ break;
238
+ }
239
+
240
+ return _context4.abrupt("return");
241
+
242
+ case 13:
243
+ _context4.next = 15;
244
+ return this._getDefinition(classDeclaration, body, parsedFile, Class);
245
+
246
+ case 15:
247
+ definition = _context4.sent;
248
+
249
+ if (definition) {
250
+ _context4.next = 18;
251
+ break;
252
+ }
253
+
254
+ return _context4.abrupt("return");
255
+
256
+ case 18:
257
+ _context4.next = 20;
258
+ return this._getServiceIdFromPath(filePath, Class.name);
259
+
260
+ case 20:
261
+ serviceId = _context4.sent;
262
+ this.container.setDefinition(serviceId, definition);
263
+ _context4.next = 24;
264
+ return this._interfaceImplementations(classDeclaration, body, parsedFile, serviceId);
265
+
266
+ case 24:
267
+ case "end":
268
+ return _context4.stop();
269
+ }
270
+ }
271
+ }, _callee3, this);
272
+ }));
273
+
274
+ function _executeFilePath(_x3) {
275
+ return _executeFilePath2.apply(this, arguments);
276
+ }
277
+
278
+ return _executeFilePath;
279
+ }()
190
280
  }, {
191
281
  key: "_getClassDeclaration",
192
- value: function _getClassDeclaration(filePath) {
193
- var sourceCode = _fs["default"].readFileSync(filePath, 'utf8');
194
-
195
- var body = (0, _typescriptEstree.parse)(sourceCode).body;
196
- var classDeclaration = body.find(function (declaration) {
197
- return declaration.type === 'ExportDefaultDeclaration';
198
- });
199
- return {
200
- classDeclaration: classDeclaration,
201
- body: body
202
- };
203
- }
282
+ value: function () {
283
+ var _getClassDeclaration2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee4(filePath) {
284
+ var sourceCode, body, classDeclaration;
285
+ return _regenerator["default"].wrap(function _callee4$(_context5) {
286
+ while (1) {
287
+ switch (_context5.prev = _context5.next) {
288
+ case 0:
289
+ sourceCode = _fs["default"].readFileSync(filePath, 'utf8');
290
+ body = (0, _typescriptEstree.parse)(sourceCode).body;
291
+ classDeclaration = body.find(function (declaration) {
292
+ return declaration.type === 'ExportDefaultDeclaration';
293
+ });
294
+ return _context5.abrupt("return", {
295
+ classDeclaration: classDeclaration,
296
+ body: body
297
+ });
298
+
299
+ case 4:
300
+ case "end":
301
+ return _context5.stop();
302
+ }
303
+ }
304
+ }, _callee4);
305
+ }));
306
+
307
+ function _getClassDeclaration(_x4) {
308
+ return _getClassDeclaration2.apply(this, arguments);
309
+ }
310
+
311
+ return _getClassDeclaration;
312
+ }()
204
313
  }, {
205
314
  key: "_getDefinition",
206
- value: function _getDefinition(classDeclaration, body, parsedFile, ServiceClass) {
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
- });
212
-
213
- if (classDeclaration.declaration["abstract"]) {
214
- definition["abstract"] = true;
215
- }
315
+ value: function () {
316
+ var _getDefinition2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee5(classDeclaration, body, parsedFile, ServiceClass) {
317
+ var definition, constructorParams, _iterator3, _step3, parameterDeclaration, typeNameForArgument, argumentId;
318
+
319
+ return _regenerator["default"].wrap(function _callee5$(_context6) {
320
+ while (1) {
321
+ switch (_context6.prev = _context6.next) {
322
+ case 0:
323
+ _context6.prev = 0;
324
+ definition = new _Definition["default"](ServiceClass);
325
+ _context6.next = 4;
326
+ return this._getConstructorParamsByDefinition(definition, classDeclaration, body, parsedFile);
327
+
328
+ case 4:
329
+ constructorParams = _context6.sent;
330
+ _iterator3 = _createForOfIteratorHelper(constructorParams);
331
+ _context6.prev = 6;
332
+
333
+ _iterator3.s();
334
+
335
+ case 8:
336
+ if ((_step3 = _iterator3.n()).done) {
337
+ _context6.next = 19;
338
+ break;
339
+ }
340
+
341
+ parameterDeclaration = _step3.value;
342
+ typeNameForArgument = parameterDeclaration.parameter.typeAnnotation.typeAnnotation.typeName.name;
343
+ _context6.next = 13;
344
+ return this._getIdentifierFromImports(typeNameForArgument, body, parsedFile);
345
+
346
+ case 13:
347
+ argumentId = _context6.sent;
348
+
349
+ if (argumentId) {
350
+ _context6.next = 16;
351
+ break;
352
+ }
353
+
354
+ return _context6.abrupt("continue", 17);
355
+
356
+ case 16:
357
+ definition.addArgument(new _Reference["default"](argumentId), definition["abstract"]);
358
+
359
+ case 17:
360
+ _context6.next = 8;
361
+ break;
362
+
363
+ case 19:
364
+ _context6.next = 24;
365
+ break;
366
+
367
+ case 21:
368
+ _context6.prev = 21;
369
+ _context6.t0 = _context6["catch"](6);
370
+
371
+ _iterator3.e(_context6.t0);
372
+
373
+ case 24:
374
+ _context6.prev = 24;
375
+
376
+ _iterator3.f();
377
+
378
+ return _context6.finish(24);
379
+
380
+ case 27:
381
+ return _context6.abrupt("return", definition);
382
+
383
+ case 30:
384
+ _context6.prev = 30;
385
+ _context6.t1 = _context6["catch"](0);
386
+
387
+ case 32:
388
+ return _context6.abrupt("return", null);
216
389
 
217
- if (classDeclaration.declaration.superClass) {
218
- var typeParent = classDeclaration.declaration.superClass.name;
390
+ case 33:
391
+ case "end":
392
+ return _context6.stop();
393
+ }
394
+ }
395
+ }, _callee5, this, [[0, 30], [6, 21, 24, 27]]);
396
+ }));
397
+
398
+ function _getDefinition(_x5, _x6, _x7, _x8) {
399
+ return _getDefinition2.apply(this, arguments);
400
+ }
401
+
402
+ return _getDefinition;
403
+ }()
404
+ }, {
405
+ key: "_getConstructorParamsByDefinition",
406
+ value: function () {
407
+ var _getConstructorParamsByDefinition2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee6(definition, classDeclaration, body, parsedFile) {
408
+ var constructorDeclaration, constructorParams;
409
+ return _regenerator["default"].wrap(function _callee6$(_context7) {
410
+ while (1) {
411
+ switch (_context7.prev = _context7.next) {
412
+ case 0:
413
+ constructorDeclaration = classDeclaration.declaration.body.body.find(function (method) {
414
+ return method.key.name === 'constructor';
415
+ });
219
416
 
220
- var parentId = this._getIdentifierFromImports(typeParent, body, parsedFile);
417
+ if (classDeclaration.declaration["abstract"]) {
418
+ definition["abstract"] = true;
419
+ }
420
+
421
+ _context7.next = 4;
422
+ return this._parentDefinition(classDeclaration, body, parsedFile, definition);
423
+
424
+ case 4:
425
+ constructorParams = constructorDeclaration ? constructorDeclaration.value.params : [];
426
+ return _context7.abrupt("return", constructorParams);
221
427
 
222
- if (parentId) {
223
- definition.parent = parentId;
428
+ case 6:
429
+ case "end":
430
+ return _context7.stop();
431
+ }
224
432
  }
225
- }
433
+ }, _callee6, this);
434
+ }));
435
+
436
+ function _getConstructorParamsByDefinition(_x9, _x10, _x11, _x12) {
437
+ return _getConstructorParamsByDefinition2.apply(this, arguments);
438
+ }
439
+
440
+ return _getConstructorParamsByDefinition;
441
+ }()
442
+ }, {
443
+ key: "_parentDefinition",
444
+ value: function () {
445
+ var _parentDefinition2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(classDeclaration, body, parsedFile, definition) {
446
+ var typeParent, parentId;
447
+ return _regenerator["default"].wrap(function _callee7$(_context8) {
448
+ while (1) {
449
+ switch (_context8.prev = _context8.next) {
450
+ case 0:
451
+ if (!classDeclaration.declaration.superClass) {
452
+ _context8.next = 6;
453
+ break;
454
+ }
226
455
 
227
- if (constructorDeclaration) {
228
- var _iterator3 = _createForOfIteratorHelper(constructorDeclaration.value.params),
229
- _step3;
456
+ typeParent = classDeclaration.declaration.superClass.name;
457
+ _context8.next = 4;
458
+ return this._getIdentifierFromImports(typeParent, body, parsedFile);
230
459
 
231
- try {
232
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
233
- var parameterDeclaration = _step3.value;
234
- var typeNameForArgument = parameterDeclaration.parameter.typeAnnotation.typeAnnotation.typeName.name;
460
+ case 4:
461
+ parentId = _context8.sent;
235
462
 
236
- var argumentId = this._getIdentifierFromImports(typeNameForArgument, body, parsedFile);
463
+ if (parentId) {
464
+ definition.parent = parentId;
465
+ }
237
466
 
238
- if (argumentId) {
239
- definition.addArgument(new _Reference["default"](argumentId), definition["abstract"]);
240
- }
467
+ case 6:
468
+ case "end":
469
+ return _context8.stop();
241
470
  }
242
- } catch (err) {
243
- _iterator3.e(err);
244
- } finally {
245
- _iterator3.f();
246
471
  }
247
- }
472
+ }, _callee7, this);
473
+ }));
248
474
 
249
- return definition;
250
- } catch (e) {
251
- return null;
475
+ function _parentDefinition(_x13, _x14, _x15, _x16) {
476
+ return _parentDefinition2.apply(this, arguments);
252
477
  }
253
- }
478
+
479
+ return _parentDefinition;
480
+ }()
254
481
  }, {
255
482
  key: "_interfaceImplementations",
256
- value: function _interfaceImplementations(classDeclaration, body, parsedFile, serviceId) {
257
- if (classDeclaration.declaration["implements"]) {
258
- var _iterator4 = _createForOfIteratorHelper(classDeclaration.declaration["implements"]),
259
- _step4;
483
+ value: function () {
484
+ var _interfaceImplementations2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee8(classDeclaration, body, parsedFile, serviceId) {
485
+ var _classDeclaration$dec;
486
+
487
+ var implementations, _iterator4, _step4, implement, interfaceType, aliasId;
488
+
489
+ return _regenerator["default"].wrap(function _callee8$(_context9) {
490
+ while (1) {
491
+ switch (_context9.prev = _context9.next) {
492
+ case 0:
493
+ implementations = (_classDeclaration$dec = classDeclaration.declaration["implements"]) !== null && _classDeclaration$dec !== void 0 ? _classDeclaration$dec : [];
494
+ _iterator4 = _createForOfIteratorHelper(implementations);
495
+ _context9.prev = 2;
496
+
497
+ _iterator4.s();
498
+
499
+ case 4:
500
+ if ((_step4 = _iterator4.n()).done) {
501
+ _context9.next = 15;
502
+ break;
503
+ }
504
+
505
+ implement = _step4.value;
506
+ interfaceType = implement.expression.name;
507
+ _context9.next = 9;
508
+ return this._getIdentifierFromImports(interfaceType, body, parsedFile);
509
+
510
+ case 9:
511
+ aliasId = _context9.sent;
512
+
513
+ if (!(!aliasId || this.container.hasAlias(aliasId))) {
514
+ _context9.next = 12;
515
+ break;
516
+ }
517
+
518
+ return _context9.abrupt("continue", 13);
519
+
520
+ case 12:
521
+ this.container.setAlias(aliasId, serviceId);
522
+
523
+ case 13:
524
+ _context9.next = 4;
525
+ break;
526
+
527
+ case 15:
528
+ _context9.next = 20;
529
+ break;
530
+
531
+ case 17:
532
+ _context9.prev = 17;
533
+ _context9.t0 = _context9["catch"](2);
534
+
535
+ _iterator4.e(_context9.t0);
260
536
 
261
- try {
262
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
263
- var implement = _step4.value;
264
- var interfaceType = implement.expression.name;
537
+ case 20:
538
+ _context9.prev = 20;
265
539
 
266
- var aliasId = this._getIdentifierFromImports(interfaceType, body, parsedFile);
540
+ _iterator4.f();
267
541
 
268
- if (aliasId && this.container.hasAlias(aliasId) === false) {
269
- this.container.setAlias(aliasId, serviceId);
542
+ return _context9.finish(20);
543
+
544
+ case 23:
545
+ case "end":
546
+ return _context9.stop();
270
547
  }
271
548
  }
272
- } catch (err) {
273
- _iterator4.e(err);
274
- } finally {
275
- _iterator4.f();
276
- }
549
+ }, _callee8, this, [[2, 17, 20, 23]]);
550
+ }));
551
+
552
+ function _interfaceImplementations(_x17, _x18, _x19, _x20) {
553
+ return _interfaceImplementations2.apply(this, arguments);
277
554
  }
278
- }
555
+
556
+ return _interfaceImplementations;
557
+ }()
279
558
  }, {
280
559
  key: "_getIdentifierFromImports",
281
- value: function _getIdentifierFromImports(type, body, parsedFile) {
282
- try {
283
- var rootDir = parsedFile.dir;
284
- var relativeImportForImplement = body.find(function (declaration) {
285
- if (declaration.specifiers) {
286
- return declaration.specifiers.find(function (specifier) {
287
- return specifier.local.name === type;
288
- });
289
- }
560
+ value: function () {
561
+ var _getIdentifierFromImports2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee9(type, body, parsedFile) {
562
+ var _this$_tsConfigPaths, rootDir, relativeImportForImplement, configPaths, pathConfig, tsConfigPath, tsRelativePath, parsedTsConfigPath, absolutePathImportForImplement;
563
+
564
+ return _regenerator["default"].wrap(function _callee9$(_context10) {
565
+ while (1) {
566
+ switch (_context10.prev = _context10.next) {
567
+ case 0:
568
+ _context10.prev = 0;
569
+ rootDir = parsedFile.dir;
570
+ _context10.next = 4;
571
+ return this._getRelativeImport(body, type);
572
+
573
+ case 4:
574
+ relativeImportForImplement = _context10.sent;
575
+ configPaths = (_this$_tsConfigPaths = this._tsConfigPaths) !== null && _this$_tsConfigPaths !== void 0 ? _this$_tsConfigPaths : [];
576
+ _context10.t0 = _regenerator["default"].keys(configPaths);
577
+
578
+ case 7:
579
+ if ((_context10.t1 = _context10.t0()).done) {
580
+ _context10.next = 19;
581
+ break;
582
+ }
583
+
584
+ pathConfig = _context10.t1.value;
585
+ tsConfigPath = pathConfig.replace(/\*/g, '');
586
+ tsRelativePath = this._tsConfigPaths[pathConfig][0];
587
+ tsRelativePath = tsRelativePath.replace(/\*/g, '');
290
588
 
291
- return null;
292
- }).source.value;
589
+ if (relativeImportForImplement.includes(tsConfigPath)) {
590
+ _context10.next = 14;
591
+ break;
592
+ }
593
+
594
+ return _context10.abrupt("continue", 7);
595
+
596
+ case 14:
597
+ relativeImportForImplement = relativeImportForImplement.replace(tsConfigPath, tsRelativePath);
598
+ parsedTsConfigPath = _path["default"].parse(this._tsConfigFullPath);
599
+ rootDir = parsedTsConfigPath.dir;
600
+ _context10.next = 7;
601
+ break;
293
602
 
294
- if (this._tsConfigPaths) {
295
- for (var pathConfig in this._tsConfigPaths) {
296
- var tsConfigPath = pathConfig.replace(/\*/g, '');
297
- var tsRelativePath = this._tsConfigPaths[pathConfig][0];
298
- tsRelativePath = tsRelativePath.replace(/\*/g, '');
603
+ case 19:
604
+ absolutePathImportForImplement = _path["default"].join(rootDir, relativeImportForImplement);
605
+ return _context10.abrupt("return", this._getServiceIdFromPath(absolutePathImportForImplement, type));
299
606
 
300
- if (relativeImportForImplement.includes(tsConfigPath)) {
301
- relativeImportForImplement = relativeImportForImplement.replace(tsConfigPath, tsRelativePath);
607
+ case 23:
608
+ _context10.prev = 23;
609
+ _context10.t2 = _context10["catch"](0);
302
610
 
303
- var parsedTsConfigPath = _path["default"].parse(this._tsConfigFullPath);
611
+ case 25:
612
+ return _context10.abrupt("return", null);
304
613
 
305
- rootDir = parsedTsConfigPath.dir;
614
+ case 26:
615
+ case "end":
616
+ return _context10.stop();
306
617
  }
307
618
  }
308
- }
619
+ }, _callee9, this, [[0, 23]]);
620
+ }));
621
+
622
+ function _getIdentifierFromImports(_x21, _x22, _x23) {
623
+ return _getIdentifierFromImports2.apply(this, arguments);
624
+ }
625
+
626
+ return _getIdentifierFromImports;
627
+ }()
628
+ }, {
629
+ key: "_getRelativeImport",
630
+ value: function () {
631
+ var _getRelativeImport2 = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee10(body, type) {
632
+ return _regenerator["default"].wrap(function _callee10$(_context11) {
633
+ while (1) {
634
+ switch (_context11.prev = _context11.next) {
635
+ case 0:
636
+ return _context11.abrupt("return", body.find(function (declaration) {
637
+ if (declaration.specifiers) {
638
+ return declaration.specifiers.find(function (specifier) {
639
+ return specifier.local.name === type;
640
+ });
641
+ }
642
+
643
+ return null;
644
+ }).source.value);
309
645
 
310
- var absolutePathImportForImplement = _path["default"].join(rootDir, relativeImportForImplement);
646
+ case 1:
647
+ case "end":
648
+ return _context11.stop();
649
+ }
650
+ }
651
+ }, _callee10);
652
+ }));
311
653
 
312
- return this._getServiceIdFromPath(absolutePathImportForImplement, type);
313
- } catch (e) {
314
- return null;
654
+ function _getRelativeImport(_x24, _x25) {
655
+ return _getRelativeImport2.apply(this, arguments);
315
656
  }
316
- }
657
+
658
+ return _getRelativeImport;
659
+ }()
317
660
  }]);
318
661
  return Autowire;
319
662
  }();