@tsed/components-scan 6.113.3 → 6.114.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.
- package/lib/cjs/__mock__/controllers/rest/TestCtrl.js +12 -0
- package/lib/cjs/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/cjs/__mock__/module1/Module1.js +19 -0
- package/lib/cjs/__mock__/module1/Module1.js.map +1 -0
- package/lib/cjs/__mock__/module1/controllers/M1Ctrl1.js +17 -0
- package/lib/cjs/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/cjs/__mock__/module1/services/M1Service.js +17 -0
- package/lib/cjs/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/cjs/__mock__/module1/submodule/SubModule.js +15 -0
- package/lib/cjs/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/cjs/__mock__/module1/submodule/SubService.js +12 -0
- package/lib/cjs/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/cjs/__mock__/module2/Module2.js +18 -0
- package/lib/cjs/__mock__/module2/Module2.js.map +1 -0
- package/lib/cjs/__mock__/module2/controllers/M2Ctrl.js +12 -0
- package/lib/cjs/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
- package/lib/cjs/importComponents.js +9 -0
- package/lib/cjs/importComponents.js.map +1 -1
- package/lib/cjs/importFiles.js +1 -1
- package/lib/cjs/importFiles.js.map +1 -1
- package/lib/cjs/importProviders.js +50 -0
- package/lib/cjs/importProviders.js.map +1 -0
- package/lib/cjs/index.js +1 -0
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/__mock__/controllers/rest/TestCtrl.js +9 -0
- package/lib/esm/__mock__/controllers/rest/TestCtrl.js.map +1 -0
- package/lib/esm/__mock__/module1/Module1.js +16 -0
- package/lib/esm/__mock__/module1/Module1.js.map +1 -0
- package/lib/esm/__mock__/module1/controllers/M1Ctrl1.js +14 -0
- package/lib/esm/__mock__/module1/controllers/M1Ctrl1.js.map +1 -0
- package/lib/esm/__mock__/module1/services/M1Service.js +14 -0
- package/lib/esm/__mock__/module1/services/M1Service.js.map +1 -0
- package/lib/esm/__mock__/module1/submodule/SubModule.js +12 -0
- package/lib/esm/__mock__/module1/submodule/SubModule.js.map +1 -0
- package/lib/esm/__mock__/module1/submodule/SubService.js +9 -0
- package/lib/esm/__mock__/module1/submodule/SubService.js.map +1 -0
- package/lib/esm/__mock__/module2/Module2.js +15 -0
- package/lib/esm/__mock__/module2/Module2.js.map +1 -0
- package/lib/esm/__mock__/module2/controllers/M2Ctrl.js +9 -0
- package/lib/esm/__mock__/module2/controllers/M2Ctrl.js.map +1 -0
- package/lib/esm/importComponents.js +9 -0
- package/lib/esm/importComponents.js.map +1 -1
- package/lib/esm/importFiles.js +1 -1
- package/lib/esm/importFiles.js.map +1 -1
- package/lib/esm/importProviders.js +46 -0
- package/lib/esm/importProviders.js.map +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/types/__mock__/controllers/rest/TestCtrl.d.ts +2 -0
- package/lib/types/__mock__/module1/Module1.d.ts +2 -0
- package/lib/types/__mock__/module1/controllers/M1Ctrl1.d.ts +5 -0
- package/lib/types/__mock__/module1/services/M1Service.d.ts +5 -0
- package/lib/types/__mock__/module1/submodule/SubModule.d.ts +2 -0
- package/lib/types/__mock__/module1/submodule/SubService.d.ts +2 -0
- package/lib/types/__mock__/module2/Module2.d.ts +2 -0
- package/lib/types/__mock__/module2/controllers/M2Ctrl.d.ts +2 -0
- package/lib/types/importComponents.d.ts +6 -0
- package/lib/types/importProviders.d.ts +6 -0
- package/lib/types/index.d.ts +1 -0
- package/package.json +4 -3
- package/tsconfig.compile.esm.json +1 -1
|
@@ -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,CAAC,KAAU,EAAE,EAAE;YAC/B,OAAO;gBACL,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;aACzB,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,GAAW,EAAE,EAAE;QAC7D,IAA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,CAAC,CAAC;AACT,CAAC;AAjBD,4CAiBC;AAED;;GAEG;AACI,KAAK,UAAU,gBAAgB,CACpC,MAAW,EACX,QAAkB,EAClB,qBAAqB,GAAG,KAAK;IAE7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAC;KACX;IAED,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,QAAQ,GAAQ,EAAE,CAAC;IAEzB,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE;QAC3B,QAAQ,CAAC,IAAI,CACX,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAU,EAAE,EAAE;YACxC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YAE7E,OAAO,OAAO,CAAC,MAAM,CAAC,cAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,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"]}
|
package/lib/cjs/importFiles.js
CHANGED
|
@@ -30,7 +30,7 @@ async function importFiles(patterns, exclude) {
|
|
|
30
30
|
const { default: globby } = await Promise.resolve().then(() => __importStar(require("globby")));
|
|
31
31
|
const files = await globby((0, cleanGlobPatterns_1.cleanGlobPatterns)(patterns, exclude));
|
|
32
32
|
const symbols = [];
|
|
33
|
-
for (const file of files) {
|
|
33
|
+
for (const file of files.sort((a, b) => (a < b ? -1 : 1))) {
|
|
34
34
|
if (!file.endsWith(".d.ts")) {
|
|
35
35
|
// prevent .d.ts import if the global pattern isn't correctly configured
|
|
36
36
|
try {
|
|
@@ -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;
|
|
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,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;AAtBD,kCAsBC","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 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"]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importProviders = void 0;
|
|
4
|
+
const di_1 = require("@tsed/di");
|
|
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;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Lookup settings and replace glob pattern by the resolved providers
|
|
27
|
+
*
|
|
28
|
+
* @param settings
|
|
29
|
+
*/
|
|
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;
|
|
48
|
+
}
|
|
49
|
+
exports.importProviders = importProviders;
|
|
50
|
+
//# sourceMappingURL=importProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,KAAK,EAAE;QACzB,IAAI,IAAA,eAAQ,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,IAAA,yBAAW,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;SACxF;KACF;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,cAAO,CAAC,CAAC;IAE/C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;QAC7B,MAAM,QAAQ,GAAG,oBAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ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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
|
@@ -7,6 +7,7 @@ const tslib_1 = require("tslib");
|
|
|
7
7
|
tslib_1.__exportStar(require("./cleanGlobPatterns"), exports);
|
|
8
8
|
tslib_1.__exportStar(require("./importComponents"), exports);
|
|
9
9
|
tslib_1.__exportStar(require("./importFiles"), exports);
|
|
10
|
+
tslib_1.__exportStar(require("./importProviders"), exports);
|
|
10
11
|
tslib_1.__exportStar(require("./isTsEnv"), exports);
|
|
11
12
|
tslib_1.__exportStar(require("./normalizePath"), exports);
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,8DAAoC;AACpC,6DAAmC;AACnC,wDAA8B;AAC9B,oDAA0B;AAC1B,0DAAgC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./cleanGlobPatterns\";\nexport * from \"./importComponents\";\nexport * from \"./importFiles\";\nexport * from \"./isTsEnv\";\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"]}
|
|
@@ -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 @@
|
|
|
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"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"M2Ctrl.js","sourceRoot":"","sources":["../../../../../src/__mock__/module2/controllers/M2Ctrl.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,IAAa,MAAM,GAAnB,MAAa,MAAM;CAAG,CAAA;AAAT,MAAM;IADlB,UAAU,CAAC,KAAK,CAAC;GACL,MAAM,CAAG;SAAT,MAAM","sourcesContent":["import {Controller} from \"@tsed/di\";\n\n@Controller(\"/m2\")\nexport class M2Ctrl {}\n"]}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { isArray, isClass } from "@tsed/core";
|
|
2
2
|
import { importFiles } from "./importFiles.js";
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated
|
|
5
|
+
*/
|
|
3
6
|
async function resolveSymbols(item, excludes, disableComponentsScan = false) {
|
|
4
7
|
if (isClass(item)) {
|
|
5
8
|
return [item];
|
|
@@ -11,6 +14,9 @@ async function resolveSymbols(item, excludes, disableComponentsScan = false) {
|
|
|
11
14
|
/* istanbul ignore next */
|
|
12
15
|
return [];
|
|
13
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @deprecated
|
|
19
|
+
*/
|
|
14
20
|
export function mapConfiguration(config) {
|
|
15
21
|
if (isArray(config)) {
|
|
16
22
|
return config.map((value) => {
|
|
@@ -27,6 +33,9 @@ export function mapConfiguration(config) {
|
|
|
27
33
|
return list;
|
|
28
34
|
}, []);
|
|
29
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* @deprecated
|
|
38
|
+
*/
|
|
30
39
|
export async function importComponents(config, excludes, disableComponentsScan = false) {
|
|
31
40
|
if (!config) {
|
|
32
41
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importComponents.js","sourceRoot":"","sources":["../../src/importComponents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAC5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AI,CACX,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAU,EAAE,EAAE;YACxC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YAE7E,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,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","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,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C;;GAEG;AACH,KAAK,UAAU,cAAc,CAAC,IAAS,EAAE,QAAkB,EAAE,qBAAqB,GAAG,KAAK;IACxF,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,CAAC,IAAI,CAAC,CAAC;KACf;IACD,0BAA0B;IAC1B,IAAI,CAAC,qBAAqB,EAAE;QAC1B,OAAO,WAAW,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KACpC;IAED,0BAA0B;IAC1B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAW;IAC1C,IAAI,OAAO,CAAC,MAAM,CAAC,EAAE;QACnB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,KAAU,EAAE,EAAE;YAC/B,OAAO;gBACL,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC;aACzB,CAAC;QACJ,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,IAAW,EAAE,GAAW,EAAE,EAAE;QAC7D,IAAI,CAAC,IAAI,CAAC;YACR,QAAQ,EAAE,GAAG;YACb,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;SAC/B,CAAC,CAAC;QAEH,OAAO,IAAI,CAAC;IACd,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,MAAW,EACX,QAAkB,EAClB,qBAAqB,GAAG,KAAK;IAE7B,IAAI,CAAC,MAAM,EAAE;QACX,OAAO,EAAE,CAAC;KACX;IAED,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IAElC,MAAM,QAAQ,GAAQ,EAAE,CAAC;IAEzB,KAAK,MAAM,MAAM,IAAI,MAAM,EAAE;QAC3B,QAAQ,CAAC,IAAI,CACX,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,KAAU,EAAE,EAAE;YACxC,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,KAAK,EAAE,QAAQ,EAAE,qBAAqB,CAAC,CAAC;YAE7E,OAAO,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,QAAQ,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","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"]}
|
package/lib/esm/importFiles.js
CHANGED
|
@@ -4,7 +4,7 @@ export async function importFiles(patterns, exclude) {
|
|
|
4
4
|
const { default: globby } = await import("globby");
|
|
5
5
|
const files = await globby(cleanGlobPatterns(patterns, exclude));
|
|
6
6
|
const symbols = [];
|
|
7
|
-
for (const file of files) {
|
|
7
|
+
for (const file of files.sort((a, b) => (a < b ? -1 : 1))) {
|
|
8
8
|
if (!file.endsWith(".d.ts")) {
|
|
9
9
|
// prevent .d.ts import if the global pattern isn't correctly configured
|
|
10
10
|
try {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"importFiles.js","sourceRoot":"","sources":["../../src/importFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAA2B,EAAE,OAAiB;IAC9E,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"importFiles.js","sourceRoot":"","sources":["../../src/importFiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AACzC,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AAEtD,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,QAA2B,EAAE,OAAiB;IAC9E,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;IAEjD,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC,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,IAAI;gBACF,MAAM,OAAO,GAAG,MAAM,aAAa,CAAC,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","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 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"]}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { GlobalProviders, ProviderType } from "@tsed/di";
|
|
2
|
+
import { isArray, isClass, isString } from "@tsed/core";
|
|
3
|
+
import { importFiles } from "./importFiles.js";
|
|
4
|
+
const lookup = ["imports", "componentsScan", "mount"];
|
|
5
|
+
async function resolveRecursively(items, exclude, rootDir) {
|
|
6
|
+
for (const index in items) {
|
|
7
|
+
if (isString(items[index])) {
|
|
8
|
+
items[index] = await importFiles(items[index].replace("${rootDir}", rootDir), exclude);
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
const providers = items.flat().filter(isClass);
|
|
12
|
+
for (const token of providers) {
|
|
13
|
+
const provider = GlobalProviders.get(token);
|
|
14
|
+
if ((provider === null || provider === void 0 ? void 0 : provider.type) === ProviderType.MODULE && provider.configuration) {
|
|
15
|
+
provider.configuration.exclude = exclude;
|
|
16
|
+
provider.configuration.rootDir = provider.configuration.rootDir || rootDir;
|
|
17
|
+
provider.configuration = await importProviders(provider.configuration);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return providers;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Lookup settings and replace glob pattern by the resolved providers
|
|
24
|
+
*
|
|
25
|
+
* @param settings
|
|
26
|
+
*/
|
|
27
|
+
export async function importProviders(settings) {
|
|
28
|
+
const { exclude = [], rootDir } = settings;
|
|
29
|
+
for (const property of lookup) {
|
|
30
|
+
if (settings[property]) {
|
|
31
|
+
if (!isArray(settings[property])) {
|
|
32
|
+
const current = settings[property];
|
|
33
|
+
const promises = Object.entries(current).map(async ([key, items]) => {
|
|
34
|
+
current[key] = await resolveRecursively([].concat(items), exclude, rootDir);
|
|
35
|
+
});
|
|
36
|
+
await Promise.all(promises);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
settings[property] = await resolveRecursively(settings[property], exclude, rootDir);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
settings.disableComponentsScan = true;
|
|
44
|
+
return settings;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=importProviders.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"importProviders.js","sourceRoot":"","sources":["../../src/importProviders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,YAAY,EAAC,MAAM,UAAU,CAAC;AACvD,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;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,KAAK,EAAE;QACzB,IAAI,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE;YAC1B,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;SACxF;KACF;IAED,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/C,KAAK,MAAM,KAAK,IAAI,SAAS,EAAE;QAC7B,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAE5C,IAAI,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAI,MAAK,YAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,EAAE;YACpE,QAAQ,CAAC,aAAa,CAAC,OAAO,GAAG,OA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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/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC","sourcesContent":["/**\n * @file Automatically generated by barrelsby.\n */\n\nexport * from \"./cleanGlobPatterns\";\nexport * from \"./importComponents\";\nexport * from \"./importFiles\";\nexport * from \"./isTsEnv\";\nexport * from \"./normalizePath\";\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC","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"]}
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated
|
|
3
|
+
*/
|
|
1
4
|
export declare function mapConfiguration(config: any): {
|
|
2
5
|
endpoint?: string;
|
|
3
6
|
values: any[];
|
|
4
7
|
}[];
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
*/
|
|
5
11
|
export declare function importComponents(config: any, excludes: string[], disableComponentsScan?: boolean): Promise<{
|
|
6
12
|
token: string;
|
|
7
13
|
route?: string;
|
package/lib/types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/components-scan",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.114.1",
|
|
4
4
|
"description": "Components scan utilities for Ts.ED Framework",
|
|
5
5
|
"private": false,
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"tslib": "2.3.1"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@tsed/core": "6.
|
|
29
|
+
"@tsed/core": "6.114.1",
|
|
30
|
+
"@tsed/di": "6.114.1",
|
|
30
31
|
"@types/normalize-path": "^3.0.0"
|
|
31
32
|
},
|
|
32
33
|
"peerDependencies": {},
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
"bugs": {
|
|
35
36
|
"url": "https://github.com/tsedio/tsed/issues"
|
|
36
37
|
},
|
|
37
|
-
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/
|
|
38
|
+
"homepage": "https://github.com/tsedio/tsed/tree/production/packages/third-parties/components-scan",
|
|
38
39
|
"author": "Romain Lenzotti",
|
|
39
40
|
"license": "MIT"
|
|
40
41
|
}
|