Skip to content

Commit

Permalink
PR#97 <- feat/loader-flag-exclude
Browse files Browse the repository at this point in the history
[PR#97 <- feat/loader-flag-exclude] File exclusion in structure loaders
  • Loading branch information
daniwasonline authored Jun 2, 2024
2 parents b2fc6f4 + 606c294 commit dabf12b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/util/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,13 @@ export async function loadStructures(dir, predicate, recursive = true, allowInde
}

// Import the structure dynamically from the file
const structure = (await import(`${dir}/${file}`)).default;
const imported = await import(`${dir}/${file}`);
const structure = imported.default;

// Exclude anything with __loader_exclude = true exported
if (imported.__loader_exclude) {
continue;
}

// If the structure is a valid structure, add it
if (predicate(structure)) structures.push(structure);
Expand Down

0 comments on commit dabf12b

Please sign in to comment.