diff --git a/src/config/importers/split-packages.ts b/src/config/importers/split-packages.ts index f87a5c2..49f0265 100644 --- a/src/config/importers/split-packages.ts +++ b/src/config/importers/split-packages.ts @@ -34,7 +34,7 @@ export const splitPackagesImporter = createJSONCollectionsListImporter( ), { // Filter icon sets. Returns true if icon set should be included, false if not - filter: (prefix) => { + filter: (prefix, info) => { return true; }, } diff --git a/src/importers/collections/collections.ts b/src/importers/collections/collections.ts index 078e611..24bac46 100644 --- a/src/importers/collections/collections.ts +++ b/src/importers/collections/collections.ts @@ -4,13 +4,14 @@ import type { BaseDownloader } from '../../downloaders/base'; import type { BaseCollectionsImporter, CreateIconSetImporter } from '../../types/importers/collections'; import type { ImportedData } from '../../types/importers/common'; import { createBaseCollectionsListImporter } from './base'; +import type { IconifyInfo } from '@iconify/types'; interface JSONCollectionsListImporterOptions { // File to load filename?: string; // Icon set filter - filter?: (prefix: string) => boolean; + filter?: (prefix: string, info: IconifyInfo) => boolean; } /** @@ -26,9 +27,10 @@ export function createJSONCollectionsListImporter { let prefixes: string[]; + let data: Record; + const filename = options?.filename || '/collections.json'; try { - const filename = options?.filename || '/collections.json'; - const data = JSON.parse(await readFile(path + filename, 'utf8')) as Record; + data = JSON.parse(await readFile(path + filename, 'utf8')) as Record; prefixes = Object.keys(data).filter((prefix) => matchIconName.test(prefix)); if (!(prefixes instanceof Array)) { @@ -43,7 +45,7 @@ export function createJSONCollectionsListImporter filter(prefix, data[prefix])); } return prefixes; };