Home / File/ util.ts — astro Source File

util.ts — astro Source File

Architecture documentation for util.ts, a typescript file in the astro codebase.

Entity Profile

Relationship Graph

Source Code

export function getResolvedHostForHttpServer(host: string | boolean) {
	if (host === false) {
		// Use a secure default
		return 'localhost';
	} else if (host === true) {
		// If passed --host in the CLI without arguments
		return undefined; // undefined typically means 0.0.0.0 or :: (listen on all IPs)
	} else {
		return host;
	}
}

export function stripBase(path: string, base: string): string {
	if (path === base) {
		return '/';
	}
	const baseWithSlash = base.endsWith('/') ? base : base + '/';
	return path.replace(RegExp('^' + baseWithSlash), '/');
}

Domain

Subdomains

Frequently Asked Questions

What does util.ts do?
util.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, RenderingEngine subdomain.
What functions are defined in util.ts?
util.ts defines 2 function(s): getResolvedHostForHttpServer, stripBase.
Where is util.ts in the architecture?
util.ts is located at packages/astro/src/core/preview/util.ts (domain: CoreAstro, subdomain: RenderingEngine, directory: packages/astro/src/core/preview).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free