diff --git a/packages/utils/src/loader/loaders.ts b/packages/utils/src/loader/loaders.ts index 5989679..502f2ea 100644 --- a/packages/utils/src/loader/loaders.ts +++ b/packages/utils/src/loader/loaders.ts @@ -8,7 +8,7 @@ export function FileSystemIconLoader(dir: string, transform?: (svg: string) => A const paths = [ `${dir}/${name}.svg`, `${dir}/${camelize(name)}.svg`, - `${dir}/${pascalize(name)}.svg`, + `${dir}/${pascalize(name)}.svg` ]; for (const path of paths) { if (existsSync(path)) { diff --git a/packages/utils/src/loader/types.ts b/packages/utils/src/loader/types.ts index eb0c88d..0739497 100644 --- a/packages/utils/src/loader/types.ts +++ b/packages/utils/src/loader/types.ts @@ -1,5 +1,5 @@ import type { Awaitable } from '@antfu/utils'; -export type CustomIconLoader = (name: string) => Awaitable -export type InlineCollection = Record Awaitable)> -export type CustomCollections = Record +export type CustomIconLoader = (name: string) => Awaitable; +export type InlineCollection = Record Awaitable)>; +export type CustomCollections = Record; diff --git a/packages/utils/src/loader/utils.ts b/packages/utils/src/loader/utils.ts index 15d8c4f..41bdb0b 100644 --- a/packages/utils/src/loader/utils.ts +++ b/packages/utils/src/loader/utils.ts @@ -8,7 +8,7 @@ export function camelize(str: string): string { export function pascalize(str: string): string { const camel = camelize(str); - return camel[0].toUpperCase() + camel.slice(1); + return `${camel[0].toUpperCase()}${camel.slice(1)}`; } export function camelToKebab(key: string): string { @@ -19,12 +19,12 @@ export function camelToKebab(key: string): string { return result.split(/\s+/g).join('-').toLowerCase(); } -const warnned = new Set(); +const warned = new Set(); export function warnOnce(msg: string): void { - if (!warnned.has(msg)) { - warnned.add(msg); - console.warn(yellow(`[@iconify-loader] ${msg}`)) + if (!warned.has(msg)) { + warned.add(msg); + console.warn(yellow(`[@iconify-loader] ${msg}`)); } } @@ -44,11 +44,11 @@ export async function tryInstallPkg(name: string): Promise { .then(() => sleep(300)) // eslint-disable-next-line .catch((e: any) => { - warnOnce(`Failed to install ${name}`) - console.error(e) + warnOnce(`Failed to install ${name}`); + console.error(e); }) .finally(() => { - pending = undefined + pending = undefined; }); }