bakit 2.0.0-alpha.19 → 2.0.0-alpha.20
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/dist/index.js +6 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,6 +5,7 @@ import { inspect } from 'util';
|
|
|
5
5
|
import { posix, relative, sep, join, dirname } from 'path';
|
|
6
6
|
import glob from 'tiny-glob';
|
|
7
7
|
import z4 from 'zod';
|
|
8
|
+
import { pathToFileURL } from 'url';
|
|
8
9
|
import { existsSync, mkdirSync, rmSync } from 'fs';
|
|
9
10
|
import { mkdir, writeFile, readFile, rm } from 'fs/promises';
|
|
10
11
|
import { createHash } from 'crypto';
|
|
@@ -471,13 +472,11 @@ var BaseClientManager = class {
|
|
|
471
472
|
this.client = client;
|
|
472
473
|
}
|
|
473
474
|
};
|
|
474
|
-
|
|
475
|
-
// src/core/managers/CommandManager.ts
|
|
476
475
|
var CommandManager = class extends BaseClientManager {
|
|
477
476
|
commands = new Collection();
|
|
478
477
|
entries = new Collection();
|
|
479
478
|
async loadModules(entryDir) {
|
|
480
|
-
let pattern = posix.join(posix.resolve(entryDir), "commands", "**/*.{ts,js}"), files = await glob(pattern, { cwd: process.cwd() }), filtered = (await Promise.all(files.map((file) => this.load(file)))).filter((c) => !!c);
|
|
479
|
+
let pattern = posix.join(posix.resolve(entryDir), "commands", "**/*.{ts,js}"), files = await glob(pattern, { cwd: process.cwd(), absolute: true }), filtered = (await Promise.all(files.map((file) => this.load(file)))).filter((c) => !!c);
|
|
481
480
|
return console.log(`[Loader] Loaded ${filtered.length}/${files.length} command(s)`), filtered;
|
|
482
481
|
}
|
|
483
482
|
/**
|
|
@@ -486,7 +485,7 @@ var CommandManager = class extends BaseClientManager {
|
|
|
486
485
|
* @returns The command object if added successfully.
|
|
487
486
|
*/
|
|
488
487
|
async load(path) {
|
|
489
|
-
let command = (await import(path)).default;
|
|
488
|
+
let command = (await import(pathToFileURL(path).href)).default;
|
|
490
489
|
if (!command) {
|
|
491
490
|
console.warn(`[Loader] File has no default export: ${path}`);
|
|
492
491
|
return;
|
|
@@ -569,14 +568,12 @@ var Context = class {
|
|
|
569
568
|
this.canceled = true;
|
|
570
569
|
}
|
|
571
570
|
};
|
|
572
|
-
|
|
573
|
-
// src/core/managers/ListenerManager.ts
|
|
574
571
|
var ListenerManager = class extends BaseClientManager {
|
|
575
572
|
listeners = [];
|
|
576
573
|
entries = new Collection();
|
|
577
574
|
executors = /* @__PURE__ */ new WeakMap();
|
|
578
575
|
async loadModules(entryDir) {
|
|
579
|
-
let pattern = posix.join(posix.resolve(entryDir), "listeners", "**/*.{ts,js}"), files = await glob(pattern, { cwd: process.cwd() }), filtered = (await Promise.all(files.map((file) => this.load(file)))).filter((l) => !!l);
|
|
576
|
+
let pattern = posix.join(posix.resolve(entryDir), "listeners", "**/*.{ts,js}"), files = await glob(pattern, { cwd: process.cwd(), absolute: true }), filtered = (await Promise.all(files.map((file) => this.load(file)))).filter((l) => !!l);
|
|
580
577
|
return console.log(`[Loader] Loaded ${filtered.length}/${files.length} listener(s)`), filtered;
|
|
581
578
|
}
|
|
582
579
|
/**
|
|
@@ -585,7 +582,7 @@ var ListenerManager = class extends BaseClientManager {
|
|
|
585
582
|
* @returns The listener object if added successfully.
|
|
586
583
|
*/
|
|
587
584
|
async load(path) {
|
|
588
|
-
let listener = (await import(path)).default;
|
|
585
|
+
let listener = (await import(pathToFileURL(path).href)).default;
|
|
589
586
|
if (!listener) {
|
|
590
587
|
console.warn(`[Loader] File has no default export: ${path}`);
|
|
591
588
|
return;
|
|
@@ -803,7 +800,7 @@ async function loadConfig(cwd = process.cwd()) {
|
|
|
803
800
|
if (!configPath)
|
|
804
801
|
throw new Error("Missing config file");
|
|
805
802
|
other && console.warn(`Multiple config files found in ${cwd}. Using ${configPath}.`);
|
|
806
|
-
let config = (await import(configPath)).default;
|
|
803
|
+
let config = (await import(pathToFileURL(configPath).href)).default;
|
|
807
804
|
return _config = Object.freeze(await ProjectConfigSchema.parseAsync(config)), _config;
|
|
808
805
|
}
|
|
809
806
|
function getConfig() {
|