1
1
import { basename } from 'pathe'
2
2
import { getIcons } from '@iconify/utils'
3
- import { consola } from 'consola'
4
3
import { hash } from 'ohash'
5
4
import { createError , getQuery , type H3Event } from 'h3'
6
5
import type { NuxtIconRuntimeOptions } from '../../schema-types'
@@ -32,14 +31,14 @@ export default defineCachedEventHandler(async (event: H3Event) => {
32
31
collection ,
33
32
icons ,
34
33
)
35
- consola . debug ( `[Icon] serving ${ ( icons || [ ] ) . map ( i => '`' + collectionName + ':' + i + '`' ) . join ( ',' ) } from bundled collection` )
34
+ console . debug ( `[Icon] serving ${ ( icons || [ ] ) . map ( i => '`' + collectionName + ':' + i + '`' ) . join ( ',' ) } from bundled collection` )
36
35
return data
37
36
}
38
37
}
39
38
else if ( import . meta. dev ) {
40
39
// Warn only once per collection, and only with the default endpoint
41
40
if ( collectionName && ! warnOnceSet . has ( collectionName ) && apiEndPoint === DEFAULT_ENDPOINT ) {
42
- consola . warn ( [
41
+ console . warn ( [
43
42
`[Icon] Collection \`${ collectionName } \` is not found locally` ,
44
43
`We suggest to install it via \`npm i -D @iconify-json/${ collectionName } \` to provide the best end-user experience.` ,
45
44
] . join ( '\n' ) )
@@ -49,7 +48,7 @@ export default defineCachedEventHandler(async (event: H3Event) => {
49
48
50
49
if ( options . fallbackToApi === true || options . fallbackToApi === 'server-only' ) {
51
50
const apiUrl = new URL ( './' + basename ( url . pathname ) + url . search , apiEndPoint )
52
- consola . debug ( `[Icon] fetching ${ ( icons || [ ] ) . map ( i => '`' + collectionName + ':' + i + '`' ) . join ( ',' ) } from iconify api` )
51
+ console . debug ( `[Icon] fetching ${ ( icons || [ ] ) . map ( i => '`' + collectionName + ':' + i + '`' ) . join ( ',' ) } from iconify api` )
53
52
if ( apiUrl . host !== new URL ( apiEndPoint ) . host ) {
54
53
return createError ( { status : 400 , message : 'Invalid icon request' } )
55
54
}
0 commit comments