@mdfriday/foundry
Version:
The core engine of MDFriday. Convert Markdown and shortcodes into fully themed static sites – Hugo-style, powered by TypeScript.
64 lines • 1.83 kB
TypeScript
export declare class BaseURL {
private url;
readonly withPath: string;
readonly withPathNoTrailingSlash: string;
readonly withoutPath: string;
readonly basePath: string;
readonly basePathNoTrailingSlash: string;
readonly isRelative: boolean;
private constructor();
/**
* Creates a new BaseURL instance from a string.
* Supports various formats:
* - Absolute URLs: https://example.com/, https://example.com/public/
* - Relative paths: /public/, /
* - Protocol-relative URLs: //example.com/
*/
static fromString(baseUrl: string): BaseURL;
/**
* Returns the appropriate root URL based on the path.
*/
getRoot(path: string): string;
toString(): string;
path(): string;
port(): number;
/**
* Returns the URL to the host root without any path elements.
*/
hostURL(): string;
/**
* Returns the protocol (scheme) of the URL.
*/
protocol(): string;
/**
* Returns the host (hostname + port) of the URL.
*/
host(): string;
/**
* Returns the hostname of the URL.
*/
hostname(): string;
/**
* Returns a copy of the internal URL.
* The copy can be safely used and modified.
*/
getURL(): URL;
/**
* Returns the BaseURL prefixed with the given protocol.
* The Protocol is normally of the form "scheme://", i.e. "webcal://".
*/
withProtocol(protocol: string): BaseURL;
/**
* Returns a new BaseURL with the specified port.
*/
withPort(port: number): BaseURL;
/**
* Checks if this BaseURL is relative (path-only).
*/
isRelativeURL(): boolean;
/**
* Checks if this BaseURL is absolute (has protocol and host).
*/
isAbsoluteURL(): boolean;
}
//# sourceMappingURL=baseurl.d.ts.map