@tsed/components-scan 7.0.0-beta.1 → 7.0.0-beta.12

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 (88) hide show
  1. package/lib/cjs/{data → __mock__}/Test1.js +0 -0
  2. package/lib/cjs/__mock__/Test1.js.map +1 -0
  3. package/lib/cjs/{data → __mock__}/Test2.js +0 -0
  4. package/lib/cjs/__mock__/Test2.js.map +1 -0
  5. package/lib/cjs/__mock__/controllers/rest/TestCtrl.js +12 -0
  6. package/lib/cjs/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  7. package/lib/cjs/__mock__/module1/Module1.js +19 -0
  8. package/lib/cjs/__mock__/module1/Module1.js.map +1 -0
  9. package/lib/cjs/__mock__/module1/controllers/M1Ctrl1.js +17 -0
  10. package/lib/cjs/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  11. package/lib/cjs/__mock__/module1/services/M1Service.js +17 -0
  12. package/lib/cjs/__mock__/module1/services/M1Service.js.map +1 -0
  13. package/lib/cjs/__mock__/module1/submodule/SubModule.js +15 -0
  14. package/lib/cjs/__mock__/module1/submodule/SubModule.js.map +1 -0
  15. package/lib/cjs/__mock__/module1/submodule/SubService.js +12 -0
  16. package/lib/cjs/__mock__/module1/submodule/SubService.js.map +1 -0
  17. package/lib/cjs/__mock__/module2/Module2.js +18 -0
  18. package/lib/cjs/__mock__/module2/Module2.js.map +1 -0
  19. package/lib/cjs/__mock__/module2/controllers/M2Ctrl.js +12 -0
  20. package/lib/cjs/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  21. package/lib/cjs/importComponents.js +9 -0
  22. package/lib/cjs/importComponents.js.map +1 -1
  23. package/lib/cjs/importFiles.js +8 -12
  24. package/lib/cjs/importFiles.js.map +1 -1
  25. package/lib/cjs/importProviders.js +38 -17
  26. package/lib/cjs/importProviders.js.map +1 -1
  27. package/lib/cjs/index.js +9 -5
  28. package/lib/cjs/index.js.map +1 -1
  29. package/lib/cjs/isTsEnv.js +9 -1
  30. package/lib/cjs/isTsEnv.js.map +1 -1
  31. package/lib/cjs/normalizePath.js +3 -2
  32. package/lib/cjs/normalizePath.js.map +1 -1
  33. package/lib/cjs/package.json +3 -0
  34. package/lib/esm/{data → __mock__}/Test1.js +0 -0
  35. package/lib/esm/__mock__/Test1.js.map +1 -0
  36. package/lib/esm/{data → __mock__}/Test2.js +0 -0
  37. package/lib/esm/__mock__/Test2.js.map +1 -0
  38. package/lib/esm/__mock__/controllers/rest/TestCtrl.js +9 -0
  39. package/lib/esm/__mock__/controllers/rest/TestCtrl.js.map +1 -0
  40. package/lib/esm/__mock__/module1/Module1.js +16 -0
  41. package/lib/esm/__mock__/module1/Module1.js.map +1 -0
  42. package/lib/esm/__mock__/module1/controllers/M1Ctrl1.js +14 -0
  43. package/lib/esm/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
  44. package/lib/esm/__mock__/module1/services/M1Service.js +14 -0
  45. package/lib/esm/__mock__/module1/services/M1Service.js.map +1 -0
  46. package/lib/esm/__mock__/module1/submodule/SubModule.js +12 -0
  47. package/lib/esm/__mock__/module1/submodule/SubModule.js.map +1 -0
  48. package/lib/esm/__mock__/module1/submodule/SubService.js +9 -0
  49. package/lib/esm/__mock__/module1/submodule/SubService.js.map +1 -0
  50. package/lib/esm/__mock__/module2/Module2.js +15 -0
  51. package/lib/esm/__mock__/module2/Module2.js.map +1 -0
  52. package/lib/esm/__mock__/module2/controllers/M2Ctrl.js +9 -0
  53. package/lib/esm/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
  54. package/lib/esm/cleanGlobPatterns.js +2 -2
  55. package/lib/esm/importComponents.js +10 -1
  56. package/lib/esm/importComponents.js.map +1 -1
  57. package/lib/esm/importFiles.js +4 -12
  58. package/lib/esm/importFiles.js.map +1 -1
  59. package/lib/esm/importProviders.js +38 -17
  60. package/lib/esm/importProviders.js.map +1 -1
  61. package/lib/esm/index.js +9 -5
  62. package/lib/esm/index.js.map +1 -1
  63. package/lib/esm/isTsEnv.js +9 -1
  64. package/lib/esm/isTsEnv.js.map +1 -1
  65. package/lib/esm/normalizePath.js +1 -1
  66. package/lib/esm/normalizePath.js.map +1 -1
  67. package/lib/esm/package.json +3 -0
  68. package/lib/types/{data → __mock__}/Test1.d.ts +0 -0
  69. package/lib/types/{data → __mock__}/Test2.d.ts +0 -0
  70. package/lib/types/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
  71. package/lib/types/__mock__/module1/Module1.d.ts +2 -0
  72. package/lib/types/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
  73. package/lib/types/__mock__/module1/services/M1Service.d.ts +5 -0
  74. package/lib/types/__mock__/module1/submodule/SubModule.d.ts +2 -0
  75. package/lib/types/__mock__/module1/submodule/SubService.d.ts +2 -0
  76. package/lib/types/__mock__/module2/Module2.d.ts +2 -0
  77. package/lib/types/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
  78. package/lib/types/importComponents.d.ts +6 -0
  79. package/lib/types/importProviders.d.ts +2 -6
  80. package/lib/types/index.d.ts +6 -2
  81. package/lib/types/isTsEnv.d.ts +1 -2
  82. package/package.json +14 -11
  83. package/readme.md +2 -3
  84. package/tsconfig.compile.esm.json +2 -13
  85. package/lib/cjs/data/Test1.js.map +0 -1
  86. package/lib/cjs/data/Test2.js.map +0 -1
  87. package/lib/esm/data/Test1.js.map +0 -1
  88. package/lib/esm/data/Test2.js.map +0 -1
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test1.js","sourceRoot":"","sources":["../../../src/__mock__/Test1.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAa,KAAK;CAAG;AAArB,sBAAqB","sourcesContent":["export const value1 = \"value\";\n\nexport class Test1 {}\n"]}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test2.js","sourceRoot":"","sources":["../../../src/__mock__/Test2.ts"],"names":[],"mappings":";;;AAAa,QAAA,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAa,KAAK;CAAG;AAArB,sBAAqB","sourcesContent":["export const value2 = \"value\";\n\nexport class Test2 {}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TestCtrl = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ let TestCtrl = class TestCtrl {
7
+ };
8
+ TestCtrl = tslib_1.__decorate([
9
+ (0, di_1.Controller)("/root")
10
+ ], TestCtrl);
11
+ exports.TestCtrl = TestCtrl;
12
+ //# sourceMappingURL=TestCtrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestCtrl.js","sourceRoot":"","sources":["../../../../../src/__mock__/controllers/rest/TestCtrl.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAAG,CAAA;AAAX,QAAQ;IADpB,IAAA,eAAU,EAAC,OAAO,CAAC;GACP,QAAQ,CAAG;AAAX,4BAAQ","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/root\")\nexport class TestCtrl {}\n"]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Module1 = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const SubModule_1 = require("./submodule/SubModule");
6
+ const di_1 = require("@tsed/di");
7
+ const M1Ctrl1_1 = require("./controllers/M1Ctrl1");
8
+ let Module1 = class Module1 {
9
+ };
10
+ Module1 = tslib_1.__decorate([
11
+ (0, di_1.Module)({
12
+ mount: {
13
+ "/m1": [M1Ctrl1_1.M1Ctrl1]
14
+ },
15
+ imports: [SubModule_1.SubModule]
16
+ })
17
+ ], Module1);
18
+ exports.Module1 = Module1;
19
+ //# sourceMappingURL=Module1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module1.js","sourceRoot":"","sources":["../../../../src/__mock__/module1/Module1.ts"],"names":[],"mappings":";;;;AAAA,qDAAgD;AAChD,iCAAgC;AAChC,mDAA8C;AAQ9C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,KAAK,EAAE,CAAC,iBAAO,CAAC;SACjB;QACD,OAAO,EAAE,CAAC,qBAAS,CAAC;KACrB,CAAC;GACW,OAAO,CAAG;AAAV,0BAAO","sourcesContent":["import {SubModule} from \"./submodule/SubModule\";\nimport {Module} from \"@tsed/di\";\nimport {M1Ctrl1} from \"./controllers/M1Ctrl1\";\n\n@Module({\n mount: {\n \"/m1\": [M1Ctrl1]\n },\n imports: [SubModule]\n})\nexport class Module1 {}\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.M1Ctrl1 = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ const M1Service_1 = require("../services/M1Service");
7
+ let M1Ctrl1 = class M1Ctrl1 {
8
+ constructor(service) {
9
+ this.service = service;
10
+ }
11
+ };
12
+ M1Ctrl1 = tslib_1.__decorate([
13
+ (0, di_1.Controller)("/m1"),
14
+ tslib_1.__metadata("design:paramtypes", [M1Service_1.M1Service])
15
+ ], M1Ctrl1);
16
+ exports.M1Ctrl1 = M1Ctrl1;
17
+ //# sourceMappingURL=M1Ctrl1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M1Ctrl1.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/controllers/M1Ctrl1.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AACpC,qDAAgD;AAGhD,IAAa,OAAO,GAApB,MAAa,OAAO;IAClB,YAAmB,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;CAC1C,CAAA;AAFY,OAAO;IADnB,IAAA,eAAU,EAAC,KAAK,CAAC;6CAEY,qBAAS;GAD1B,OAAO,CAEnB;AAFY,0BAAO","sourcesContent":["import {Controller} from \"@tsed/di\";\nimport {M1Service} from \"../services/M1Service\";\n\n@Controller(\"/m1\")\nexport class M1Ctrl1 {\n constructor(public service: M1Service) {}\n}\n"]}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.M1Service = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ const SubService_1 = require("../submodule/SubService");
7
+ let M1Service = class M1Service {
8
+ constructor(subService) {
9
+ this.subService = subService;
10
+ }
11
+ };
12
+ M1Service = tslib_1.__decorate([
13
+ (0, di_1.Injectable)(),
14
+ tslib_1.__metadata("design:paramtypes", [SubService_1.SubService])
15
+ ], M1Service);
16
+ exports.M1Service = M1Service;
17
+ //# sourceMappingURL=M1Service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M1Service.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/services/M1Service.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AACpC,wDAAmD;AAGnD,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;CAC9C,CAAA;AAFY,SAAS;IADrB,IAAA,eAAU,GAAE;6CAEoB,uBAAU;GAD9B,SAAS,CAErB;AAFY,8BAAS","sourcesContent":["import {Injectable} from \"@tsed/di\";\nimport {SubService} from \"../submodule/SubService\";\n\n@Injectable()\nexport class M1Service {\n constructor(public subService: SubService) {}\n}\n"]}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubModule = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ const SubService_1 = require("./SubService");
7
+ let SubModule = class SubModule {
8
+ };
9
+ SubModule = tslib_1.__decorate([
10
+ (0, di_1.Module)({
11
+ imports: [SubService_1.SubService]
12
+ })
13
+ ], SubModule);
14
+ exports.SubModule = SubModule;
15
+ //# sourceMappingURL=SubModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubModule.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/submodule/SubModule.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,6CAAwC;AAKxC,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAHrB,IAAA,WAAM,EAAC;QACN,OAAO,EAAE,CAAC,uBAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG;AAAZ,8BAAS","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {SubService} from \"./SubService\";\n\n@Module({\n imports: [SubService]\n})\nexport class SubModule {}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubService = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ let SubService = class SubService {
7
+ };
8
+ SubService = tslib_1.__decorate([
9
+ (0, di_1.Injectable)()
10
+ ], SubService);
11
+ exports.SubService = SubService;
12
+ //# sourceMappingURL=SubService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubService.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/submodule/SubService.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IADtB,IAAA,eAAU,GAAE;GACA,UAAU,CAAG;AAAb,gCAAU","sourcesContent":["import {Injectable} from \"@tsed/di\";\n\n@Injectable()\nexport class SubService {}\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Module2 = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ const M2Ctrl_1 = require("./controllers/M2Ctrl");
7
+ let Module2 = class Module2 {
8
+ };
9
+ Module2 = tslib_1.__decorate([
10
+ (0, di_1.Module)({
11
+ mount: {
12
+ "/mod2": [M2Ctrl_1.M2Ctrl]
13
+ },
14
+ imports: []
15
+ })
16
+ ], Module2);
17
+ exports.Module2 = Module2;
18
+ //# sourceMappingURL=Module2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module2.js","sourceRoot":"","sources":["../../../../src/__mock__/module2/Module2.ts"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAChC,iDAA4C;AAQ5C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,IAAA,WAAM,EAAC;QACN,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,eAAM,CAAC;SAClB;QACD,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,OAAO,CAAG;AAAV,0BAAO","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {M2Ctrl} from \"./controllers/M2Ctrl\";\n\n@Module({\n mount: {\n \"/mod2\": [M2Ctrl]\n },\n imports: []\n})\nexport class Module2 {}\n"]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.M2Ctrl = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const di_1 = require("@tsed/di");
6
+ let M2Ctrl = class M2Ctrl {
7
+ };
8
+ M2Ctrl = tslib_1.__decorate([
9
+ (0, di_1.Controller)("/m2")
10
+ ], M2Ctrl);
11
+ exports.M2Ctrl = M2Ctrl;
12
+ //# sourceMappingURL=M2Ctrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M2Ctrl.js","sourceRoot":"","sources":["../../../../../src/__mock__/module2/controllers/M2Ctrl.ts"],"names":[],"mappings":";;;;AAAA,iCAAoC;AAGpC,IAAa,MAAM,GAAnB,MAAa,MAAM;CAAG,CAAA;AAAT,MAAM;IADlB,IAAA,eAAU,EAAC,KAAK,CAAC;GACL,MAAM,CAAG;AAAT,wBAAM","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/m2\")\nexport class M2Ctrl {}\n"]}
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.importComponents = exports.mapConfiguration = void 0;
4
4
  const core_1 = require("@tsed/core");
5
5
  const importFiles_1 = require("./importFiles");
6
+ /**
7
+ * @deprecated
8
+ */
6
9
  async function resolveSymbols(item, excludes, disableComponentsScan = false) {
7
10
  if ((0, core_1.isClass)(item)) {
8
11
  return [item];
@@ -14,6 +17,9 @@ async function resolveSymbols(item, excludes, disableComponentsScan = false) {
14
17
  /* istanbul ignore next */
15
18
  return [];
16
19
  }
20
+ /**
21
+ * @deprecated
22
+ */
17
23
  function mapConfiguration(config) {
18
24
  if ((0, core_1.isArray)(config)) {
19
25
  return config.map((value) => {
@@ -31,6 +37,9 @@ function mapConfiguration(config) {
31
37
  }, []);
32
38
  }
33
39
  exports.mapConfiguration = mapConfiguration;
40
+ /**
41
+ * @deprecated
42
+ */
34
43
  async function importComponents(config, excludes, disableComponentsScan = false) {
35
44
  if (!config) {
36
45
  return [];
@@ -1 +1 @@
1
- {"version":3,"file":"importComponents.js","sourceRoot":"","sources":["../../src/importComponents.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAC5C,+CAA0C;AAE1C,KAAK,UAAU,cAAc,CAAC,IAAS,EAAE,QAAkB,EAAE,qBAAqB,GAAG,KAAK;IACxF,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IACD,0BAA0B;IAC1B,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACpC;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAgB,gBAAgB,CAAC,MAAW;IAC1C,IAAI,IAAA,cAAO,EAAC,MAAM,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,GAAG,CAAC,C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,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AA1BD,4CA0BC","sourcesContent":["import {isArray, isClass} from \"@tsed/core\";\nimport {importFiles} from \"./importFiles\";\n\nasync function resolveSymbols(item: any, excludes: string[], disableComponentsScan = false) {\n if (isClass(item)) {\n return [item];\n }\n /* istanbul ignore else */\n if (!disableComponentsScan) {\n return importFiles(item, excludes);\n }\n\n /* istanbul ignore next */\n return [];\n}\n\nexport function mapConfiguration(config: any): {endpoint?: string; values: any[]}[] {\n if (isArray(config)) {\n return config.map((value: any) => {\n return {\n values: [].concat(value)\n };\n });\n }\n\n return Object.keys(config).reduce((list: any[], key: string) => {\n list.push({\n endpoint: key,\n values: [].concat(config[key])\n });\n\n return list;\n }, []);\n}\n\nexport async function importComponents(\n config: any,\n excludes: string[],\n disableComponentsScan = false\n): Promise<{token: string; route?: string}[]> {\n if (!config) {\n return [];\n }\n\n config = mapConfiguration(config);\n\n const promises: any = [];\n\n for (const option of config) {\n promises.push(\n ...option.values.map(async (value: any) => {\n const symbols = await resolveSymbols(value, excludes, disableComponentsScan);\n\n return symbols.filter(isClass).map((symbol) => ({token: symbol, route: option.endpoint}));\n })\n );\n }\n\n const result: {token: string; route?: string}[][] = await Promise.all(promises);\n\n return result.flat();\n}\n"]}
1
+ {"version":3,"file":"importComponents.js","sourceRoot":"","sources":["../../src/importComponents.ts"],"names":[],"mappings":";;;AAAA,qCAA4C;AAC5C,+CAA0C;AAE1C;;GAEG;AACH,KAAK,UAAU,cAAc,CAAC,IAAS,EAAE,QAAkB,EAAE,qBAAqB,GAAG,KAAK;IACxF,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IACD,0BAA0B;IAC1B,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,IAAA,yBAAW,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACpC;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ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AAQ,EAAC,CAAC,CAAC,CAAC;QAC5F,CAAC,CAAC,CACH,CAAC;KACH;IAED,MAAM,MAAM,GAAwC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEhF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AA1BD,4CA0BC","sourcesContent":["import {isArray, isClass} from \"@tsed/core\";\nimport {importFiles} from \"./importFiles\";\n\n/**\n * @deprecated\n */\nasync function resolveSymbols(item: any, excludes: string[], disableComponentsScan = false) {\n if (isClass(item)) {\n return [item];\n }\n /* istanbul ignore else */\n if (!disableComponentsScan) {\n return importFiles(item, excludes);\n }\n\n /* istanbul ignore next */\n return [];\n}\n\n/**\n * @deprecated\n */\nexport function mapConfiguration(config: any): {endpoint?: string; values: any[]}[] {\n if (isArray(config)) {\n return config.map((value: any) => {\n return {\n values: [].concat(value)\n };\n });\n }\n\n return Object.keys(config).reduce((list: any[], key: string) => {\n list.push({\n endpoint: key,\n values: [].concat(config[key])\n });\n\n return list;\n }, []);\n}\n\n/**\n * @deprecated\n */\nexport async function importComponents(\n config: any,\n excludes: string[],\n disableComponentsScan = false\n): Promise<{token: string; route?: string}[]> {\n if (!config) {\n return [];\n }\n\n config = mapConfiguration(config);\n\n const promises: any = [];\n\n for (const option of config) {\n promises.push(\n ...option.values.map(async (value: any) => {\n const symbols = await resolveSymbols(value, excludes, disableComponentsScan);\n\n return symbols.filter(isClass).map((symbol) => ({token: symbol, route: option.endpoint}));\n })\n );\n }\n\n const result: {token: string; route?: string}[][] = await Promise.all(promises);\n\n return result.flat();\n}\n"]}
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -26,19 +30,11 @@ async function importFiles(patterns, exclude) {
26
30
  const { default: globby } = await Promise.resolve().then(() => __importStar(require("globby")));
27
31
  const files = await globby((0, cleanGlobPatterns_1.cleanGlobPatterns)(patterns, exclude));
28
32
  const symbols = [];
29
- for (const file of files) {
33
+ for (const file of files.sort((a, b) => (a < b ? -1 : 1))) {
30
34
  if (!file.endsWith(".d.ts")) {
31
35
  // prevent .d.ts import if the global pattern isn't correctly configured
32
- try {
33
- const exports = await (0, core_1.importPackage)(file);
34
- Object.keys(exports).forEach((key) => symbols.push(exports[key]));
35
- }
36
- catch (er) {
37
- // istanbul ignore next
38
- console.error(er);
39
- // istanbul ignore next
40
- process.exit(1);
41
- }
36
+ const exports = await (0, core_1.importPackage)(file);
37
+ Object.keys(exports).forEach((key) => symbols.push(exports[key]));
42
38
  }
43
39
  }
44
40
  return symbols;
@@ -1 +1 @@
1
- {"version":3,"file":"importFiles.js","sourceRoot":"","sources":["../../src/importFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyC;AACzC,2DAAsD;AAE/C,KAAK,UAAU,WAAW,CAAC,QAA2B,EAAE,OAAiB;IAC9E,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,wDAAa,QAAQ,GAAC,CAAC;IACjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAA,qCAAiB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,MAAM,OAAO,GAAU,EAAE,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC3B,wEAAwE;YACxE,IAAI;gBACF,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;gBAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;aACnE;YAAC,OAAO,EAAE,EAAE;gBACX,uBAAuB;gBACvB,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBAClB,uBAAuB;gBACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACjB;SACF;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AArBD,kCAqBC","sourcesContent":["import {importPackage} from \"@tsed/core\";\nimport {cleanGlobPatterns} from \"./cleanGlobPatterns\";\n\nexport async function importFiles(patterns: string | string[], exclude: string[]): Promise<any[]> {\n const {default: globby} = await import(\"globby\");\n const files = await globby(cleanGlobPatterns(patterns, exclude));\n const symbols: any[] = [];\n\n for (const file of files) {\n if (!file.endsWith(\".d.ts\")) {\n // prevent .d.ts import if the global pattern isn't correctly configured\n try {\n const exports = await importPackage(file);\n Object.keys(exports).forEach((key) => symbols.push(exports[key]));\n } catch (er) {\n // istanbul ignore next\n console.error(er);\n // istanbul ignore next\n process.exit(1);\n }\n }\n }\n\n return symbols;\n}\n"]}
1
+ {"version":3,"file":"importFiles.js","sourceRoot":"","sources":["../../src/importFiles.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyC;AACzC,2DAAsD;AAE/C,KAAK,UAAU,WAAW,CAAC,QAA2B,EAAE,OAAiB;IAC9E,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,wDAAa,QAAQ,GAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,IAAA,qCAAiB,EAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;IACjE,MAAM,OAAO,GAAU,EAAE,CAAC;IAE1B,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;QACzD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE;YAC3B,wEAAwE;YACxE,MAAM,OAAO,GAAG,MAAM,IAAA,oBAAa,EAAC,IAAI,CAAC,CAAC;YAC1C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;SACnE;KACF;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAfD,kCAeC","sourcesContent":["import {importPackage} from \"@tsed/core\";\nimport {cleanGlobPatterns} from \"./cleanGlobPatterns\";\n\nexport async function importFiles(patterns: string | string[], exclude: string[]): Promise<any[]> {\n const {default: globby} = await import(\"globby\");\n\n const files = await globby(cleanGlobPatterns(patterns, exclude));\n const symbols: any[] = [];\n\n for (const file of files.sort((a, b) => (a < b ? -1 : 1))) {\n if (!file.endsWith(\".d.ts\")) {\n // prevent .d.ts import if the global pattern isn't correctly configured\n const exports = await importPackage(file);\n Object.keys(exports).forEach((key) => symbols.push(exports[key]));\n }\n }\n\n return symbols;\n}\n"]}
@@ -2,28 +2,49 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.importProviders = void 0;
4
4
  const di_1 = require("@tsed/di");
5
- const importComponents_1 = require("./importComponents");
6
- async function recursiveImports(providers, settings, properties) {
7
- const { exclude = [] } = settings;
8
- const promises = providers
9
- .map(({ token }) => di_1.GlobalProviders.get(token))
10
- .filter((provider) => (provider === null || provider === void 0 ? void 0 : provider.type) === di_1.ProviderType.MODULE && provider.configuration)
11
- .map((provider) => importProviders({ exclude, ...provider.configuration }, properties));
12
- return (await Promise.all(promises)).flat();
5
+ const core_1 = require("@tsed/core");
6
+ const importFiles_1 = require("./importFiles");
7
+ const lookup = ["imports", "componentsScan", "mount"];
8
+ async function resolveRecursively(items, exclude, rootDir) {
9
+ for (const index in items) {
10
+ if ((0, core_1.isString)(items[index])) {
11
+ items[index] = await (0, importFiles_1.importFiles)(items[index].replace("${rootDir}", rootDir), exclude);
12
+ }
13
+ }
14
+ const providers = items.flat().filter(core_1.isClass);
15
+ for (const token of providers) {
16
+ const provider = di_1.GlobalProviders.get(token);
17
+ if ((provider === null || provider === void 0 ? void 0 : provider.type) === di_1.ProviderType.MODULE && provider.configuration) {
18
+ provider.configuration.exclude = exclude;
19
+ provider.configuration.rootDir = provider.configuration.rootDir || rootDir;
20
+ provider.configuration = await importProviders(provider.configuration);
21
+ }
22
+ }
23
+ return providers;
13
24
  }
14
25
  /**
15
- * Import providers from given patterns.
26
+ * Lookup settings and replace glob pattern by the resolved providers
16
27
  *
17
28
  * @param settings
18
- * @param properties
19
29
  */
20
- async function importProviders(settings, properties = ["imports"]) {
21
- const { exclude = [] } = settings;
22
- const disableComponentsScan = settings.disableComponentsScan || !!process.env.WEBPACK;
23
- const promises = properties.map((key) => (0, importComponents_1.importComponents)(settings[key], exclude, disableComponentsScan));
24
- const providers = (await Promise.all(promises)).flat();
25
- const children = await recursiveImports(providers, settings, properties);
26
- return [...children, ...providers];
30
+ async function importProviders(settings) {
31
+ const { exclude = [], rootDir } = settings;
32
+ for (const property of lookup) {
33
+ if (settings[property]) {
34
+ if (!(0, core_1.isArray)(settings[property])) {
35
+ const current = settings[property];
36
+ const promises = Object.entries(current).map(async ([key, items]) => {
37
+ current[key] = await resolveRecursively([].concat(items), exclude, rootDir);
38
+ });
39
+ await Promise.all(promises);
40
+ }
41
+ else {
42
+ settings[property] = await resolveRecursively(settings[property], exclude, rootDir);
43
+ }
44
+ }
45
+ }
46
+ settings.disableComponentsScan = true;
47
+ return settings;
27
48
  }
28
49
  exports.importProviders = importProviders;
29
50
  //# sourceMappingURL=importProviders.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"importProviders.js","sourceRoot":"","sources":["../../src/importProviders.ts"],"names":[],"mappings":";;;AAAA,iCAAiE;AACjE,yDAAoD;AAEpD,KAAK,UAAU,gBAAgB,CAAC,SAA4C,EAAE,QAAqC,EAAE,UAAoB;IACvI,MAAM,EAAC,OAAO,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAEhC,MAAM,QAAQ,GAAG,SAAS;SACvB,GAAG,CAAC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE,CAAC,oBAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC5C,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,iBAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,CAAC;SACtF,GAAG,CAAC,CAAC,QAAkB,EAAE,EAAE,CAAC,eAAe,CAAC,EAAC,OAAO,EAAE,GAAG,QAAQ,CAAC,aAAa,EAAC,EAAE,UAAU,CAAC,CAAC,CAAC;IAElG,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACI,KAAK,UAAU,eAAe,CACnC,QAAqC,EACrC,aAAuB,CAAC,SAAS,CAAC;IAElC,MAAM,EAAC,OAAO,GAAG,EAAE,EAAC,GAAG,QAAQ,CAAC;IAChC,MAAM,qBAAqB,GAAG,QAAQ,CAAC,qBAAqB,IAAI,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC;IAEtF,MAAM,QAAQ,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,mCAAgB,EAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,qBAAqB,CAAC,CAAC,CAAC;IAC1G,MAAM,SAAS,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;IACvD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,SAAS,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;IAEzE,OAAO,CAAC,GAAG,QAAQ,EAAE,GAAG,SAAS,CAAC,CAAC;AACrC,CAAC;AAZD,0CAYC","sourcesContent":["import {GlobalProviders, Provider, ProviderType} from \"@tsed/di\";\nimport {importComponents} from \"./importComponents\";\n\nasync function recursiveImports(providers: {token: string; route?: string}[], settings: Partial<TsED.Configuration>, properties: string[]) {\n const {exclude = []} = settings;\n\n const promises = providers\n .map(({token}) => GlobalProviders.get(token))\n .filter((provider) => provider?.type === ProviderType.MODULE && provider.configuration)\n .map((provider: Provider) => importProviders({exclude, ...provider.configuration}, properties));\n\n return (await Promise.all(promises)).flat();\n}\n\n/**\n * Import providers from given patterns.\n *\n * @param settings\n * @param properties\n */\nexport async function importProviders(\n settings: Partial<TsED.Configuration>,\n properties: string[] = [\"imports\"]\n): Promise<{token: string; route?: string}[]> {\n const {exclude = []} = settings;\n const disableComponentsScan = settings.disableComponentsScan || !!process.env.WEBPACK;\n\n const promises = properties.map((key) => importComponents(settings[key], exclude, disableComponentsScan));\n const providers = (await Promise.all(promises)).flat();\n const children = await recursiveImports(providers, settings, properties);\n\n return [...children, ...providers];\n}\n"]}
1
+ {"version":3,"file":"importProviders.js","sourceRoot":"","sources":["../../src/importProviders.ts"],"names":[],"mappings":";;;AAAA,iCAAuD;AACvD,qCAAsD;AACtD,+CAA0C;AAE1C,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,gBAAgB,EAAE,OAAO,CAAC,CAAC;AAEtD,KAAK,UAAU,kBAAkB,CAAC,KAAY,EAAE,OAAiB,EAAE,OAAe;IAChF,KAAK,MAAM,KAAK,IAAI,K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,OAAO,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,KAAK,CAAgB,EAAE,EAAE;oBACjF,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,kBAAkB,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;gBAC9E,CAAC,CAAC,CAAC;gBAEH,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;aAC7B;iBAAM;gBACL,QAAQ,CAAC,QAAQ,CAAC,GAAG,MAAM,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;aACrF;SACF;KACF;IAED,QAAQ,CAAC,qBAAqB,GAAG,IAAI,CAAC;IAEtC,OAAO,QAAQ,CAAC;AAClB,CAAC;AArBD,0CAqBC","sourcesContent":["import {GlobalProviders, ProviderType} from \"@tsed/di\";\nimport {isArray, isClass, isString} from \"@tsed/core\";\nimport {importFiles} from \"./importFiles\";\n\nconst lookup = [\"imports\", \"componentsScan\", \"mount\"];\n\nasync function resolveRecursively(items: any[], exclude: string[], rootDir: string) {\n for (const index in items) {\n if (isString(items[index])) {\n items[index] = await importFiles(items[index].replace(\"${rootDir}\", rootDir), exclude);\n }\n }\n\n const providers = items.flat().filter(isClass);\n\n for (const token of providers) {\n const provider = GlobalProviders.get(token);\n\n if (provider?.type === ProviderType.MODULE && provider.configuration) {\n provider.configuration.exclude = exclude;\n provider.configuration.rootDir = provider.configuration.rootDir || rootDir;\n\n provider.configuration = await importProviders(provider.configuration);\n }\n }\n\n return providers;\n}\n\n/**\n * Lookup settings and replace glob pattern by the resolved providers\n *\n * @param settings\n */\nexport async function importProviders(settings: Partial<TsED.Configuration>): Promise<Partial<TsED.Configuration>> {\n const {exclude = [], rootDir} = settings;\n\n for (const property of lookup) {\n if (settings[property]) {\n if (!isArray(settings[property])) {\n const current = settings[property];\n const promises = Object.entries(current).map(async ([key, items]: [string, any]) => {\n current[key] = await resolveRecursively([].concat(items), exclude, rootDir);\n });\n\n await Promise.all(promises);\n } else {\n settings[property] = await resolveRecursively(settings[property], exclude, rootDir);\n }\n }\n }\n\n settings.disableComponentsScan = true;\n\n return settings;\n}\n"]}
package/lib/cjs/index.js CHANGED
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
+ /**
3
+ * @file Automatically generated by barrelsby.
4
+ */
2
5
  Object.defineProperty(exports, "__esModule", { value: true });
3
6
  const tslib_1 = require("tslib");
4
- (0, tslib_1.__exportStar)(require("./importFiles"), exports);
5
- (0, tslib_1.__exportStar)(require("./importComponents"), exports);
6
- (0, tslib_1.__exportStar)(require("./importProviders"), exports);
7
- (0, tslib_1.__exportStar)(require("./cleanGlobPatterns"), exports);
8
- (0, tslib_1.__exportStar)(require("./normalizePath"), exports);
7
+ tslib_1.__exportStar(require("./cleanGlobPatterns"), exports);
8
+ tslib_1.__exportStar(require("./importComponents"), exports);
9
+ tslib_1.__exportStar(require("./importFiles"), exports);
10
+ tslib_1.__exportStar(require("./importProviders"), exports);
11
+ tslib_1.__exportStar(require("./isTsEnv"), exports);
12
+ tslib_1.__exportStar(require("./normalizePath"), exports);
9
13
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA,6DAA8B;AAC9B,kEAAmC;AACnC,iEAAkC;AAClC,mEAAoC;AACpC,+DAAgC","sourcesContent":["export * from \"./importFiles\";\nexport * from \"./importComponents\";\nexport * from \"./importProviders\";\nexport * from \"./cleanGlobPatterns\";\nexport * from \"./normalizePath\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAoC;AACpC,6DAAmC;AACnC,wDAA8B;AAC9B,4DAAkC;AAClC,oDAA0B;AAC1B,0DAAgC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./cleanGlobPatterns\";\nexport * from \"./importComponents\";\nexport * from \"./importFiles\";\nexport * from \"./importProviders\";\nexport * from \"./isTsEnv\";\nexport * from \"./normalizePath\";\n"]}
@@ -2,7 +2,15 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isTsEnv = void 0;
4
4
  function isTsEnv() {
5
- return ((require && require.extensions && require.extensions[".ts"]) ||
5
+ var _a;
6
+ try {
7
+ if (require && require.extensions && require.extensions[".ts"]) {
8
+ return true;
9
+ }
10
+ }
11
+ catch (er) { }
12
+ return (process.env["TS_NODE_DEV"] ||
13
+ ((_a = process.env["_"]) === null || _a === void 0 ? void 0 : _a.includes("ts-node")) ||
6
14
  process.env["TS_TEST"] ||
7
15
  process.env.JEST_WORKER_ID !== undefined ||
8
16
  process.env.NODE_ENV === "test");
@@ -1 +1 @@
1
- {"version":3,"file":"isTsEnv.js","sourceRoot":"","sources":["../../src/isTsEnv.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO;IACrB,OAAO,CACL,CAAC,OAAO,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,SAAS;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAChC,CAAC;AACJ,CAAC;AAPD,0BAOC","sourcesContent":["export function isTsEnv() {\n return (\n (require && require.extensions && require.extensions[\".ts\"]) ||\n process.env[\"TS_TEST\"] ||\n process.env.JEST_WORKER_ID !== undefined ||\n process.env.NODE_ENV === \"test\"\n );\n}\n"]}
1
+ {"version":3,"file":"isTsEnv.js","sourceRoot":"","sources":["../../src/isTsEnv.ts"],"names":[],"mappings":";;;AAAA,SAAgB,OAAO;;IACrB,IAAI;QACF,IAAI,OAAO,IAAI,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,EAAE;YAC9D,OAAO,IAAI,CAAC;SACb;KACF;IAAC,OAAO,EAAE,EAAE,GAAE;IACf,OAAO,CACL,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;SAC1B,MAAA,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,0CAAE,QAAQ,CAAC,SAAS,CAAC,CAAA;QACrC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC;QACtB,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,SAAS;QACxC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,CAChC,CAAC;AACJ,CAAC;AAbD,0BAaC","sourcesContent":["export function isTsEnv() {\n try {\n if (require && require.extensions && require.extensions[\".ts\"]) {\n return true;\n }\n } catch (er) {}\n return (\n process.env[\"TS_NODE_DEV\"] ||\n process.env[\"_\"]?.includes(\"ts-node\") ||\n process.env[\"TS_TEST\"] ||\n process.env.JEST_WORKER_ID !== undefined ||\n process.env.NODE_ENV === \"test\"\n );\n}\n"]}
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.normalizePath = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const core_1 = require("@tsed/core");
5
6
  const path_1 = require("path");
6
- const fixPath = require("normalize-path");
7
+ const normalize_path_1 = tslib_1.__importDefault(require("normalize-path"));
7
8
  function normalizePath(item, ...paths) {
8
9
  if ((0, core_1.isString)(item)) {
9
10
  const path = (0, path_1.join)(item, ...paths);
10
- return fixPath(path);
11
+ return (0, normalize_path_1.default)(path);
11
12
  }
12
13
  if ((0, core_1.isArray)(item)) {
13
14
  return item.map((item) => normalizePath(item));
@@ -1 +1 @@
1
- {"version":3,"file":"normalizePath.js","sourceRoot":"","sources":["../../src/normalizePath.ts"],"names":[],"mappings":";;;AAAA,qCAA6C;AAC7C,+BAA0B;AAE1B,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAI1C,SAAgB,aAAa,CAAC,IAAS,EAAE,GAAG,KAAe;IACzD,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE;QAClB,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;QAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC;KACtB;IAED,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;KACrD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAXD,sCAWC","sourcesContent":["import {isArray, isString} from \"@tsed/core\";\nimport {join} from \"path\";\n\nconst fixPath = require(\"normalize-path\");\n\nexport function normalizePath(item: string, ...paths: string[]): string;\nexport function normalizePath(item: (string | any)[]): (string | any)[];\nexport function normalizePath(item: any, ...paths: string[]) {\n if (isString(item)) {\n const path = join(item, ...paths);\n return fixPath(path);\n }\n\n if (isArray(item)) {\n return item.map((item: any) => normalizePath(item));\n }\n\n return item;\n}\n"]}
1
+ {"version":3,"file":"normalizePath.js","sourceRoot":"","sources":["../../src/normalizePath.ts"],"names":[],"mappings":";;;;AAAA,qCAA6C;AAC7C,+BAA0B;AAC1B,4EAAqC;AAIrC,SAAgB,aAAa,CAAC,IAAS,EAAE,GAAG,KAAe;IACzD,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE;QAClB,MAAM,IAAI,GAAG,IAAA,WAAI,EAAC,IAAI,EAAE,GAAG,KAAK,CAAC,CAAC;QAClC,OAAO,IAAA,wBAAO,EAAC,IAAI,CAAC,CAAC;KACtB;IAED,IAAI,IAAA,cAAO,EAAC,IAAI,CAAC,EAAE;QACjB,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAS,EAAE,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC;KACrD;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAXD,sCAWC","sourcesContent":["import {isArray, isString} from \"@tsed/core\";\nimport {join} from \"path\";\nimport fixPath from \"normalize-path\";\n\nexport function normalizePath(item: string, ...paths: string[]): string;\nexport function normalizePath(item: (string | any)[]): (string | any)[];\nexport function normalizePath(item: any, ...paths: string[]) {\n if (isString(item)) {\n const path = join(item, ...paths);\n return fixPath(path);\n }\n\n if (isArray(item)) {\n return item.map((item: any) => normalizePath(item));\n }\n\n return item;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ {
2
+ "type": "commonjs"
3
+ }
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test1.js","sourceRoot":"","sources":["../../../src/__mock__/Test1.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAM,OAAO,KAAK;CAAG","sourcesContent":["export const value1 = \"value\";\n\nexport class Test1 {}\n"]}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Test2.js","sourceRoot":"","sources":["../../../src/__mock__/Test2.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC;AAE9B,MAAM,OAAO,KAAK;CAAG","sourcesContent":["export const value2 = \"value\";\n\nexport class Test2 {}\n"]}
@@ -0,0 +1,9 @@
1
+ import { __decorate } from "tslib";
2
+ import { Controller } from "@tsed/di";
3
+ let TestCtrl = class TestCtrl {
4
+ };
5
+ TestCtrl = __decorate([
6
+ Controller("/root")
7
+ ], TestCtrl);
8
+ export { TestCtrl };
9
+ //# sourceMappingURL=TestCtrl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TestCtrl.js","sourceRoot":"","sources":["../../../../../src/__mock__/controllers/rest/TestCtrl.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,IAAa,QAAQ,GAArB,MAAa,QAAQ;CAAG,CAAA;AAAX,QAAQ;IADpB,UAAU,CAAC,OAAO,CAAC;GACP,QAAQ,CAAG;SAAX,QAAQ","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/root\")\nexport class TestCtrl {}\n"]}
@@ -0,0 +1,16 @@
1
+ import { __decorate } from "tslib";
2
+ import { SubModule } from "./submodule/SubModule.js";
3
+ import { Module } from "@tsed/di";
4
+ import { M1Ctrl1 } from "./controllers/M1Ctrl1.js";
5
+ let Module1 = class Module1 {
6
+ };
7
+ Module1 = __decorate([
8
+ Module({
9
+ mount: {
10
+ "/m1": [M1Ctrl1]
11
+ },
12
+ imports: [SubModule]
13
+ })
14
+ ], Module1);
15
+ export { Module1 };
16
+ //# sourceMappingURL=Module1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module1.js","sourceRoot":"","sources":["../../../../src/__mock__/module1/Module1.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAQ9C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,MAAM,CAAC;QACN,KAAK,EAAE;YACL,KAAK,EAAE,CAAC,OAAO,CAAC;SACjB;QACD,OAAO,EAAE,CAAC,SAAS,CAAC;KACrB,CAAC;GACW,OAAO,CAAG;SAAV,OAAO","sourcesContent":["import {SubModule} from \"./submodule/SubModule\";\nimport {Module} from \"@tsed/di\";\nimport {M1Ctrl1} from \"./controllers/M1Ctrl1\";\n\n@Module({\n mount: {\n \"/m1\": [M1Ctrl1]\n },\n imports: [SubModule]\n})\nexport class Module1 {}\n"]}
@@ -0,0 +1,14 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Controller } from "@tsed/di";
3
+ import { M1Service } from "../services/M1Service.js";
4
+ let M1Ctrl1 = class M1Ctrl1 {
5
+ constructor(service) {
6
+ this.service = service;
7
+ }
8
+ };
9
+ M1Ctrl1 = __decorate([
10
+ Controller("/m1"),
11
+ __metadata("design:paramtypes", [M1Service])
12
+ ], M1Ctrl1);
13
+ export { M1Ctrl1 };
14
+ //# sourceMappingURL=M1Ctrl1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M1Ctrl1.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/controllers/M1Ctrl1.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,uBAAuB,CAAC;AAGhD,IAAa,OAAO,GAApB,MAAa,OAAO;IAClB,YAAmB,OAAkB;QAAlB,YAAO,GAAP,OAAO,CAAW;IAAG,CAAC;CAC1C,CAAA;AAFY,OAAO;IADnB,UAAU,CAAC,KAAK,CAAC;qCAEY,SAAS;GAD1B,OAAO,CAEnB;SAFY,OAAO","sourcesContent":["import {Controller} from \"@tsed/di\";\nimport {M1Service} from \"../services/M1Service\";\n\n@Controller(\"/m1\")\nexport class M1Ctrl1 {\n constructor(public service: M1Service) {}\n}\n"]}
@@ -0,0 +1,14 @@
1
+ import { __decorate, __metadata } from "tslib";
2
+ import { Injectable } from "@tsed/di";
3
+ import { SubService } from "../submodule/SubService.js";
4
+ let M1Service = class M1Service {
5
+ constructor(subService) {
6
+ this.subService = subService;
7
+ }
8
+ };
9
+ M1Service = __decorate([
10
+ Injectable(),
11
+ __metadata("design:paramtypes", [SubService])
12
+ ], M1Service);
13
+ export { M1Service };
14
+ //# sourceMappingURL=M1Service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"M1Service.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/services/M1Service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAAM,yBAAyB,CAAC;AAGnD,IAAa,SAAS,GAAtB,MAAa,SAAS;IACpB,YAAmB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;CAC9C,CAAA;AAFY,SAAS;IADrB,UAAU,EAAE;qCAEoB,UAAU;GAD9B,SAAS,CAErB;SAFY,SAAS","sourcesContent":["import {Injectable} from \"@tsed/di\";\nimport {SubService} from \"../submodule/SubService\";\n\n@Injectable()\nexport class M1Service {\n constructor(public subService: SubService) {}\n}\n"]}
@@ -0,0 +1,12 @@
1
+ import { __decorate } from "tslib";
2
+ import { Module } from "@tsed/di";
3
+ import { SubService } from "./SubService.js";
4
+ let SubModule = class SubModule {
5
+ };
6
+ SubModule = __decorate([
7
+ Module({
8
+ imports: [SubService]
9
+ })
10
+ ], SubModule);
11
+ export { SubModule };
12
+ //# sourceMappingURL=SubModule.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubModule.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/submodule/SubModule.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAKxC,IAAa,SAAS,GAAtB,MAAa,SAAS;CAAG,CAAA;AAAZ,SAAS;IAHrB,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,UAAU,CAAC;KACtB,CAAC;GACW,SAAS,CAAG;SAAZ,SAAS","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {SubService} from \"./SubService\";\n\n@Module({\n imports: [SubService]\n})\nexport class SubModule {}\n"]}
@@ -0,0 +1,9 @@
1
+ import { __decorate } from "tslib";
2
+ import { Injectable } from "@tsed/di";
3
+ let SubService = class SubService {
4
+ };
5
+ SubService = __decorate([
6
+ Injectable()
7
+ ], SubService);
8
+ export { SubService };
9
+ //# sourceMappingURL=SubService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubService.js","sourceRoot":"","sources":["../../../../../src/__mock__/module1/submodule/SubService.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,IAAa,UAAU,GAAvB,MAAa,UAAU;CAAG,CAAA;AAAb,UAAU;IADtB,UAAU,EAAE;GACA,UAAU,CAAG;SAAb,UAAU","sourcesContent":["import {Injectable} from \"@tsed/di\";\n\n@Injectable()\nexport class SubService {}\n"]}
@@ -0,0 +1,15 @@
1
+ import { __decorate } from "tslib";
2
+ import { Module } from "@tsed/di";
3
+ import { M2Ctrl } from "./controllers/M2Ctrl.js";
4
+ let Module2 = class Module2 {
5
+ };
6
+ Module2 = __decorate([
7
+ Module({
8
+ mount: {
9
+ "/mod2": [M2Ctrl]
10
+ },
11
+ imports: []
12
+ })
13
+ ], Module2);
14
+ export { Module2 };
15
+ //# sourceMappingURL=Module2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Module2.js","sourceRoot":"","sources":["../../../../src/__mock__/module2/Module2.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,sBAAsB,CAAC;AAQ5C,IAAa,OAAO,GAApB,MAAa,OAAO;CAAG,CAAA;AAAV,OAAO;IANnB,MAAM,CAAC;QACN,KAAK,EAAE;YACL,OAAO,EAAE,CAAC,MAAM,CAAC;SAClB;QACD,OAAO,EAAE,EAAE;KACZ,CAAC;GACW,OAAO,CAAG;SAAV,OAAO","sourcesContent":["import {Module} from \"@tsed/di\";\nimport {M2Ctrl} from \"./controllers/M2Ctrl\";\n\n@Module({\n mount: {\n \"/mod2\": [M2Ctrl]\n },\n imports: []\n})\nexport class Module2 {}\n"]}