2
0
mirror of https://github.com/iconify/iconify.git synced 2024-12-12 05:37:49 +00:00

Merge remote-tracking branch 'KermanX/feat/multiple-cwd' into next

This commit is contained in:
Vjacheslav Trushkin 2024-07-28 18:29:45 +03:00
commit c2a76b13ac
2 changed files with 20 additions and 12 deletions

View File

@ -15,19 +15,24 @@ export const loadNodeIcon: UniversalIconLoader = async (
return result;
}
const iconSet = await loadCollectionFromFS(
collection,
options?.autoInstall,
undefined,
options?.cwd
);
if (iconSet) {
result = await searchForIcon(
iconSet,
const cwds = Array.isArray(options?.cwd) ? options.cwd : [options?.cwd];
for (const cwd of cwds) {
const iconSet = await loadCollectionFromFS(
collection,
getPossibleIconNames(icon),
options
options?.autoInstall,
undefined,
cwd
);
if (iconSet) {
result = await searchForIcon(
iconSet,
collection,
getPossibleIconNames(icon),
options
);
if (result) break;
}
}
if (!result && options?.warn) {

View File

@ -183,8 +183,11 @@ export type IconifyLoaderOptions = {
/**
* Current working directory, used to resolve the @iconify-json package.
*
* Can be a string or an array of strings, the first existing path will be used.
*
* Only used on `node` environment.
*
* @default process.cwd()
*/
cwd?: string;
cwd?: string | string[];
};