feat: support .cjs, .mjs, .ts, .mts and .cts extensions in seyfert.config file (#214)

* refactor: update import statement in sharder.ts

* feat: support .mjs and .ts extensions in seyfert.config file

* feat: support .cts, .mts and .cjs extensions in seyfert.config
This commit is contained in:
David 2024-06-26 18:00:00 -05:00 committed by GitHub
parent ddc6dab0db
commit f05ba46b3a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 2 deletions

View File

@ -364,7 +364,11 @@ export class BaseClient {
>() {
const seyfertConfig = (BaseClient._seyfertConfig ||
(await this.options.getRC?.()) ||
(await magicImport(join(process.cwd(), 'seyfert.config.js')).then(x => x.default ?? x))) as T;
(await Promise.any(
['.js', '.mjs', '.cjs', '.ts', '.mts', '.cts'].map(ext =>
magicImport(join(process.cwd(), `seyfert.config${ext}`)).then(x => x.default ?? x),
),
))) as T;
const { locations, debug, ...env } = seyfertConfig;

View File

@ -17,7 +17,7 @@ import {
import { ShardManagerDefaults } from '../constants';
import { DynamicBucket } from '../structures';
import { ConnectQueue } from '../structures/timeout';
import { Shard } from './shard.js';
import { Shard } from './shard';
import type { ShardManagerOptions, WorkerData } from './shared';
let parentPort: import('node:worker_threads').MessagePort;