@tsed/components-scan 7.0.0-alpha.2 → 7.0.0-beta.11
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__/Test1.js +8 -0
- package/lib/cjs/__mock__/Test1.js.map +1 -0
- package/lib/cjs/__mock__/Test2.js +8 -0
- package/lib/cjs/__mock__/Test2.js.map +1 -0
- 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/cleanGlobPatterns.js +25 -0
- package/lib/cjs/cleanGlobPatterns.js.map +1 -0
- package/lib/cjs/importComponents.js +59 -0
- package/lib/cjs/importComponents.js.map +1 -0
- package/lib/cjs/importFiles.js +51 -0
- package/lib/cjs/importFiles.js.map +1 -0
- package/lib/cjs/importProviders.js +50 -0
- package/lib/cjs/importProviders.js.map +1 -0
- package/lib/cjs/index.js +13 -0
- package/lib/cjs/index.js.map +1 -0
- package/lib/cjs/isTsEnv.js +19 -0
- package/lib/cjs/isTsEnv.js.map +1 -0
- package/lib/cjs/normalizePath.js +19 -0
- package/lib/cjs/normalizePath.js.map +1 -0
- package/lib/cjs/package.json +3 -0
- package/lib/esm/__mock__/Test1.js +4 -0
- package/lib/esm/__mock__/Test1.js.map +1 -0
- package/lib/esm/__mock__/Test2.js +4 -0
- package/lib/esm/__mock__/Test2.js.map +1 -0
- 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/cleanGlobPatterns.js +21 -0
- package/lib/esm/cleanGlobPatterns.js.map +1 -0
- package/lib/esm/importComponents.js +54 -0
- package/lib/esm/importComponents.js.map +1 -0
- package/lib/esm/importFiles.js +24 -0
- package/lib/esm/importFiles.js.map +1 -0
- package/lib/esm/importProviders.js +46 -0
- package/lib/esm/importProviders.js.map +1 -0
- package/lib/esm/index.js +10 -0
- package/lib/esm/index.js.map +1 -0
- package/lib/esm/isTsEnv.js +15 -0
- package/lib/esm/isTsEnv.js.map +1 -0
- package/lib/esm/normalizePath.js +14 -0
- package/lib/esm/normalizePath.js.map +1 -0
- package/lib/esm/package.json +3 -0
- package/lib/types/__mock__/Test1.d.ts +3 -0
- package/lib/types/__mock__/Test2.d.ts +3 -0
- 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/{cleanGlobPatterns.d.ts → types/cleanGlobPatterns.d.ts} +0 -0
- package/lib/{importComponents.d.ts → types/importComponents.d.ts} +7 -1
- package/lib/{importFiles.d.ts → types/importFiles.d.ts} +0 -0
- package/lib/types/importProviders.d.ts +6 -0
- package/lib/{index.d.ts → types/index.d.ts} +6 -2
- package/lib/types/isTsEnv.d.ts +1 -0
- package/lib/{normalizePath.d.ts → types/normalizePath.d.ts} +0 -0
- package/package.json +19 -18
- package/readme.md +0 -2
- package/tsconfig.compile.esm.json +12 -0
- package/lib/importProviders.d.ts +0 -10
- package/lib/index.js +0 -193
- package/lib/index.js.map +0 -1
- package/lib/index.modern.js +0 -168
- package/lib/index.modern.js.map +0 -1
- package/lib/isTsEnv.d.ts +0 -2
|
@@ -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"]}
|
|
@@ -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"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanGlobPatterns = void 0;
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const isTsEnv_1 = require("./isTsEnv");
|
|
6
|
+
const normalizePath_1 = require("./normalizePath");
|
|
7
|
+
function mapExcludes(excludes) {
|
|
8
|
+
return excludes.map((s) => `!${s.replace(/!/gi, "")}`);
|
|
9
|
+
}
|
|
10
|
+
function mapExtensions(file) {
|
|
11
|
+
if (!(0, isTsEnv_1.isTsEnv)()) {
|
|
12
|
+
file = file.replace(/\.ts$/i, ".js").replace(/{\.ts,\.js}$/i, ".js");
|
|
13
|
+
}
|
|
14
|
+
return file;
|
|
15
|
+
}
|
|
16
|
+
function cleanGlobPatterns(files, excludes) {
|
|
17
|
+
return []
|
|
18
|
+
.concat(files)
|
|
19
|
+
.map((s) => (0, path_1.resolve)(s))
|
|
20
|
+
.concat(mapExcludes(excludes))
|
|
21
|
+
.map(mapExtensions)
|
|
22
|
+
.map((s) => (0, normalizePath_1.normalizePath)(s));
|
|
23
|
+
}
|
|
24
|
+
exports.cleanGlobPatterns = cleanGlobPatterns;
|
|
25
|
+
//# sourceMappingURL=cleanGlobPatterns.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cleanGlobPatterns.js","sourceRoot":"","sources":["../../src/cleanGlobPatterns.ts"],"names":[],"mappings":";;;AAAA,+BAA6B;AAC7B,uCAAkC;AAClC,mDAA8C;AAE9C,SAAS,WAAW,CAAC,QAAkB;IACrC,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC;AACjE,CAAC;AAED,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,CAAC,IAAA,iBAAO,GAAE,EAAE;QACd,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;KACtE;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,iBAAiB,CAAC,KAAwB,EAAE,QAAkB;IAC5E,OAAO,EAAE;SACN,MAAM,CAAC,KAAc,CAAC;SACtB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,cAAO,EAAC,CAAC,CAAC,CAAC;SAC9B,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAU,CAAC;SACtC,GAAG,CAAC,aAAa,CAAC;SAClB,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,IAAA,6BAAa,EAAC,CAAC,CAAC,CAAC,CAAC;AAC1C,CAAC;AAPD,8CAOC","sourcesContent":["import {resolve} from \"path\";\nimport {isTsEnv} from \"./isTsEnv\";\nimport {normalizePath} from \"./normalizePath\";\n\nfunction mapExcludes(excludes: string[]) {\n return excludes.map((s: string) => `!${s.replace(/!/gi, \"\")}`);\n}\n\nfunction mapExtensions(file: string): string {\n if (!isTsEnv()) {\n file = file.replace(/\\.ts$/i, \".js\").replace(/{\\.ts,\\.js}$/i, \".js\");\n }\n\n return file;\n}\n\nexport function cleanGlobPatterns(files: string | string[], excludes: string[]): string[] {\n return []\n .concat(files as never)\n .map((s: string) => resolve(s))\n .concat(mapExcludes(excludes) as never)\n .map(mapExtensions)\n .map((s: string) => normalizePath(s));\n}\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.importComponents = exports.mapConfiguration = void 0;
|
|
4
|
+
const core_1 = require("@tsed/core");
|
|
5
|
+
const importFiles_1 = require("./importFiles");
|
|
6
|
+
/**
|
|
7
|
+
* @deprecated
|
|
8
|
+
*/
|
|
9
|
+
async function resolveSymbols(item, excludes, disableComponentsScan = false) {
|
|
10
|
+
if ((0, core_1.isClass)(item)) {
|
|
11
|
+
return [item];
|
|
12
|
+
}
|
|
13
|
+
/* istanbul ignore else */
|
|
14
|
+
if (!disableComponentsScan) {
|
|
15
|
+
return (0, importFiles_1.importFiles)(item, excludes);
|
|
16
|
+
}
|
|
17
|
+
/* istanbul ignore next */
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* @deprecated
|
|
22
|
+
*/
|
|
23
|
+
function mapConfiguration(config) {
|
|
24
|
+
if ((0, core_1.isArray)(config)) {
|
|
25
|
+
return config.map((value) => {
|
|
26
|
+
return {
|
|
27
|
+
values: [].concat(value)
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
return Object.keys(config).reduce((list, key) => {
|
|
32
|
+
list.push({
|
|
33
|
+
endpoint: key,
|
|
34
|
+
values: [].concat(config[key])
|
|
35
|
+
});
|
|
36
|
+
return list;
|
|
37
|
+
}, []);
|
|
38
|
+
}
|
|
39
|
+
exports.mapConfiguration = mapConfiguration;
|
|
40
|
+
/**
|
|
41
|
+
* @deprecated
|
|
42
|
+
*/
|
|
43
|
+
async function importComponents(config, excludes, disableComponentsScan = false) {
|
|
44
|
+
if (!config) {
|
|
45
|
+
return [];
|
|
46
|
+
}
|
|
47
|
+
config = mapConfiguration(config);
|
|
48
|
+
const promises = [];
|
|
49
|
+
for (const option of config) {
|
|
50
|
+
promises.push(...option.values.map(async (value) => {
|
|
51
|
+
const symbols = await resolveSymbols(value, excludes, disableComponentsScan);
|
|
52
|
+
return symbols.filter(core_1.isClass).map((symbol) => ({ token: symbol, route: option.endpoint }));
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
const result = await Promise.all(promises);
|
|
56
|
+
return result.flat();
|
|
57
|
+
}
|
|
58
|
+
exports.importComponents = importComponents;
|
|
59
|
+
//# sourceMappingURL=importComponents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,CAAC;AAED;;GAEG;AACH,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,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;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"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = 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);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.importFiles = void 0;
|
|
27
|
+
const core_1 = require("@tsed/core");
|
|
28
|
+
const cleanGlobPatterns_1 = require("./cleanGlobPatterns");
|
|
29
|
+
async function importFiles(patterns, exclude) {
|
|
30
|
+
const { default: globby } = await Promise.resolve().then(() => __importStar(require("globby")));
|
|
31
|
+
const files = await globby((0, cleanGlobPatterns_1.cleanGlobPatterns)(patterns, exclude));
|
|
32
|
+
const symbols = [];
|
|
33
|
+
for (const file of files.sort((a, b) => (a < b ? -1 : 1))) {
|
|
34
|
+
if (!file.endsWith(".d.ts")) {
|
|
35
|
+
// prevent .d.ts import if the global pattern isn't correctly configured
|
|
36
|
+
try {
|
|
37
|
+
const exports = await (0, core_1.importPackage)(file);
|
|
38
|
+
Object.keys(exports).forEach((key) => symbols.push(exports[key]));
|
|
39
|
+
}
|
|
40
|
+
catch (er) {
|
|
41
|
+
// istanbul ignore next
|
|
42
|
+
console.error(er);
|
|
43
|
+
// istanbul ignore next
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return symbols;
|
|
49
|
+
}
|
|
50
|
+
exports.importFiles = importFiles;
|
|
51
|
+
//# sourceMappingURL=importFiles.js.map
|
|
@@ -0,0 +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;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,CAAE,IAAI,MAAK,iBAAY,CAAC,MAAM,IAAI,QAAQ,CAAC,aAAa,EAAE;YACpE,QAAQ,CAAC,aAAa,CAAC,OAAO,GAAG,OAAO,CAAC;YACzC,QAAQ,CAAC,aAAa,CAAC,OAAO,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,IAAI,OAAO,CAAC;YAE3E,QAAQ,CAAC,aAAa,GAAG,MAAM,eAAe,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC;SACxE;KACF;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED;;;;GAIG;AACI,KAAK,UAAU,eAAe,CAAC,QAAqC;IACzE,MAAM,EAAC,OAAO,GAAG,EAAE,EAAE,OAAO,EAAC,GAAG,QAAQ,CAAC;IAEzC,KAAK,MAAM,QAAQ,IAAI,MAAM,EAAE;QAC7B,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE;YACtB,IAAI,CAAC,IAAA,cAAO,EAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,EAAE;gBAChC,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;gBACnC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,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
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @file Automatically generated by barrelsby.
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const tslib_1 = require("tslib");
|
|
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);
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isTsEnv = void 0;
|
|
4
|
+
function isTsEnv() {
|
|
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")) ||
|
|
14
|
+
process.env["TS_TEST"] ||
|
|
15
|
+
process.env.JEST_WORKER_ID !== undefined ||
|
|
16
|
+
process.env.NODE_ENV === "test");
|
|
17
|
+
}
|
|
18
|
+
exports.isTsEnv = isTsEnv;
|
|
19
|
+
//# sourceMappingURL=isTsEnv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizePath = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const core_1 = require("@tsed/core");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const normalize_path_1 = tslib_1.__importDefault(require("normalize-path"));
|
|
8
|
+
function normalizePath(item, ...paths) {
|
|
9
|
+
if ((0, core_1.isString)(item)) {
|
|
10
|
+
const path = (0, path_1.join)(item, ...paths);
|
|
11
|
+
return (0, normalize_path_1.default)(path);
|
|
12
|
+
}
|
|
13
|
+
if ((0, core_1.isArray)(item)) {
|
|
14
|
+
return item.map((item) => normalizePath(item));
|
|
15
|
+
}
|
|
16
|
+
return item;
|
|
17
|
+
}
|
|
18
|
+
exports.normalizePath = normalizePath;
|
|
19
|
+
//# sourceMappingURL=normalizePath.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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 @@
|
|
|
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"]}
|
|
@@ -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 @@
|
|
|
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"]}
|