@xrystal/core 3.13.0 → 3.13.3
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/package.json
CHANGED
|
@@ -70,8 +70,8 @@ export default class LoggerService {
|
|
|
70
70
|
connectKafka();
|
|
71
71
|
}
|
|
72
72
|
this.winstonLoader({
|
|
73
|
-
loadPath: config?.loadPath
|
|
74
|
-
loggerLevel: config?.loggerLevel
|
|
73
|
+
loadPath: config?.loadPath,
|
|
74
|
+
loggerLevel: config?.loggerLevel
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
77
|
safeReplacer = (key, value) => {
|
package/source/project/index.js
CHANGED
|
@@ -50,7 +50,7 @@ const coreLoader = async ({}) => {
|
|
|
50
50
|
{
|
|
51
51
|
service: LocalizationsService,
|
|
52
52
|
props: {
|
|
53
|
-
loadPath: path.
|
|
53
|
+
loadPath: path.join(rootFolderPath, configs.loaders.localization.loadPath),
|
|
54
54
|
fallbackLang: configs.loaders.localization.fallbackLang,
|
|
55
55
|
preloadLang: configs.loaders.localization.preloadLangs
|
|
56
56
|
}
|
|
@@ -8,7 +8,7 @@ export class X {
|
|
|
8
8
|
strict: true
|
|
9
9
|
});
|
|
10
10
|
}
|
|
11
|
-
load(patterns, verbose =
|
|
11
|
+
load(patterns, verbose = false) {
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
const resolvedPatterns = (Array.isArray(patterns) ? patterns : [patterns]).map(p => {
|
|
14
14
|
const resolved = path.isAbsolute(p) ? p : path.resolve(cwd, p);
|
|
@@ -66,27 +66,27 @@ export class X {
|
|
|
66
66
|
});
|
|
67
67
|
return this;
|
|
68
68
|
}
|
|
69
|
-
async initialize(input) {
|
|
69
|
+
async initialize(input, verbose = true) {
|
|
70
70
|
const cradle = this.container.cradle;
|
|
71
71
|
const inputList = input ? (Array.isArray(input) ? input : [input]) : [];
|
|
72
72
|
const propsMap = new Map();
|
|
73
|
+
const initializedNames = [];
|
|
73
74
|
inputList.forEach(item => {
|
|
74
75
|
const name = typeof item.service === 'function'
|
|
75
76
|
? item.service.name.charAt(0).toLowerCase() + item.service.name.slice(1)
|
|
76
77
|
: item.service;
|
|
77
78
|
propsMap.set(name, item.props);
|
|
78
79
|
});
|
|
79
|
-
for (const key of Object.keys(
|
|
80
|
+
for (const key of Object.keys(this.container.registrations)) {
|
|
80
81
|
const instance = cradle[key];
|
|
81
82
|
if (instance && typeof instance.load === 'function') {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
else {
|
|
86
|
-
await instance.load();
|
|
87
|
-
}
|
|
83
|
+
const props = propsMap.get(key) || {};
|
|
84
|
+
await instance.load(props);
|
|
85
|
+
initializedNames.push(key);
|
|
88
86
|
}
|
|
89
87
|
}
|
|
88
|
+
if (verbose && initializedNames.length > 0)
|
|
89
|
+
console.log('[DI] Initialized Services:', initializedNames);
|
|
90
90
|
return this;
|
|
91
91
|
}
|
|
92
92
|
get(target) {
|