@@ -8,6 +8,7 @@ import type { RollupError } from 'rollup'
8
8
import type { CommonServerOptions } from './http'
9
9
import type { Hostname } from './utils'
10
10
import { resolveHostname } from './utils'
11
+ import { loopbackHosts , wildcardHosts } from './constants'
11
12
import type { ResolvedConfig } from '.'
12
13
13
14
export type LogType = 'error' | 'warn' | 'info'
@@ -164,13 +165,6 @@ export function printCommonServerUrls(
164
165
}
165
166
}
166
167
167
- const loopbackHosts = new Set ( [
168
- 'localhost' ,
169
- '127.0.0.1' ,
170
- '::1' ,
171
- '0000:0000:0000:0000:0000:0000:0000:0001'
172
- ] )
173
-
174
168
function printServerUrls (
175
169
hostname : Hostname ,
176
170
protocol : string ,
@@ -227,11 +221,26 @@ function printServerUrls(
227
221
( length , { label } ) => Math . max ( length , label . length ) ,
228
222
0
229
223
)
230
- urls . forEach ( ( { label, url : text } ) => {
224
+ const print = (
225
+ iconWithColor : string ,
226
+ label : string ,
227
+ messageWithColor : string
228
+ ) => {
231
229
info (
232
- ` ${ colors . green ( '➜' ) } ${ colors . bold ( label ) } : ${ ' ' . repeat (
230
+ ` ${ iconWithColor } ${ colors . bold ( label ) } : ${ ' ' . repeat (
233
231
length - label . length
234
- ) } ${ text } `
232
+ ) } ${ messageWithColor } `
235
233
)
234
+ }
235
+
236
+ urls . forEach ( ( { label, url : text } ) => {
237
+ print ( colors . green ( '➜' ) , label , text )
236
238
} )
239
+ if ( ! hostname . host || wildcardHosts . has ( hostname . host ) ) {
240
+ print (
241
+ colors . bold ( colors . blue ( 'ⓘ' ) ) ,
242
+ 'Note' ,
243
+ colors . dim ( 'You are using a wildcard host. Ports might be overriden.' )
244
+ )
245
+ }
237
246
}
0 commit comments