Skip to content

Commit 867ffda

Browse files
committed
chore: update
1 parent 15aec24 commit 867ffda

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import { describe, expect, it } from 'vitest'
2-
import { normalizeHttpHost } from '../utils'
2+
import { normalizeHttpServerUrl } from '../utils'
33

4-
describe('normalizeHttpHost', () => {
4+
describe('normalizeHttpServerUrl', () => {
55
it('formats ipv4 localhost as localhost', () => {
6-
expect(normalizeHttpHost('127.0.0.1', 9999)).toBe('http://localhost:9999')
6+
expect(normalizeHttpServerUrl('127.0.0.1', 9999)).toBe('http://localhost:9999')
77
})
88

99
it('wraps ipv6 hosts in brackets', () => {
10-
expect(normalizeHttpHost('::1', 9999)).toBe('http://[::1]:9999')
10+
expect(normalizeHttpServerUrl('::1', 9999)).toBe('http://[::1]:9999')
1111
})
1212

1313
it('preserves non-ip hosts', () => {
14-
expect(normalizeHttpHost('localhost', 9999)).toBe('http://localhost:9999')
14+
expect(normalizeHttpServerUrl('localhost', 9999)).toBe('http://localhost:9999')
1515
})
1616
})

packages/core/src/node/cli-commands.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { renderDockImportsMap } from './plugins/server'
2323
import { createDevToolsMiddleware } from './server'
2424
import { startStandaloneDevTools } from './standalone'
2525
import { collectStaticRpcDump } from './static-dump'
26-
import { normalizeHttpHost } from './utils'
26+
import { normalizeHttpServerUrl } from './utils'
2727

2828
export interface StartOptions {
2929
root?: string
@@ -69,7 +69,7 @@ export async function start(options: StartOptions) {
6969
const server = createServer(toNodeListener(app))
7070

7171
server.listen(port, host, async () => {
72-
const url = normalizeHttpHost(host, port)
72+
const url = normalizeHttpServerUrl(host, port)
7373
console.log(c.green`${MARK_NODE} Vite DevTools started at`, c.green(url), '\n')
7474
if (options.open)
7575
await open(url)

packages/core/src/node/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export function isObject(value: unknown): value is Record<string, any> {
44
return Object.prototype.toString.call(value) === '[object Object]'
55
}
66

7-
export function normalizeHttpHost(host: string, port: number | string): string {
7+
export function normalizeHttpServerUrl(host: string, port: number | string): string {
88
const normalizedHost
99
= host === '127.0.0.1'
1010
? 'localhost'

0 commit comments

Comments
 (0)