Skip to content

Commit b9f2bdb

Browse files
committed
fix: add debug logs to the checkIconNames in code injector
1 parent c707dd6 commit b9f2bdb

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

adminforth/modules/codeInjector.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,25 +94,28 @@ class CodeInjector implements ICodeInjector {
9494
}
9595

9696
async checkIconNames(icons: string[]) {
97+
process.env.HEAVY_DEBUG && console.log(`Checking icon names: ${icons.join(', ')}`);
9798
const uniqueIcons = Array.from(new Set(icons));
99+
process.env.HEAVY_DEBUG && console.log(`Unique icons: ${uniqueIcons.join(', ')}`);
98100
const collections = new Set(icons.map((icon) => icon.split(':')[0]));
101+
process.env.HEAVY_DEBUG && console.log(`Icon collections: ${Array.from(collections).join(', ')}`);
99102
const iconPackageNames = Array.from(collections).map((collection) => `@iconify-prerendered/vue-${collection}`);
100-
103+
process.env.HEAVY_DEBUG && console.log(`Icon package names: ${iconPackageNames.join(', ')}`);
101104
const iconPackages = (
102105
await Promise.allSettled(iconPackageNames.map(async (pkg) => ({ pkg: await import(pathToFileURL(path.join(this.spaTmpPath(), 'node_modules', pkg)).href), name: pkg})))
103106
);
104-
107+
process.env.HEAVY_DEBUG && console.log(`Icon packages load results: ${iconPackages.map((res) => res.status + ':' + res.value?.name || res.reason).join(', ')}`);
105108
const loadedIconPackages = iconPackages.filter(isFulfilled).map((res) => res.value).reduce((acc, { pkg, name }) => {
106109
acc[name.slice(`@iconify-prerendered/vue-`.length)] = pkg;
107110
return acc;
108111
}, {});
109-
112+
process.env.HEAVY_DEBUG && console.log(`Loaded icon packages: ${Object.keys(loadedIconPackages).join(', ')}`);
110113
uniqueIcons.forEach((icon) => {
111114
const [ collection, iconName ] = icon.split(':');
112115
const PascalIconName = 'Icon' + iconName.split('-').map((part, index) => {
113116
return part[0].toUpperCase() + part.slice(1);
114117
}).join('');
115-
118+
process.env.HEAVY_DEBUG && console.log(`Checking icon: ${icon}, collection: ${collection}, iconName: ${iconName}, PascalIconName: ${PascalIconName}`);
116119
if (!loadedIconPackages[collection]) {
117120
throw new Error(`Collection ${collection} not found`);
118121
}

0 commit comments

Comments
 (0)