fix: structure imports on windows (#10835)

This commit is contained in:
Almeida
2025-04-13 20:45:11 +01:00
committed by GitHub
parent f0ea40586b
commit 5c0b714557
3 changed files with 6 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import type { PathLike } from 'node:fs';
import { readdir, stat } from 'node:fs/promises';
import { fileURLToPath, URL } from 'node:url';
import { URL } from 'node:url';
import type { Command } from '../commands/index.ts';
import { predicate as commandPredicate } from '../commands/index.ts';
import type { Event } from '../events/index.ts';
@@ -57,7 +57,7 @@ export async function loadStructures<T>(
}
// Import the structure dynamically from the file
const structure = (await import(fileURLToPath(fileUrl))).default;
const structure = (await import(fileUrl.toString())).default;
// If the structure is a valid structure, add it
if (predicate(structure)) {

View File

@@ -1,5 +1,5 @@
import { readdir, stat } from 'node:fs/promises';
import { fileURLToPath, URL } from 'node:url';
import { URL } from 'node:url';
import { predicate as commandPredicate } from '../commands/index.js';
import { predicate as eventPredicate } from '../events/index.js';
@@ -54,7 +54,7 @@ export async function loadStructures(dir, predicate, recursive = true) {
}
// Import the structure dynamically from the file
const structure = (await import(fileURLToPath(fileUrl))).default;
const structure = (await import(fileUrl.toString())).default;
// If the structure is a valid structure, add it
if (predicate(structure)) {

View File

@@ -1,6 +1,6 @@
import type { PathLike } from 'node:fs';
import { readdir, stat } from 'node:fs/promises';
import { fileURLToPath, URL } from 'node:url';
import { URL } from 'node:url';
import type { Command } from '../commands/index.[REPLACE_IMPORT_EXT]';
import { predicate as commandPredicate } from '../commands/index.[REPLACE_IMPORT_EXT]';
import type { Event } from '../events/index.[REPLACE_IMPORT_EXT]';
@@ -57,7 +57,7 @@ export async function loadStructures<T>(
}
// Import the structure dynamically from the file
const structure = (await import(fileURLToPath(fileUrl))).default;
const structure = (await import(fileUrl.toString())).default;
// If the structure is a valid structure, add it
if (predicate(structure)) structures.push(structure);