+17
-12
src/core/Loader.ts
+17
-12
src/core/Loader.ts
···
26
const glob = new Glob(`**/**.ts`);
27
const iterator = glob.scan(this.dataSource);
28
29
-
for await (const path of iterator) {
30
-
let moduleDefault: T | null;
31
32
-
try {
33
-
const module = (await import(`${this.dataSource}/${path}`));
34
-
moduleDefault = module.default;
35
36
-
if (!moduleDefault) continue;
37
-
} catch {
38
-
continue;
39
-
}
40
41
-
const final = await this.validate(moduleDefault);
42
-
if (!final) continue;
43
44
-
this.store.push(final);
45
}
46
47
return this;
···
26
const glob = new Glob(`**/**.ts`);
27
const iterator = glob.scan(this.dataSource);
28
29
+
try {
30
+
for await (const path of iterator) {
31
+
let moduleDefault: T | null;
32
33
+
try {
34
+
const module = (await import(`${this.dataSource}/${path}`));
35
+
moduleDefault = module.default;
36
37
+
if (!moduleDefault) continue;
38
+
} catch {
39
+
continue;
40
+
}
41
42
+
const final = await this.validate(moduleDefault);
43
+
if (!final) continue;
44
45
+
this.store.push(final);
46
+
}
47
+
} catch {
48
+
console.error(`[Voidy] Specified loader target ${this.dataSource} doesn't exist. Skipping...`);
49
+
return this;
50
}
51
52
return this;